view collection_list_paired.Rmd @ 6:a0c8b2b25774 draft

planemo upload for repository https://github.com/statonlab/docker-GRReport/tree/master/my_tools/rmarkdown_collection_builder commit 88ca36a41aa577ba888cee39cf81b176bf7e68db
author mingchen0919
date Tue, 26 Sep 2017 13:33:22 -0400
parents 66022ba24ac7
children f555686ca340
line wrap: on
line source

---
title: 'Build collection: a list of paired datasets'
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)
```

# Rename files

## Forward inputs

```{r 'create inputs directory'}
# create directory to store both forward and reverse inputs
# this is the directory where datasets will be discovered.
dir.create('./files_directory')
```

```{r 'rename forward files'}
# create directory
dir.create('./forward_files_directory')
# get full paths of original files
from_files = strsplit("FORWARD_FILE_LIST", ',')[[1]]
# copy files to forward_files_directory.
file.copy(from_files, './forward_files_directory')
# get original file names
original_files = list.files('./forward_files_directory')
# create new files names from original file names
new_files = gsub('\\.dat', '_forward\\.FORMAT', original_files)
new_files = paste0('input', 1:length(original_files), '_forward.FORMAT')
new_files
# rename files
file.copy(paste0('./forward_files_directory/', original_files),
          paste0('./files_directory/', new_files))
```

## Reverse inputs

```{r 'rename reverse files'}
# create directory
dir.create('./reverse_files_directory')
# get full paths of original files
from_files = strsplit("REVERSE_FILE_LIST", ',')[[1]]
# copy files to reverse_files_directory.
file.copy(from_files, './reverse_files_directory')
# get original file names
original_files = list.files('./reverse_files_directory')
# create new files names from original file names
new_files = gsub('\\.dat', '_reverse\\.FORMAT', original_files)
new_files = paste0('input', 1:length(original_files), '_reverse.FORMAT')
new_files
# rename files
file.copy(paste0('./reverse_files_directory/', original_files),
          paste0('./files_directory/', new_files))
```