Question: (Closed) Quickest Way To Pull A List Of Reads Out Of A Bam File?
0
gravatar for David Quigley
6.3 years ago by
David Quigley11k
San Francisco
David Quigley11k wrote:

What is the quickest way find the final aligned locations of a list of reads in BAM file? I can call

samtools view my.bam | grep -e uniqueID1 -e uniqueID2 > output

to grep for uniqueID1 and uniqueID2 in my.bam, but crawling through the SAM is quite slow. I'd like to call:

handyTool extractID my.bam -l listOfIdentifiers > output

and get the SAM line for each identifier found in the BAM. Is there a better way?

next-gen samtools • 3.3k views
ADD COMMENTlink modified 6.3 years ago by Pierre Lindenbaum119k • written 6.3 years ago by David Quigley11k
1

I'm not sure if there's another tool, but you could always use

samtools view input.bam | grep -Ff listOfIdentifiers
ADD REPLYlink modified 6.3 years ago • written 6.3 years ago by brentp23k

As I have tried before, grep -f is extremely slow for this purpose.

ADD REPLYlink written 6.3 years ago by lh331k
0
gravatar for Pierre Lindenbaum
6.3 years ago by
France/Nantes/Institut du Thorax - INSERM UMR1087
Pierre Lindenbaum119k wrote:

duplicate of:

Extracting subsets of reads from a BAM file

ADD COMMENTlink written 6.3 years ago by Pierre Lindenbaum119k
Please log in to add an answer.
The thread is closed. No new answers may be added.

Help
Access

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.
Powered by Biostar version 2.3.0
Traffic: 1127 users visited in the last hour