view bdss_client.Rmd @ 23:fd15cf620d5d draft

planemo upload for repository https://github.com/statonlab/docker-GRReport/tree/master/my_tools/rmarkdown_bdss_client commit 3d2a2c46f10b7f00a36771d2a0fc334d2c177730-dirty
author mingchen0919
date Sun, 15 Oct 2017 00:50:10 -0400
parents a709a705ce09
children a1c0ebd05f2f
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('/main/sites/galaxy/galaxy/tools/_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))
```