annotate mytools/fasta-dinucleotide-shuffle.py @ 7:f0dc65e7f6c0

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