gravatar for Jorge Amigo

1 hour ago by

Santiago de Compostela, Spain

If you are looking for a particular read group, you can filter your bam file directly:

samtools view -br RGTAG file.bam > file.RGTAG.bam

If you're looking for a particular read name, parsing the bam file with grep is still a viable way to do it. You can try to optimize it though, if only 1 read is expected:

samtools view file.bam | grep -m1 queryname - > subset.sam

You can try to optimize it even more, if only 1 read is expected and you more or less know the region (say chr3:1000-2000 as an example) where the read could have been mapped:

samtools view file.bam chr3:1000-2000 | grep -m1 queryname - > subset.sam

If you are able to go for this last option, the results should be generated immediately.



Source link