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