# HG changeset patch # User jjjjia # Date 1535067612 14400 # Node ID 93c25036d3b90e86ec4d3d0969772fb694d58607 # Parent 4d2777aa99dbb96a8f1f6abe20b6652e9fe4b13d planemo upload diff -r 4d2777aa99db -r 93c25036d3b9 cpo_galaxy_tree.py --- 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 @@ # pandas # python # ete3 -# pyqt +# pyqt # 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 diff -r 4d2777aa99db -r 93c25036d3b9 cpo_galaxy_tree.xml --- a/cpo_galaxy_tree.xml Thu Aug 23 18:35:54 2018 -0400 +++ b/cpo_galaxy_tree.xml Thu Aug 23 19:40:12 2018 -0400 @@ -20,7 +20,7 @@ - +