How to simply extract certain filed from sam file
1
1
Entering edit mode
6.6 years ago
934963534 ▴ 20

Hello everyone.

I have a sam file and only want to keep the read name and the FLAG field. How can I make it with awk?(And I do not want to keep the header)

Thanks for your answer!

sam assembly samtools • 1.9k views
ADD COMMENT
2
Entering edit mode
6.6 years ago

How I'd do it:

samtools view mydata.bam | cut -f 1,2 > truncated.sam
ADD COMMENT
0
Entering edit mode

It works! Thanks a lot.

ADD REPLY
0
Entering edit mode

If an answer was helpful you should upvote it, if the answer resolved your question you should mark it as accepted.
Upvote|Bookmark|Accept

ADD REPLY
0
Entering edit mode

sorry to bother again but I wonder if there is a way to speed up this process since my sam file is 140G and it is running really slowly...

ADD REPLY

Login before adding your answer.

Traffic: 2079 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