Filtering SAM file based on column numbers
0
0
Entering edit mode
6.8 years ago
elena.syp • 0

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 • 1.5k views
ADD COMMENT
0
Entering edit mode

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

ADD REPLY
0
Entering edit mode

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

ADD REPLY
0
Entering edit mode

I assume the NM tag.

ADD REPLY
0
Entering edit mode
ADD REPLY

Login before adding your answer.

Traffic: 2910 users visited in the last hour
Help About
FAQ
Access RSS
API
Stats

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6