comparison cpo_galaxy_tree.py @ 24:e5a7da2239af draft

planemo upload
author jjjjia
date Wed, 29 Aug 2018 02:31:49 -0400
parents 596bf8a792de
children 573136f142b6
comparison
equal deleted inserted replaced
23:2cca036ceb91 24:e5a7da2239af
94 self.MLSTSpecies = "?" 94 self.MLSTSpecies = "?"
95 self.SequenceType = "?" 95 self.SequenceType = "?"
96 self.MLSTScheme = "?" 96 self.MLSTScheme = "?"
97 self.CarbapenemResistanceGenes ="?" 97 self.CarbapenemResistanceGenes ="?"
98 self.plasmidBestMatch ="?" 98 self.plasmidBestMatch ="?"
99 self.plasmididentity =-1
100 self.plasmidsharedhashes ="?"
99 self.OtherAMRGenes="?" 101 self.OtherAMRGenes="?"
100 self.TotalPlasmids = -1 102 self.TotalPlasmids = -1
101 self.plasmids = [] 103 self.plasmids = []
102 self.DefinitelyPlasmidContigs ="?" 104 self.DefinitelyPlasmidContigs ="?"
103 self.LikelyPlasmidContigs="?" 105 self.LikelyPlasmidContigs="?"
180 _results.MLSTScheme = (str(r.loc[r.index[i], 'MLST Scheme'])) 182 _results.MLSTScheme = (str(r.loc[r.index[i], 'MLST Scheme']))
181 _results.CarbapenemResistanceGenes = (str(r.loc[r.index[i], 'Carbapenem Resistance Genes'])) 183 _results.CarbapenemResistanceGenes = (str(r.loc[r.index[i], 'Carbapenem Resistance Genes']))
182 _results.OtherAMRGenes = (str(r.loc[r.index[i], 'Other AMR Genes'])) 184 _results.OtherAMRGenes = (str(r.loc[r.index[i], 'Other AMR Genes']))
183 _results.TotalPlasmids = int(r.loc[r.index[i], 'Total Plasmids']) 185 _results.TotalPlasmids = int(r.loc[r.index[i], 'Total Plasmids'])
184 _results.plasmidBestMatch = str(r.loc[r.index[i], 'Plasmid Best Match']) 186 _results.plasmidBestMatch = str(r.loc[r.index[i], 'Plasmid Best Match'])
187 _results.plasmididentity = str(r.loc[r.index[i], 'Plasmid Identity'])
188 _results.plasmidsharedhashes = float(r.loc[r.index[i], 'Plasmid Shared Hash'])
185 for j in range(0,_results.TotalPlasmids): 189 for j in range(0,_results.TotalPlasmids):
186 _plasmid = plasmidObj() 190 _plasmid = plasmidObj()
187 _plasmid.PlasmidsID =(((str(r.loc[r.index[i], 'Plasmids ID'])).split(";"))[j]) 191 _plasmid.PlasmidsID =(((str(r.loc[r.index[i], 'Plasmids ID'])).split(";"))[j])
188 _plasmid.Num_Contigs = (((str(r.loc[r.index[i], 'Num_Contigs'])).split(";"))[j]) 192 _plasmid.Num_Contigs = (((str(r.loc[r.index[i], 'Num_Contigs'])).split(";"))[j])
189 _plasmid.PlasmidLength = (((str(r.loc[r.index[i], 'Plasmid Length'])).split(";"))[j]) 193 _plasmid.PlasmidLength = (((str(r.loc[r.index[i], 'Plasmid Length'])).split(";"))[j])
271 index = index + 1 275 index = index + 1
272 (t&"Reference").add_face(addFace("Carbapenamases"), index, "aligned") 276 (t&"Reference").add_face(addFace("Carbapenamases"), index, "aligned")
273 index = index + 1 277 index = index + 1
274 (t&"Reference").add_face(addFace("Plasmid Best Match"), index, "aligned") 278 (t&"Reference").add_face(addFace("Plasmid Best Match"), index, "aligned")
275 index = index + 1 279 index = index + 1
280 (t&"Reference").add_face(addFace("Best Match Identity"), index, "aligned")
281 index = index + 1
276 for i in range(len(distanceDict[list(distanceDict.keys())[0]])): #this loop adds the distance matrix 282 for i in range(len(distanceDict[list(distanceDict.keys())[0]])): #this loop adds the distance matrix
277 (t&"Reference").add_face(addFace(distanceDict[list(distanceDict.keys())[0]][i]), index + i, "aligned") 283 (t&"Reference").add_face(addFace(distanceDict[list(distanceDict.keys())[0]][i]), index + i, "aligned")
278 index = index + len(distanceDict[list(distanceDict.keys())[0]]) 284 index = index + len(distanceDict[list(distanceDict.keys())[0]])
279 elif (n.is_leaf() and not n.name == "Reference"): 285 elif (n.is_leaf() and not n.name == "Reference"):
280 #not reference branches, populate with metadata 286 #not reference branches, populate with metadata
324 index = index + 1 330 index = index + 1
325 n.add_face(addFace(mData.CarbapenemResistanceGenes), index, "aligned") 331 n.add_face(addFace(mData.CarbapenemResistanceGenes), index, "aligned")
326 index = index + 1 332 index = index + 1
327 n.add_face(addFace(mData.plasmidBestMatch), index, "aligned") 333 n.add_face(addFace(mData.plasmidBestMatch), index, "aligned")
328 index = index + 1 334 index = index + 1
335 n.add_face(addFace(mData.plasmididentity), index, "aligned")
336 index = index + 1
329 for i in range(len(distanceDict[list(distanceDict.keys())[0]])): #this loop adds distance matrix 337 for i in range(len(distanceDict[list(distanceDict.keys())[0]])): #this loop adds distance matrix
330 if (n.name in distanceDict): #make sure the column is in the distance matrice 338 if (n.name in distanceDict): #make sure the column is in the distance matrice
331 n.add_face(addFace(list(distanceDict[n.name])[i]), index + i, "aligned") 339 n.add_face(addFace(list(distanceDict[n.name])[i]), index + i, "aligned")
332 340
333 t.render(outputFile, w=5000,units="mm", tree_style=ts) #save it as a png, pdf, svg or an phyloxml 341 t.render(outputFile, w=5000,units="mm", tree_style=ts) #save it as a png, pdf, svg or an phyloxml