This is a test version of Biostars. For the public version, visit https://www.biostars.org.
how to extract the sense and antisene bam files from the single end mapping bam file?

Dear all,

I have one bam file produced from single end RNAseq reads using Gsnap. I want to extract the separated bam files for sense and antisense reads only.

I know that the samtools could use to extract them by flag for pair ens read bam file. But what's the flag number for single end reads bam file? what's the commands for single end bam file?

Or what other tools could be used to extract the sense and antisense reads bam file from one total bam file?

Thanks!

ZQ

rna-seq

1 answer

It's the same flag: use -f 16 or -F 16 to include/exclude the reads on the reverse strand

If you want to split the file according to the strand, you should follow Pierre's answer.

If you want to have the sense/antisense reads according to the transcripts' orientation, you should use for instance intersectBed with the -s and -S options.

to add to the discussion a decade later :)

intersectBed -a genes.gff -b input.bam  -s  >  sense.bam
intersectBed -a genes.gff -b input.bam  -S  >  antisense.bam

where input.bam is your input file and genes.gff is the annotation file of the genes for which you want to extract the sense and antisense.

sense and antisene for reads in BAM files is not the same as positive/negative strand for genes.

Thanks. I will do your suggestion to try. if I have problem, I will post here. Cheers!

Log in to answer this question.