Mercurial > repos > mingchen0919 > rmarkdown_collection_builder
diff collection_list_paired.Rmd @ 5:66022ba24ac7 draft
planemo upload for repository https://github.com/statonlab/docker-GRReport/tree/master/my_tools/rmarkdown_collection_builder commit 51c9df9f3f883537269f8928f92052457b29f744-dirty
author | mingchen0919 |
---|---|
date | Tue, 26 Sep 2017 00:16:09 -0400 |
parents | |
children | a0c8b2b25774 |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/collection_list_paired.Rmd Tue Sep 26 00:16:09 2017 -0400 @@ -0,0 +1,70 @@ +--- +title: 'Collection builder (collection type: list:paired)' +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)) +``` +