Mercurial > repos > mingchen0919 > rmarkdown_collection_builder
diff collection_list_paired.Rmd @ 17:2f6a7c67440f draft
planemo upload for repository https://github.com/statonlab/docker-GRReport/tree/master/my_tools/rmarkdown_collection_builder commit 436d91722b309f61890d13d7ed28cd43c79a5c74-dirty
author | mingchen0919 |
---|---|
date | Mon, 25 Sep 2017 22:47:21 -0400 |
parents | |
children | a5dcb110f213 |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/collection_list_paired.Rmd Mon Sep 25 22:47:21 2017 -0400 @@ -0,0 +1,61 @@ +--- +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 +dir.create('./files_directory') +``` + +```{r 'rename forward files'} +# get full paths of original files +from_files = strsplit("FOWARD_FILE_LIST", ',')[[1]] +# copy files to the created directory. +file.copy(from_files, './files_directory') +# get original file names +original_files = list.files('./files_directory') +# create new files names from original file names +new_files = gsub('\\.dat', '\\.FORMAT_1', original_files) +# rename files +file.copy(paste0('./files_directory/', original_files), + paste0('./files_directory/', new_files)) +``` + +## Reverse inputs + +```{r 'rename reverse files'} +# get full paths of original files +from_files = strsplit("FOWARD_FILE_LIST", ',')[[1]] +# copy files to the created directory. +file.copy(from_files, './files_directory') +# get original file names +original_files = list.files('./files_directory') +# create new files names from original file names +new_files = gsub('\\.dat', '\\.FORMAT_2', original_files) +# rename files +file.copy(paste0('./files_directory/', original_files), + paste0('./files_directory/', new_files)) +``` +