Documentation ¶
Index ¶
- Variables
- type Taxonomy
- func NewTaxonomy(file string, childColumn int, parentColumn int) (*Taxonomy, error)
- func NewTaxonomyFromNCBI(file string) (*Taxonomy, error)
- func NewTaxonomyWithRank(file string, childColumn int, parentColumn int, rankColumn int) (*Taxonomy, error)
- func NewTaxonomyWithRankFromNCBI(file string) (*Taxonomy, error)
- func (t *Taxonomy) AtOrBelowRank(taxid uint32, rank string) bool
- func (t *Taxonomy) CacheLCA()
- func (t *Taxonomy) LCA(a uint32, b uint32) uint32
- func (t *Taxonomy) LineageNames(taxid uint32) []string
- func (t *Taxonomy) LineageTaxIds(taxid uint32) []uint32
- func (t *Taxonomy) LoadDeletedNodes(file string, column int) error
- func (t *Taxonomy) LoadDeletedNodesFromNCBI(file string) error
- func (t *Taxonomy) LoadMergedNodes(file string, oldColumn int, newColumn int) error
- func (t *Taxonomy) LoadMergedNodesFromNCBI(file string) error
- func (t *Taxonomy) LoadNames(file string, taxidColumn int, nameColumn int, typeColumn int, _type string) error
- func (t *Taxonomy) LoadNamesFromNCBI(file string) error
- func (t *Taxonomy) MaxTaxid() uint32
- func (t *Taxonomy) Name(taxid uint32) string
- func (t *Taxonomy) Rank(taxid uint32) string
- func (t *Taxonomy) TaxId(taxid uint32) (uint32, bool)
Constants ¶
This section is empty.
Variables ¶
var ErrIllegalColumnIndex = errors.New("taxdump: illegal column index, positive integer needed")
ErrIllegalColumnIndex means column index is 0 or negative.
var ErrNamesNotLoaded = errors.New("taxdump: taxonomy names not loaded, please call: LoadNames")
ErrNamesNotLoaded means you should call LoadNames before using taxonomy names.
var ErrRankNotLoaded = errors.New("taxdump: taxonomic ranks not loaded, please call: NewTaxonomyWithRank")
ErrRankNotLoaded means you should reate load Taxonomy with NewTaxonomyWithRank before calling some methods.
var ErrTooManyRanks = errors.New("taxdump: number of ranks exceed limit of 255")
ErrTooManyRanks means number of ranks exceed limit of 255
var ErrUnkownRank = errors.New("taxdump: unknown rank")
ErrUnkownRank indicate an unknown rank
Functions ¶
This section is empty.
Types ¶
type Taxonomy ¶
type Taxonomy struct { Nodes map[uint32]uint32 // child -> parent DelNodes map[uint32]struct{} MergeNodes map[uint32]uint32 // from -> to Names map[uint32]string Ranks map[string]interface{} // contains filtered or unexported fields }
Taxonomy holds relationship of taxon in a taxonomy.
func NewTaxonomy ¶
NewTaxonomy only loads nodes from nodes.dmp file.
func NewTaxonomyFromNCBI ¶
NewTaxonomyFromNCBI parses nodes relationship from nodes.dmp from ftp://ftp.ncbi.nih.gov/pub/taxonomy/taxdump.tar.gz .
func NewTaxonomyWithRank ¶
func NewTaxonomyWithRank(file string, childColumn int, parentColumn int, rankColumn int) (*Taxonomy, error)
NewTaxonomyWithRank loads nodes and ranks from nodes.dmp file.
func NewTaxonomyWithRankFromNCBI ¶
NewTaxonomyWithRankFromNCBI parses Taxonomy from nodes.dmp from ftp://ftp.ncbi.nih.gov/pub/taxonomy/taxdump.tar.gz .
func (*Taxonomy) AtOrBelowRank ¶
AtOrBelowRank returns whether a taxid is at or below one rank.
func (*Taxonomy) CacheLCA ¶
func (t *Taxonomy) CacheLCA()
CacheLCA tells to cache every LCA query result
func (*Taxonomy) LineageNames ¶
LineageNames returns nodes' names of the the complete lineage.
func (*Taxonomy) LineageTaxIds ¶
LineageTaxIds returns nodes' taxid of the the complete lineage.
func (*Taxonomy) LoadDeletedNodes ¶
LoadDeletedNodes loads deleted nodes.
func (*Taxonomy) LoadDeletedNodesFromNCBI ¶
LoadDeletedNodesFromNCBI loads deleted nodes from NCBI delnodes.dmp.
func (*Taxonomy) LoadMergedNodes ¶
LoadMergedNodes loads merged nodes.
func (*Taxonomy) LoadMergedNodesFromNCBI ¶
LoadMergedNodesFromNCBI loads merged nodes from NCBI merged.dmp.
func (*Taxonomy) LoadNames ¶
func (t *Taxonomy) LoadNames(file string, taxidColumn int, nameColumn int, typeColumn int, _type string) error
LoadNames loads names.
func (*Taxonomy) LoadNamesFromNCBI ¶
LoadNamesFromNCBI loads scientific names from NCBI names.dmp
func (*Taxonomy) Name ¶
Name returns the name of a TaxId. If being merged, the name of the new TaxId will be returned. If the TaxId is not found or deleted, empty will be returned.