Mercurial > repos > mingchen0919 > rmarkdown_bdss_client_main
annotate bdss_client.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 with BDSS client' |
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 data |
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 a directory to store read 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
|
37 dir.create('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 # 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
|
39 urls = strsplit(gsub(',', ' ', 'URLS'), ' ')[[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
|
40 urls = urls[urls != ''] |
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 # 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
|
42 for(url in urls) { |
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 print(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
|
44 bdss_command = paste0('/tool_deps/_conda/bin/bdss transfer --destination read_files_directory -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
|
45 print(bdss_command) |
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 print(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
|
47 } |
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 # all files that need to be saved should be moved to REPORT_DIR 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
|
49 # print(system('mv read_files_directory REPORT_DIR', 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
|
50 ``` |
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 |
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 |