Mercurial > repos > mingchen0919 > rmarkdown_bdss_client
annotate bdss_client.Rmd @ 10:b7171118a078 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 13:31:47 -0400 |
parents | efb1938c3020 |
children | bfc6133f3a2b |
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 |
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 # 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
|
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) { |
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 bdss_command = paste0('/tool_deps/_conda/bin/bdss transfer -u ', url) |
10
b7171118a078
planemo upload for repository https://github.com/statonlab/docker-GRReport/tree/master/my_tools/rmarkdown_bdss_client commit ea6df97960569d247d64be1549aa90768c9786f4-dirty
mingchen0919
parents:
7
diff
changeset
|
43 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
|
44 } |
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 move_files_command = 'find . -type f -print0 | xargs -0 mv -t ./read_files_directory' |
10
b7171118a078
planemo upload for repository https://github.com/statonlab/docker-GRReport/tree/master/my_tools/rmarkdown_bdss_client commit ea6df97960569d247d64be1549aa90768c9786f4-dirty
mingchen0919
parents:
7
diff
changeset
|
46 system(move_files_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 ``` |
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 |
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
|
49 * `fastq-dump` command |
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 ```{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
|
51 print(command) |
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 ``` |
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
|
53 |
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
|
54 * `command line stdout` |
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
|
55 |
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
|
56 ```{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
|
57 system(command = command, intern = 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
|
58 ``` |
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
|
59 |