Mercurial > repos > mingchen0919 > rmarkdown_bdss_client
annotate bdss_client_sra_se.Rmd @ 2:979136fc0650 draft
planemo upload for repository https://github.com/statonlab/docker-GRReport/tree/master/my_tools/rmarkdown_bdss_client commit 36de2ee9751d1ef5db0c76c217fd5ba262ca3739-dirty
| author | mingchen0919 |
|---|---|
| date | Tue, 10 Oct 2017 20:22:55 -0400 |
| parents | 614e9553f366 |
| children | c707a4178832 |
| rev | line source |
|---|---|
|
0
614e9553f366
planemo upload for repository https://github.com/statonlab/docker-GRReport/tree/master/my_tools/rmarkdown_bdss_client commit 36de2ee9751d1ef5db0c76c217fd5ba262ca3739-dirty
mingchen0919
parents:
diff
changeset
|
1 --- |
|
614e9553f366
planemo upload for repository https://github.com/statonlab/docker-GRReport/tree/master/my_tools/rmarkdown_bdss_client commit 36de2ee9751d1ef5db0c76c217fd5ba262ca3739-dirty
mingchen0919
parents:
diff
changeset
|
2 title: 'Fastq-dump: download and extract single end reads into FASTQ/FASTA file' |
|
614e9553f366
planemo upload for repository https://github.com/statonlab/docker-GRReport/tree/master/my_tools/rmarkdown_bdss_client commit 36de2ee9751d1ef5db0c76c217fd5ba262ca3739-dirty
mingchen0919
parents:
diff
changeset
|
3 output: |
|
614e9553f366
planemo upload for repository https://github.com/statonlab/docker-GRReport/tree/master/my_tools/rmarkdown_bdss_client commit 36de2ee9751d1ef5db0c76c217fd5ba262ca3739-dirty
mingchen0919
parents:
diff
changeset
|
4 html_document: |
|
614e9553f366
planemo upload for repository https://github.com/statonlab/docker-GRReport/tree/master/my_tools/rmarkdown_bdss_client commit 36de2ee9751d1ef5db0c76c217fd5ba262ca3739-dirty
mingchen0919
parents:
diff
changeset
|
5 number_sections: true |
|
614e9553f366
planemo upload for repository https://github.com/statonlab/docker-GRReport/tree/master/my_tools/rmarkdown_bdss_client commit 36de2ee9751d1ef5db0c76c217fd5ba262ca3739-dirty
mingchen0919
parents:
diff
changeset
|
6 toc: true |
|
614e9553f366
planemo upload for repository https://github.com/statonlab/docker-GRReport/tree/master/my_tools/rmarkdown_bdss_client commit 36de2ee9751d1ef5db0c76c217fd5ba262ca3739-dirty
mingchen0919
parents:
diff
changeset
|
7 theme: cosmo |
|
614e9553f366
planemo upload for repository https://github.com/statonlab/docker-GRReport/tree/master/my_tools/rmarkdown_bdss_client commit 36de2ee9751d1ef5db0c76c217fd5ba262ca3739-dirty
mingchen0919
parents:
diff
changeset
|
8 highlight: tango |
|
614e9553f366
planemo upload for repository https://github.com/statonlab/docker-GRReport/tree/master/my_tools/rmarkdown_bdss_client commit 36de2ee9751d1ef5db0c76c217fd5ba262ca3739-dirty
mingchen0919
parents:
diff
changeset
|
9 --- |
|
614e9553f366
planemo upload for repository https://github.com/statonlab/docker-GRReport/tree/master/my_tools/rmarkdown_bdss_client commit 36de2ee9751d1ef5db0c76c217fd5ba262ca3739-dirty
mingchen0919
parents:
diff
changeset
|
10 |
|
614e9553f366
planemo upload for repository https://github.com/statonlab/docker-GRReport/tree/master/my_tools/rmarkdown_bdss_client commit 36de2ee9751d1ef5db0c76c217fd5ba262ca3739-dirty
mingchen0919
parents:
diff
changeset
|
11 ```{r setup, include=FALSE, warning=FALSE, message=FALSE} |
|
614e9553f366
planemo upload for repository https://github.com/statonlab/docker-GRReport/tree/master/my_tools/rmarkdown_bdss_client commit 36de2ee9751d1ef5db0c76c217fd5ba262ca3739-dirty
mingchen0919
parents:
diff
changeset
|
12 knitr::opts_chunk$set( |
|
614e9553f366
planemo upload for repository https://github.com/statonlab/docker-GRReport/tree/master/my_tools/rmarkdown_bdss_client commit 36de2ee9751d1ef5db0c76c217fd5ba262ca3739-dirty
mingchen0919
parents:
diff
changeset
|
13 echo = ECHO |
|
614e9553f366
planemo upload for repository https://github.com/statonlab/docker-GRReport/tree/master/my_tools/rmarkdown_bdss_client commit 36de2ee9751d1ef5db0c76c217fd5ba262ca3739-dirty
mingchen0919
parents:
diff
changeset
|
14 ) |
|
614e9553f366
planemo upload for repository https://github.com/statonlab/docker-GRReport/tree/master/my_tools/rmarkdown_bdss_client commit 36de2ee9751d1ef5db0c76c217fd5ba262ca3739-dirty
mingchen0919
parents:
diff
changeset
|
15 ``` |
|
614e9553f366
planemo upload for repository https://github.com/statonlab/docker-GRReport/tree/master/my_tools/rmarkdown_bdss_client commit 36de2ee9751d1ef5db0c76c217fd5ba262ca3739-dirty
mingchen0919
parents:
diff
changeset
|
16 |
|
614e9553f366
planemo upload for repository https://github.com/statonlab/docker-GRReport/tree/master/my_tools/rmarkdown_bdss_client commit 36de2ee9751d1ef5db0c76c217fd5ba262ca3739-dirty
mingchen0919
parents:
diff
changeset
|
17 # Command line arguments |
|
614e9553f366
planemo upload for repository https://github.com/statonlab/docker-GRReport/tree/master/my_tools/rmarkdown_bdss_client commit 36de2ee9751d1ef5db0c76c217fd5ba262ca3739-dirty
mingchen0919
parents:
diff
changeset
|
18 |
|
614e9553f366
planemo upload for repository https://github.com/statonlab/docker-GRReport/tree/master/my_tools/rmarkdown_bdss_client commit 36de2ee9751d1ef5db0c76c217fd5ba262ca3739-dirty
mingchen0919
parents:
diff
changeset
|
19 ```{r 'command line arguments'} |
|
614e9553f366
planemo upload for repository https://github.com/statonlab/docker-GRReport/tree/master/my_tools/rmarkdown_bdss_client commit 36de2ee9751d1ef5db0c76c217fd5ba262ca3739-dirty
mingchen0919
parents:
diff
changeset
|
20 str(opt) |
|
614e9553f366
planemo upload for repository https://github.com/statonlab/docker-GRReport/tree/master/my_tools/rmarkdown_bdss_client commit 36de2ee9751d1ef5db0c76c217fd5ba262ca3739-dirty
mingchen0919
parents:
diff
changeset
|
21 ``` |
|
614e9553f366
planemo upload for repository https://github.com/statonlab/docker-GRReport/tree/master/my_tools/rmarkdown_bdss_client commit 36de2ee9751d1ef5db0c76c217fd5ba262ca3739-dirty
mingchen0919
parents:
diff
changeset
|
22 |
|
614e9553f366
planemo upload for repository https://github.com/statonlab/docker-GRReport/tree/master/my_tools/rmarkdown_bdss_client commit 36de2ee9751d1ef5db0c76c217fd5ba262ca3739-dirty
mingchen0919
parents:
diff
changeset
|
23 # BDSS configuration file |
|
614e9553f366
planemo upload for repository https://github.com/statonlab/docker-GRReport/tree/master/my_tools/rmarkdown_bdss_client commit 36de2ee9751d1ef5db0c76c217fd5ba262ca3739-dirty
mingchen0919
parents:
diff
changeset
|
24 |
|
614e9553f366
planemo upload for repository https://github.com/statonlab/docker-GRReport/tree/master/my_tools/rmarkdown_bdss_client commit 36de2ee9751d1ef5db0c76c217fd5ba262ca3739-dirty
mingchen0919
parents:
diff
changeset
|
25 First, we create a bdss configuration file `bdss.cfg` in the current directory. |
|
614e9553f366
planemo upload for repository https://github.com/statonlab/docker-GRReport/tree/master/my_tools/rmarkdown_bdss_client commit 36de2ee9751d1ef5db0c76c217fd5ba262ca3739-dirty
mingchen0919
parents:
diff
changeset
|
26 |
|
614e9553f366
planemo upload for repository https://github.com/statonlab/docker-GRReport/tree/master/my_tools/rmarkdown_bdss_client commit 36de2ee9751d1ef5db0c76c217fd5ba262ca3739-dirty
mingchen0919
parents:
diff
changeset
|
27 ```{r} |
|
614e9553f366
planemo upload for repository https://github.com/statonlab/docker-GRReport/tree/master/my_tools/rmarkdown_bdss_client commit 36de2ee9751d1ef5db0c76c217fd5ba262ca3739-dirty
mingchen0919
parents:
diff
changeset
|
28 system('echo "[metadata_repository]" > bdss.cfg') |
|
614e9553f366
planemo upload for repository https://github.com/statonlab/docker-GRReport/tree/master/my_tools/rmarkdown_bdss_client commit 36de2ee9751d1ef5db0c76c217fd5ba262ca3739-dirty
mingchen0919
parents:
diff
changeset
|
29 system('echo url=http://bdss.bioinfo.wsu.edu/ >> bdss.cfg') |
|
614e9553f366
planemo upload for repository https://github.com/statonlab/docker-GRReport/tree/master/my_tools/rmarkdown_bdss_client commit 36de2ee9751d1ef5db0c76c217fd5ba262ca3739-dirty
mingchen0919
parents:
diff
changeset
|
30 ``` |
|
614e9553f366
planemo upload for repository https://github.com/statonlab/docker-GRReport/tree/master/my_tools/rmarkdown_bdss_client commit 36de2ee9751d1ef5db0c76c217fd5ba262ca3739-dirty
mingchen0919
parents:
diff
changeset
|
31 |
|
614e9553f366
planemo upload for repository https://github.com/statonlab/docker-GRReport/tree/master/my_tools/rmarkdown_bdss_client commit 36de2ee9751d1ef5db0c76c217fd5ba262ca3739-dirty
mingchen0919
parents:
diff
changeset
|
32 # Download and extract reads |
|
614e9553f366
planemo upload for repository https://github.com/statonlab/docker-GRReport/tree/master/my_tools/rmarkdown_bdss_client commit 36de2ee9751d1ef5db0c76c217fd5ba262ca3739-dirty
mingchen0919
parents:
diff
changeset
|
33 |
|
614e9553f366
planemo upload for repository https://github.com/statonlab/docker-GRReport/tree/master/my_tools/rmarkdown_bdss_client commit 36de2ee9751d1ef5db0c76c217fd5ba262ca3739-dirty
mingchen0919
parents:
diff
changeset
|
34 ```{r 'download and extract reads'} |
|
614e9553f366
planemo upload for repository https://github.com/statonlab/docker-GRReport/tree/master/my_tools/rmarkdown_bdss_client commit 36de2ee9751d1ef5db0c76c217fd5ba262ca3739-dirty
mingchen0919
parents:
diff
changeset
|
35 # create a directory to store read files |
|
614e9553f366
planemo upload for repository https://github.com/statonlab/docker-GRReport/tree/master/my_tools/rmarkdown_bdss_client commit 36de2ee9751d1ef5db0c76c217fd5ba262ca3739-dirty
mingchen0919
parents:
diff
changeset
|
36 dir.create('read_files_directory') |
|
614e9553f366
planemo upload for repository https://github.com/statonlab/docker-GRReport/tree/master/my_tools/rmarkdown_bdss_client commit 36de2ee9751d1ef5db0c76c217fd5ba262ca3739-dirty
mingchen0919
parents:
diff
changeset
|
37 # download and extract reads |
|
614e9553f366
planemo upload for repository https://github.com/statonlab/docker-GRReport/tree/master/my_tools/rmarkdown_bdss_client commit 36de2ee9751d1ef5db0c76c217fd5ba262ca3739-dirty
mingchen0919
parents:
diff
changeset
|
38 sra_accessions = strsplit(gsub(',', ' ', 'SRA_ACCESSION'), ' ')[[1]] |
|
614e9553f366
planemo upload for repository https://github.com/statonlab/docker-GRReport/tree/master/my_tools/rmarkdown_bdss_client commit 36de2ee9751d1ef5db0c76c217fd5ba262ca3739-dirty
mingchen0919
parents:
diff
changeset
|
39 sra_accessions = sra_accessions[sra_accessions != ''] |
|
614e9553f366
planemo upload for repository https://github.com/statonlab/docker-GRReport/tree/master/my_tools/rmarkdown_bdss_client commit 36de2ee9751d1ef5db0c76c217fd5ba262ca3739-dirty
mingchen0919
parents:
diff
changeset
|
40 # loop through SRA accessions to download and extract reads. |
|
614e9553f366
planemo upload for repository https://github.com/statonlab/docker-GRReport/tree/master/my_tools/rmarkdown_bdss_client commit 36de2ee9751d1ef5db0c76c217fd5ba262ca3739-dirty
mingchen0919
parents:
diff
changeset
|
41 for(id in sra_accessions) { |
|
614e9553f366
planemo upload for repository https://github.com/statonlab/docker-GRReport/tree/master/my_tools/rmarkdown_bdss_client commit 36de2ee9751d1ef5db0c76c217fd5ba262ca3739-dirty
mingchen0919
parents:
diff
changeset
|
42 # build URL from SRA accession |
|
614e9553f366
planemo upload for repository https://github.com/statonlab/docker-GRReport/tree/master/my_tools/rmarkdown_bdss_client commit 36de2ee9751d1ef5db0c76c217fd5ba262ca3739-dirty
mingchen0919
parents:
diff
changeset
|
43 url = paste0('ftp://ftp.ncbi.nlm.nih.gov/sra/sra-instant/reads/ByRun/sra/SRR/', |
|
614e9553f366
planemo upload for repository https://github.com/statonlab/docker-GRReport/tree/master/my_tools/rmarkdown_bdss_client commit 36de2ee9751d1ef5db0c76c217fd5ba262ca3739-dirty
mingchen0919
parents:
diff
changeset
|
44 substr(id, 1, 6), '/', id, '/', id, '.sra') |
|
614e9553f366
planemo upload for repository https://github.com/statonlab/docker-GRReport/tree/master/my_tools/rmarkdown_bdss_client commit 36de2ee9751d1ef5db0c76c217fd5ba262ca3739-dirty
mingchen0919
parents:
diff
changeset
|
45 # download sra file with bdss |
|
614e9553f366
planemo upload for repository https://github.com/statonlab/docker-GRReport/tree/master/my_tools/rmarkdown_bdss_client commit 36de2ee9751d1ef5db0c76c217fd5ba262ca3739-dirty
mingchen0919
parents:
diff
changeset
|
46 bdss_command = paste0('/tool_deps/_conda/bin/bdss transfer -u ', url) |
|
614e9553f366
planemo upload for repository https://github.com/statonlab/docker-GRReport/tree/master/my_tools/rmarkdown_bdss_client commit 36de2ee9751d1ef5db0c76c217fd5ba262ca3739-dirty
mingchen0919
parents:
diff
changeset
|
47 system(bdss_command, intern = TRUE) |
|
614e9553f366
planemo upload for repository https://github.com/statonlab/docker-GRReport/tree/master/my_tools/rmarkdown_bdss_client commit 36de2ee9751d1ef5db0c76c217fd5ba262ca3739-dirty
mingchen0919
parents:
diff
changeset
|
48 # convert .sra to .fastq/.fasta |
|
614e9553f366
planemo upload for repository https://github.com/statonlab/docker-GRReport/tree/master/my_tools/rmarkdown_bdss_client commit 36de2ee9751d1ef5db0c76c217fd5ba262ca3739-dirty
mingchen0919
parents:
diff
changeset
|
49 if('FORMAT' == 'fasta') { |
|
614e9553f366
planemo upload for repository https://github.com/statonlab/docker-GRReport/tree/master/my_tools/rmarkdown_bdss_client commit 36de2ee9751d1ef5db0c76c217fd5ba262ca3739-dirty
mingchen0919
parents:
diff
changeset
|
50 command = paste0('fastq-dump --fasta ', '-O read_files_directory ', id) |
|
614e9553f366
planemo upload for repository https://github.com/statonlab/docker-GRReport/tree/master/my_tools/rmarkdown_bdss_client commit 36de2ee9751d1ef5db0c76c217fd5ba262ca3739-dirty
mingchen0919
parents:
diff
changeset
|
51 } else { |
|
614e9553f366
planemo upload for repository https://github.com/statonlab/docker-GRReport/tree/master/my_tools/rmarkdown_bdss_client commit 36de2ee9751d1ef5db0c76c217fd5ba262ca3739-dirty
mingchen0919
parents:
diff
changeset
|
52 command = paste0('fastq-dump ', '-O read_files_directory ', id) |
|
614e9553f366
planemo upload for repository https://github.com/statonlab/docker-GRReport/tree/master/my_tools/rmarkdown_bdss_client commit 36de2ee9751d1ef5db0c76c217fd5ba262ca3739-dirty
mingchen0919
parents:
diff
changeset
|
53 } |
|
614e9553f366
planemo upload for repository https://github.com/statonlab/docker-GRReport/tree/master/my_tools/rmarkdown_bdss_client commit 36de2ee9751d1ef5db0c76c217fd5ba262ca3739-dirty
mingchen0919
parents:
diff
changeset
|
54 } |
|
614e9553f366
planemo upload for repository https://github.com/statonlab/docker-GRReport/tree/master/my_tools/rmarkdown_bdss_client commit 36de2ee9751d1ef5db0c76c217fd5ba262ca3739-dirty
mingchen0919
parents:
diff
changeset
|
55 |
|
614e9553f366
planemo upload for repository https://github.com/statonlab/docker-GRReport/tree/master/my_tools/rmarkdown_bdss_client commit 36de2ee9751d1ef5db0c76c217fd5ba262ca3739-dirty
mingchen0919
parents:
diff
changeset
|
56 # remove all .sra file |
|
614e9553f366
planemo upload for repository https://github.com/statonlab/docker-GRReport/tree/master/my_tools/rmarkdown_bdss_client commit 36de2ee9751d1ef5db0c76c217fd5ba262ca3739-dirty
mingchen0919
parents:
diff
changeset
|
57 system('rm *.sra', intern = TRUE) |
|
614e9553f366
planemo upload for repository https://github.com/statonlab/docker-GRReport/tree/master/my_tools/rmarkdown_bdss_client commit 36de2ee9751d1ef5db0c76c217fd5ba262ca3739-dirty
mingchen0919
parents:
diff
changeset
|
58 ``` |
|
614e9553f366
planemo upload for repository https://github.com/statonlab/docker-GRReport/tree/master/my_tools/rmarkdown_bdss_client commit 36de2ee9751d1ef5db0c76c217fd5ba262ca3739-dirty
mingchen0919
parents:
diff
changeset
|
59 |
|
614e9553f366
planemo upload for repository https://github.com/statonlab/docker-GRReport/tree/master/my_tools/rmarkdown_bdss_client commit 36de2ee9751d1ef5db0c76c217fd5ba262ca3739-dirty
mingchen0919
parents:
diff
changeset
|
60 * `fastq-dump` command |
|
614e9553f366
planemo upload for repository https://github.com/statonlab/docker-GRReport/tree/master/my_tools/rmarkdown_bdss_client commit 36de2ee9751d1ef5db0c76c217fd5ba262ca3739-dirty
mingchen0919
parents:
diff
changeset
|
61 ```{r} |
|
614e9553f366
planemo upload for repository https://github.com/statonlab/docker-GRReport/tree/master/my_tools/rmarkdown_bdss_client commit 36de2ee9751d1ef5db0c76c217fd5ba262ca3739-dirty
mingchen0919
parents:
diff
changeset
|
62 print(command) |
|
614e9553f366
planemo upload for repository https://github.com/statonlab/docker-GRReport/tree/master/my_tools/rmarkdown_bdss_client commit 36de2ee9751d1ef5db0c76c217fd5ba262ca3739-dirty
mingchen0919
parents:
diff
changeset
|
63 ``` |
|
614e9553f366
planemo upload for repository https://github.com/statonlab/docker-GRReport/tree/master/my_tools/rmarkdown_bdss_client commit 36de2ee9751d1ef5db0c76c217fd5ba262ca3739-dirty
mingchen0919
parents:
diff
changeset
|
64 |
|
614e9553f366
planemo upload for repository https://github.com/statonlab/docker-GRReport/tree/master/my_tools/rmarkdown_bdss_client commit 36de2ee9751d1ef5db0c76c217fd5ba262ca3739-dirty
mingchen0919
parents:
diff
changeset
|
65 * `command line stdout` |
|
614e9553f366
planemo upload for repository https://github.com/statonlab/docker-GRReport/tree/master/my_tools/rmarkdown_bdss_client commit 36de2ee9751d1ef5db0c76c217fd5ba262ca3739-dirty
mingchen0919
parents:
diff
changeset
|
66 |
|
614e9553f366
planemo upload for repository https://github.com/statonlab/docker-GRReport/tree/master/my_tools/rmarkdown_bdss_client commit 36de2ee9751d1ef5db0c76c217fd5ba262ca3739-dirty
mingchen0919
parents:
diff
changeset
|
67 ```{r} |
|
614e9553f366
planemo upload for repository https://github.com/statonlab/docker-GRReport/tree/master/my_tools/rmarkdown_bdss_client commit 36de2ee9751d1ef5db0c76c217fd5ba262ca3739-dirty
mingchen0919
parents:
diff
changeset
|
68 system(command = command, intern = TRUE) |
|
614e9553f366
planemo upload for repository https://github.com/statonlab/docker-GRReport/tree/master/my_tools/rmarkdown_bdss_client commit 36de2ee9751d1ef5db0c76c217fd5ba262ca3739-dirty
mingchen0919
parents:
diff
changeset
|
69 ``` |
|
614e9553f366
planemo upload for repository https://github.com/statonlab/docker-GRReport/tree/master/my_tools/rmarkdown_bdss_client commit 36de2ee9751d1ef5db0c76c217fd5ba262ca3739-dirty
mingchen0919
parents:
diff
changeset
|
70 |
