Question: sam header is not recognized by awk?
0
gravatar for mosquitoes
6.0 years ago by
mosquitoes0
United States
mosquitoes0 wrote:

Why doesn't awk recognize the sam header? I match on ^@ and it will print to stdout but not to a file. It prints to stdout but never finishes.

 

awk '/^@/ {print}' filename

 

I can't make any sense of this.

 

Thanks!

awk samtools next-gen sequencing • 1.5k views
ADD COMMENTlink modified 6.0 years ago by John Marshall2.1k • written 6.0 years ago by mosquitoes0
2
awk '/^@/{print}!/^@/{exit}'
ADD REPLYlink modified 6.0 years ago • written 6.0 years ago by lh332k
1

what's  in filename ? a BAM ?

ADD REPLYlink written 6.0 years ago by Pierre Lindenbaum131k
3
gravatar for John Marshall
6.0 years ago by
John Marshall2.1k
Glasgow, Scotland
John Marshall2.1k wrote:

It prints to stdout but never finishes.

It's got perhaps several dozen headers to read through and print out, followed by perhaps several hundred million alignment records to read though. I'm sure it will finish if you wait long enough!

Perhaps you should consider samtools view -H or similar.

ADD COMMENTlink written 6.0 years ago by John Marshall2.1k
0
gravatar for Zhilong Jia
6.0 years ago by
Zhilong Jia1.6k
London
Zhilong Jia1.6k wrote:

For file 1.t:

    @HD VN:1.5 SO:coordinate
    @SQ SN:ref LN:45
    r001 99 ref 7 30 8M2I4M1D3M = 37 39 TTAGATAAAGGATACTG *

awk '/^@/ {print}' 1.t > 2.t

And 2.t will get the output. It works in mawk and gawk.

 

ADD COMMENTlink written 6.0 years ago by Zhilong Jia1.6k
Please log in to add an answer.

Help
Access

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.
Powered by Biostar version 2.3.0
Traffic: 2082 users visited in the last hour