Mercurial > repos > mingchen0919 > rmarkdown_fastq_dump
annotate fastq_dump_se.Rmd @ 17:cf1233051a9b draft
planemo upload for repository https://github.com/statonlab/docker-GRReport/tree/master/my_tools/rmarkdown_fastq_dump commit e6035405141d63626702084eacd02089f816cdc7-dirty
author | mingchen0919 |
---|---|
date | Wed, 27 Sep 2017 17:12:39 -0400 |
parents | d4a9c31d0046 |
children | 42e154ba2d35 |
rev | line source |
---|---|
0
7ec600e7dba7
planemo upload for repository https://github.com/statonlab/docker-GRReport/tree/master/my_tools/rmarkdown_fastq_dump commit 6e3aaf47c3178dc89ad303c7fd398c08961064c0-dirty
mingchen0919
parents:
diff
changeset
|
1 --- |
7ec600e7dba7
planemo upload for repository https://github.com/statonlab/docker-GRReport/tree/master/my_tools/rmarkdown_fastq_dump commit 6e3aaf47c3178dc89ad303c7fd398c08961064c0-dirty
mingchen0919
parents:
diff
changeset
|
2 title: 'Fastq-dump: download and extract single end reads into FASTQ/FASTA file' |
7ec600e7dba7
planemo upload for repository https://github.com/statonlab/docker-GRReport/tree/master/my_tools/rmarkdown_fastq_dump commit 6e3aaf47c3178dc89ad303c7fd398c08961064c0-dirty
mingchen0919
parents:
diff
changeset
|
3 output: |
7ec600e7dba7
planemo upload for repository https://github.com/statonlab/docker-GRReport/tree/master/my_tools/rmarkdown_fastq_dump commit 6e3aaf47c3178dc89ad303c7fd398c08961064c0-dirty
mingchen0919
parents:
diff
changeset
|
4 html_document: |
7ec600e7dba7
planemo upload for repository https://github.com/statonlab/docker-GRReport/tree/master/my_tools/rmarkdown_fastq_dump commit 6e3aaf47c3178dc89ad303c7fd398c08961064c0-dirty
mingchen0919
parents:
diff
changeset
|
5 number_sections: true |
7ec600e7dba7
planemo upload for repository https://github.com/statonlab/docker-GRReport/tree/master/my_tools/rmarkdown_fastq_dump commit 6e3aaf47c3178dc89ad303c7fd398c08961064c0-dirty
mingchen0919
parents:
diff
changeset
|
6 toc: true |
7ec600e7dba7
planemo upload for repository https://github.com/statonlab/docker-GRReport/tree/master/my_tools/rmarkdown_fastq_dump commit 6e3aaf47c3178dc89ad303c7fd398c08961064c0-dirty
mingchen0919
parents:
diff
changeset
|
7 theme: cosmo |
7ec600e7dba7
planemo upload for repository https://github.com/statonlab/docker-GRReport/tree/master/my_tools/rmarkdown_fastq_dump commit 6e3aaf47c3178dc89ad303c7fd398c08961064c0-dirty
mingchen0919
parents:
diff
changeset
|
8 highlight: tango |
7ec600e7dba7
planemo upload for repository https://github.com/statonlab/docker-GRReport/tree/master/my_tools/rmarkdown_fastq_dump commit 6e3aaf47c3178dc89ad303c7fd398c08961064c0-dirty
mingchen0919
parents:
diff
changeset
|
9 --- |
7ec600e7dba7
planemo upload for repository https://github.com/statonlab/docker-GRReport/tree/master/my_tools/rmarkdown_fastq_dump commit 6e3aaf47c3178dc89ad303c7fd398c08961064c0-dirty
mingchen0919
parents:
diff
changeset
|
10 |
7ec600e7dba7
planemo upload for repository https://github.com/statonlab/docker-GRReport/tree/master/my_tools/rmarkdown_fastq_dump commit 6e3aaf47c3178dc89ad303c7fd398c08961064c0-dirty
mingchen0919
parents:
diff
changeset
|
11 ```{r setup, include=FALSE, warning=FALSE, message=FALSE} |
7ec600e7dba7
planemo upload for repository https://github.com/statonlab/docker-GRReport/tree/master/my_tools/rmarkdown_fastq_dump commit 6e3aaf47c3178dc89ad303c7fd398c08961064c0-dirty
mingchen0919
parents:
diff
changeset
|
12 knitr::opts_chunk$set( |
7ec600e7dba7
planemo upload for repository https://github.com/statonlab/docker-GRReport/tree/master/my_tools/rmarkdown_fastq_dump commit 6e3aaf47c3178dc89ad303c7fd398c08961064c0-dirty
mingchen0919
parents:
diff
changeset
|
13 echo = ECHO |
7ec600e7dba7
planemo upload for repository https://github.com/statonlab/docker-GRReport/tree/master/my_tools/rmarkdown_fastq_dump commit 6e3aaf47c3178dc89ad303c7fd398c08961064c0-dirty
mingchen0919
parents:
diff
changeset
|
14 ) |
7ec600e7dba7
planemo upload for repository https://github.com/statonlab/docker-GRReport/tree/master/my_tools/rmarkdown_fastq_dump commit 6e3aaf47c3178dc89ad303c7fd398c08961064c0-dirty
mingchen0919
parents:
diff
changeset
|
15 ``` |
7ec600e7dba7
planemo upload for repository https://github.com/statonlab/docker-GRReport/tree/master/my_tools/rmarkdown_fastq_dump commit 6e3aaf47c3178dc89ad303c7fd398c08961064c0-dirty
mingchen0919
parents:
diff
changeset
|
16 |
7ec600e7dba7
planemo upload for repository https://github.com/statonlab/docker-GRReport/tree/master/my_tools/rmarkdown_fastq_dump commit 6e3aaf47c3178dc89ad303c7fd398c08961064c0-dirty
mingchen0919
parents:
diff
changeset
|
17 # Command line arguments |
7ec600e7dba7
planemo upload for repository https://github.com/statonlab/docker-GRReport/tree/master/my_tools/rmarkdown_fastq_dump commit 6e3aaf47c3178dc89ad303c7fd398c08961064c0-dirty
mingchen0919
parents:
diff
changeset
|
18 |
7ec600e7dba7
planemo upload for repository https://github.com/statonlab/docker-GRReport/tree/master/my_tools/rmarkdown_fastq_dump commit 6e3aaf47c3178dc89ad303c7fd398c08961064c0-dirty
mingchen0919
parents:
diff
changeset
|
19 ```{r 'command line arguments'} |
7ec600e7dba7
planemo upload for repository https://github.com/statonlab/docker-GRReport/tree/master/my_tools/rmarkdown_fastq_dump commit 6e3aaf47c3178dc89ad303c7fd398c08961064c0-dirty
mingchen0919
parents:
diff
changeset
|
20 str(opt) |
7ec600e7dba7
planemo upload for repository https://github.com/statonlab/docker-GRReport/tree/master/my_tools/rmarkdown_fastq_dump commit 6e3aaf47c3178dc89ad303c7fd398c08961064c0-dirty
mingchen0919
parents:
diff
changeset
|
21 ``` |
7ec600e7dba7
planemo upload for repository https://github.com/statonlab/docker-GRReport/tree/master/my_tools/rmarkdown_fastq_dump commit 6e3aaf47c3178dc89ad303c7fd398c08961064c0-dirty
mingchen0919
parents:
diff
changeset
|
22 |
7ec600e7dba7
planemo upload for repository https://github.com/statonlab/docker-GRReport/tree/master/my_tools/rmarkdown_fastq_dump commit 6e3aaf47c3178dc89ad303c7fd398c08961064c0-dirty
mingchen0919
parents:
diff
changeset
|
23 # Download and extract reads |
7ec600e7dba7
planemo upload for repository https://github.com/statonlab/docker-GRReport/tree/master/my_tools/rmarkdown_fastq_dump commit 6e3aaf47c3178dc89ad303c7fd398c08961064c0-dirty
mingchen0919
parents:
diff
changeset
|
24 |
7ec600e7dba7
planemo upload for repository https://github.com/statonlab/docker-GRReport/tree/master/my_tools/rmarkdown_fastq_dump commit 6e3aaf47c3178dc89ad303c7fd398c08961064c0-dirty
mingchen0919
parents:
diff
changeset
|
25 ```{r 'download and extract reads'} |
7ec600e7dba7
planemo upload for repository https://github.com/statonlab/docker-GRReport/tree/master/my_tools/rmarkdown_fastq_dump commit 6e3aaf47c3178dc89ad303c7fd398c08961064c0-dirty
mingchen0919
parents:
diff
changeset
|
26 # create a directory to store read files |
7ec600e7dba7
planemo upload for repository https://github.com/statonlab/docker-GRReport/tree/master/my_tools/rmarkdown_fastq_dump commit 6e3aaf47c3178dc89ad303c7fd398c08961064c0-dirty
mingchen0919
parents:
diff
changeset
|
27 dir.create('read_files_directory') |
7ec600e7dba7
planemo upload for repository https://github.com/statonlab/docker-GRReport/tree/master/my_tools/rmarkdown_fastq_dump commit 6e3aaf47c3178dc89ad303c7fd398c08961064c0-dirty
mingchen0919
parents:
diff
changeset
|
28 # download and extract reads |
7ec600e7dba7
planemo upload for repository https://github.com/statonlab/docker-GRReport/tree/master/my_tools/rmarkdown_fastq_dump commit 6e3aaf47c3178dc89ad303c7fd398c08961064c0-dirty
mingchen0919
parents:
diff
changeset
|
29 sra_accessions = strsplit(gsub(',', ' ', 'SRA_ACCESSION'), ' ')[[1]] |
7ec600e7dba7
planemo upload for repository https://github.com/statonlab/docker-GRReport/tree/master/my_tools/rmarkdown_fastq_dump commit 6e3aaf47c3178dc89ad303c7fd398c08961064c0-dirty
mingchen0919
parents:
diff
changeset
|
30 sra_accessions = sra_accessions[sra_accessions != ''] |
7ec600e7dba7
planemo upload for repository https://github.com/statonlab/docker-GRReport/tree/master/my_tools/rmarkdown_fastq_dump commit 6e3aaf47c3178dc89ad303c7fd398c08961064c0-dirty
mingchen0919
parents:
diff
changeset
|
31 # loop through SRA accessions to download and extract reads. |
7ec600e7dba7
planemo upload for repository https://github.com/statonlab/docker-GRReport/tree/master/my_tools/rmarkdown_fastq_dump commit 6e3aaf47c3178dc89ad303c7fd398c08961064c0-dirty
mingchen0919
parents:
diff
changeset
|
32 for(id in sra_accessions) { |
9
233210d44681
planemo upload for repository https://github.com/statonlab/docker-GRReport/tree/master/my_tools/rmarkdown_fastq_dump commit 5d2a63708a8abf73432c1d6863d970146c6a38b2-dirty
mingchen0919
parents:
6
diff
changeset
|
33 if('FORMAT' == 'fasta') { |
6
4c84d748da08
planemo upload for repository https://github.com/statonlab/docker-GRReport/tree/master/my_tools/rmarkdown_fastq_dump commit c9517f0b061cdca3b79678d9a2620e1e43115d42-dirty
mingchen0919
parents:
0
diff
changeset
|
34 command = paste0('fastq-dump --fasta ', '-O read_files_directory ', id) |
0
7ec600e7dba7
planemo upload for repository https://github.com/statonlab/docker-GRReport/tree/master/my_tools/rmarkdown_fastq_dump commit 6e3aaf47c3178dc89ad303c7fd398c08961064c0-dirty
mingchen0919
parents:
diff
changeset
|
35 } else { |
6
4c84d748da08
planemo upload for repository https://github.com/statonlab/docker-GRReport/tree/master/my_tools/rmarkdown_fastq_dump commit c9517f0b061cdca3b79678d9a2620e1e43115d42-dirty
mingchen0919
parents:
0
diff
changeset
|
36 command = paste0('fastq-dump ', '-O read_files_directory ', id) |
0
7ec600e7dba7
planemo upload for repository https://github.com/statonlab/docker-GRReport/tree/master/my_tools/rmarkdown_fastq_dump commit 6e3aaf47c3178dc89ad303c7fd398c08961064c0-dirty
mingchen0919
parents:
diff
changeset
|
37 } |
6
4c84d748da08
planemo upload for repository https://github.com/statonlab/docker-GRReport/tree/master/my_tools/rmarkdown_fastq_dump commit c9517f0b061cdca3b79678d9a2620e1e43115d42-dirty
mingchen0919
parents:
0
diff
changeset
|
38 print(command) |
11
d4a9c31d0046
planemo upload for repository https://github.com/statonlab/docker-GRReport/tree/master/my_tools/rmarkdown_fastq_dump commit affb362adeb095389646b0c51738d24c2de3838d-dirty
mingchen0919
parents:
9
diff
changeset
|
39 system(command = command) |
0
7ec600e7dba7
planemo upload for repository https://github.com/statonlab/docker-GRReport/tree/master/my_tools/rmarkdown_fastq_dump commit 6e3aaf47c3178dc89ad303c7fd398c08961064c0-dirty
mingchen0919
parents:
diff
changeset
|
40 } |
7ec600e7dba7
planemo upload for repository https://github.com/statonlab/docker-GRReport/tree/master/my_tools/rmarkdown_fastq_dump commit 6e3aaf47c3178dc89ad303c7fd398c08961064c0-dirty
mingchen0919
parents:
diff
changeset
|
41 ``` |
7ec600e7dba7
planemo upload for repository https://github.com/statonlab/docker-GRReport/tree/master/my_tools/rmarkdown_fastq_dump commit 6e3aaf47c3178dc89ad303c7fd398c08961064c0-dirty
mingchen0919
parents:
diff
changeset
|
42 |