Skip to content

Commit

Permalink
Updated doc for gotree ltt
Browse files Browse the repository at this point in the history
  • Loading branch information
fredericlemoine committed Nov 28, 2023
1 parent 8024b96 commit 6d8d378
Show file tree
Hide file tree
Showing 3 changed files with 134 additions and 1 deletion.
78 changes: 78 additions & 0 deletions docs/commands/ltt.md
Original file line number Diff line number Diff line change
@@ -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 <image file>`` 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)
54 changes: 54 additions & 0 deletions docs/commands/ltt.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 2 additions & 1 deletion docs/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 6d8d378

Please sign in to comment.