view fastq_dump_se.Rmd @ 1:496359735aa1 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:28:12 -0400
parents 7ec600e7dba7
children 4c84d748da08
line wrap: on
line source

---
title: 'Fastq-dump: download and extract single 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 ', id, ' -O read_files_directory')
  } else {
    command = paste0('fastq-dump ', id, ' -O read_files_directory')
  }
  system(command = command)
}
```