gtaxon: Index | Files | Directories

package taxon

import ""

Package taxon provides APIs of parsing, writing (to bolt database) and quering APIs on NCBI taxonomy data, a web server with REST API is also available for query.

Therefore, you can build a NCBI taxonomy query server that could be accessed both from local or remote server. [goTaxon]( is one of this implemention.


Package Files

db.go divisions.go doc.go gencodes.go gi_taxid.go helper.go log.go names.go nodes.go server.go


var DbFile string

DbFile is the bolt database filename

var DbPath string

DbPath is the database path

func ImportDivisions Uses

func ImportDivisions(dbFile string, bucket string, dataFile string, batchSize int, force bool)

ImportDivisions reads data from divisions.dmp and write to bolt database

func ImportGenCodes Uses

func ImportGenCodes(dbFile string, bucket string, dataFile string, batchSize int, force bool)

ImportGenCodes reads data from gencodes.dmp and write to bolt database

func ImportGiTaxid Uses

func ImportGiTaxid(dbFile string, bucket string, dataFile string, chunkSize int, force bool)

ImportGiTaxid reads gi_taxid_nucl or gi_taxid_prot file and writes the data to database

func ImportNames Uses

func ImportNames(dbFile string, bucket string, dataFile string, chunkSize int, force bool)

ImportNames reads data from names.dmp and write to bolt database

func ImportNodes Uses

func ImportNodes(dbFile string, bucket string, dataFile string, batchSize int, force bool)

ImportNodes reads data from nodes.dmp and write to bolt database

func InitDatabase Uses

func InitDatabase(dbPath string, dbFile string, force bool)

InitDatabase initializes database direcotry

func LoadAllDivisions Uses

func LoadAllDivisions(db *bolt.DB, bucket string) (map[string]nodes.Division, error)

LoadAllDivisions loads all divisions into memory

func LoadAllGenCodes Uses

func LoadAllGenCodes(db *bolt.DB, bucket string) (map[string]nodes.GenCode, error)

LoadAllGenCodes loads all gencodes into memory

func LoadAllNames Uses

func LoadAllNames(db *bolt.DB, bucket string) (map[string]nodes.Name, error)

LoadAllNames loads all names into memory

func LoadAllNodes Uses

func LoadAllNodes(db *bolt.DB, bucket string) (map[string]nodes.Node, error)

LoadAllNodes loads all nodes into memory

func QueryDivisionByDivisionID Uses

func QueryDivisionByDivisionID(db *bolt.DB, bucket string, ids []string) ([]nodes.Division, error)

QueryDivisionByDivisionID querys Division by taxid

func QueryGenCodeByGenCodeID Uses

func QueryGenCodeByGenCodeID(db *bolt.DB, bucket string, ids []string) ([]nodes.GenCode, error)

QueryGenCodeByGenCodeID querys GenCode by taxid

func QueryGi2Taxid Uses

func QueryGi2Taxid(db *bolt.DB, bucket string, gis []string) ([]string, error)

QueryGi2Taxid querys taxids by gis

func QueryNameByTaxID Uses

func QueryNameByTaxID(db *bolt.DB, bucket string, taxids []string) ([]nodes.Name, error)

QueryNameByTaxID querys Name by taxid

func QueryNodeByTaxID Uses

func QueryNodeByTaxID(db *bolt.DB, bucket string, taxids []string) ([]nodes.Node, error)

QueryNodeByTaxID querys Node by taxid

func QueryTaxIDByName Uses

func QueryTaxIDByName(db *bolt.DB, bucket string, useRegexp bool, nameClass string, threads int, queries []string) (map[string][]string, error)

QueryTaxIDByName query taxid by name

func StartServer Uses

func StartServer(dbFilePath string, port int, timeout int, threads int)

StartServer runs a web server for query

type DBPool Uses

type DBPool struct {
    // contains filtered or unexported fields

DBPool is bolt db connection pool

func NewDBPool Uses

func NewDBPool(dbFilePath string, n int) *DBPool

NewDBPool is constructor for DBPools

func (*DBPool) Close Uses

func (p *DBPool) Close()

Close closes all connection

func (*DBPool) GetDB Uses

func (p *DBPool) GetDB() *bolt.DB

GetDB gets one connection

func (*DBPool) ReleaseDB Uses

func (p *DBPool) ReleaseDB(db *bolt.DB)

ReleaseDB releases a connection

type MessageGI2TaxidMap Uses

type MessageGI2TaxidMap struct {
    Status  string `json:"status"`
    Message string `json:"message"`

    Taxids map[string]string `json:"gi2taxid"`

MessageGI2TaxidMap is

func RemoteQueryGi2Taxid Uses

func RemoteQueryGi2Taxid(host string, port int, dbType string, gis []string) MessageGI2TaxidMap

RemoteQueryGi2Taxid query from remote server

type MessageLCAMap Uses

type MessageLCAMap struct {
    Status  string `json:"status"`
    Message string `json:"message"`

    LCA map[string]nodes.Taxon `json:"taxids2taxon"`

MessageLCAMap is

func RemoteQueryLCA Uses

func RemoteQueryLCA(host string, port int, queries []string) MessageLCAMap

RemoteQueryLCA is

type MessageTaxid2TaxonMap Uses

type MessageTaxid2TaxonMap struct {
    Status  string `json:"status"`
    Message string `json:"message"`

    Taxons map[string]nodes.Taxon `json:"taxid2taxon"`

MessageTaxid2TaxonMap is

func RemoteQueryTaxid2Taxon Uses

func RemoteQueryTaxid2Taxon(host string, port int, taxids []string) MessageTaxid2TaxonMap

RemoteQueryTaxid2Taxon is

type MssageName2TaxIDMap Uses

type MssageName2TaxIDMap struct {
    Status  string `json:"status"`
    Message string `json:"message"`

    TaxIDs map[string][]TaxIDSciNameItem `json:"name2taxid"`

MssageName2TaxIDMap is

func RemoteQueryName2TaxID Uses

func RemoteQueryName2TaxID(host string, port int, useRegexp bool, nameClass string, names []string) MssageName2TaxIDMap

RemoteQueryName2TaxID is

type TaxIDSciNameItem Uses

type TaxIDSciNameItem struct {
    TaxID          int
    ScientificName string

TaxIDSciNameItem is


nodesPackage nodes a

Package taxon imports 20 packages (graph) and is imported by 1 packages. Updated 2016-08-07. Refresh now. Tools for package owners.