| 1 |
#!/usr/bin/env python |
| 2 |
# Must look in /usr/local/ir/bin on the Compaqs for the correct Python interpreter. |
| 3 |
# export PYTHONPATH=${PYTHONPATH}:$WORK/cds/IR/COMPASS/src/AtacPipeline |
| 4 |
|
| 5 |
""" |
| 6 |
Extensive documentation for the Python language is available at |
| 7 |
http://www.python.org. |
| 8 |
""" |
| 9 |
|
| 10 |
import os, sys, re, tempfile |
| 11 |
|
| 12 |
def main(glist): |
| 13 |
for inpname in glist: |
| 14 |
|
| 15 |
if(0): |
| 16 |
inpfile = open(inpname,'r') |
| 17 |
tmpname = tempfile.mktemp(".tmp") |
| 18 |
tmpfile = open(tmpname,'w') |
| 19 |
pattern = re.compile(r"^M [gl] ") |
| 20 |
for line in inpfile: |
| 21 |
if(pattern.search(line)): |
| 22 |
print >>tmpfile, line, |
| 23 |
tmpfile.close() |
| 24 |
os.system("celagram -c 7 -t 'gapped match lengths' %s" % (tmpname,)) |
| 25 |
|
| 26 |
if(0): |
| 27 |
inpfile = open(inpname,'r') |
| 28 |
tmpname = tempfile.mktemp(".tmp") |
| 29 |
tmpfile = open(tmpname,'w') |
| 30 |
pattern = re.compile(r"^M x ") |
| 31 |
for line in inpfile: |
| 32 |
if(pattern.search(line)): |
| 33 |
print >>tmpfile, line, |
| 34 |
tmpfile.close() |
| 35 |
os.system("celagram -c 7 -t 'exact match lengths' %s" % (tmpname,)) |
| 36 |
|
| 37 |
if(0): |
| 38 |
inpfile = open(inpname,'r') |
| 39 |
tmpname = tempfile.mktemp(".tmp") |
| 40 |
tmpfile = open(tmpname,'w') |
| 41 |
pattern = re.compile(r"^M u ") |
| 42 |
for line in inpfile: |
| 43 |
if(pattern.search(line)): |
| 44 |
print >>tmpfile, line, |
| 45 |
tmpfile.close() |
| 46 |
os.system("celagram -c 7 -t 'ungapped match lengths' %s" % (tmpname,)) |
| 47 |
|
| 48 |
inpfile = open(inpname,'r') |
| 49 |
tmpname = tempfile.mktemp(".tmp") |
| 50 |
tmpfile = open(tmpname,'w') |
| 51 |
# pattern = re.compile(r"^M\s*[xu]\s") |
| 52 |
pattern = re.compile(r"^M [xu] ") |
| 53 |
for line in inpfile: |
| 54 |
if(pattern.search(line)): |
| 55 |
print >>tmpfile, line, |
| 56 |
tmpfile.close() |
| 57 |
os.system("celagram -c 7 -t '%s ungapped match lengths' %s" % (inpname,tmpname)) |
| 58 |
|
| 59 |
|
| 60 |
inpfile = open(inpname,'r') |
| 61 |
tmpname = tempfile.mktemp(".tmp") |
| 62 |
tmpfile = open(tmpname,'w') |
| 63 |
pattern = re.compile(r"^M\s*r\s") |
| 64 |
for line in inpfile: |
| 65 |
if(pattern.search(line)): |
| 66 |
print >>tmpfile, line, |
| 67 |
tmpfile.close() |
| 68 |
os.system("celagram -c 7 -t '%s spans in 1st assembly' %s" % (inpname,tmpname)) |
| 69 |
os.system("celagram -c 11 -t '%s spans in 2nd assembly' %s" % (inpname,tmpname)) |
| 70 |
|
| 71 |
|
| 72 |
|
| 73 |
if __name__ == '__main__': |
| 74 |
#glist = [ "humR27vsB31-V2.atac", "humB31vsVAN-V1.atac", "humB31vsSC-V3.atac", ] |
| 75 |
|
| 76 |
main(sys.argv[1:]) |