Mercurial > repos > mingchen0919 > rmarkdown_collection_builder
comparison 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 |
comparison
equal
deleted
inserted
replaced
4:63e9500cdeec | 5:66022ba24ac7 |
---|---|
1 --- | |
2 title: 'Collection builder (collection type: list:paired)' | |
3 output: | |
4 html_document: | |
5 number_sections: true | |
6 toc: true | |
7 theme: cosmo | |
8 highlight: tango | |
9 --- | |
10 | |
11 ```{r setup, include=FALSE, warning=FALSE, message=FALSE} | |
12 knitr::opts_chunk$set( | |
13 echo = ECHO | |
14 ) | |
15 ``` | |
16 | |
17 # Command line arguments | |
18 | |
19 ```{r 'command line arguments'} | |
20 str(opt) | |
21 ``` | |
22 | |
23 # Rename files | |
24 | |
25 ## Forward inputs | |
26 | |
27 ```{r 'create inputs directory'} | |
28 # create directory to store both forward and reverse inputs | |
29 # this is the directory where datasets will be discovered. | |
30 dir.create('./files_directory') | |
31 ``` | |
32 | |
33 ```{r 'rename forward files'} | |
34 # create directory | |
35 dir.create('./forward_files_directory') | |
36 # get full paths of original files | |
37 from_files = strsplit("FORWARD_FILE_LIST", ',')[[1]] | |
38 # copy files to forward_files_directory. | |
39 file.copy(from_files, './forward_files_directory') | |
40 # get original file names | |
41 original_files = list.files('./forward_files_directory') | |
42 # create new files names from original file names | |
43 new_files = gsub('\\.dat', '_forward\\.FORMAT', original_files) | |
44 new_files = paste0('input_', 1:length(original_files), '_forward.FORMAT') | |
45 new_files | |
46 # rename files | |
47 file.copy(paste0('./forward_files_directory/', original_files), | |
48 paste0('./files_directory/', new_files)) | |
49 ``` | |
50 | |
51 ## Reverse inputs | |
52 | |
53 ```{r 'rename reverse files'} | |
54 # create directory | |
55 dir.create('./reverse_files_directory') | |
56 # get full paths of original files | |
57 from_files = strsplit("REVERSE_FILE_LIST", ',')[[1]] | |
58 # copy files to reverse_files_directory. | |
59 file.copy(from_files, './reverse_files_directory') | |
60 # get original file names | |
61 original_files = list.files('./reverse_files_directory') | |
62 # create new files names from original file names | |
63 new_files = gsub('\\.dat', '_reverse\\.FORMAT', original_files) | |
64 new_files = paste0('input_', 1:length(original_files), '_reverse.FORMAT') | |
65 new_files | |
66 # rename files | |
67 file.copy(paste0('./reverse_files_directory/', original_files), | |
68 paste0('./files_directory/', new_files)) | |
69 ``` | |
70 |