view i_adhore_configure.Rmd @ 1:fd719a0a6b26 draft

planemo upload for repository https://github.com/statonlab/docker-GRReport/tree/master/my_tools/rmarkdown_i_adhore commit 29e8b40899c71ca12fd07b2bb530b0ee65037588-dirty
author mingchen0919
date Tue, 08 Aug 2017 12:59:51 -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)
```