This is a test version of Biostars. For the public version, visit https://www.biostars.org.
recommended way of filtering out non-karyotype ref sequences and reads from a bam file?

What is the recommended way of filtering out the '@SQ' lines and the reads mapping to non-karyotypic sequences from a bam file?

At the moment I use a simple bash one-liner like the one below, but I presume there must be a cleaner way to do it with samtools/sambamba or some other tool.

```

samtools view -h -L $karyotype_bed $inputfile | grep -v decoy | grep -v HLA | grep -v _alt | grep -v chrUn | grep -v random | grep -v chrEBV | samtools view -bS - > $outfile

```

bam samtools sambamba

0 answers

No answers yet.

Log in to answer this question.