This is a test version of Biostars. For the public version, visit https://www.biostars.org.
Filtering SAM file based on column numbers

Hi!

I want to filter a sam file (produced by bowtie2) based on alignment score (column 14) >= 5000. I tried:

 awk '{ if($14 >= 5000) { print }}' input.sam > output.sam

However, this doesn't work as the values of my column are preceeded by "AS:i:" so it does not identify it as a number. I removed all my "AS:i:" from the file and then the previous command worked, of course, but now I am left out without the AS:i: preceeding the alignment score values. Does somebody have any suggestion on how to do this in a different way?

Thanks!

Elena

sam filter alignment

with this awk expression, the header is removed...

what is the column 14 ? because the alignment score (= MAPQ ?) is usually the 5th column.

0 answers

No answers yet.

Log in to answer this question.