annotate fasta-dinucleotide-shuffle.py @ 11:b7f1d9f8f3bc

Uploaded
author xuebing
date Sat, 10 Mar 2012 07:59:27 -0500
parents
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
11
b7f1d9f8f3bc Uploaded
xuebing
parents:
diff changeset
1 #!/usr/bin/python
b7f1d9f8f3bc Uploaded
xuebing
parents:
diff changeset
2
b7f1d9f8f3bc Uploaded
xuebing
parents:
diff changeset
3 import sys, string, random
b7f1d9f8f3bc Uploaded
xuebing
parents:
diff changeset
4 import sequence
b7f1d9f8f3bc Uploaded
xuebing
parents:
diff changeset
5
b7f1d9f8f3bc Uploaded
xuebing
parents:
diff changeset
6 #
b7f1d9f8f3bc Uploaded
xuebing
parents:
diff changeset
7 # turn on psyco to speed up by 3X
b7f1d9f8f3bc Uploaded
xuebing
parents:
diff changeset
8 #
b7f1d9f8f3bc Uploaded
xuebing
parents:
diff changeset
9 if __name__=='__main__':
b7f1d9f8f3bc Uploaded
xuebing
parents:
diff changeset
10 try:
b7f1d9f8f3bc Uploaded
xuebing
parents:
diff changeset
11 import psyco
b7f1d9f8f3bc Uploaded
xuebing
parents:
diff changeset
12 #psyco.log()
b7f1d9f8f3bc Uploaded
xuebing
parents:
diff changeset
13 psyco.full()
b7f1d9f8f3bc Uploaded
xuebing
parents:
diff changeset
14 psyco_found = True
b7f1d9f8f3bc Uploaded
xuebing
parents:
diff changeset
15 except ImportError:
b7f1d9f8f3bc Uploaded
xuebing
parents:
diff changeset
16 # psyco_found = False
b7f1d9f8f3bc Uploaded
xuebing
parents:
diff changeset
17 pass
b7f1d9f8f3bc Uploaded
xuebing
parents:
diff changeset
18 # print >> sys.stderr, "psyco_found", psyco_found
b7f1d9f8f3bc Uploaded
xuebing
parents:
diff changeset
19
b7f1d9f8f3bc Uploaded
xuebing
parents:
diff changeset
20
b7f1d9f8f3bc Uploaded
xuebing
parents:
diff changeset
21 # altschulEriksonDinuclShuffle.py
b7f1d9f8f3bc Uploaded
xuebing
parents:
diff changeset
22 # P. Clote, Oct 2003
b7f1d9f8f3bc Uploaded
xuebing
parents:
diff changeset
23
b7f1d9f8f3bc Uploaded
xuebing
parents:
diff changeset
24 def computeCountAndLists(s):
b7f1d9f8f3bc Uploaded
xuebing
parents:
diff changeset
25
b7f1d9f8f3bc Uploaded
xuebing
parents:
diff changeset
26 #Initialize lists and mono- and dinucleotide dictionaries
b7f1d9f8f3bc Uploaded
xuebing
parents:
diff changeset
27 List = {} #List is a dictionary of lists
b7f1d9f8f3bc Uploaded
xuebing
parents:
diff changeset
28 List['A'] = []; List['C'] = [];
b7f1d9f8f3bc Uploaded
xuebing
parents:
diff changeset
29 List['G'] = []; List['T'] = [];
b7f1d9f8f3bc Uploaded
xuebing
parents:
diff changeset
30 # FIXME: is this ok?
b7f1d9f8f3bc Uploaded
xuebing
parents:
diff changeset
31 List['N'] = []
b7f1d9f8f3bc Uploaded
xuebing
parents:
diff changeset
32 nuclList = ["A","C","G","T","N"]
b7f1d9f8f3bc Uploaded
xuebing
parents:
diff changeset
33 s = s.upper()
b7f1d9f8f3bc Uploaded
xuebing
parents:
diff changeset
34 #s = s.replace("U","T")
b7f1d9f8f3bc Uploaded
xuebing
parents:
diff changeset
35 nuclCnt = {} #empty dictionary
b7f1d9f8f3bc Uploaded
xuebing
parents:
diff changeset
36 dinuclCnt = {} #empty dictionary
b7f1d9f8f3bc Uploaded
xuebing
parents:
diff changeset
37 for x in nuclList:
b7f1d9f8f3bc Uploaded
xuebing
parents:
diff changeset
38 nuclCnt[x]=0
b7f1d9f8f3bc Uploaded
xuebing
parents:
diff changeset
39 dinuclCnt[x]={}
b7f1d9f8f3bc Uploaded
xuebing
parents:
diff changeset
40 for y in nuclList:
b7f1d9f8f3bc Uploaded
xuebing
parents:
diff changeset
41 dinuclCnt[x][y]=0
b7f1d9f8f3bc Uploaded
xuebing
parents:
diff changeset
42
b7f1d9f8f3bc Uploaded
xuebing
parents:
diff changeset
43 #Compute count and lists
b7f1d9f8f3bc Uploaded
xuebing
parents:
diff changeset
44 nuclCnt[s[0]] = 1
b7f1d9f8f3bc Uploaded
xuebing
parents:
diff changeset
45 nuclTotal = 1
b7f1d9f8f3bc Uploaded
xuebing
parents:
diff changeset
46 dinuclTotal = 0
b7f1d9f8f3bc Uploaded
xuebing
parents:
diff changeset
47 for i in range(len(s)-1):
b7f1d9f8f3bc Uploaded
xuebing
parents:
diff changeset
48 x = s[i]; y = s[i+1]
b7f1d9f8f3bc Uploaded
xuebing
parents:
diff changeset
49 List[x].append( y )
b7f1d9f8f3bc Uploaded
xuebing
parents:
diff changeset
50 nuclCnt[y] += 1; nuclTotal += 1
b7f1d9f8f3bc Uploaded
xuebing
parents:
diff changeset
51 dinuclCnt[x][y] += 1; dinuclTotal += 1
b7f1d9f8f3bc Uploaded
xuebing
parents:
diff changeset
52 assert (nuclTotal==len(s))
b7f1d9f8f3bc Uploaded
xuebing
parents:
diff changeset
53 assert (dinuclTotal==len(s)-1)
b7f1d9f8f3bc Uploaded
xuebing
parents:
diff changeset
54 return nuclCnt,dinuclCnt,List
b7f1d9f8f3bc Uploaded
xuebing
parents:
diff changeset
55
b7f1d9f8f3bc Uploaded
xuebing
parents:
diff changeset
56
b7f1d9f8f3bc Uploaded
xuebing
parents:
diff changeset
57 def chooseEdge(x,dinuclCnt):
b7f1d9f8f3bc Uploaded
xuebing
parents:
diff changeset
58 z = random.random()
b7f1d9f8f3bc Uploaded
xuebing
parents:
diff changeset
59 denom=dinuclCnt[x]['A']+dinuclCnt[x]['C']+dinuclCnt[x]['G']+dinuclCnt[x]['T']+dinuclCnt[x]['N']
b7f1d9f8f3bc Uploaded
xuebing
parents:
diff changeset
60 numerator = dinuclCnt[x]['A']
b7f1d9f8f3bc Uploaded
xuebing
parents:
diff changeset
61 if z < float(numerator)/float(denom):
b7f1d9f8f3bc Uploaded
xuebing
parents:
diff changeset
62 dinuclCnt[x]['A'] -= 1
b7f1d9f8f3bc Uploaded
xuebing
parents:
diff changeset
63 return 'A'
b7f1d9f8f3bc Uploaded
xuebing
parents:
diff changeset
64 numerator += dinuclCnt[x]['C']
b7f1d9f8f3bc Uploaded
xuebing
parents:
diff changeset
65 if z < float(numerator)/float(denom):
b7f1d9f8f3bc Uploaded
xuebing
parents:
diff changeset
66 dinuclCnt[x]['C'] -= 1
b7f1d9f8f3bc Uploaded
xuebing
parents:
diff changeset
67 return 'C'
b7f1d9f8f3bc Uploaded
xuebing
parents:
diff changeset
68 numerator += dinuclCnt[x]['G']
b7f1d9f8f3bc Uploaded
xuebing
parents:
diff changeset
69 if z < float(numerator)/float(denom):
b7f1d9f8f3bc Uploaded
xuebing
parents:
diff changeset
70 dinuclCnt[x]['G'] -= 1
b7f1d9f8f3bc Uploaded
xuebing
parents:
diff changeset
71 return 'G'
b7f1d9f8f3bc Uploaded
xuebing
parents:
diff changeset
72 numerator += dinuclCnt[x]['T']
b7f1d9f8f3bc Uploaded
xuebing
parents:
diff changeset
73 if z < float(numerator)/float(denom):
b7f1d9f8f3bc Uploaded
xuebing
parents:
diff changeset
74 dinuclCnt[x]['T'] -= 1
b7f1d9f8f3bc Uploaded
xuebing
parents:
diff changeset
75 return 'T'
b7f1d9f8f3bc Uploaded
xuebing
parents:
diff changeset
76 dinuclCnt[x]['N'] -= 1
b7f1d9f8f3bc Uploaded
xuebing
parents:
diff changeset
77 return 'N'
b7f1d9f8f3bc Uploaded
xuebing
parents:
diff changeset
78
b7f1d9f8f3bc Uploaded
xuebing
parents:
diff changeset
79 def connectedToLast(edgeList,nuclList,lastCh):
b7f1d9f8f3bc Uploaded
xuebing
parents:
diff changeset
80 D = {}
b7f1d9f8f3bc Uploaded
xuebing
parents:
diff changeset
81 for x in nuclList: D[x]=0
b7f1d9f8f3bc Uploaded
xuebing
parents:
diff changeset
82 for edge in edgeList:
b7f1d9f8f3bc Uploaded
xuebing
parents:
diff changeset
83 a = edge[0]; b = edge[1]
b7f1d9f8f3bc Uploaded
xuebing
parents:
diff changeset
84 if b==lastCh: D[a]=1
b7f1d9f8f3bc Uploaded
xuebing
parents:
diff changeset
85 for i in range(3):
b7f1d9f8f3bc Uploaded
xuebing
parents:
diff changeset
86 for edge in edgeList:
b7f1d9f8f3bc Uploaded
xuebing
parents:
diff changeset
87 a = edge[0]; b = edge[1]
b7f1d9f8f3bc Uploaded
xuebing
parents:
diff changeset
88 if D[b]==1: D[a]=1
b7f1d9f8f3bc Uploaded
xuebing
parents:
diff changeset
89 ok = 0
b7f1d9f8f3bc Uploaded
xuebing
parents:
diff changeset
90 for x in nuclList:
b7f1d9f8f3bc Uploaded
xuebing
parents:
diff changeset
91 if x!=lastCh and D[x]==0: return 0
b7f1d9f8f3bc Uploaded
xuebing
parents:
diff changeset
92 return 1
b7f1d9f8f3bc Uploaded
xuebing
parents:
diff changeset
93
b7f1d9f8f3bc Uploaded
xuebing
parents:
diff changeset
94 def eulerian(s):
b7f1d9f8f3bc Uploaded
xuebing
parents:
diff changeset
95 nuclCnt,dinuclCnt,List = computeCountAndLists(s)
b7f1d9f8f3bc Uploaded
xuebing
parents:
diff changeset
96 #compute nucleotides appearing in s
b7f1d9f8f3bc Uploaded
xuebing
parents:
diff changeset
97 nuclList = []
b7f1d9f8f3bc Uploaded
xuebing
parents:
diff changeset
98 for x in ["A","C","G","T","N"]:
b7f1d9f8f3bc Uploaded
xuebing
parents:
diff changeset
99 if x in s: nuclList.append(x)
b7f1d9f8f3bc Uploaded
xuebing
parents:
diff changeset
100 #create dinucleotide shuffle L
b7f1d9f8f3bc Uploaded
xuebing
parents:
diff changeset
101 firstCh = s[0] #start with first letter of s
b7f1d9f8f3bc Uploaded
xuebing
parents:
diff changeset
102 lastCh = s[-1]
b7f1d9f8f3bc Uploaded
xuebing
parents:
diff changeset
103 edgeList = []
b7f1d9f8f3bc Uploaded
xuebing
parents:
diff changeset
104 for x in nuclList:
b7f1d9f8f3bc Uploaded
xuebing
parents:
diff changeset
105 if x!= lastCh: edgeList.append( [x,chooseEdge(x,dinuclCnt)] )
b7f1d9f8f3bc Uploaded
xuebing
parents:
diff changeset
106 ok = connectedToLast(edgeList,nuclList,lastCh)
b7f1d9f8f3bc Uploaded
xuebing
parents:
diff changeset
107 return ok,edgeList,nuclList,lastCh
b7f1d9f8f3bc Uploaded
xuebing
parents:
diff changeset
108
b7f1d9f8f3bc Uploaded
xuebing
parents:
diff changeset
109
b7f1d9f8f3bc Uploaded
xuebing
parents:
diff changeset
110 def shuffleEdgeList(L):
b7f1d9f8f3bc Uploaded
xuebing
parents:
diff changeset
111 n = len(L); barrier = n
b7f1d9f8f3bc Uploaded
xuebing
parents:
diff changeset
112 for i in range(n-1):
b7f1d9f8f3bc Uploaded
xuebing
parents:
diff changeset
113 z = int(random.random() * barrier)
b7f1d9f8f3bc Uploaded
xuebing
parents:
diff changeset
114 tmp = L[z]
b7f1d9f8f3bc Uploaded
xuebing
parents:
diff changeset
115 L[z]= L[barrier-1]
b7f1d9f8f3bc Uploaded
xuebing
parents:
diff changeset
116 L[barrier-1] = tmp
b7f1d9f8f3bc Uploaded
xuebing
parents:
diff changeset
117 barrier -= 1
b7f1d9f8f3bc Uploaded
xuebing
parents:
diff changeset
118 return L
b7f1d9f8f3bc Uploaded
xuebing
parents:
diff changeset
119
b7f1d9f8f3bc Uploaded
xuebing
parents:
diff changeset
120 def dinuclShuffle(s):
b7f1d9f8f3bc Uploaded
xuebing
parents:
diff changeset
121 ok = 0
b7f1d9f8f3bc Uploaded
xuebing
parents:
diff changeset
122 while not ok:
b7f1d9f8f3bc Uploaded
xuebing
parents:
diff changeset
123 ok,edgeList,nuclList,lastCh = eulerian(s)
b7f1d9f8f3bc Uploaded
xuebing
parents:
diff changeset
124 nuclCnt,dinuclCnt,List = computeCountAndLists(s)
b7f1d9f8f3bc Uploaded
xuebing
parents:
diff changeset
125
b7f1d9f8f3bc Uploaded
xuebing
parents:
diff changeset
126 #remove last edges from each vertex list, shuffle, then add back
b7f1d9f8f3bc Uploaded
xuebing
parents:
diff changeset
127 #the removed edges at end of vertex lists.
b7f1d9f8f3bc Uploaded
xuebing
parents:
diff changeset
128 for [x,y] in edgeList: List[x].remove(y)
b7f1d9f8f3bc Uploaded
xuebing
parents:
diff changeset
129 for x in nuclList: shuffleEdgeList(List[x])
b7f1d9f8f3bc Uploaded
xuebing
parents:
diff changeset
130 for [x,y] in edgeList: List[x].append(y)
b7f1d9f8f3bc Uploaded
xuebing
parents:
diff changeset
131
b7f1d9f8f3bc Uploaded
xuebing
parents:
diff changeset
132 #construct the eulerian path
b7f1d9f8f3bc Uploaded
xuebing
parents:
diff changeset
133 L = [s[0]]; prevCh = s[0]
b7f1d9f8f3bc Uploaded
xuebing
parents:
diff changeset
134 for i in range(len(s)-2):
b7f1d9f8f3bc Uploaded
xuebing
parents:
diff changeset
135 ch = List[prevCh][0]
b7f1d9f8f3bc Uploaded
xuebing
parents:
diff changeset
136 L.append( ch )
b7f1d9f8f3bc Uploaded
xuebing
parents:
diff changeset
137 del List[prevCh][0]
b7f1d9f8f3bc Uploaded
xuebing
parents:
diff changeset
138 prevCh = ch
b7f1d9f8f3bc Uploaded
xuebing
parents:
diff changeset
139 L.append(s[-1])
b7f1d9f8f3bc Uploaded
xuebing
parents:
diff changeset
140 t = string.join(L,"")
b7f1d9f8f3bc Uploaded
xuebing
parents:
diff changeset
141 return t
b7f1d9f8f3bc Uploaded
xuebing
parents:
diff changeset
142
b7f1d9f8f3bc Uploaded
xuebing
parents:
diff changeset
143 def main():
b7f1d9f8f3bc Uploaded
xuebing
parents:
diff changeset
144
b7f1d9f8f3bc Uploaded
xuebing
parents:
diff changeset
145 #
b7f1d9f8f3bc Uploaded
xuebing
parents:
diff changeset
146 # defaults
b7f1d9f8f3bc Uploaded
xuebing
parents:
diff changeset
147 #
b7f1d9f8f3bc Uploaded
xuebing
parents:
diff changeset
148 file_name = None
b7f1d9f8f3bc Uploaded
xuebing
parents:
diff changeset
149 seed = 1
b7f1d9f8f3bc Uploaded
xuebing
parents:
diff changeset
150 copies = 1
b7f1d9f8f3bc Uploaded
xuebing
parents:
diff changeset
151
b7f1d9f8f3bc Uploaded
xuebing
parents:
diff changeset
152 #
b7f1d9f8f3bc Uploaded
xuebing
parents:
diff changeset
153 # get command line arguments
b7f1d9f8f3bc Uploaded
xuebing
parents:
diff changeset
154 #
b7f1d9f8f3bc Uploaded
xuebing
parents:
diff changeset
155 usage = """USAGE:
b7f1d9f8f3bc Uploaded
xuebing
parents:
diff changeset
156 %s [options]
b7f1d9f8f3bc Uploaded
xuebing
parents:
diff changeset
157
b7f1d9f8f3bc Uploaded
xuebing
parents:
diff changeset
158 -f <filename> file name (required)
b7f1d9f8f3bc Uploaded
xuebing
parents:
diff changeset
159 -t <tag> added to shuffled sequence names
b7f1d9f8f3bc Uploaded
xuebing
parents:
diff changeset
160 -s <seed> random seed; default: %d
b7f1d9f8f3bc Uploaded
xuebing
parents:
diff changeset
161 -c <n> make <n> shuffled copies of each sequence; default: %d
b7f1d9f8f3bc Uploaded
xuebing
parents:
diff changeset
162 -h print this usage message
b7f1d9f8f3bc Uploaded
xuebing
parents:
diff changeset
163 """ % (sys.argv[0], seed, copies)
b7f1d9f8f3bc Uploaded
xuebing
parents:
diff changeset
164
b7f1d9f8f3bc Uploaded
xuebing
parents:
diff changeset
165 # no arguments: print usage
b7f1d9f8f3bc Uploaded
xuebing
parents:
diff changeset
166 if len(sys.argv) == 1:
b7f1d9f8f3bc Uploaded
xuebing
parents:
diff changeset
167 print >> sys.stderr, usage; sys.exit(1)
b7f1d9f8f3bc Uploaded
xuebing
parents:
diff changeset
168
b7f1d9f8f3bc Uploaded
xuebing
parents:
diff changeset
169 tag = "";
b7f1d9f8f3bc Uploaded
xuebing
parents:
diff changeset
170
b7f1d9f8f3bc Uploaded
xuebing
parents:
diff changeset
171 # parse command line
b7f1d9f8f3bc Uploaded
xuebing
parents:
diff changeset
172 i = 1
b7f1d9f8f3bc Uploaded
xuebing
parents:
diff changeset
173 while i < len(sys.argv):
b7f1d9f8f3bc Uploaded
xuebing
parents:
diff changeset
174 arg = sys.argv[i]
b7f1d9f8f3bc Uploaded
xuebing
parents:
diff changeset
175 if (arg == "-f"):
b7f1d9f8f3bc Uploaded
xuebing
parents:
diff changeset
176 i += 1
b7f1d9f8f3bc Uploaded
xuebing
parents:
diff changeset
177 try: file_name = sys.argv[i]
b7f1d9f8f3bc Uploaded
xuebing
parents:
diff changeset
178 except: print >> sys.stderr, usage; sys.exit(1)
b7f1d9f8f3bc Uploaded
xuebing
parents:
diff changeset
179 elif (arg == "-t"):
b7f1d9f8f3bc Uploaded
xuebing
parents:
diff changeset
180 i += 1
b7f1d9f8f3bc Uploaded
xuebing
parents:
diff changeset
181 try: tag = sys.argv[i]
b7f1d9f8f3bc Uploaded
xuebing
parents:
diff changeset
182 except: print >> sys.stderr, usage; sys.exit(1)
b7f1d9f8f3bc Uploaded
xuebing
parents:
diff changeset
183 elif (arg == "-s"):
b7f1d9f8f3bc Uploaded
xuebing
parents:
diff changeset
184 i += 1
b7f1d9f8f3bc Uploaded
xuebing
parents:
diff changeset
185 try: seed = string.atoi(sys.argv[i])
b7f1d9f8f3bc Uploaded
xuebing
parents:
diff changeset
186 except: print >> sys.stderr, usage; sys.exit(1)
b7f1d9f8f3bc Uploaded
xuebing
parents:
diff changeset
187 elif (arg == "-c"):
b7f1d9f8f3bc Uploaded
xuebing
parents:
diff changeset
188 i += 1
b7f1d9f8f3bc Uploaded
xuebing
parents:
diff changeset
189 try: copies = string.atoi(sys.argv[i])
b7f1d9f8f3bc Uploaded
xuebing
parents:
diff changeset
190 except: print >> sys.stderr, usage; sys.exit(1)
b7f1d9f8f3bc Uploaded
xuebing
parents:
diff changeset
191 elif (arg == "-h"):
b7f1d9f8f3bc Uploaded
xuebing
parents:
diff changeset
192 print >> sys.stderr, usage; sys.exit(1)
b7f1d9f8f3bc Uploaded
xuebing
parents:
diff changeset
193 else:
b7f1d9f8f3bc Uploaded
xuebing
parents:
diff changeset
194 print >> sys.stderr, "Unknown command line argument: " + arg
b7f1d9f8f3bc Uploaded
xuebing
parents:
diff changeset
195 sys.exit(1)
b7f1d9f8f3bc Uploaded
xuebing
parents:
diff changeset
196 i += 1
b7f1d9f8f3bc Uploaded
xuebing
parents:
diff changeset
197
b7f1d9f8f3bc Uploaded
xuebing
parents:
diff changeset
198 # check that required arguments given
b7f1d9f8f3bc Uploaded
xuebing
parents:
diff changeset
199 if (file_name == None):
b7f1d9f8f3bc Uploaded
xuebing
parents:
diff changeset
200 print >> sys.stderr, usage; sys.exit(1)
b7f1d9f8f3bc Uploaded
xuebing
parents:
diff changeset
201
b7f1d9f8f3bc Uploaded
xuebing
parents:
diff changeset
202 random.seed(seed)
b7f1d9f8f3bc Uploaded
xuebing
parents:
diff changeset
203
b7f1d9f8f3bc Uploaded
xuebing
parents:
diff changeset
204 # read sequences
b7f1d9f8f3bc Uploaded
xuebing
parents:
diff changeset
205 seqs = sequence.readFASTA(file_name,'Extended DNA')
b7f1d9f8f3bc Uploaded
xuebing
parents:
diff changeset
206
b7f1d9f8f3bc Uploaded
xuebing
parents:
diff changeset
207 for s in seqs:
b7f1d9f8f3bc Uploaded
xuebing
parents:
diff changeset
208 str = s.getString()
b7f1d9f8f3bc Uploaded
xuebing
parents:
diff changeset
209 #FIXME altschul can't handle ambigs
b7f1d9f8f3bc Uploaded
xuebing
parents:
diff changeset
210 name = s.getName()
b7f1d9f8f3bc Uploaded
xuebing
parents:
diff changeset
211
b7f1d9f8f3bc Uploaded
xuebing
parents:
diff changeset
212 #print >> sys.stderr, ">%s" % name
b7f1d9f8f3bc Uploaded
xuebing
parents:
diff changeset
213
b7f1d9f8f3bc Uploaded
xuebing
parents:
diff changeset
214 for i in range(copies):
b7f1d9f8f3bc Uploaded
xuebing
parents:
diff changeset
215
b7f1d9f8f3bc Uploaded
xuebing
parents:
diff changeset
216 shuffledSeq = dinuclShuffle(str)
b7f1d9f8f3bc Uploaded
xuebing
parents:
diff changeset
217
b7f1d9f8f3bc Uploaded
xuebing
parents:
diff changeset
218 if (copies == 1):
b7f1d9f8f3bc Uploaded
xuebing
parents:
diff changeset
219 print >> sys.stdout, ">%s\n%s" % (name+tag, shuffledSeq)
b7f1d9f8f3bc Uploaded
xuebing
parents:
diff changeset
220 else:
b7f1d9f8f3bc Uploaded
xuebing
parents:
diff changeset
221 print >> sys.stdout, ">%s_%d\n%s" % (name+tag, i, shuffledSeq)
b7f1d9f8f3bc Uploaded
xuebing
parents:
diff changeset
222
b7f1d9f8f3bc Uploaded
xuebing
parents:
diff changeset
223 if __name__ == '__main__': main()