Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

change AbstractTrees compat #28

Merged
merged 3 commits into from
Nov 7, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ InteractiveUtils = "b77e0a4c-d291-57a0-90e8-8db25a27a240"
OrderedCollections = "bac558e1-5e72-5ebc-8fee-abe8a469f55d"

[compat]
AbstractTrees = "0.4.2"
AbstractTrees = "0.4.3"
DataAPI = "1.6"
OrderedCollections = "1"
julia = "1.5"
Expand Down
34 changes: 33 additions & 1 deletion docs/src/man/usage.md
Original file line number Diff line number Diff line change
Expand Up @@ -121,9 +121,11 @@ julia> human = Taxon(9606); gorilla = Taxon(9592); orangutan = Taxon(9600);
juliia> lca(human, gorilla)
207598 [subfamily] Homininae

# lca is a "varargs" function
julia> lca(human, gorilla, orangutan)
9604 [family] Hominidaes

# Vector input is also available
julia> lca([human, gorilla, orangutan])
9604 [family] Hominidae
```
Expand Down Expand Up @@ -224,6 +226,37 @@ julia> lineage[:species]
```

`Between`, `From`, `Until`, `Cols` and `All` selectors are available in more complex rank selection scenarios.
```julia
julia> lineage[Between(:order, :family)]
6-element Lineage{Taxon}:
9443 [order] Primates
376913 [suborder] Haplorrhini
314293 [infraorder] Simiiformes
9526 [parvorder] Catarrhini
314295 [superfamily] Hominoidea
9604 [family] Hominidae

julia> lineage[From(:family)]
4-element Lineage{Taxon}:
9604 [family] Hominidae
207598 [subfamily] Homininae
9605 [genus] Homo
9606 [species] Homo sapiens

julia> lineage[Until(:kingdom)]
5-element Lineage{Taxon}:
1 [no Rank] root
131567 [no rank] cellular organisms
2759 [superkingdom] Eukaryota
33154 [clade] Opisthokonta
33208 [kingdom] Metazoa

julia> lineage[Cols(:superkingdom, :genus, :species)]
3-element Lineage{Taxon}:
2759 [superkingdom] Eukaryota
9605 [genus] Homo
9606 [species] Homo sapiens
```

## Reformat `Lineage`
Reformation of `Linage` to your ranks can be performed by using `reformat()`.
Expand Down Expand Up @@ -328,4 +361,3 @@ julia> taxa .|> Lineage .|> (x -> reformat(x, seven_rank)) .|> (x -> namedtuple
3 │ 2759 [superkingdom] Eukaryota 7711 [phylum] Chordata 40674 [class] Mammalia 9443 [order] Primates 9604 [family] Hominidae 9592 [genus] Gorilla 9593 [species] Gorilla gorilla
4 │ 2157 [superkingdom] Archaea 1655434 [phylum] Candidatus Loki… missing missing missing missing 2053489 [species] Candidatus Lok…
```