Entering edit mode
9.1 years ago
14134125465346445
★
3.6k
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
```