I ended up writing my own python script that filters lines in the SAM based on what chromosome they map to. So, your answer is best.
• 0 views
•
link
I created a sam file by aligning reads, using bwa. I want to create a new sam file that contains all reads except ones that are on a particular chromosome or have an alternative alignment on that chromosome.
How can I do it?
cat yoursam.sam | awk '{ if($3 != YourExcludedChrom) print $0 }'
That should do it.
EDIT: However, the alternate alignments to the excluded chromosome will still be in there. Sorry.
I ended up writing my own python script that filters lines in the SAM based on what chromosome they map to. So, your answer is best.
Log in to answer this question.