Mercurial > repos > jjjjia > cpo_prediction
diff cpo_galaxy_tree.py @ 8:93c25036d3b9 draft
planemo upload
author | jjjjia |
---|---|
date | Thu, 23 Aug 2018 19:40:12 -0400 |
parents | 4d2777aa99db |
children | b7e9a3be2b11 |
line wrap: on
line diff
--- a/cpo_galaxy_tree.py Thu Aug 23 18:35:54 2018 -0400 +++ b/cpo_galaxy_tree.py Thu Aug 23 19:40:12 2018 -0400 @@ -17,13 +17,14 @@ # <requirement type="package" version="0.23.4">pandas</requirement> # <requirement type="package" version="3.6">python</requirement> # <requirement type="package" version="3.1.1">ete3</requirement> -# <requirement type="package" version="5.9.3">pyqt</requirement> +# <requirement type="package" version="5.6.0">pyqt</requirement> # </requirements> import subprocess import pandas #conda pandas import optparse import os +os.environ['QT_QPA_PLATFORM']='offscreen' import datetime import sys import time @@ -167,73 +168,7 @@ for i in range(len(distance)): temp = distance[i].split("\t") distanceDict[temp[0]] = temp[1:] - #region step5: tree construction - ''' - #region create detailed tree - - plasmidCount = 0 - for n in t.traverse(): - if (n.is_leaf() and not n.name == "Reference"): - mData = metadata[n.name.replace(".fa","")] - face = faces.TextFace(mData.MLSTSpecies,fsize=10,tight_text=True) - face.border.margin = 5 - face.margin_left = 10 - face.margin_right = 10 - n.add_face(face, 0, "aligned") - face = faces.TextFace(mData.SequenceType,fsize=10,tight_text=True) - face.border.margin = 5 - face.margin_right = 10 - n.add_face(face, 1, "aligned") - face = faces.TextFace(mData.CarbapenemResistanceGenes,fsize=10,tight_text=True) - face.border.margin = 5 - face.margin_right = 10 - n.add_face(face, 2, "aligned") - index = 3 - if (mData.TotalPlasmids > plasmidCount): - plasmidCount = mData.TotalPlasmids - for i in range(0, mData.TotalPlasmids): - face = faces.TextFace(mData.plasmids[i].PlasmidRepType,fsize=10,tight_text=True) - face.border.margin = 5 - face.margin_right = 10 - n.add_face(face, index, "aligned") - index+=1 - face = faces.TextFace(mData.plasmids[i].PlasmidMobility,fsize=10,tight_text=True) - face.border.margin = 5 - face.margin_right = 10 - n.add_face(face, index, "aligned") - index+=1 - - face = faces.TextFace("Species",fsize=10,tight_text=True) - face.border.margin = 5 - face.margin_right = 10 - face.margin_left = 10 - (t&"Reference").add_face(face, 0, "aligned") - face = faces.TextFace("Sequence Type",fsize=10,tight_text=True) - face.border.margin = 5 - face.margin_right = 10 - (t&"Reference").add_face(face, 1, "aligned") - face = faces.TextFace("Carbapenamases",fsize=10,tight_text=True) - face.border.margin = 5 - face.margin_right = 10 - (t&"Reference").add_face(face, 2, "aligned") - index = 3 - for i in range(0, plasmidCount): - face = faces.TextFace("plasmid " + str(i) + " replicons",fsize=10,tight_text=True) - face.border.margin = 5 - face.margin_right = 10 - (t&"Reference").add_face(face, index, "aligned") - index+=1 - face = faces.TextFace("plasmid " + str(i) + " mobility",fsize=10,tight_text=True) - face.border.margin = 5 - face.margin_right = 10 - (t&"Reference").add_face(face, index, "aligned") - index+=1 - - t.render("./pipelineTest/tree.png", w=5000,units="mm", tree_style=ts) - - #endregion - ''' #region create box tree #region step5: tree construction treeFile = "".join(read(treePath)) @@ -324,7 +259,7 @@ for i in range(len(distanceDict[list(distanceDict.keys())[0]])): #this loop adds distance matrix n.add_face(addFace(list(distanceDict[n.name])[i]), index + i, "aligned") - t.render("./tree.png", w=5000,units="mm", tree_style=ts) #save it as a png. or an phyloxml + t.render("./tree.pdf", w=5000,units="mm", tree_style=ts) #save it as a png. or an phyloxml #endregion #endregion