view i_adhore_configure.Rmd @ 3:45b64e04ab7d draft

planemo upload for repository https://github.com/statonlab/docker-GRReport/tree/master/my_tools/rmarkdown_i_adhore commit a23e23222252167ef7c3338a4872e84706df8f83-dirty
author mingchen0919
date Tue, 08 Aug 2017 14:33:23 -0400
parents 9755ce6ac4d5
children dab02b629d48
line wrap: on
line source

---
title: 'i-adhore: generate i-adhore config file'
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)
```

# Genomes and analysis files

```{r}
g_analysis_files_set = strsplit(opt$g_analysis_file, ';')[[1]]
g_analysis_files_list = list()
# for(i in g_analysis_files_set) {
#   genome = strsplit(i, ':')[[1]][1]
#   analysis_files = strsplit(i, ':')[[1]][2] %>% 
#                       strsplit(',') %>% `[[`(1) %>% 
#                       (function(x){
#                         paste0(1:length(x),' ', x)
#                       })
#   g_analysis_files_list[[genome]] = analysis_files
# }
for(i in g_analysis_files_set) {
  genome = strsplit(i, ':')[[1]][1]
  analysis_files = strsplit(i, ':')[[1]][2] %>% 
                      strsplit(',') %>% `[[`(1) %>% 
                      laply(.fun = function(x){
                        file_name = strsplit(x, '/')[[1]] %>% tail(1)
                        file_name = strsplit(file_name, '\\.')[[1]][1]
                        paste0(file_name, ' ', x)
                      })
  g_analysis_files_list[[genome]] = c(
    'name' = paste0('genome=', strsplit(i, ':')[[1]][1]),
    'analysis_files' = analysis_files
  )
  print(paste0('genome=', strsplit(i, ':')[[1]][1]))
  print(analysis_files)
}
```

# Other parameters

```{r}
params = c(
  'blast table' = opt$blast_table,
  'output_path' = opt$i_adhore_configure_dir,
  'gap_size' = opt$gap_size,
  'cluster_gap' = opt$cluster_gap,
  'q_value' = opt$q_value,
  'prob_cutoff' = opt$prob_cutoff,
  'anchor_points' = opt$anchor_points,
  'level_2_only' = opt$level2only,
  'table_type' = opt$table_type,
  'multi_hypothesis_correction' = opt$multi_hypothesis_correction
)

df = data.frame(name = names(params),
                value = params)
knitr::kable(df)
```


```{r echo=FALSE}
# generate i_adhore_configure.txt file
lines = c(unlist(g_analysis_files_list), 
          ' ', 
          paste0(df$name, '=', df$value), 
          'CompareAligners')
fileConn = file('I_ADHORE_CONFIGURE_TXT')
writeLines(lines, con = fileConn)
```