-
Notifications
You must be signed in to change notification settings - Fork 42
/
Copy pathbatchTcoffee.py
executable file
·45 lines (43 loc) · 1.46 KB
/
batchTcoffee.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#from __future__ import division, with_statement
'''
Copyright 2010, 陈同 ([email protected]).
Please see the license file for legal information.
===========================================================
'''
__author__ = 'chentong & ct586[9]'
__author_email__ = '[email protected]'
#=========================================================
import sys
import os
from ctIO import readRep
def main():
print >>sys.stderr, "Print the result to screen"
if len(sys.argv) != 2:
print >>sys.stderr, 'Using python %s repfile' % sys.argv[0]
sys.exit(0)
#------------------------------------------------------
repdict = {}
readRep(sys.argv[1], repdict)
for id, valueL in repdict.items():
i = 0
for seqDict in valueL:
filename = id + str(i) + '.fasta'
fh = open(filename, 'w')
seqDictK = seqDict.keys()
seqDictK.sort()
output = ''
for key in seqDictK:
output += ''.join(('>pos', str(key[0]), '-', str(key[1])\
, '\n', seqDict[key], '\n'))
#--------------------------------------------
print >>fh, output,
fh.close()
cmd = 't_coffee ' + filename
i += 1
os.system(cmd)
#---------------End one id--------------
#--------End all id-------------------------
if __name__ == '__main__':
main()