Commit c6752c1a authored by Gael  MILLOT's avatar Gael MILLOT
Browse files

tempo: this version works but the duplicate rw insertion freq plot is not the good one

parent 2b750774
......@@ -343,7 +343,7 @@ fun_report(data = paste0("\n\n################################ RUNNING\n\n"), ou
################ Data import
obs.ini <- read.table(pos, stringsAsFactors = FALSE) # does not take the header
obs.ini <- read.table(pos, stringsAsFactors = FALSE) # no header
################ end Data import
......
......@@ -329,26 +329,29 @@ for(i0 in 1:length(freq)){
tempo <- read.table(freq[i0], sep = "\t", stringsAsFactors = TRUE)
row.names(tempo) <- tempo[, 1]
tempo <- as.matrix(tempo[, -1])
if(grepl(x = freq[i0], pattern = "LEADING_16|LAGGING_16")){
# equivalent to reverse - complement for contingency
row.names(tempo)[row.names(tempo) == "A"] <- "Tf"
row.names(tempo)[row.names(tempo) == "T"] <- "A"
row.names(tempo)[row.names(tempo) == "G"] <- "Cf"
row.names(tempo)[row.names(tempo) == "C"] <- "G"
row.names(tempo)[row.names(tempo) == "Tf"] <- "T"
row.names(tempo)[row.names(tempo) == "Cf"] <- "C"
tempo <- tempo[, ncol(tempo):1]
tempo <- tempo[order(row.names(tempo)), ]
tempo <- tempo[, 1:(ncol(tempo) - abs(decal))]
# end equivalent to reverse - complement for contingency
}else{
tempo <- tempo[order(row.names(tempo)), ]
tempo <- tempo[, (1 + abs(decal)):ncol(tempo)]
}
if(i0 == 1){
final <- tempo
}else{
final <- fun_mat_op(list(final, tempo))
if(ncol(tempo) > 1){ # some of the 4 files, like leading reverse, may not have any insertion sites
if(grepl(x = freq[i0], pattern = "LEADING_16|LAGGING_16")){
# equivalent to reverse - complement for contingency
row.names(tempo)[row.names(tempo) == "A"] <- "Tf"
row.names(tempo)[row.names(tempo) == "T"] <- "A"
row.names(tempo)[row.names(tempo) == "G"] <- "Cf"
row.names(tempo)[row.names(tempo) == "C"] <- "G"
row.names(tempo)[row.names(tempo) == "Tf"] <- "T"
row.names(tempo)[row.names(tempo) == "Cf"] <- "C"
tempo <- tempo[, ncol(tempo):1]
tempo <- tempo[order(row.names(tempo)), ]
tempo <- tempo[, 1:(ncol(tempo) - abs(decal))]
# end equivalent to reverse - complement for contingency
}else{
print(tempo)
tempo <- tempo[order(row.names(tempo)), ]
tempo <- tempo[, (1 + abs(decal)):ncol(tempo)]
}
if(i0 == 1){
final <- tempo
}else{
final <- fun_mat_op(list(final, tempo))
}
}
}
......@@ -382,7 +385,7 @@ title.text.size <- 5
angle <- 90
tempo.just <- fun_gg_just(angle = angle, pos = "bottom")
if(ncol(tempo) > 0){
if(ncol(final) > 0){
title <- "GLOBAL CONSENSUS (LEADING / LAGGING AND FORWARD / REVERSE OVERLAY USING POSITION 1"
gg1 = ggseqlogo::geom_logo(data = final, method = "bits", seq_type = "dna") # Derived from https://weblogo.berkeley.edu/logo.cgi because the website does not work
gg2 <- ggplot2::theme(
......
......@@ -637,7 +637,7 @@ process insertion { // section 24.7 of the labbook 20200707
file "${bam.baseName}.pos" into orient_ch1 // warning: 2 files (no duplication and duplications)
file "insertion_report.txt" into insertion_report_ch // warning: several files
file "report.rmd" optional true into log_ch15 // single file
// optional true: report.rmd send into a channel only the process that has generated a report.rmd. Of note, if("${bam}" == "${file_name}_q20_nodup.bam"){file "report.rmd" into log_ch15} does not work
// optional true: report.rmd sent into a channel only if the process has generated a report.rmd. Of note, if("${bam}" == "${file_name}_q20_nodup.bam"){file "report.rmd" into log_ch15} does not work
script:
"""
......@@ -677,7 +677,7 @@ insertion_report_ch.collectFile(name: "insertion_report.txt").subscribe{it -> it
process final_insertion_files { // 44.1 of the labbook 20201210. Also select the nb_max_insertion_sites most frequent sites in the duplicated file
label 'r_ext' // see the withLabel: bash in the nextflow config file
publishDir "${out_path}/files", mode: 'copy', pattern: "{*.pos,*.freq}", overwrite: false
cache 'true'
cache 'lenient'
input:
file pos from orient_ch1 // warning: 2 files
......@@ -690,7 +690,7 @@ process final_insertion_files { // 44.1 of the labbook 20201210. Also select the
file "${pos.baseName}.pos" into pos_ch // warning: 2 files
file "${pos.baseName}_annot.pos" into pos_annot_ch // warning: 2 files
file "${pos.baseName}_annot.freq" into freq_ch // warning: 2 files
file "final_insertion_files_report.txt" into final_insertion_files_report_ch // warning: several files
file "final_insertion_files_report.txt" into final_insertion_files_report_ch // warning: 2 files
script:
"""
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment