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