Extract a list of specific read IDs from a bam file

Assume you have a list of specific reads you would like to extract from an alignment file. You have the ID of these reads in a file called IDs.txt . A fast way to this is to use the tool fgrep.
samtools view file.bam | fgrep -w -f IDs.txt


Receive updates about NGS articles and trainings

Share this article



Last updated on May 06, 2013

ecSeq is a bioinformatics solution provider with solid expertise in the analysis of high-throughput sequencing data. We organize public workshops and conduct on-site trainings on NGS data analysis.

Would you like to receive updates about our NGS trainings and solutions? Then sign-up for our newsletter