Hi
I would like to filter a bam file, keeping only reads overlapping with genomic intervals from a bed file. I used samtools for this:
samtools view -b -h -L bedfile.bed bamfile.bam
However the -L
option does not seem to take into account the strand information.
Do you know if there is another option or way to do it that would keep strand information?
Do all of the regions in the BED file have the same orientation? If not, you'll be better off with bedtools or bedops.
Some intervals in the bed files are +, others are -. With bed tools, I don't see an easy way to manipulate the bam file. The output I'm looking for is an alignment that I can visualize in IGV.
bedtools intersect will output a BAM file if you give it one as input. Just sort and index it and then load into IGV.