Skip to content
This repository has been archived by the owner on Sep 7, 2023. It is now read-only.

3.1. Usage (plot_gain_loss_map)

moshi edited this page Oct 23, 2021 · 8 revisions

Install

FastDTLmapper subtool plot_gain_loss_map is installed with pip command below.

pip install fastdtlmapper

Additionally, plot_gain_loss_map requires Qt5 runtime environment (Used in ete3).
In Ubuntu20.04, user can install Qt5 using apt command below.

sudo apt install qt5-default

Command Usage

Basic Command

plot_gain_loss_map inputs FastDTLmapper DTL map result file (*_dtl_map.nwk)

plot_gain_loss_map -i [*_dtl_map.nwk] -o [output_plot_file]

Options

-h, --help          show this help message and exit
-i I, --infile I    Input gain/loss map result file
-o O, --outfile O   Output plot file (*.png|*.svg|*.pdf)
--plot_scale        Horizontal branch scale plot parameter (Default: Auto Defined)
--plot_margin       Vertical margin plot parameter (Default: 15)
--plot_width        Pixel width size plot parameter (Default: None)
--title             Plot figure title (Default: None)
--ladderize         Plot ladderized style tree (Default: off)
--add_brn_dup_trn   Add Brn/Dup/Trn plot (Default: off)
--edit_mode         Launch interactive tree editor (Default: off)
--color_gene_num    Plot color of gene number (Default: 'lightgreen')
--color_gain_num    Plot color of gain number (Default: 'red')
--color_loss_num    Plot color of loss number (Default: 'blue')
--gain_symbol       Plot symbol of gain gene (Default: ' ▲ ')
--loss_symbol       Plot symbol of loss gene (Default: ' ▼ ')
--fsize_node_name   Plot font size of node name (Default: 8)
--fsize_leaf_name   Plot font size of leaf name (Default: 10)
--fsize_gene_num    Plot font size of gene number (Default: 8)
--fsize_gain_num    Plot font size of gain number (Default: 8)
--fsize_loss_num    Plot font size of loss number (Default: 8)
--fsize_title       Plot font size of title (Default: 30)
--fsize_legend      Plot font size of legend (Default: 8)

Example Command

all_dtl_map.nwk (Input file)

