From 6d8d3780462087df625c6c89091d0aa91549b333 Mon Sep 17 00:00:00 2001 From: Frederic Lemoine Date: Tue, 28 Nov 2023 16:31:48 +0100 Subject: [PATCH] Updated doc for gotree ltt --- docs/commands/ltt.md | 78 +++++++++++++++++++++++++++++++++++++++++++ docs/commands/ltt.svg | 54 ++++++++++++++++++++++++++++++ docs/index.md | 3 +- 3 files changed, 134 insertions(+), 1 deletion(-) create mode 100644 docs/commands/ltt.md create mode 100644 docs/commands/ltt.svg diff --git a/docs/commands/ltt.md b/docs/commands/ltt.md new file mode 100644 index 0000000..0749617 --- /dev/null +++ b/docs/commands/ltt.md @@ -0,0 +1,78 @@ +# Gotree: toolkit and api for phylogenetic tree manipulation + +## Commands + +### ltt + +Compute or draw lineage through time data. + +Two options: + +1) Will output data visualizable in statistical packages (R, python, etc.). Set of x,y coordinates pairs: x: time (or mutations) and y: number of lineages. +2) If `--image `` is specified, then a ltt plot is generate in the given output file. The format of the image depends on the extension (.png, .svg, .pdf, etc. see [gonum doc](https://github.com/gonum/plot/blob/342a5cee2153b051d94ae813861f9436c5584de2/plot.go#L525C17-L525C17). Image width and height can be specified (in inch) with `--image-width` and `--image-height`. + + +Example of usage: + +``` +gotree ltt -i tree.nw -o ltt_data.txt --image ltt_image.pdf --image-width 10 --image-height 10 +``` + +#### Usage + +General command +``` +Usage: + gotree ltt [flags] + +Flags: + -h, --help help for ltt + --image string LTT plot image image output file (default "none") + --image-height int LTT plot image output heigh (default 4) + --image-width int LTT plot image image output width (default 4) + -i, --input string Input tree(s) file (default "stdin") + -o, --output string LTT output file (default "stdout") + +Global Flags: + --format string Input tree format (newick, nexus, phyloxml, or nextstrain) (default "newick") +``` + +#### Examples + +* Generate ltt data from an input tree + + +``` +$ echo "(((A:1,B:1):1,C:2):3,(D:4,(E:3,((F:1.5,G:1.5):0.5,H:2):1):1):1);" | gotree draw text -w 50 + +-------- A + +---------| ++----------------------------| +-------- B +| | +| +------------------ C +| +| +-------------------------------------- D +| | ++--------| +---------------------------- E + | | + +---------| +------------- F + | +----| + +---------| +------------- G + | + +------------------ H +$ echo "(((A:1,B:1):1,C:2):3,(D:4,(E:3,((F:1.5,G:1.5):0.5,H:2):1):1):1);" | gotree ltt +0 0.000000 2 +0 1.000000 3 +0 2.000000 4 +0 3.000000 6 +0 3.500000 7 +0 4.000000 8 +0 5.000000 0 +``` + +* Generate ltt plot from an input tree + +``` +$ echo "(((A:1,B:1):1,C:2):3,(D:4,(E:3,((F:1.5,G:1.5):0.5,H:2):1):1):1);" | gotree ltt --image ltt.png --image-width 10 --image-height 10 +``` + +![LTT Plot](ltt.svg) diff --git a/docs/commands/ltt.svg b/docs/commands/ltt.svg new file mode 100644 index 0000000..d1a210d --- /dev/null +++ b/docs/commands/ltt.svg @@ -0,0 +1,54 @@ + + + + + +Lineage through time plot +Time +0 +2 +4 + + + + + + + +Number of lineages + +2 +4 +6 +8 + + + + + + + + + + + + + + + +LTT_0 + + diff --git a/docs/index.md b/docs/index.md index 2e4f1a0..56ce934 100644 --- a/docs/index.md +++ b/docs/index.md @@ -81,8 +81,9 @@ Command | Subcommand -- | topologies | Generates all possible tree topologies -- | uniformtree | Randomly generates uniform trees -- | yuletree | Randomly generates Yule-Harding trees -[graft](commands/graft.md) ([api](api/graft.md)) | | Graft a tree on an input tree +[graft](commands/graft.md) ([api](api/graft.md)) | | Graft a tree on an input tree [labels](commands/labels.md) | | Lists labels of tree tips +[ltt](commands/ltt.md) | | Draws a lineage through time plot [matrix](commands/matrix.md) ([api](api/matrix.md)) | | Prints distance matrix associated to the input tree [merge](commands/merge.md) ([api](api/merge.md)) | | Merges two rooted trees [nni](commands/nni.md) ([api](api/nni.md)) | | Generates all NNI neighbors from a given tree