Skip to content
Snippets Groups Projects
Verified Commit b150868b authored by nfontrod's avatar nfontrod
Browse files

modules/nf-core/custom/filterbam/main.nf: add new module

parent b607dc0e
No related branches found
No related tags found
No related merge requests found
process FILTER_PAIR {
tag "$meta1.id"
label 'process_high' //medium
conda "bioconda::samtools=1.17"
container "${ workflow.containerEngine == 'singularity' && !task.ext.singularity_pull_docker_container ?
'https://depot.galaxyproject.org/singularity/samtools:1.17--h00cdaf9_0' :
'quay.io/biocontainers/samtools:1.17--h00cdaf9_0' }"
input:
tuple val(meta1), path(bam1), val(meta2), path(bam2)
output:
tuple val(meta1), path("*_1paired.bam"), val(meta2), path("*_2paired.bam"), emit: bam
script:
"""
samtools view ${bam1} | cut -f1 | sort | uniq > names1.txt
samtools view ${bam2} | cut -f1 | sort | uniq > names2.txt
cat names1.txt names2.txt| sort | uniq -c | grep " 2" | sed "s/^ 2 //g" > common_reads.txt
samtools view -h -N common_reads.txt ${bam1} -O BAM > ${meta1.id}_1paired.bam
samtools view -h -N common_reads.txt ${bam2} -O BAM > ${meta2.id}_2paired.bam
"""
}
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment