Hello.
I have a question about Bam files. How can I extract the alignment of a specific named read from a Bam file? I did a search for Biostar and and found the following answer
Question: (Closed) Efficiently Extracting Reads With Specific Names ('Queryname') From .Bam File Efficiently Extracting Reads With Specific Names ('Queryname') From .Bam File
samtools view file.bam | grep queryname - > subset.sam
Yes. This is a simple and great answer, but since it's seven years old, I thought there might be a better way today. Is there a more efficient way to extract the Bam files? Especially when they are sorted by name?
(I would like to know how to extract by name and not by location.)
I would use
You're right. That should be faster and more precise.