Skip to content
Snippets Groups Projects
Verified Commit 9912cc94 authored by Mia Croiset's avatar Mia Croiset
Browse files

try picard hicpro + delete temp bam sorted files

parent 88d6463e
Branches
No related tags found
No related merge requests found
......@@ -424,9 +424,5 @@ process {
ext.args = { [
"-n"
].join('').trim() }
publishDir = [
path: { "${params.outdir}/picard/bam" },
mode: 'copy'
]
}
}
......@@ -10,7 +10,7 @@
params {
// Choice of the workflow ('hicpro' or 'hicstuff')
workflow = 'hicstuff'
workflow = 'hicpro'
// Input options
input = null
......
......@@ -32,6 +32,7 @@ workflow FILTER_PCR_DUP {
)
SAMTOOLS_SORT_N.out.bam.set{ ch_bam }
if (params.workflow == "hicstuff"){
FILTER_PAIR(
ch_bam.combine(ch_bam)
.map {
......@@ -39,6 +40,11 @@ workflow FILTER_PCR_DUP {
meta1.id == meta2.id && meta1.chunk == meta2.chunk && meta1.mates == "R1" && meta2.mates == "R2" ? [ meta1, bam1, meta2, bam2 ] : null
})
FILTER_PAIR.out.bam.set{ new_ch_bam }
}
else{
ch_bam.set{ new_ch_bam }
}
emit:
bam = new_ch_bam
......
......@@ -12,6 +12,7 @@ include { MERGE_STATS } from '../../modules/local/hicpro/merge_stats'
include { HICPRO2PAIRS } from '../../modules/local/hicpro/hicpro2pairs'
include { BUILD_CONTACT_MAPS } from '../../modules/local/hicpro/build_contact_maps'
include { ICE_NORMALIZATION } from '../../modules/local/hicpro/run_ice'
include { FILTER_PCR_DUP } from './filter_pcr_dup'
// Remove meta.chunks
def removeChunks(row){
......@@ -44,7 +45,22 @@ workflow HICPRO {
ch_versions = ch_versions.mix(HICPRO_MAPPING.out.versions)
HICPRO_MAPPING.out.bam.set{ ch_bam }
ch_bam.view()
//***************************************
// FILTER PCR DUPLICATES
if (params.filter_pcr_picard && !params.keep_dups){
error "Error: cannot filter PCR duplicates with both methods! If filter_pcr_picard is true, keep_dups should be true too"
}
else if (params.filter_pcr_picard){
FILTER_PCR_DUP(
HICPRO_MAPPING.out.bam,
fasta,
index
)
FILTER_PCR_DUP.out.bam
.set {ch_bam}
}
//***************************************
// DIGESTION PROTOCOLS
......
......@@ -9,7 +9,6 @@ include { BOWTIE2_ALIGN as BOWTIE2_ALIGN_TRIMMED } from '../../modules/nf-core/b
include { MERGE_BOWTIE2 } from '../../modules/local/hicpro/bowtie2_merge'
include { COMBINE_MATES} from '../../modules/local/hicpro/combine_mates'
include { MAPPING_STATS_DNASE } from '../../modules/local/hicpro/dnase_mapping_stats'
include { FILTER_PCR_DUP } from './filter_pcr_dup'
// Paired-end to Single-end
def pairToSingle(row, mates) {
......@@ -31,12 +30,12 @@ def singleToPair(row){
return [ meta, row[1] ]
}
def singleToPairPCR(row){
/* def singleToPairPCR(row){
def meta = row[0].clone()
meta.remove('mates')
meta.single_end = false
return [ meta, [row[1], row[3]] ]
}
} */
workflow HICPRO_MAPPING {
......@@ -111,28 +110,7 @@ workflow HICPRO_MAPPING {
.set {ch_bams}
}
//***************************************
// FILTER PCR DUPLICATES
if (params.filter_pcr_picard && !params.keep_dups){
error "Error: cannot filter PCR duplicates with both methods! If filter_pcr_picard is true, keep_dups should be true too"
}
else if (params.filter_pcr_picard){
if (!params.dnase){
MERGE_BOWTIE2.out.bam.set{ch_2filter}
}
else{
BOWTIE2_ALIGN.out.bamx.set{ch_2filter}
}
FILTER_PCR_DUP(
ch_2filter,
fasta,
index
)
FILTER_PCR_DUP.out.bam
.map { singleToPairPCR(it) }
.set {ch_bams}
}
COMBINE_MATES (
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment