annotate bdss_client_sra.Rmd @ 23:fd15cf620d5d draft

planemo upload for repository https://github.com/statonlab/docker-GRReport/tree/master/my_tools/rmarkdown_bdss_client commit 3d2a2c46f10b7f00a36771d2a0fc334d2c177730-dirty
author mingchen0919
date Sun, 15 Oct 2017 00:50:10 -0400
parents 89cc5b026494
children a1c0ebd05f2f
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
21
a709a705ce09 planemo upload for repository https://github.com/statonlab/docker-GRReport/tree/master/my_tools/rmarkdown_bdss_client commit 813dcaa22f297814dd6d6a8c4c5ff01664942aa6-dirty
mingchen0919
parents:
diff changeset
1 ---
a709a705ce09 planemo upload for repository https://github.com/statonlab/docker-GRReport/tree/master/my_tools/rmarkdown_bdss_client commit 813dcaa22f297814dd6d6a8c4c5ff01664942aa6-dirty
mingchen0919
parents:
diff changeset
2 title: 'Download and extract single end fastq/fasta data with BDSS client from SRA accessions'
a709a705ce09 planemo upload for repository https://github.com/statonlab/docker-GRReport/tree/master/my_tools/rmarkdown_bdss_client commit 813dcaa22f297814dd6d6a8c4c5ff01664942aa6-dirty
mingchen0919
parents:
diff changeset
3 output:
a709a705ce09 planemo upload for repository https://github.com/statonlab/docker-GRReport/tree/master/my_tools/rmarkdown_bdss_client commit 813dcaa22f297814dd6d6a8c4c5ff01664942aa6-dirty
mingchen0919
parents:
diff changeset
4 html_document:
a709a705ce09 planemo upload for repository https://github.com/statonlab/docker-GRReport/tree/master/my_tools/rmarkdown_bdss_client commit 813dcaa22f297814dd6d6a8c4c5ff01664942aa6-dirty
mingchen0919
parents:
diff changeset
5 number_sections: true
a709a705ce09 planemo upload for repository https://github.com/statonlab/docker-GRReport/tree/master/my_tools/rmarkdown_bdss_client commit 813dcaa22f297814dd6d6a8c4c5ff01664942aa6-dirty
mingchen0919
parents:
diff changeset
6 toc: true
a709a705ce09 planemo upload for repository https://github.com/statonlab/docker-GRReport/tree/master/my_tools/rmarkdown_bdss_client commit 813dcaa22f297814dd6d6a8c4c5ff01664942aa6-dirty
mingchen0919
parents:
diff changeset
7 theme: cosmo
a709a705ce09 planemo upload for repository https://github.com/statonlab/docker-GRReport/tree/master/my_tools/rmarkdown_bdss_client commit 813dcaa22f297814dd6d6a8c4c5ff01664942aa6-dirty
mingchen0919
parents:
diff changeset
8 highlight: tango
a709a705ce09 planemo upload for repository https://github.com/statonlab/docker-GRReport/tree/master/my_tools/rmarkdown_bdss_client commit 813dcaa22f297814dd6d6a8c4c5ff01664942aa6-dirty
mingchen0919
parents:
diff changeset
9 ---
a709a705ce09 planemo upload for repository https://github.com/statonlab/docker-GRReport/tree/master/my_tools/rmarkdown_bdss_client commit 813dcaa22f297814dd6d6a8c4c5ff01664942aa6-dirty
mingchen0919
parents:
diff changeset
10
a709a705ce09 planemo upload for repository https://github.com/statonlab/docker-GRReport/tree/master/my_tools/rmarkdown_bdss_client commit 813dcaa22f297814dd6d6a8c4c5ff01664942aa6-dirty
mingchen0919
parents:
diff changeset
11 ```{r setup, include=FALSE, warning=FALSE, message=FALSE}
a709a705ce09 planemo upload for repository https://github.com/statonlab/docker-GRReport/tree/master/my_tools/rmarkdown_bdss_client commit 813dcaa22f297814dd6d6a8c4c5ff01664942aa6-dirty
mingchen0919
parents:
diff changeset
12 knitr::opts_chunk$set(
a709a705ce09 planemo upload for repository https://github.com/statonlab/docker-GRReport/tree/master/my_tools/rmarkdown_bdss_client commit 813dcaa22f297814dd6d6a8c4c5ff01664942aa6-dirty
mingchen0919
parents:
diff changeset
13 echo = ECHO,
a709a705ce09 planemo upload for repository https://github.com/statonlab/docker-GRReport/tree/master/my_tools/rmarkdown_bdss_client commit 813dcaa22f297814dd6d6a8c4c5ff01664942aa6-dirty
mingchen0919
parents:
diff changeset
14 error=TRUE
a709a705ce09 planemo upload for repository https://github.com/statonlab/docker-GRReport/tree/master/my_tools/rmarkdown_bdss_client commit 813dcaa22f297814dd6d6a8c4c5ff01664942aa6-dirty
mingchen0919
parents:
diff changeset
15 )
a709a705ce09 planemo upload for repository https://github.com/statonlab/docker-GRReport/tree/master/my_tools/rmarkdown_bdss_client commit 813dcaa22f297814dd6d6a8c4c5ff01664942aa6-dirty
mingchen0919
parents:
diff changeset
16 ```
a709a705ce09 planemo upload for repository https://github.com/statonlab/docker-GRReport/tree/master/my_tools/rmarkdown_bdss_client commit 813dcaa22f297814dd6d6a8c4c5ff01664942aa6-dirty
mingchen0919
parents:
diff changeset
17
a709a705ce09 planemo upload for repository https://github.com/statonlab/docker-GRReport/tree/master/my_tools/rmarkdown_bdss_client commit 813dcaa22f297814dd6d6a8c4c5ff01664942aa6-dirty
mingchen0919
parents:
diff changeset
18 # Command line arguments
a709a705ce09 planemo upload for repository https://github.com/statonlab/docker-GRReport/tree/master/my_tools/rmarkdown_bdss_client commit 813dcaa22f297814dd6d6a8c4c5ff01664942aa6-dirty
mingchen0919
parents:
diff changeset
19
a709a705ce09 planemo upload for repository https://github.com/statonlab/docker-GRReport/tree/master/my_tools/rmarkdown_bdss_client commit 813dcaa22f297814dd6d6a8c4c5ff01664942aa6-dirty
mingchen0919
parents:
diff changeset
20 ```{r 'command line arguments'}
a709a705ce09 planemo upload for repository https://github.com/statonlab/docker-GRReport/tree/master/my_tools/rmarkdown_bdss_client commit 813dcaa22f297814dd6d6a8c4c5ff01664942aa6-dirty
mingchen0919
parents:
diff changeset
21 str(opt)
a709a705ce09 planemo upload for repository https://github.com/statonlab/docker-GRReport/tree/master/my_tools/rmarkdown_bdss_client commit 813dcaa22f297814dd6d6a8c4c5ff01664942aa6-dirty
mingchen0919
parents:
diff changeset
22 ```
a709a705ce09 planemo upload for repository https://github.com/statonlab/docker-GRReport/tree/master/my_tools/rmarkdown_bdss_client commit 813dcaa22f297814dd6d6a8c4c5ff01664942aa6-dirty
mingchen0919
parents:
diff changeset
23
a709a705ce09 planemo upload for repository https://github.com/statonlab/docker-GRReport/tree/master/my_tools/rmarkdown_bdss_client commit 813dcaa22f297814dd6d6a8c4c5ff01664942aa6-dirty
mingchen0919
parents:
diff changeset
24 # BDSS configuration file
a709a705ce09 planemo upload for repository https://github.com/statonlab/docker-GRReport/tree/master/my_tools/rmarkdown_bdss_client commit 813dcaa22f297814dd6d6a8c4c5ff01664942aa6-dirty
mingchen0919
parents:
diff changeset
25
a709a705ce09 planemo upload for repository https://github.com/statonlab/docker-GRReport/tree/master/my_tools/rmarkdown_bdss_client commit 813dcaa22f297814dd6d6a8c4c5ff01664942aa6-dirty
mingchen0919
parents:
diff changeset
26 First, we create a bdss configuration file `bdss.cfg` in the current directory.
a709a705ce09 planemo upload for repository https://github.com/statonlab/docker-GRReport/tree/master/my_tools/rmarkdown_bdss_client commit 813dcaa22f297814dd6d6a8c4c5ff01664942aa6-dirty
mingchen0919
parents:
diff changeset
27
a709a705ce09 planemo upload for repository https://github.com/statonlab/docker-GRReport/tree/master/my_tools/rmarkdown_bdss_client commit 813dcaa22f297814dd6d6a8c4c5ff01664942aa6-dirty
mingchen0919
parents:
diff changeset
28 ```{r}
a709a705ce09 planemo upload for repository https://github.com/statonlab/docker-GRReport/tree/master/my_tools/rmarkdown_bdss_client commit 813dcaa22f297814dd6d6a8c4c5ff01664942aa6-dirty
mingchen0919
parents:
diff changeset
29 system('echo "[metadata_repository]" > bdss.cfg')
a709a705ce09 planemo upload for repository https://github.com/statonlab/docker-GRReport/tree/master/my_tools/rmarkdown_bdss_client commit 813dcaa22f297814dd6d6a8c4c5ff01664942aa6-dirty
mingchen0919
parents:
diff changeset
30 system('echo url=http://bdss.bioinfo.wsu.edu/ >> bdss.cfg')
a709a705ce09 planemo upload for repository https://github.com/statonlab/docker-GRReport/tree/master/my_tools/rmarkdown_bdss_client commit 813dcaa22f297814dd6d6a8c4c5ff01664942aa6-dirty
mingchen0919
parents:
diff changeset
31 ```
a709a705ce09 planemo upload for repository https://github.com/statonlab/docker-GRReport/tree/master/my_tools/rmarkdown_bdss_client commit 813dcaa22f297814dd6d6a8c4c5ff01664942aa6-dirty
mingchen0919
parents:
diff changeset
32
a709a705ce09 planemo upload for repository https://github.com/statonlab/docker-GRReport/tree/master/my_tools/rmarkdown_bdss_client commit 813dcaa22f297814dd6d6a8c4c5ff01664942aa6-dirty
mingchen0919
parents:
diff changeset
33 # Download and extract reads
a709a705ce09 planemo upload for repository https://github.com/statonlab/docker-GRReport/tree/master/my_tools/rmarkdown_bdss_client commit 813dcaa22f297814dd6d6a8c4c5ff01664942aa6-dirty
mingchen0919
parents:
diff changeset
34
a709a705ce09 planemo upload for repository https://github.com/statonlab/docker-GRReport/tree/master/my_tools/rmarkdown_bdss_client commit 813dcaa22f297814dd6d6a8c4c5ff01664942aa6-dirty
mingchen0919
parents:
diff changeset
35 ```{r 'download and extract reads'}
a709a705ce09 planemo upload for repository https://github.com/statonlab/docker-GRReport/tree/master/my_tools/rmarkdown_bdss_client commit 813dcaa22f297814dd6d6a8c4c5ff01664942aa6-dirty
mingchen0919
parents:
diff changeset
36 # create two directories, one for single end and the other for paired end SRA reads.
a709a705ce09 planemo upload for repository https://github.com/statonlab/docker-GRReport/tree/master/my_tools/rmarkdown_bdss_client commit 813dcaa22f297814dd6d6a8c4c5ff01664942aa6-dirty
mingchen0919
parents:
diff changeset
37 dir.create('se_read_files_directory')
a709a705ce09 planemo upload for repository https://github.com/statonlab/docker-GRReport/tree/master/my_tools/rmarkdown_bdss_client commit 813dcaa22f297814dd6d6a8c4c5ff01664942aa6-dirty
mingchen0919
parents:
diff changeset
38 dir.create('pe_read_files_directory')
a709a705ce09 planemo upload for repository https://github.com/statonlab/docker-GRReport/tree/master/my_tools/rmarkdown_bdss_client commit 813dcaa22f297814dd6d6a8c4c5ff01664942aa6-dirty
mingchen0919
parents:
diff changeset
39 # download and extract reads (single end)
a709a705ce09 planemo upload for repository https://github.com/statonlab/docker-GRReport/tree/master/my_tools/rmarkdown_bdss_client commit 813dcaa22f297814dd6d6a8c4c5ff01664942aa6-dirty
mingchen0919
parents:
diff changeset
40 sra_ids_se = strsplit(gsub(',', ' ', 'SRA_IDS_SE'), ' ')[[1]]
22
89cc5b026494 planemo upload for repository https://github.com/statonlab/docker-GRReport/tree/master/my_tools/rmarkdown_bdss_client commit 8d95d985955944734cd00ac94346e1197a4feb20-dirty
mingchen0919
parents: 21
diff changeset
41 sra_ids_se = sra_ids_se[sra_ids_se != '']
21
a709a705ce09 planemo upload for repository https://github.com/statonlab/docker-GRReport/tree/master/my_tools/rmarkdown_bdss_client commit 813dcaa22f297814dd6d6a8c4c5ff01664942aa6-dirty
mingchen0919
parents:
diff changeset
42 # loop through SRA accessions to download and extract reads.
22
89cc5b026494 planemo upload for repository https://github.com/statonlab/docker-GRReport/tree/master/my_tools/rmarkdown_bdss_client commit 8d95d985955944734cd00ac94346e1197a4feb20-dirty
mingchen0919
parents: 21
diff changeset
43 for(id in sra_ids_se) {
21
a709a705ce09 planemo upload for repository https://github.com/statonlab/docker-GRReport/tree/master/my_tools/rmarkdown_bdss_client commit 813dcaa22f297814dd6d6a8c4c5ff01664942aa6-dirty
mingchen0919
parents:
diff changeset
44 # build URL from SRA id
a709a705ce09 planemo upload for repository https://github.com/statonlab/docker-GRReport/tree/master/my_tools/rmarkdown_bdss_client commit 813dcaa22f297814dd6d6a8c4c5ff01664942aa6-dirty
mingchen0919
parents:
diff changeset
45 url = paste0('ftp://ftp.ncbi.nlm.nih.gov/sra/sra-instant/reads/ByRun/sra/',
a709a705ce09 planemo upload for repository https://github.com/statonlab/docker-GRReport/tree/master/my_tools/rmarkdown_bdss_client commit 813dcaa22f297814dd6d6a8c4c5ff01664942aa6-dirty
mingchen0919
parents:
diff changeset
46 substr(id, 1, 3), '/',
a709a705ce09 planemo upload for repository https://github.com/statonlab/docker-GRReport/tree/master/my_tools/rmarkdown_bdss_client commit 813dcaa22f297814dd6d6a8c4c5ff01664942aa6-dirty
mingchen0919
parents:
diff changeset
47 substr(id, 1, 6), '/', id, '/', id, '.sra')
a709a705ce09 planemo upload for repository https://github.com/statonlab/docker-GRReport/tree/master/my_tools/rmarkdown_bdss_client commit 813dcaa22f297814dd6d6a8c4c5ff01664942aa6-dirty
mingchen0919
parents:
diff changeset
48 # download sra file with bdss
23
fd15cf620d5d planemo upload for repository https://github.com/statonlab/docker-GRReport/tree/master/my_tools/rmarkdown_bdss_client commit 3d2a2c46f10b7f00a36771d2a0fc334d2c177730-dirty
mingchen0919
parents: 22
diff changeset
49 bdss_command = paste0('/main/sites/galaxy/galaxy/tools/_conda/bin/bdss transfer -u ', url)
21
a709a705ce09 planemo upload for repository https://github.com/statonlab/docker-GRReport/tree/master/my_tools/rmarkdown_bdss_client commit 813dcaa22f297814dd6d6a8c4c5ff01664942aa6-dirty
mingchen0919
parents:
diff changeset
50 system(bdss_command, intern = TRUE)
a709a705ce09 planemo upload for repository https://github.com/statonlab/docker-GRReport/tree/master/my_tools/rmarkdown_bdss_client commit 813dcaa22f297814dd6d6a8c4c5ff01664942aa6-dirty
mingchen0919
parents:
diff changeset
51 # convert .sra to .fastq/.fasta
a709a705ce09 planemo upload for repository https://github.com/statonlab/docker-GRReport/tree/master/my_tools/rmarkdown_bdss_client commit 813dcaa22f297814dd6d6a8c4c5ff01664942aa6-dirty
mingchen0919
parents:
diff changeset
52 if('FORMAT' == 'fasta') {
22
89cc5b026494 planemo upload for repository https://github.com/statonlab/docker-GRReport/tree/master/my_tools/rmarkdown_bdss_client commit 8d95d985955944734cd00ac94346e1197a4feb20-dirty
mingchen0919
parents: 21
diff changeset
53 command = paste0('fastq-dump --fasta -O se_read_files_directory ', id, '.sra')
21
a709a705ce09 planemo upload for repository https://github.com/statonlab/docker-GRReport/tree/master/my_tools/rmarkdown_bdss_client commit 813dcaa22f297814dd6d6a8c4c5ff01664942aa6-dirty
mingchen0919
parents:
diff changeset
54 } else {
22
89cc5b026494 planemo upload for repository https://github.com/statonlab/docker-GRReport/tree/master/my_tools/rmarkdown_bdss_client commit 8d95d985955944734cd00ac94346e1197a4feb20-dirty
mingchen0919
parents: 21
diff changeset
55 command = paste0('fastq-dump -O se_read_files_directory ', id, '.sra')
21
a709a705ce09 planemo upload for repository https://github.com/statonlab/docker-GRReport/tree/master/my_tools/rmarkdown_bdss_client commit 813dcaa22f297814dd6d6a8c4c5ff01664942aa6-dirty
mingchen0919
parents:
diff changeset
56 }
22
89cc5b026494 planemo upload for repository https://github.com/statonlab/docker-GRReport/tree/master/my_tools/rmarkdown_bdss_client commit 8d95d985955944734cd00ac94346e1197a4feb20-dirty
mingchen0919
parents: 21
diff changeset
57 cat('----convert SRA to fastq/fasta------\n')
89cc5b026494 planemo upload for repository https://github.com/statonlab/docker-GRReport/tree/master/my_tools/rmarkdown_bdss_client commit 8d95d985955944734cd00ac94346e1197a4feb20-dirty
mingchen0919
parents: 21
diff changeset
58 print(system(command, intern = TRUE))
21
a709a705ce09 planemo upload for repository https://github.com/statonlab/docker-GRReport/tree/master/my_tools/rmarkdown_bdss_client commit 813dcaa22f297814dd6d6a8c4c5ff01664942aa6-dirty
mingchen0919
parents:
diff changeset
59 }
a709a705ce09 planemo upload for repository https://github.com/statonlab/docker-GRReport/tree/master/my_tools/rmarkdown_bdss_client commit 813dcaa22f297814dd6d6a8c4c5ff01664942aa6-dirty
mingchen0919
parents:
diff changeset
60
a709a705ce09 planemo upload for repository https://github.com/statonlab/docker-GRReport/tree/master/my_tools/rmarkdown_bdss_client commit 813dcaa22f297814dd6d6a8c4c5ff01664942aa6-dirty
mingchen0919
parents:
diff changeset
61 # download and extract reads (paired end)
a709a705ce09 planemo upload for repository https://github.com/statonlab/docker-GRReport/tree/master/my_tools/rmarkdown_bdss_client commit 813dcaa22f297814dd6d6a8c4c5ff01664942aa6-dirty
mingchen0919
parents:
diff changeset
62 sra_ids_pe = strsplit(gsub(',', ' ', 'SRA_IDS_PE'), ' ')[[1]]
22
89cc5b026494 planemo upload for repository https://github.com/statonlab/docker-GRReport/tree/master/my_tools/rmarkdown_bdss_client commit 8d95d985955944734cd00ac94346e1197a4feb20-dirty
mingchen0919
parents: 21
diff changeset
63 sra_ids_pe = sra_ids_pe[sra_ids_pe != '']
21
a709a705ce09 planemo upload for repository https://github.com/statonlab/docker-GRReport/tree/master/my_tools/rmarkdown_bdss_client commit 813dcaa22f297814dd6d6a8c4c5ff01664942aa6-dirty
mingchen0919
parents:
diff changeset
64 # loop through SRA accessions to download and extract reads.
22
89cc5b026494 planemo upload for repository https://github.com/statonlab/docker-GRReport/tree/master/my_tools/rmarkdown_bdss_client commit 8d95d985955944734cd00ac94346e1197a4feb20-dirty
mingchen0919
parents: 21
diff changeset
65 for(id in sra_ids_pe) {
21
a709a705ce09 planemo upload for repository https://github.com/statonlab/docker-GRReport/tree/master/my_tools/rmarkdown_bdss_client commit 813dcaa22f297814dd6d6a8c4c5ff01664942aa6-dirty
mingchen0919
parents:
diff changeset
66 # build URL from SRA id
a709a705ce09 planemo upload for repository https://github.com/statonlab/docker-GRReport/tree/master/my_tools/rmarkdown_bdss_client commit 813dcaa22f297814dd6d6a8c4c5ff01664942aa6-dirty
mingchen0919
parents:
diff changeset
67 url = paste0('ftp://ftp.ncbi.nlm.nih.gov/sra/sra-instant/reads/ByRun/sra/',
a709a705ce09 planemo upload for repository https://github.com/statonlab/docker-GRReport/tree/master/my_tools/rmarkdown_bdss_client commit 813dcaa22f297814dd6d6a8c4c5ff01664942aa6-dirty
mingchen0919
parents:
diff changeset
68 substr(id, 1, 3), '/',
a709a705ce09 planemo upload for repository https://github.com/statonlab/docker-GRReport/tree/master/my_tools/rmarkdown_bdss_client commit 813dcaa22f297814dd6d6a8c4c5ff01664942aa6-dirty
mingchen0919
parents:
diff changeset
69 substr(id, 1, 6), '/', id, '/', id, '.sra')
a709a705ce09 planemo upload for repository https://github.com/statonlab/docker-GRReport/tree/master/my_tools/rmarkdown_bdss_client commit 813dcaa22f297814dd6d6a8c4c5ff01664942aa6-dirty
mingchen0919
parents:
diff changeset
70 # download sra file with bdss
23
fd15cf620d5d planemo upload for repository https://github.com/statonlab/docker-GRReport/tree/master/my_tools/rmarkdown_bdss_client commit 3d2a2c46f10b7f00a36771d2a0fc334d2c177730-dirty
mingchen0919
parents: 22
diff changeset
71 bdss_command = paste0('/main/sites/galaxy/galaxy/tools/_conda/bin/bdss transfer -u ', url)
21
a709a705ce09 planemo upload for repository https://github.com/statonlab/docker-GRReport/tree/master/my_tools/rmarkdown_bdss_client commit 813dcaa22f297814dd6d6a8c4c5ff01664942aa6-dirty
mingchen0919
parents:
diff changeset
72 system(bdss_command, intern = TRUE)
a709a705ce09 planemo upload for repository https://github.com/statonlab/docker-GRReport/tree/master/my_tools/rmarkdown_bdss_client commit 813dcaa22f297814dd6d6a8c4c5ff01664942aa6-dirty
mingchen0919
parents:
diff changeset
73 # convert .sra to .fastq/.fasta
a709a705ce09 planemo upload for repository https://github.com/statonlab/docker-GRReport/tree/master/my_tools/rmarkdown_bdss_client commit 813dcaa22f297814dd6d6a8c4c5ff01664942aa6-dirty
mingchen0919
parents:
diff changeset
74 if('FORMAT' == 'fasta') {
22
89cc5b026494 planemo upload for repository https://github.com/statonlab/docker-GRReport/tree/master/my_tools/rmarkdown_bdss_client commit 8d95d985955944734cd00ac94346e1197a4feb20-dirty
mingchen0919
parents: 21
diff changeset
75 command = paste0('fastq-dump --fasta --split-files -O pe_read_files_directory ', id, '.sra')
21
a709a705ce09 planemo upload for repository https://github.com/statonlab/docker-GRReport/tree/master/my_tools/rmarkdown_bdss_client commit 813dcaa22f297814dd6d6a8c4c5ff01664942aa6-dirty
mingchen0919
parents:
diff changeset
76 } else {
22
89cc5b026494 planemo upload for repository https://github.com/statonlab/docker-GRReport/tree/master/my_tools/rmarkdown_bdss_client commit 8d95d985955944734cd00ac94346e1197a4feb20-dirty
mingchen0919
parents: 21
diff changeset
77 command = paste0('fastq-dump --split-files -O pe_read_files_directory ', id, '.sra')
21
a709a705ce09 planemo upload for repository https://github.com/statonlab/docker-GRReport/tree/master/my_tools/rmarkdown_bdss_client commit 813dcaa22f297814dd6d6a8c4c5ff01664942aa6-dirty
mingchen0919
parents:
diff changeset
78 }
22
89cc5b026494 planemo upload for repository https://github.com/statonlab/docker-GRReport/tree/master/my_tools/rmarkdown_bdss_client commit 8d95d985955944734cd00ac94346e1197a4feb20-dirty
mingchen0919
parents: 21
diff changeset
79 cat('----convert SRA to fastq/fasta------\n')
89cc5b026494 planemo upload for repository https://github.com/statonlab/docker-GRReport/tree/master/my_tools/rmarkdown_bdss_client commit 8d95d985955944734cd00ac94346e1197a4feb20-dirty
mingchen0919
parents: 21
diff changeset
80 command_stdout = system(command, intern = TRUE)
89cc5b026494 planemo upload for repository https://github.com/statonlab/docker-GRReport/tree/master/my_tools/rmarkdown_bdss_client commit 8d95d985955944734cd00ac94346e1197a4feb20-dirty
mingchen0919
parents: 21
diff changeset
81 print(command_stdout)
23
fd15cf620d5d planemo upload for repository https://github.com/statonlab/docker-GRReport/tree/master/my_tools/rmarkdown_bdss_client commit 3d2a2c46f10b7f00a36771d2a0fc334d2c177730-dirty
mingchen0919
parents: 22
diff changeset
82 if(!(paste0(id, '_2.FORMAT') %in% list.files('pe_read_files_directory'))) {
22
89cc5b026494 planemo upload for repository https://github.com/statonlab/docker-GRReport/tree/master/my_tools/rmarkdown_bdss_client commit 8d95d985955944734cd00ac94346e1197a4feb20-dirty
mingchen0919
parents: 21
diff changeset
83 # this is not a paired end SRA file. The corresponding file will be deleted.
23
fd15cf620d5d planemo upload for repository https://github.com/statonlab/docker-GRReport/tree/master/my_tools/rmarkdown_bdss_client commit 3d2a2c46f10b7f00a36771d2a0fc334d2c177730-dirty
mingchen0919
parents: 22
diff changeset
84 cat(paste0(id, ' is not paired end SRA, the corresponding fastq/fasta file will deleted.'))
22
89cc5b026494 planemo upload for repository https://github.com/statonlab/docker-GRReport/tree/master/my_tools/rmarkdown_bdss_client commit 8d95d985955944734cd00ac94346e1197a4feb20-dirty
mingchen0919
parents: 21
diff changeset
85 system(paste0('rm pe_read_files_directory/', id, '_1.*'), intern = TRUE)
89cc5b026494 planemo upload for repository https://github.com/statonlab/docker-GRReport/tree/master/my_tools/rmarkdown_bdss_client commit 8d95d985955944734cd00ac94346e1197a4feb20-dirty
mingchen0919
parents: 21
diff changeset
86 }
89cc5b026494 planemo upload for repository https://github.com/statonlab/docker-GRReport/tree/master/my_tools/rmarkdown_bdss_client commit 8d95d985955944734cd00ac94346e1197a4feb20-dirty
mingchen0919
parents: 21
diff changeset
87
21
a709a705ce09 planemo upload for repository https://github.com/statonlab/docker-GRReport/tree/master/my_tools/rmarkdown_bdss_client commit 813dcaa22f297814dd6d6a8c4c5ff01664942aa6-dirty
mingchen0919
parents:
diff changeset
88 }
a709a705ce09 planemo upload for repository https://github.com/statonlab/docker-GRReport/tree/master/my_tools/rmarkdown_bdss_client commit 813dcaa22f297814dd6d6a8c4c5ff01664942aa6-dirty
mingchen0919
parents:
diff changeset
89
22
89cc5b026494 planemo upload for repository https://github.com/statonlab/docker-GRReport/tree/master/my_tools/rmarkdown_bdss_client commit 8d95d985955944734cd00ac94346e1197a4feb20-dirty
mingchen0919
parents: 21
diff changeset
90 cat('-----single end files----\n')
89cc5b026494 planemo upload for repository https://github.com/statonlab/docker-GRReport/tree/master/my_tools/rmarkdown_bdss_client commit 8d95d985955944734cd00ac94346e1197a4feb20-dirty
mingchen0919
parents: 21
diff changeset
91 list.files('./se_read_files_directory')
89cc5b026494 planemo upload for repository https://github.com/statonlab/docker-GRReport/tree/master/my_tools/rmarkdown_bdss_client commit 8d95d985955944734cd00ac94346e1197a4feb20-dirty
mingchen0919
parents: 21
diff changeset
92 cat('-----paired end files----\n')
89cc5b026494 planemo upload for repository https://github.com/statonlab/docker-GRReport/tree/master/my_tools/rmarkdown_bdss_client commit 8d95d985955944734cd00ac94346e1197a4feb20-dirty
mingchen0919
parents: 21
diff changeset
93 list.files('./pe_read_files_directory')
89cc5b026494 planemo upload for repository https://github.com/statonlab/docker-GRReport/tree/master/my_tools/rmarkdown_bdss_client commit 8d95d985955944734cd00ac94346e1197a4feb20-dirty
mingchen0919
parents: 21
diff changeset
94
89cc5b026494 planemo upload for repository https://github.com/statonlab/docker-GRReport/tree/master/my_tools/rmarkdown_bdss_client commit 8d95d985955944734cd00ac94346e1197a4feb20-dirty
mingchen0919
parents: 21
diff changeset
95 cat('-----Renaming files------\n')
21
a709a705ce09 planemo upload for repository https://github.com/statonlab/docker-GRReport/tree/master/my_tools/rmarkdown_bdss_client commit 813dcaa22f297814dd6d6a8c4c5ff01664942aa6-dirty
mingchen0919
parents:
diff changeset
96 # rename files for paired end reads
22
89cc5b026494 planemo upload for repository https://github.com/statonlab/docker-GRReport/tree/master/my_tools/rmarkdown_bdss_client commit 8d95d985955944734cd00ac94346e1197a4feb20-dirty
mingchen0919
parents: 21
diff changeset
97 old_files = paste0('./pe_read_files_directory/', list.files('./pe_read_files_directory'))
23
fd15cf620d5d planemo upload for repository https://github.com/statonlab/docker-GRReport/tree/master/my_tools/rmarkdown_bdss_client commit 3d2a2c46f10b7f00a36771d2a0fc334d2c177730-dirty
mingchen0919
parents: 22
diff changeset
98 print(old_files)
21
a709a705ce09 planemo upload for repository https://github.com/statonlab/docker-GRReport/tree/master/my_tools/rmarkdown_bdss_client commit 813dcaa22f297814dd6d6a8c4c5ff01664942aa6-dirty
mingchen0919
parents:
diff changeset
99 new_files = gsub('_1', '_forward', old_files)
a709a705ce09 planemo upload for repository https://github.com/statonlab/docker-GRReport/tree/master/my_tools/rmarkdown_bdss_client commit 813dcaa22f297814dd6d6a8c4c5ff01664942aa6-dirty
mingchen0919
parents:
diff changeset
100 new_files = gsub('_2', '_reverse', new_files)
23
fd15cf620d5d planemo upload for repository https://github.com/statonlab/docker-GRReport/tree/master/my_tools/rmarkdown_bdss_client commit 3d2a2c46f10b7f00a36771d2a0fc334d2c177730-dirty
mingchen0919
parents: 22
diff changeset
101 print(new_files)
21
a709a705ce09 planemo upload for repository https://github.com/statonlab/docker-GRReport/tree/master/my_tools/rmarkdown_bdss_client commit 813dcaa22f297814dd6d6a8c4c5ff01664942aa6-dirty
mingchen0919
parents:
diff changeset
102 file.rename(old_files, new_files)
a709a705ce09 planemo upload for repository https://github.com/statonlab/docker-GRReport/tree/master/my_tools/rmarkdown_bdss_client commit 813dcaa22f297814dd6d6a8c4c5ff01664942aa6-dirty
mingchen0919
parents:
diff changeset
103 ```
a709a705ce09 planemo upload for repository https://github.com/statonlab/docker-GRReport/tree/master/my_tools/rmarkdown_bdss_client commit 813dcaa22f297814dd6d6a8c4c5ff01664942aa6-dirty
mingchen0919
parents:
diff changeset
104
a709a705ce09 planemo upload for repository https://github.com/statonlab/docker-GRReport/tree/master/my_tools/rmarkdown_bdss_client commit 813dcaa22f297814dd6d6a8c4c5ff01664942aa6-dirty
mingchen0919
parents:
diff changeset
105