Skip to content

Commit 3a89067

Browse files
authored
Merge pull request #64 from banhbio/dev
Add doctest for reformat
2 parents 40a999d + a8ac1c0 commit 3a89067

1 file changed

Lines changed: 21 additions & 0 deletions

File tree

src/lineage.jl

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -219,6 +219,27 @@ Return the `Lineage` object reformatted according to the given canonical ranks.
219219
Non-canonical ranks and multiple aliases for the same rank slot are not supported.
220220
If there is no corresponding taxon in the lineage to the rank, `UnclassifiedTaxon` will be stored.
221221
Once a `Lineage` is reformatted, it cannot be reformatted again.
222+
223+
# Examples
224+
225+
```jldoctest
226+
julia> ranks = [:domain, :phylum, :class, :order, :family, :genus, :species];
227+
228+
julia> reformatted = reformat(Lineage(Taxon(9606)), ranks);
229+
230+
julia> isreformatted(reformatted)
231+
true
232+
233+
julia> taxid.(reformatted)
234+
7-element Vector{Int64}:
235+
2759
236+
7711
237+
40674
238+
9443
239+
9604
240+
9605
241+
9606
242+
```
222243
"""
223244
function reformat(l::Lineage, ranks::Vector{Symbol})
224245
_check_reformat_ranks(ranks)

0 commit comments

Comments
 (0)