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

About us

ecSeq is a bioinformatics solution provider with solid expertise in the analysis of high-throughput sequencing data. We can help you to get the most out of your sequencing experiments by developing data analysis strategies and expert consulting. We organize public workshops and conduct on-site trainings on NGS data analysis.

Last updated on May 06, 2013