Mercurial > repos > mingchen0919 > rmarkdown_mirdeep2
comparison mirdeep2_mapper.Rmd @ 0:963905bcb754 draft
planemo upload for repository https://github.com/statonlab/docker-GRReport/tree/master/my_tools/rmarkdown_mirdeep2 commit 29e8b40899c71ca12fd07b2bb530b0ee65037588-dirty
author | mingchen0919 |
---|---|
date | Tue, 08 Aug 2017 13:14:41 -0400 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
-1:000000000000 | 0:963905bcb754 |
---|---|
1 --- | |
2 title: 'Mirdeep2 Mapper' | |
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 # Job command line | |
18 | |
19 ## View arguments from command line. | |
20 | |
21 ```{r 'view arguments'} | |
22 str(opt) | |
23 ``` | |
24 | |
25 ```{r 'build PATH', echo=FALSE} | |
26 # set PATH environment. | |
27 PATH = system('pwd', intern = TRUE) %>% | |
28 (function(x) { | |
29 paste0('/home/galaxy/mirdeep2/bin:', x) | |
30 }) %>% | |
31 paste0(':$PATH') | |
32 ``` | |
33 | |
34 | |
35 ## Build job command line. | |
36 | |
37 ```{r 'build command line'} | |
38 command_line = paste0('export PATH=', PATH, ' && ') %>% | |
39 # index reference genome | |
40 paste0(' bowtie-build REFERENCE_GENOME ref_genome &&') %>% | |
41 paste0(' mapper.pl ') %>% | |
42 # reads | |
43 (function(x) { | |
44 paste0(x, 'FASTQ_READS -c ') | |
45 }) %>% | |
46 # reference genome | |
47 (function(x) { | |
48 paste0(x, '-p ref_genome ') | |
49 }) %>% | |
50 # # parse to fasta | |
51 # (function(x) { | |
52 # ifelse(PARSE_TO_FASTA, paste0(x, '-h '), x) | |
53 # }) %>% | |
54 # clean entries | |
55 (function(x) { | |
56 ifelse(CLEAN_ENTRIES, paste0(x, '-j '), x) | |
57 }) %>% | |
58 # clip 3 adapter | |
59 (function(x) { | |
60 ifelse('CLIP_3_ADAPTER' == '', x, paste0(x, '-k CLIP_3_ADAPTER ')) | |
61 }) %>% | |
62 # discard shorter reads | |
63 (function(x) { | |
64 paste0(x, '-l DISCARD_SHORTER_READS ') | |
65 }) %>% | |
66 # collapse reads | |
67 (function(x) { | |
68 # ifelse(COLLAPSE_READS, paste0(x, '-m '), x) | |
69 paste0(x, '-m ') | |
70 }) %>% | |
71 # map with one mismatch | |
72 (function(x) { | |
73 ifelse(MAP_WITH_ONE_MISMATCH, paste0(x, '-q '), x) | |
74 }) %>% | |
75 # map up to position | |
76 (function(x) { | |
77 paste0(x, '-r MAP_UP_TO_POSITION ') | |
78 }) %>% | |
79 # overwrite existing files(-n), outputs | |
80 (function(x) { | |
81 paste0(x, '-s reads_collapsed.fa -t reads_collapsed_vs_genome.arf -v -n ') | |
82 }) %>% | |
83 # write stdout to reprot.log | |
84 (function(x) { | |
85 paste0(x, ' 2>report.log') | |
86 }) | |
87 command_line | |
88 ``` | |
89 | |
90 ## Run command line | |
91 | |
92 ```{r} | |
93 system(command_line) | |
94 ``` | |
95 | |
96 |