Mercurial > repos > mingchen0919 > rmarkdown_fastq_dump
diff fastq_dump_pe.Rmd @ 11:d4a9c31d0046 draft
planemo upload for repository https://github.com/statonlab/docker-GRReport/tree/master/my_tools/rmarkdown_fastq_dump commit affb362adeb095389646b0c51738d24c2de3838d-dirty
author | mingchen0919 |
---|---|
date | Wed, 27 Sep 2017 16:43:52 -0400 |
parents | 7ec600e7dba7 |
children | d330ce2d4663 |
line wrap: on
line diff
--- a/fastq_dump_pe.Rmd Wed Sep 27 16:17:40 2017 -0400 +++ b/fastq_dump_pe.Rmd Wed Sep 27 16:43:52 2017 -0400 @@ -0,0 +1,48 @@ +--- +title: 'Fastq-dump: download and extract paired end reads into FASTQ/FASTA file' +output: + html_document: + number_sections: true + toc: true + theme: cosmo + highlight: tango +--- + +```{r setup, include=FALSE, warning=FALSE, message=FALSE} +knitr::opts_chunk$set( + echo = ECHO +) +``` + +# Command line arguments + +```{r 'command line arguments'} +str(opt) +``` + +# Download and extract reads + +```{r 'download and extract reads'} +# create a directory to store read files +dir.create('read_files_directory') +# download and extract reads +sra_accessions = strsplit(gsub(',', ' ', 'SRA_ACCESSION'), ' ')[[1]] +sra_accessions = sra_accessions[sra_accessions != ''] +# loop through SRA accessions to download and extract reads. +for(id in sra_accessions) { + if('FORMAT' == 'fasta') { + command = paste0('fastq-dump --fasta ', '-O read_files_directory ') + } else { + command = paste0('fastq-dump ', '-O read_files_directory ') + } + + if('SPLIT_FILES' == TRUE) { + command = paste0(command, '--split_files ', id) + } else { + command = paste0(command, id) + } + print(command) + system(command = command) +} +``` +