I have paired-end sequencing reads and two ends of a read may not come from the same region. I want to extract those that have at least one end mapping on a certain region of the genome.
I have found the following command. But it seems that this command does not extract the read whose one end falls within the region while the other one does not.
samtools view input.bam "Chr10:18000-45500" > output.bam
I think
bedtools pairtobed
can do what you want.liorglic pairtobed uses a 6 column bed because I am getting an error with a 3 col bed. I even tried creating a 6 col bed adding
.
however that does not work. Any clues ?