Mercurial > repos > mingchen0919 > rmarkdown_fastq_dump
annotate fastq_dump_se.Rmd @ 0:7ec600e7dba7 draft
planemo upload for repository https://github.com/statonlab/docker-GRReport/tree/master/my_tools/rmarkdown_fastq_dump commit 6e3aaf47c3178dc89ad303c7fd398c08961064c0-dirty
author | mingchen0919 |
---|---|
date | Wed, 27 Sep 2017 09:25:48 -0400 |
parents | |
children | 4c84d748da08 |
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) { |
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
|
33 if(FORMAT == 'fasta') { |
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
|
34 command = paste0('fastq-dump --fasta ', id, ' -O 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
|
35 } else { |
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
|
36 command = paste0('fastq-dump ', id, ' -O 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
|
37 } |
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
|
38 system(command = command) |
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
|
39 } |
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 |