((insp01 | 4430 [brn=829 dup=669 los=90 trn=1318]:0.684975,((((insp02 | 2850 [brn=793 dup=202 los=422 trn=101]:0.124628,insp03 | 3280 [brn=531 dup=204 los=58 trn=427]:0.124628)N006 | 2176 [brn=216 dup=36 los=406 trn=191]:0.257137,insp04 | 2525 [brn=184 dup=50 los=330 trn=482]:0.381764)N005 | 2139 [brn=51 dup=7 los=728 trn=298]:0.083451,((insp05 | 3815 [brn=298 dup=80 los=747 trn=878]:0.388686,(((insp06 | 4228 [brn=581 dup=453 los=996 trn=776]:0.270187,((insp07 | 6311 [brn=1130 dup=1532 los=870 trn=898]:0.204279,insp08 | 4268 [brn=366 dup=155 los=857 trn=983]:0.204279)N013 | 3621 [brn=32 dup=8 los=523 trn=241]:0.035805,(insp09 | 3167 [brn=151 dup=160 los=1415 trn=678]:0.208855,insp10 | 4762 [brn=684 dup=247 los=555 trn=793]:0.208855)N014 | 3593 [brn=54 dup=8 los=647 trn=315]:0.031229)N012 | 3863 [brn=286 dup=34 los=451 trn=580]:0.030104)N011 | 3414 [brn=97 dup=29 los=355 trn=408]:0.026523,insp11 | 3337 [brn=274 dup=224 los=950 trn=554]:0.296710)N010 | 3235 [brn=124 dup=26 los=1110 trn=421]:0.052497,(((((insp12 | 5368 [brn=298 dup=165 los=236 trn=307]:0.015703,insp13 | 5039 [brn=196 dup=126 los=378 trn=261]:0.015703)N019 | 4834 [brn=332 dup=69 los=570 trn=323]:0.141013,insp14 | 5393 [brn=647 dup=427 los=882 trn=521]:0.156716)N018 | 4680 [brn=206 dup=40 los=728 trn=375]:0.080264,insp15 | 5408 [brn=687 dup=389 los=1116 trn=661]:0.236980)N017 | 4787 [brn=128 dup=30 los=747 trn=358]:0.058583,(insp16 | 6027 [brn=694 dup=498 los=1007 trn=976]:0.274289,(insp17 | 5498 [brn=1000 dup=677 los=1515 trn=1442]:0.234242,insp18 | 4474 [brn=462 dup=244 los=841 trn=715]:0.234242)N021 | 3894 [brn=47 dup=4 los=1232 trn=209]:0.040047)N020 | 4866 [brn=114 dup=14 los=589 trn=309]:0.021275)N016 | 5018 [brn=391 dup=68 los=394 trn=428]:0.030598,(insp19 | 5704 [brn=675 dup=480 los=690 trn=890]:0.293260,(insp20 | 4451 [brn=457 dup=657 los=1037 trn=675]:0.236459,insp21 | 6630 [brn=896 dup=1920 los=583 trn=698]:0.236459)N023 | 3699 [brn=92 dup=26 los=1080 trn=312]:0.056802)N022 | 4349 [brn=184 dup=48 los=775 trn=367]:0.032901)N015 | 4525 [brn=501 dup=71 los=192 trn=371]:0.023046)N009 | 3774 [brn=435 dup=39 los=184 trn=178]:0.039479)N008 | 3306 [brn=529 dup=15 los=286 trn=147]:0.036002,(insp22 | 2475 [brn=158 dup=132 los=951 trn=468]:0.360947,insp23 | 6254 [brn=1731 dup=817 los=448 trn=1486]:0.360947)N024 | 2668 [brn=28 dup=7 los=521 trn=253]:0.063741)N007 | 2901 [brn=374 dup=19 los=104 trn=101]:0.040527)N004 | 2511 [brn=363 dup=13 los=82 trn=84]:0.062321,insp24 | 3561 [brn=502 dup=188 los=570 trn=1308]:0.527535)N003 | 2133 [brn=527 dup=13 los=164 trn=53]:0.157440)N002 | 1704 [brn=656 dup=39 los=1 trn=62]:0.497301,((outsp01 | 4185 [brn=1325 dup=569 los=312 trn=296]:0.851644,outsp02 | 3574 [brn=1121 dup=607 los=690 trn=229]:0.851644)N026 | 2307 [brn=324 dup=118 los=208 trn=114]:0.305632,(outsp03 | 4189 [brn=1195 dup=749 los=740 trn=265]:0.440819,outsp04 | 7769 [brn=2208 dup=2235 los=162 trn=768]:0.440819)N027 | 2720 [brn=528 dup=167 los=112 trn=178]:0.716457)N025 | 1959 [brn=463 dup=120 los=0 trn=428]:0.025001)N001 | 948 [brn=923 dup=25 los=0 trn=0];

01. Basic Command (Plot gain/loss)

plot_gain_loss_map -i all_dtl_map.nwk -o gain_loss_map_plot_01.png

gain_loss_map_plot_01.png gain_loss_map_plot_01.png

02. Basic Command (Plot gain/brn/dup/trn/loss)

plot_gain_loss_map -i all_dtl_map.nwk -o gain_loss_map_plot_02.png --add_brn_dup_trn

gain_loss_map_plot_02.png gain_loss_map_plot_02.png

03. Advanced Command (Plot wide scale & wide margin)

plot_gain_loss_map -i all_dtl_map.nwk -o gain_loss_map_plot_03.png --plot_scale 120 --plot_margin 30

gain_loss_map_plot_03.png gain_loss_map_plot_03.png

04. Advanced Commnad (Plot title & ladderized tree)

plot_gain_loss_map -i all_dtl_map.nwk -o gain_loss_map_plot_04.png --title "Ladderized Tree Style" --ladderize

gain_loss_map_plot_04.png gain_loss_map_plot_04.png

More options...?

User can also change font-size,color, etc. with command options.
Please try it out for yourself to adjust plotting figure.

⚠️ Adjust figure from command option ⚠️
There is a limit to how much you can adjust the figure from the command option.
If you need further fine-adjusting, I recommend that you output the figure in SVG format and then edit it with an SVG editor(e.g. Inkscape).

Clone this wiki locally