Mercurial > repos > mingchen0919 > rmarkdown_bdss_client
annotate bdss_client.Rmd @ 15:fe5f30584308 draft
planemo upload for repository https://github.com/statonlab/docker-GRReport/tree/master/my_tools/rmarkdown_bdss_client commit ea6df97960569d247d64be1549aa90768c9786f4-dirty
author | mingchen0919 |
---|---|
date | Wed, 11 Oct 2017 14:50:19 -0400 |
parents | c0b8476fbc85 |
children | c2150a0f9c7c |
rev | line source |
---|---|
7
efb1938c3020
planemo upload for repository https://github.com/statonlab/docker-GRReport/tree/master/my_tools/rmarkdown_bdss_client commit ea6df97960569d247d64be1549aa90768c9786f4-dirty
mingchen0919
parents:
diff
changeset
|
1 --- |
efb1938c3020
planemo upload for repository https://github.com/statonlab/docker-GRReport/tree/master/my_tools/rmarkdown_bdss_client commit ea6df97960569d247d64be1549aa90768c9786f4-dirty
mingchen0919
parents:
diff
changeset
|
2 title: 'Download with BDSS client' |
efb1938c3020
planemo upload for repository https://github.com/statonlab/docker-GRReport/tree/master/my_tools/rmarkdown_bdss_client commit ea6df97960569d247d64be1549aa90768c9786f4-dirty
mingchen0919
parents:
diff
changeset
|
3 output: |
efb1938c3020
planemo upload for repository https://github.com/statonlab/docker-GRReport/tree/master/my_tools/rmarkdown_bdss_client commit ea6df97960569d247d64be1549aa90768c9786f4-dirty
mingchen0919
parents:
diff
changeset
|
4 html_document: |
efb1938c3020
planemo upload for repository https://github.com/statonlab/docker-GRReport/tree/master/my_tools/rmarkdown_bdss_client commit ea6df97960569d247d64be1549aa90768c9786f4-dirty
mingchen0919
parents:
diff
changeset
|
5 number_sections: true |
efb1938c3020
planemo upload for repository https://github.com/statonlab/docker-GRReport/tree/master/my_tools/rmarkdown_bdss_client commit ea6df97960569d247d64be1549aa90768c9786f4-dirty
mingchen0919
parents:
diff
changeset
|
6 toc: true |
efb1938c3020
planemo upload for repository https://github.com/statonlab/docker-GRReport/tree/master/my_tools/rmarkdown_bdss_client commit ea6df97960569d247d64be1549aa90768c9786f4-dirty
mingchen0919
parents:
diff
changeset
|
7 theme: cosmo |
efb1938c3020
planemo upload for repository https://github.com/statonlab/docker-GRReport/tree/master/my_tools/rmarkdown_bdss_client commit ea6df97960569d247d64be1549aa90768c9786f4-dirty
mingchen0919
parents:
diff
changeset
|
8 highlight: tango |
efb1938c3020
planemo upload for repository https://github.com/statonlab/docker-GRReport/tree/master/my_tools/rmarkdown_bdss_client commit ea6df97960569d247d64be1549aa90768c9786f4-dirty
mingchen0919
parents:
diff
changeset
|
9 --- |
efb1938c3020
planemo upload for repository https://github.com/statonlab/docker-GRReport/tree/master/my_tools/rmarkdown_bdss_client commit ea6df97960569d247d64be1549aa90768c9786f4-dirty
mingchen0919
parents:
diff
changeset
|
10 |
efb1938c3020
planemo upload for repository https://github.com/statonlab/docker-GRReport/tree/master/my_tools/rmarkdown_bdss_client commit ea6df97960569d247d64be1549aa90768c9786f4-dirty
mingchen0919
parents:
diff
changeset
|
11 ```{r setup, include=FALSE, warning=FALSE, message=FALSE} |
efb1938c3020
planemo upload for repository https://github.com/statonlab/docker-GRReport/tree/master/my_tools/rmarkdown_bdss_client commit ea6df97960569d247d64be1549aa90768c9786f4-dirty
mingchen0919
parents:
diff
changeset
|
12 knitr::opts_chunk$set( |
efb1938c3020
planemo upload for repository https://github.com/statonlab/docker-GRReport/tree/master/my_tools/rmarkdown_bdss_client commit ea6df97960569d247d64be1549aa90768c9786f4-dirty
mingchen0919
parents:
diff
changeset
|
13 echo = ECHO |
efb1938c3020
planemo upload for repository https://github.com/statonlab/docker-GRReport/tree/master/my_tools/rmarkdown_bdss_client commit ea6df97960569d247d64be1549aa90768c9786f4-dirty
mingchen0919
parents:
diff
changeset
|
14 ) |
efb1938c3020
planemo upload for repository https://github.com/statonlab/docker-GRReport/tree/master/my_tools/rmarkdown_bdss_client commit ea6df97960569d247d64be1549aa90768c9786f4-dirty
mingchen0919
parents:
diff
changeset
|
15 ``` |
efb1938c3020
planemo upload for repository https://github.com/statonlab/docker-GRReport/tree/master/my_tools/rmarkdown_bdss_client commit ea6df97960569d247d64be1549aa90768c9786f4-dirty
mingchen0919
parents:
diff
changeset
|
16 |
efb1938c3020
planemo upload for repository https://github.com/statonlab/docker-GRReport/tree/master/my_tools/rmarkdown_bdss_client commit ea6df97960569d247d64be1549aa90768c9786f4-dirty
mingchen0919
parents:
diff
changeset
|
17 # Command line arguments |
efb1938c3020
planemo upload for repository https://github.com/statonlab/docker-GRReport/tree/master/my_tools/rmarkdown_bdss_client commit ea6df97960569d247d64be1549aa90768c9786f4-dirty
mingchen0919
parents:
diff
changeset
|
18 |
efb1938c3020
planemo upload for repository https://github.com/statonlab/docker-GRReport/tree/master/my_tools/rmarkdown_bdss_client commit ea6df97960569d247d64be1549aa90768c9786f4-dirty
mingchen0919
parents:
diff
changeset
|
19 ```{r 'command line arguments'} |
efb1938c3020
planemo upload for repository https://github.com/statonlab/docker-GRReport/tree/master/my_tools/rmarkdown_bdss_client commit ea6df97960569d247d64be1549aa90768c9786f4-dirty
mingchen0919
parents:
diff
changeset
|
20 str(opt) |
efb1938c3020
planemo upload for repository https://github.com/statonlab/docker-GRReport/tree/master/my_tools/rmarkdown_bdss_client commit ea6df97960569d247d64be1549aa90768c9786f4-dirty
mingchen0919
parents:
diff
changeset
|
21 ``` |
efb1938c3020
planemo upload for repository https://github.com/statonlab/docker-GRReport/tree/master/my_tools/rmarkdown_bdss_client commit ea6df97960569d247d64be1549aa90768c9786f4-dirty
mingchen0919
parents:
diff
changeset
|
22 |
efb1938c3020
planemo upload for repository https://github.com/statonlab/docker-GRReport/tree/master/my_tools/rmarkdown_bdss_client commit ea6df97960569d247d64be1549aa90768c9786f4-dirty
mingchen0919
parents:
diff
changeset
|
23 # BDSS configuration file |
efb1938c3020
planemo upload for repository https://github.com/statonlab/docker-GRReport/tree/master/my_tools/rmarkdown_bdss_client commit ea6df97960569d247d64be1549aa90768c9786f4-dirty
mingchen0919
parents:
diff
changeset
|
24 |
efb1938c3020
planemo upload for repository https://github.com/statonlab/docker-GRReport/tree/master/my_tools/rmarkdown_bdss_client commit ea6df97960569d247d64be1549aa90768c9786f4-dirty
mingchen0919
parents:
diff
changeset
|
25 First, we create a bdss configuration file `bdss.cfg` in the current directory. |
efb1938c3020
planemo upload for repository https://github.com/statonlab/docker-GRReport/tree/master/my_tools/rmarkdown_bdss_client commit ea6df97960569d247d64be1549aa90768c9786f4-dirty
mingchen0919
parents:
diff
changeset
|
26 |
efb1938c3020
planemo upload for repository https://github.com/statonlab/docker-GRReport/tree/master/my_tools/rmarkdown_bdss_client commit ea6df97960569d247d64be1549aa90768c9786f4-dirty
mingchen0919
parents:
diff
changeset
|
27 ```{r} |
efb1938c3020
planemo upload for repository https://github.com/statonlab/docker-GRReport/tree/master/my_tools/rmarkdown_bdss_client commit ea6df97960569d247d64be1549aa90768c9786f4-dirty
mingchen0919
parents:
diff
changeset
|
28 system('echo "[metadata_repository]" > bdss.cfg') |
efb1938c3020
planemo upload for repository https://github.com/statonlab/docker-GRReport/tree/master/my_tools/rmarkdown_bdss_client commit ea6df97960569d247d64be1549aa90768c9786f4-dirty
mingchen0919
parents:
diff
changeset
|
29 system('echo url=http://bdss.bioinfo.wsu.edu/ >> bdss.cfg') |
efb1938c3020
planemo upload for repository https://github.com/statonlab/docker-GRReport/tree/master/my_tools/rmarkdown_bdss_client commit ea6df97960569d247d64be1549aa90768c9786f4-dirty
mingchen0919
parents:
diff
changeset
|
30 ``` |
efb1938c3020
planemo upload for repository https://github.com/statonlab/docker-GRReport/tree/master/my_tools/rmarkdown_bdss_client commit ea6df97960569d247d64be1549aa90768c9786f4-dirty
mingchen0919
parents:
diff
changeset
|
31 |
14
c0b8476fbc85
planemo upload for repository https://github.com/statonlab/docker-GRReport/tree/master/my_tools/rmarkdown_bdss_client commit ea6df97960569d247d64be1549aa90768c9786f4-dirty
mingchen0919
parents:
13
diff
changeset
|
32 # Download data |
7
efb1938c3020
planemo upload for repository https://github.com/statonlab/docker-GRReport/tree/master/my_tools/rmarkdown_bdss_client commit ea6df97960569d247d64be1549aa90768c9786f4-dirty
mingchen0919
parents:
diff
changeset
|
33 |
efb1938c3020
planemo upload for repository https://github.com/statonlab/docker-GRReport/tree/master/my_tools/rmarkdown_bdss_client commit ea6df97960569d247d64be1549aa90768c9786f4-dirty
mingchen0919
parents:
diff
changeset
|
34 ```{r 'download and extract reads'} |
efb1938c3020
planemo upload for repository https://github.com/statonlab/docker-GRReport/tree/master/my_tools/rmarkdown_bdss_client commit ea6df97960569d247d64be1549aa90768c9786f4-dirty
mingchen0919
parents:
diff
changeset
|
35 # create a directory to store read files |
efb1938c3020
planemo upload for repository https://github.com/statonlab/docker-GRReport/tree/master/my_tools/rmarkdown_bdss_client commit ea6df97960569d247d64be1549aa90768c9786f4-dirty
mingchen0919
parents:
diff
changeset
|
36 dir.create('read_files_directory') |
efb1938c3020
planemo upload for repository https://github.com/statonlab/docker-GRReport/tree/master/my_tools/rmarkdown_bdss_client commit ea6df97960569d247d64be1549aa90768c9786f4-dirty
mingchen0919
parents:
diff
changeset
|
37 # download and extract reads |
efb1938c3020
planemo upload for repository https://github.com/statonlab/docker-GRReport/tree/master/my_tools/rmarkdown_bdss_client commit ea6df97960569d247d64be1549aa90768c9786f4-dirty
mingchen0919
parents:
diff
changeset
|
38 urls = strsplit(gsub(',', ' ', 'URLS'), ' ')[[1]] |
efb1938c3020
planemo upload for repository https://github.com/statonlab/docker-GRReport/tree/master/my_tools/rmarkdown_bdss_client commit ea6df97960569d247d64be1549aa90768c9786f4-dirty
mingchen0919
parents:
diff
changeset
|
39 urls = urls[urls != ''] |
efb1938c3020
planemo upload for repository https://github.com/statonlab/docker-GRReport/tree/master/my_tools/rmarkdown_bdss_client commit ea6df97960569d247d64be1549aa90768c9786f4-dirty
mingchen0919
parents:
diff
changeset
|
40 # loop through SRA accessions to download and extract reads. |
efb1938c3020
planemo upload for repository https://github.com/statonlab/docker-GRReport/tree/master/my_tools/rmarkdown_bdss_client commit ea6df97960569d247d64be1549aa90768c9786f4-dirty
mingchen0919
parents:
diff
changeset
|
41 for(url in urls) { |
15
fe5f30584308
planemo upload for repository https://github.com/statonlab/docker-GRReport/tree/master/my_tools/rmarkdown_bdss_client commit ea6df97960569d247d64be1549aa90768c9786f4-dirty
mingchen0919
parents:
14
diff
changeset
|
42 # bdss_command = paste0('cd ./read_files_directory && /tool_deps/_conda/bin/bdss transfer -u ', url) |
fe5f30584308
planemo upload for repository https://github.com/statonlab/docker-GRReport/tree/master/my_tools/rmarkdown_bdss_client commit ea6df97960569d247d64be1549aa90768c9786f4-dirty
mingchen0919
parents:
14
diff
changeset
|
43 bdss_command = paste0('cd ./read_files_directory && /main/sites/galaxy/galaxy/tools/_conda/bin/bdss transfer -u ', url) |
14
c0b8476fbc85
planemo upload for repository https://github.com/statonlab/docker-GRReport/tree/master/my_tools/rmarkdown_bdss_client commit ea6df97960569d247d64be1549aa90768c9786f4-dirty
mingchen0919
parents:
13
diff
changeset
|
44 print(system(bdss_command, intern = TRUE)) |
7
efb1938c3020
planemo upload for repository https://github.com/statonlab/docker-GRReport/tree/master/my_tools/rmarkdown_bdss_client commit ea6df97960569d247d64be1549aa90768c9786f4-dirty
mingchen0919
parents:
diff
changeset
|
45 } |
efb1938c3020
planemo upload for repository https://github.com/statonlab/docker-GRReport/tree/master/my_tools/rmarkdown_bdss_client commit ea6df97960569d247d64be1549aa90768c9786f4-dirty
mingchen0919
parents:
diff
changeset
|
46 ``` |
efb1938c3020
planemo upload for repository https://github.com/statonlab/docker-GRReport/tree/master/my_tools/rmarkdown_bdss_client commit ea6df97960569d247d64be1549aa90768c9786f4-dirty
mingchen0919
parents:
diff
changeset
|
47 |
efb1938c3020
planemo upload for repository https://github.com/statonlab/docker-GRReport/tree/master/my_tools/rmarkdown_bdss_client commit ea6df97960569d247d64be1549aa90768c9786f4-dirty
mingchen0919
parents:
diff
changeset
|
48 |