Skip to content

Commit

Permalink
fix: TagAlign extension
Browse files Browse the repository at this point in the history
  • Loading branch information
kelly-sovacool committed Sep 11, 2023
1 parent a4a5a83 commit 24af451
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions modules/local/qc.nf
Original file line number Diff line number Diff line change
Expand Up @@ -187,25 +187,25 @@ 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
"""

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
"""
}

Expand Down

0 comments on commit 24af451

Please sign in to comment.