Mercurial > repos > charles_s_test > seqsero2
view libs/Initial_functions.py @ 16:ed79f56d2184 draft default tip
planemo upload commit a4fb57231f274270afbfebd47f67df05babffa4a-dirty
author | charles_s_test |
---|---|
date | Thu, 30 Nov 2017 16:58:25 -0500 |
parents | 6895de35a263 |
children |
line wrap: on
line source
#!/usr/bin/env python def To_list(L): import string New_list=[] for x in L: x1=x[:-1] x1=string.atoi(x1) New_list.append(x1) return New_list def Uniq(L): #return the uniq list and the count number Old=L L.sort() L = [L[i] for i in range(len(L)) if L[i] not in L[:i]] count=[] for j in range(len(L)): y=0 for x in Old: if L[j]==x: y+=1 count.append(y) return (L,count) def Parse_seros_in_genome_trakr(L): #return the sero names in the sra_result.xlsx, the next step is usually "Uniq" in above names2=[] for x in L: if "serovar" in x: key_word=x.split("serovar")[1].split("_")[1] #the seronames if key_word!="str." and key_word!="group": #to eliminate some "serovar_str." and "serovar_group" if key_word in ["I","II","III","IIIa","IIIb","IV","VI","B"]: #the serovar is behind those letters if x.split("serovar")[1].split("_")[2]!="str.": names2.append(x.split("serovar")[1].split("_")[2]) else: names2.append(x.split("serovar")[1].split("_")[1]) return names2