taxon

package
v0.0.0-...-fd9d89b Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 24, 2016 License: MIT Imports: 20 Imported by: 0

Documentation

Overview

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](https://github.com/shenwei356/gotaxon) is one of this implemention.

Index

Constants

This section is empty.

Variables

View Source
var DbFile string

DbFile is the bolt database filename

View Source
var DbPath string

DbPath is the database path

Functions

func ImportDivisions

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

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

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

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

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

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

InitDatabase initializes database direcotry

func LoadAllDivisions

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

LoadAllDivisions loads all divisions into memory

func LoadAllGenCodes

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

LoadAllGenCodes loads all gencodes into memory

func LoadAllNames

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

LoadAllNames loads all names into memory

func LoadAllNodes

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

LoadAllNodes loads all nodes into memory

func QueryDivisionByDivisionID

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

QueryDivisionByDivisionID querys Division by taxid

func QueryGenCodeByGenCodeID

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

QueryGenCodeByGenCodeID querys GenCode by taxid

func QueryGi2Taxid

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

QueryGi2Taxid querys taxids by gis

func QueryNameByTaxID

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

QueryNameByTaxID querys Name by taxid

func QueryNodeByTaxID

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

QueryNodeByTaxID querys Node by taxid

func QueryTaxIDByName

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

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

StartServer runs a web server for query

Types

type DBPool

type DBPool struct {
	// contains filtered or unexported fields
}

DBPool is bolt db connection pool

func NewDBPool

func NewDBPool(dbFilePath string, n int) *DBPool

NewDBPool is constructor for DBPools

func (*DBPool) Close

func (p *DBPool) Close()

Close closes all connection

func (*DBPool) GetDB

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

GetDB gets one connection

func (*DBPool) ReleaseDB

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

ReleaseDB releases a connection

type MessageGI2TaxidMap

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

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

MessageGI2TaxidMap is

func RemoteQueryGi2Taxid

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

RemoteQueryGi2Taxid query from remote server

type MessageLCAMap

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

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

MessageLCAMap is

func RemoteQueryLCA

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

RemoteQueryLCA is

type MessageTaxid2TaxonMap

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

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

MessageTaxid2TaxonMap is

func RemoteQueryTaxid2Taxon

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

RemoteQueryTaxid2Taxon is

type MssageName2TaxIDMap

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

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

MssageName2TaxIDMap is

func RemoteQueryName2TaxID

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

RemoteQueryName2TaxID is

type TaxIDSciNameItem

type TaxIDSciNameItem struct {
	TaxID          int
	ScientificName string
}

TaxIDSciNameItem is

Directories

Path Synopsis
Package nodes a Package nodes a Package nodes a Package nodes a Package nodes a
Package nodes a Package nodes a Package nodes a Package nodes a Package nodes a

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL