Plotting trees with plotTree

Kat Holt’s lab have a nice set of scripts that wrap around ete2 which makes it nice ‘n’ easy to annotate trees – plotTree! It works out the box!

They have some great installation and usage instructions on the github, and some examples for the R half of the code, but the examples for the python bit are coming soon. I have been having a play and got it to work very nicely with an example data set, so thought I would post here, because there are a lot of options and I will probably forget what they are.

Hat tip to Danielle Ingle and Kate Mellor for the template that I used to make my version. The file names are links to the example files.

`python –tree ~/ –info ~/ –output ~/ –colour_dict ‘{“UK”:”#000000″,”African”:”#FFFF00″}’ –colour_tags lineage –margin_right 120 –margin_left 120 –margin_top 50 –margin_bottom 50 –length_scale 10`

One of the key arguments here is the --length_scale which sorts out the horizontal axis of the tree, I generated a few cramped looking trees before I twigged to this. You can also pass --fan instead to get a radial tree. --colour_tags determines which columns from your --info file get plotted onto the tree.

Anyway, there are loads of options to fiddle with, but the above will give you a decent rectangular tree to get you started. Bit more info below.

This is Kate’s colour_dict

`'{“Human”:”#000000″,”Environment”:”#FFFF00″,”Livestock”:”#FFD700″,”Food”:”#32CD32″,”Poultry”:”#ADFF2F”,”Aquatic”:”#98FB98″, “Companion Animal”:”#FF0000″, “human faeces”:”Olive”, “human blood”:”Olive”, “human sacrum”:”DarkOliveGreen”, “human ureter”:”YellowGreen”, “bovine”:”IndianRed”, “beef”:”Red”, “turkey meat”:”Yellow”, “chicken meat”:”Gold”, “chicken faeces”: “Khaki”, “bovine faeces”:”Salmon”, “swine”:”Aquamarine”, “swine tongue”:”PaleTurquoise”, “swine liver”:”PaleTurquoise”, “soybean protein”: “Thistle”, “herb/spice”:”DarkViolet”, “bread mix”:”MediumOrchid”, “fennel”: “Violet”, “nut”:”DarkViolet”, “environmental swab”:”DarkGrey”, “wheat flour”: “Fuschia”, “chicken cloacal swab”:”Moccasin”, “swine lymph node”:”PaleTurquoise”, “swine caecum”:”PaleTurquiose”, “pork”:”DeepSkyBlue”, “alfalfa sprouts”:”Plum”, “urine”:”Green”, “fish meat”:”DarkOrange”, “fish meat (dried)”:”DarkOrange”, “0”:”White”, “1”:”Indigo”, “factory environmental swab “:”DarkGrey”, “swine faeces “:”PaleTurquoise”, “_”:”White”, “OXA_48″:”LimeGreen”, “TEM_1″:”LightSalmon”, “CIP0.5″:”Gold”, “CTX_M_14″:”Coral”, “TEM_57″:”Tomato”, “CMY_2;OXA_10;TEM_1″:”OrangeRed”, “OXA_114a[u];TEM_1″:”OrangeRed”, “CTX_M_123[u];CTX_M_14;OXA_33p[c];TEM_191_p[c]”:”OrangeRed”, “TEM_191_p*”:”LightSalmon”, “TEM_135″:”LightSalmon”, “CTX_M_55;TEM_1″:”OrangeRed”, “CTX_M_15[c];CMY_2;TEM_191_p*”:”OrangeRed”, “CMY_2[c];TEM_1″:”Coral”, “OXA_2;OXA_21[v]”:”OrangeRed”, “TEM_118_p[c]”:”Coral”, “TEM_1[v]”:”LightSalmon”, “1”:”Lavender”, “2”:”Thistle”, “3”:”Plum”, “4”:”Violet”, “5”:”Orchid”, “6”:”Fuchsia”, “7”:”MediumOrchid”, “8”:”BlueViolet”, “9”:”DarkViolet”, “10”:”DarkOrchid”, “11”:”DarkMagenta”, “12”:”Purple”, “13”:”Indigo”, “CTX_M_123[u];CTX_M_14;OXA_33_p[c];TEM_191_p[c]”:”OrangeRed”, “CTX_M_104″:”OrangeRed”}’`

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s