view bdss_client.Rmd @ 0:512d008295db draft default tip

planemo upload for repository https://github.com/statonlab/docker-GRReport/tree/master/my_tools/rmarkdown_bdss_client_main commit d9ab791a7ce12362dc6e28c0a518a3f23dd581fe-dirty
author mingchen0919
date Tue, 17 Oct 2017 14:09:01 -0400
parents
children
line wrap: on
line source

---
title: 'Download with BDSS client'
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,
  error=TRUE
)
```

# Command line arguments

```{r 'command line arguments'}
str(opt)
```

# BDSS configuration file

First, we create a bdss configuration file `bdss.cfg` in the current directory.

```{r}
system('echo "[metadata_repository]" > bdss.cfg')
system('echo url=http://bdss.bioinfo.wsu.edu/ >> bdss.cfg')
```

# Download data

```{r 'download and extract reads'}
# create a directory to store read files
dir.create('read_files_directory')
# download and extract reads
urls = strsplit(gsub(',', ' ', 'URLS'), ' ')[[1]]
urls = urls[urls != '']
# loop through SRA accessions to download and extract reads.
for(url in urls) {
    print(url)
    bdss_command = paste0('/tool_deps/_conda/bin/bdss transfer --destination read_files_directory -u ', url)
    print(bdss_command)
    print(system(bdss_command, intern = TRUE))
}
# all files that need to be saved should be moved to REPORT_DIR directory
# print(system('mv read_files_directory REPORT_DIR', intern = TRUE))
```