BedTotalSize

From genomewiki
Revision as of 12:47, 11 August 2006 by Max (talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigationJump to search
#!/usr/bin/env python


from sys import *
import sys
from re import *

if len(argv)==2:
        print " Will read bed-style features from stdin"
        print " Will add all features-lengths together"
        print ""
        print " SYNTAX: "
        print " totalSize "
        exit() 



line = sys.stdin.readline()
sum = 0
while line!="":         
    fields = line.split()
    start = int(fields[1])
    stop = int(fields[2])
    sum += (stop-start+1)
    line = sys.stdin.readline()

print "Total length of all features: "+str(sum)