diff --git a/modules/local/qc.nf b/modules/local/qc.nf index f622998e..93b2eef0 100644 --- a/modules/local/qc.nf +++ b/modules/local/qc.nf @@ -187,17 +187,17 @@ process DEDUPLICATE { tuple val(meta), path(bam), path(chrom_sizes) output: - tuple val(meta), path("${meta.id}.TagAlign.bed"), emit: tag_align + tuple val(meta), path("${meta.id}.TagAlign"), emit: tag_align tuple val(meta), path("${bam.baseName}.dedup.bam"), emit: bam tuple path("${bam.baseName}.dedup.bam.flagstat"), path("${bam.baseName}.dedup.bam.idxstat"), emit: flagstat script: """ - macs2 filterdup -i ${bam} -g ${params.align.effective_genome_size} --keep-dup="auto" -o TmpTagAlign1.bed - awk -F"\\t" -v OFS="\\t" '{{if (\$2>0 && \$3>0) {{print}}}}' TmpTagAlign1.bed > TmpTagAlign2.bed + macs2 filterdup -i ${bam} -g ${params.align.effective_genome_size} --keep-dup="auto" -o TmpTagAlign1 + awk -F"\\t" -v OFS="\\t" '{{if (\$2>0 && \$3>0) {{print}}}}' TmpTagAlign1 > TmpTagAlign2 awk -F"\\t" -v OFS="\\t" '{{print \$1,1,\$2}}' ${chrom_sizes} | sort -k1,1 -k2,2n > GenomeFile.bed - bedtools intersect -wa -f 1.0 -a TmpTagAlign2.bed -b GenomeFile.bed > ${meta.id}.TagAlign.bed - bedtools bedtobam -i ${meta.id}.TagAlign.bed -g ${chrom_sizes} | samtools sort -@ ${task.cpus} -o ${bam.baseName}.dedup.bam + bedtools intersect -wa -f 1.0 -a TmpTagAlign2 -b GenomeFile.bed > ${meta.id}.TagAlign + bedtools bedtobam -i ${meta.id}.TagAlign -g ${chrom_sizes} | samtools sort -@ ${task.cpus} -o ${bam.baseName}.dedup.bam samtools index ${bam.baseName}.dedup.bam samtools flagstat ${bam.baseName}.dedup.bam > ${bam.baseName}.dedup.bam.flagstat samtools idxstats ${bam.baseName}.dedup.bam > ${bam.baseName}.dedup.bam.idxstat @@ -205,7 +205,7 @@ process DEDUPLICATE { stub: """ - touch ${meta.id}.TagAlign.bed ${bam.baseName}.dedup.bam ${bam.baseName}.dedup.bam.flagstat ${bam.baseName}.dedup.bam.idxstat + touch ${meta.id}.TagAlign ${bam.baseName}.dedup.bam ${bam.baseName}.dedup.bam.flagstat ${bam.baseName}.dedup.bam.idxstat """ }