Fastest way to use pysam view in order to get the reads in different regions
0
1
Entering edit mode
2.8 years ago
MarVi ▴ 30

Dear all,

I am trying to retrieve all reads in several different regions for several bam files. I am writing my code in python, using the pysam library as follows,

pysam.view("-F0X100", bam_file, region_to_query)

Everything works, but I am concerned about the time it takes to process each bam file. It seems that the I/O takes a long time since I am querying each region at a time.

Would you have any suggestions on how I can speed up the querying of each bam file?

pysam_view samtools pysam bam optimisation • 1.2k views
ADD COMMENT
0
Entering edit mode

Have you tried "bedtools intersect"? I guess you can easily intersect each bam file with the bed file (regions) in parallel by bedtools, then merge the output bam files finally.

ADD REPLY

Login before adding your answer.

Traffic: 2530 users visited in the last hour
Help About
FAQ
Access RSS
API
Stats

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6