annotate bdss_client.Rmd @ 30:e97a8e2b8183 draft default tip

planemo upload for repository https://github.com/statonlab/docker-GRReport/tree/master/my_tools/rmarkdown_bdss_client commit 7c282211dbff8125b5aeef6e0172d5eb2f3a2ddb-dirty
author mingchen0919
date Mon, 16 Oct 2017 23:56:14 -0400
parents 69d51de74c0f
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
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(
21
a709a705ce09 planemo upload for repository https://github.com/statonlab/docker-GRReport/tree/master/my_tools/rmarkdown_bdss_client commit 813dcaa22f297814dd6d6a8c4c5ff01664942aa6-dirty
mingchen0919
parents: 16
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: 16
diff changeset
14 error=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
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
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 # 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
19
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 ```{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
21 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
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
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 # 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
25
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 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
27
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 ```{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
29 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
30 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
31 ```
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
32
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
33 # 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
34
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 ```{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
36 # 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
37 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
38 # 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
39 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
40 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
41 # 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
42 for(url in urls) {
21
a709a705ce09 planemo upload for repository https://github.com/statonlab/docker-GRReport/tree/master/my_tools/rmarkdown_bdss_client commit 813dcaa22f297814dd6d6a8c4c5ff01664942aa6-dirty
mingchen0919
parents: 16
diff changeset
43 print(url)
29
69d51de74c0f planemo upload for repository https://github.com/statonlab/docker-GRReport/tree/master/my_tools/rmarkdown_bdss_client commit 7c282211dbff8125b5aeef6e0172d5eb2f3a2ddb-dirty
mingchen0919
parents: 28
diff changeset
44 bdss_command = paste0('/tool_deps/_conda/bin/bdss transfer --destination read_files_directory -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: 16
diff changeset
45 print(bdss_command)
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
46 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
47 }
21
a709a705ce09 planemo upload for repository https://github.com/statonlab/docker-GRReport/tree/master/my_tools/rmarkdown_bdss_client commit 813dcaa22f297814dd6d6a8c4c5ff01664942aa6-dirty
mingchen0919
parents: 16
diff changeset
48 # all files that need to be saved should be moved to REPORT_DIR directory
a709a705ce09 planemo upload for repository https://github.com/statonlab/docker-GRReport/tree/master/my_tools/rmarkdown_bdss_client commit 813dcaa22f297814dd6d6a8c4c5ff01664942aa6-dirty
mingchen0919
parents: 16
diff changeset
49 # print(system('mv read_files_directory REPORT_DIR', 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
50 ```
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
51
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
52