Charlie -
What's faster is to sort the .bam file by query name AND sort your
target list by query name, then write a perl or awk script to do the
selection. This way, perl is only looking for one target query name
at a time. Because both lists are sorted, perl knows when the .bam
file has gone past the current target and it needs to switch to the
next target. I've done this in other contexts, but never for a .bam
file. Don't know whether someone has this implemented already.
- tom blackwell -
On Mon, 18 Aug 2014, csoeder wrote:
> Hi! I would like to query a sam/bam file by its qname field. Can this be done
> with samtools? I haven't seen anything like it in the documentation. I've
> tried
>
> grep -f qnames.list reads.sam > output.out
>
> but it's unworkably slow.
>
> Thanks!
> Charlie
>
>
> ------------------------------------------------------------------------------
> _______________________________________________
> Samtools-help mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/samtools-help
>
------------------------------------------------------------------------------
_______________________________________________
Samtools-help mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/samtools-help