This is a test version of Biostars. For the public version, visit https://www.biostars.org.
mapped paired end reads extraction from .bam file

Hi there,

I am working on a project where I have bam file after alignment to reference genome. Now I want to filter out the mapped reads separately(forward and reverse read files) in fastq format. I have tried many commands but it shows the same reads in forward and reverse file. and I am unable to go ahead with the assembly step.

Please can anyone help me. Thanks

samtools

1 answer

samtools collate -f --threads 4 -O -u --no-PG --reference "ref.fa" "in.bam" TMP/tmp.collate |\
samtools fastq -N --threads 1 -1 TMP/jeter.R1.fq.gz -2 TMP/jeter.R2.fq.gz -s /dev/null -0 /dev/null -n

Log in to answer this question.