0
|
1 #!/usr/bin/env python
|
|
2
|
|
3
|
|
4 def To_list(L):
|
|
5 import string
|
|
6 New_list=[]
|
|
7 for x in L:
|
|
8 x1=x[:-1]
|
|
9 x1=string.atoi(x1)
|
|
10 New_list.append(x1)
|
|
11 return New_list
|
|
12
|
|
13
|
|
14 def Uniq(L): #return the uniq list and the count number
|
|
15 Old=L
|
|
16 L.sort()
|
|
17 L = [L[i] for i in range(len(L)) if L[i] not in L[:i]]
|
|
18 count=[]
|
|
19 for j in range(len(L)):
|
|
20 y=0
|
|
21 for x in Old:
|
|
22 if L[j]==x:
|
|
23 y+=1
|
|
24 count.append(y)
|
|
25 return (L,count)
|
|
26
|
|
27
|
|
28 def Parse_seros_in_genome_trakr(L): #return the sero names in the sra_result.xlsx, the next step is usually "Uniq" in above
|
|
29 names2=[]
|
|
30 for x in L:
|
|
31 if "serovar" in x:
|
|
32 key_word=x.split("serovar")[1].split("_")[1] #the seronames
|
|
33 if key_word!="str." and key_word!="group": #to eliminate some "serovar_str." and "serovar_group"
|
|
34 if key_word in ["I","II","III","IIIa","IIIb","IV","VI","B"]: #the serovar is behind those letters
|
|
35 if x.split("serovar")[1].split("_")[2]!="str.":
|
|
36 names2.append(x.split("serovar")[1].split("_")[2])
|
|
37 else:
|
|
38 names2.append(x.split("serovar")[1].split("_")[1])
|
|
39 return names2
|
|
40
|
|
41
|
|
42
|