@@ -0,0 +1,409 @@
+'''Creates BED file from SAM header.'''%0A%0Aimport sys%0A%0Aif __name__=='__main__':%0A    try:%0A        infile = open(sys.argv%5B1%5D)%0A    except:%0A        infile = sys.stdin%0A    for line in infile:%0A        if line.startswith('@SQ'):%0A            seqname, seqlen = line.split()%5B1:%5D%0A            seqname = seqname.split(':')%5B1%5D%0A            seqlen = int(seqlen.split(':')%5B1%5D)%0A            print '%25s%5Ct0%5Ct%25d' %25 (seqname, seqlen)%0A%0A

add header_to_bed.py