diff --git a/docs/index.html b/docs/index.html index b0301fe..4aaacc1 100644 --- a/docs/index.html +++ b/docs/index.html @@ -1,137 +1,7 @@ - + - - - module list – pdoc 6.4.2 - - - - - - + -
- - -
Available Modules
-
- multitax - multitax.multitax - multitax.utils -
- -
- - \ No newline at end of file + diff --git a/docs/multitax.html b/docs/multitax.html index 9322240..b1201cc 100644 --- a/docs/multitax.html +++ b/docs/multitax.html @@ -3,32 +3,28 @@ - + multitax API documentation - + + + + + + + +

@@ -134,7 +131,7 @@

View Source -
__all__ = (
+            
__all__ = (
     'CustomTx',
     'DummyTx',
     'GreengenesTx',
@@ -162,12 +159,12 @@ 

class - CustomTx(multitax.multitax.MultiTax): + CustomTx(multitax.multitax.MultiTax):

-
+
View Source -
class CustomTx(MultiTax):
+            
class CustomTx(MultiTax):
 
     _required_cols = ["node", "parent"]
     _possible_cols = ["node", "parent", "rank", "name"]
@@ -244,9 +241,9 @@ 

)

-
+
View Source -
    def __init__(self, cols: list=["node", "parent", "rank", "name"], sep: str="\t", **kwargs):
+            
    def __init__(self, cols: list=["node", "parent", "rank", "name"], sep: str="\t", **kwargs):
         """
         CustomTx()
 
@@ -321,12 +318,12 @@ 
Inherited Members
class - DummyTx(multitax.multitax.MultiTax): + DummyTx(multitax.multitax.MultiTax):
-
+
View Source -
class DummyTx(MultiTax):
+            
class DummyTx(MultiTax):
 
     def __init__(self, **kwargs):
         """
@@ -354,9 +351,9 @@ 
Inherited Members
DummyTx(**kwargs)
-
+
View Source -
    def __init__(self, **kwargs):
+            
    def __init__(self, **kwargs):
         """
         DummyTx() - Dummy empty taxonomy
 
@@ -414,12 +411,12 @@ 
Inherited Members
class - GreengenesTx(multitax.multitax.MultiTax): + GreengenesTx(multitax.multitax.MultiTax):
-
+
View Source -
class GreengenesTx(MultiTax):
+            
class GreengenesTx(MultiTax):
     _default_urls = ["https://gg-sg-web.s3-us-west-2.amazonaws.com/downloads/greengenes_database/gg_13_5/gg_13_5_taxonomy.txt.gz"]
     _rank_codes = [("k__", "kingdom"),
                    ("p__", "phylum"),
@@ -480,9 +477,9 @@ 
Inherited Members
GreengenesTx(**kwargs)
-
+
View Source -
    def __init__(self, **kwargs):
+            
    def __init__(self, **kwargs):
         # forwards.tsv
         self._forwards = {}
         super().__init__(**kwargs)
@@ -557,14 +554,15 @@ 
Inherited Members
class - GtdbTx(multitax.multitax.MultiTax): + GtdbTx(multitax.multitax.MultiTax):
-
+
View Source -
class GtdbTx(MultiTax):
-    _default_urls = ["https://data.ace.uq.edu.au/public/gtdb/data/releases/latest/ar122_taxonomy.tsv.gz",
-                     "https://data.ace.uq.edu.au/public/gtdb/data/releases/latest/bac120_taxonomy.tsv.gz"]
+            
class GtdbTx(MultiTax):
+    
+    _default_urls = ["https://data.gtdb.ecogenomic.org/releases/latest/ar53_taxonomy.tsv.gz",
+                     "https://data.gtdb.ecogenomic.org/releases/latest/bac120_taxonomy.tsv.gz"]
     _rank_codes = [("d__", "domain"),
                    ("p__", "phylum"),
                    ("c__", "class"),
@@ -624,9 +622,9 @@ 
Inherited Members
GtdbTx(**kwargs)
-
+
View Source -
    def __init__(self, **kwargs):
+            
    def __init__(self, **kwargs):
         super().__init__(**kwargs)
 
@@ -699,12 +697,12 @@
Inherited Members
class - NcbiTx(multitax.multitax.MultiTax): + NcbiTx(multitax.multitax.MultiTax):
-
+
View Source -
class NcbiTx(MultiTax):
+            
class NcbiTx(MultiTax):
     _default_urls = ["ftp://ftp.ncbi.nih.gov/pub/taxonomy/taxdump.tar.gz"]
 
     def __init__(self, **kwargs):
@@ -851,9 +849,9 @@ 
Inherited Members
NcbiTx(**kwargs)
-
+
View Source -
    def __init__(self, **kwargs):
+            
    def __init__(self, **kwargs):
         self._merged = {}
         self._extended_name_nodes = {}
         super().__init__(**kwargs)
@@ -902,9 +900,9 @@ 
Inherited Members
merged(self, node: str):
-
+
View Source -
    def merged(self, node: str):
+            
    def merged(self, node: str):
         """
         Returns relative entry from the merged.dmp file of a given node.
         """
@@ -929,9 +927,9 @@ 
Inherited Members
latest(self, node: str):
-
+
View Source -
    def latest(self, node: str):
+            
    def latest(self, node: str):
         n = super().latest(node)
         if n == self.undefined_node:
             n = self.merged(node)
@@ -955,9 +953,9 @@ 
Inherited Members
stats(self):
-
+
View Source -
    def stats(self):
+            
    def stats(self):
         s = super().stats()
         if self._merged:
             s["merged"] = len(self._merged)
@@ -1009,9 +1007,9 @@ 
Inherited Members
):
-
+
View Source -
    def search_name(self, text: str, rank: str=None, exact: bool=True, force_extended: bool=False):
+            
    def search_name(self, text: str, rank: str=None, exact: bool=True, force_extended: bool=False):
         """
         Search node by exact or partial name.
 
@@ -1100,12 +1098,12 @@ 
Inherited Members
class - OttTx(multitax.multitax.MultiTax): + OttTx(multitax.multitax.MultiTax):
-
+
View Source -
class OttTx(MultiTax):
+            
class OttTx(MultiTax):
     _default_urls = ["http://files.opentreeoflife.org/ott/ott3.2/ott3.2.tgz"]
     _default_root_node = "805080"
 
@@ -1263,9 +1261,9 @@ 
Inherited Members
OttTx(**kwargs)
-
+
View Source -
    def __init__(self, **kwargs):
+            
    def __init__(self, **kwargs):
         self._forwards = {}
         self._extended_name_nodes = {}
         super().__init__(**kwargs)
@@ -1314,9 +1312,9 @@ 
Inherited Members
forwards(self, node: str):
-
+
View Source -
    def forwards(self, node: str):
+            
    def forwards(self, node: str):
         """
         Returns relative entry from the forwards.tsv file of a given node.
         """
@@ -1341,9 +1339,9 @@ 
Inherited Members
latest(self, node: str):
-
+
View Source -
    def latest(self, node: str):
+            
    def latest(self, node: str):
         n = super().latest(node)
         if n == self.undefined_node:
             n = self.forwards(node)
@@ -1367,9 +1365,9 @@ 
Inherited Members
stats(self):
-
+
View Source -
    def stats(self):
+            
    def stats(self):
         s = super().stats()
         if self._forwards:
             s["forwards"] = len(self._forwards)
@@ -1421,9 +1419,9 @@ 
Inherited Members
):
-
+
View Source -
    def search_name(self, text: str, rank: str=None, exact: bool=True, force_extended: bool=False):
+            
    def search_name(self, text: str, rank: str=None, exact: bool=True, force_extended: bool=False):
         """
         Search node by exact or partial name.
 
@@ -1512,12 +1510,12 @@ 
Inherited Members
class - SilvaTx(multitax.multitax.MultiTax): + SilvaTx(multitax.multitax.MultiTax):
-
+
View Source -
class SilvaTx(MultiTax):
+            
class SilvaTx(MultiTax):
     _default_urls = ["https://www.arb-silva.de/fileadmin/silva_databases/current/Exports/taxonomy/tax_slv_ssu_138.1.txt.gz"]
 
     def __init__(self, **kwargs):
@@ -1575,9 +1573,9 @@ 
Inherited Members
SilvaTx(**kwargs)
-
+
View Source -
    def __init__(self, **kwargs):
+            
    def __init__(self, **kwargs):
         super().__init__(**kwargs)
 
@@ -1645,5 +1643,182 @@
Inherited Members

- + \ No newline at end of file diff --git a/docs/multitax/multitax.html b/docs/multitax/multitax.html index 9093235..8118008 100644 --- a/docs/multitax/multitax.html +++ b/docs/multitax/multitax.html @@ -3,30 +3,33 @@ - + multitax.multitax API documentation - - - - - - - -

-multitax.multitax

+multitax.multitax
View Source -
from .utils import *
+            
from .utils import *
 from collections import Counter
 
 
 class MultiTax(object):
 
-    version = "1.1.0"
+    version = "1.1.1"
 
     _default_urls = []
     _default_root_node = "1"
@@ -678,11 +682,11 @@ 

MultiTax:

-
+
View Source -
class MultiTax(object):
+            
class MultiTax(object):
 
-    version = "1.1.0"
+    version = "1.1.1"
 
     _default_urls = []
     _default_root_node = "1"
@@ -1257,9 +1261,9 @@ 

)

-
+
View Source -
    def __init__(self,
+            
    def __init__(self,
                  files: list=None,
                  urls: list=None,
                  output_prefix: str=None,
@@ -1392,10 +1396,11 @@ 

#   - version = '1.1.0' + version = '1.1.1'
+
@@ -1406,9 +1411,9 @@

children(self, node: str):

-
+
View Source -
    def children(self, node: str):
+            
    def children(self, node: str):
         """
         Returns list of direct children nodes of a given node.
         """
@@ -1436,9 +1441,9 @@ 

search_name(self, text: str, rank: str = None, exact: bool = True):

-
+
View Source -
    def search_name(self, text: str, rank: str=None, exact: bool=True):
+            
    def search_name(self, text: str, rank: str=None, exact: bool=True):
         """
         Search node by exact or partial name
 
@@ -1490,9 +1495,9 @@ 

nodes_rank(self, rank: str):

-
+
View Source -
    def nodes_rank(self, rank: str):
+            
    def nodes_rank(self, rank: str):
         """
         Returns list of nodes of a given rank.
         """
@@ -1520,9 +1525,9 @@ 

parent(self, node: str):

-
+
View Source -
    def parent(self, node: str):
+            
    def parent(self, node: str):
         """
         Returns parent node of a given node.
         """
@@ -1547,9 +1552,9 @@ 

rank(self, node: str):

-
+
View Source -
    def rank(self, node: str):
+            
    def rank(self, node: str):
         """
         Returns the rank of a given node.
         """
@@ -1574,9 +1579,9 @@ 

name(self, node: str):

-
+
View Source -
    def name(self, node: str):
+            
    def name(self, node: str):
         """
         Returns name of a given node.
         """
@@ -1601,9 +1606,9 @@ 

latest(self, node: str):

-
+
View Source -
    def latest(self, node: str):
+            
    def latest(self, node: str):
         """
         Returns latest/updated version of a given node.
         If node is already the latests, returns itself.
@@ -1632,9 +1637,9 @@ 

leaves(self, node: str = None):

-
+
View Source -
    def leaves(self, node: str=None):
+            
    def leaves(self, node: str=None):
         """
         Returns a list of leaf nodes of a given node.
         """
@@ -1662,9 +1667,9 @@ 

lineage(self, node: str, root_node: str = None, ranks: list = None):

-
+
View Source -
    def lineage(self, node: str, root_node: str=None, ranks: list=None):
+            
    def lineage(self, node: str, root_node: str=None, ranks: list=None):
         """
         Returns a o list with the lineage of a given node.
         If ranks is provide, returns only nodes annotated with such ranks.
@@ -1727,9 +1732,9 @@ 

rank_lineage(self, node: str, root_node: str = None, ranks: list = None):

-
+
View Source -
    def rank_lineage(self, node: str, root_node: str=None, ranks: list=None):
+            
    def rank_lineage(self, node: str, root_node: str=None, ranks: list=None):
         """
         Returns a list with the rank lineage of a given node.
         """
@@ -1754,9 +1759,9 @@ 

name_lineage(self, node: str, root_node: str = None, ranks: list = None):

-
+
View Source -
    def name_lineage(self, node: str, root_node: str=None, ranks: list=None):
+            
    def name_lineage(self, node: str, root_node: str=None, ranks: list=None):
         """
         Returns a list with the name lineage of a given node.
         """
@@ -1781,9 +1786,9 @@ 

parent_rank(self, node: str, rank: str):

-
+
View Source -
    def parent_rank(self, node: str, rank: str):
+            
    def parent_rank(self, node: str, rank: str):
         """
         Returns the parent node of a given rank in the specified rank.
         """
@@ -1806,9 +1811,9 @@ 

stats(self):

-
+
View Source -
    def stats(self):
+            
    def stats(self):
         """
         Returns a dict with general numbers of the taxonomic tree
 
@@ -1882,9 +1887,9 @@ 

build_lineages(self, root_node: str = None, ranks: list = None):

-
+
View Source -
    def build_lineages(self, root_node: str=None, ranks: list=None):
+            
    def build_lineages(self, root_node: str=None, ranks: list=None):
         """
         Stores lineages in memory for faster access
 
@@ -1912,9 +1917,9 @@ 

clear_lineages(self):

-
+
View Source -
    def clear_lineages(self):
+            
    def clear_lineages(self):
         """
         Clear built lineages.
 
@@ -1940,9 +1945,9 @@ 

check_consistency(self):

-
+
View Source -
    def check_consistency(self):
+            
    def check_consistency(self):
         """
         Checks consistency of the tree
 
@@ -1975,9 +1980,9 @@ 

filter(self, nodes: list, desc: bool = False):

-
+
View Source -
    def filter(self, nodes: list, desc: bool=False):
+            
    def filter(self, nodes: list, desc: bool=False):
         """
         Filters taxonomy given a list of nodes.
         By default keep all the ancestors of the given nodes.
@@ -2090,9 +2095,9 @@ 

):

-
+
View Source -
    def write(self,
+            
    def write(self,
               output_file: str,
               cols: list=["node", "parent", "rank", "name"],
               sep: str="\t",
@@ -2167,5 +2172,182 @@ 

- + \ No newline at end of file diff --git a/docs/multitax/utils.html b/docs/multitax/utils.html index 2f956b0..0bcb78a 100644 --- a/docs/multitax/utils.html +++ b/docs/multitax/utils.html @@ -3,30 +3,33 @@ - + multitax.utils API documentation - - - - - - - -

-multitax.utils

+multitax.utils
View Source -
import os
+            
import os
 import gzip
 import tarfile
 import urllib.request
@@ -242,9 +246,9 @@ 

open_files(files: list):

-
+
View Source -
def open_files(files: list):
+            
def open_files(files: list):
     """
     Parameters:
     * **files** *[list]*: List of files to open (text, ".gz", ".tar.gz", ".tgz")
@@ -289,9 +293,9 @@ 

download_files(urls: list, output_prefix: str = None):

-
+
View Source -
def download_files(urls: list, output_prefix: str=None):
+            
def download_files(urls: list, output_prefix: str=None):
     """
     Download and open files (memory/stream) or write to disk (multitax.utils.save_urls)
 
@@ -352,9 +356,9 @@ 

close_files(fhs: dict):

-
+
View Source -
def close_files(fhs: dict):
+            
def close_files(fhs: dict):
     """
     Parameters:
     * **fhs** *[dict]*: {file: file handler}
@@ -386,9 +390,9 @@ 

save_urls(urls: list, output_prefix: str):

-
+
View Source -
def save_urls(urls: list, output_prefix: str):
+            
def save_urls(urls: list, output_prefix: str):
     """
     Parameters:
     * **urls** *[list]*: List of urls to download
@@ -435,9 +439,9 @@ 

load_url_mem(url: str):

-
+
View Source -
def load_url_mem(url: str):
+            
def load_url_mem(url: str):
     """
     Parameters:
     * **url** *[str]*: URL to load into memory
@@ -483,9 +487,9 @@ 

check_file(file: str):

-
+
View Source -
def check_file(file: str):
+            
def check_file(file: str):
     if not os.path.isfile(file):
         raise FileNotFoundError(file + " file do not exist")
     if os.path.getsize(file) == 0:
@@ -505,9 +509,9 @@ 

check_no_file(file: str):

-
+
View Source -
def check_no_file(file: str):
+            
def check_no_file(file: str):
     if os.path.isfile(file):
         raise FileExistsError(file)
 
@@ -525,9 +529,9 @@

check_dir(prefix: str):

-
+
View Source -
def check_dir(prefix: str):
+            
def check_dir(prefix: str):
     abs_path = os.path.dirname(os.path.abspath(prefix))
     if not os.path.exists(abs_path):
         raise NotADirectoryError(abs_path)
@@ -546,9 +550,9 @@ 

reverse_dict(d: dict):

-
+
View Source -
def reverse_dict(d: dict):
+            
def reverse_dict(d: dict):
     rd = {}
     for k, v in d.items():
         if v not in rd:
@@ -570,9 +574,9 @@ 

join_check(elements, sep: str):

-
+
View Source -
def join_check(elements, sep: str):
+            
def join_check(elements, sep: str):
     if elements:
         return sep.join(map(str, elements))
     else:
@@ -592,9 +596,9 @@ 

filter_function(elements, function, value):

-
+
View Source -
def filter_function(elements, function, value):
+            
def filter_function(elements, function, value):
     return [elements[i] for i, v in enumerate(map(function, elements)) if v == value]
 
@@ -604,5 +608,182 @@

- + \ No newline at end of file diff --git a/docs/search.js b/docs/search.js new file mode 100644 index 0000000..18b6aae --- /dev/null +++ b/docs/search.js @@ -0,0 +1,46 @@ +window.pdocSearch = (function(){ +/** elasticlunr - http://weixsong.github.io * Copyright (C) 2017 Oliver Nightingale * Copyright (C) 2017 Wei Song * MIT Licensed */!function(){function e(e){if(null===e||"object"!=typeof e)return e;var t=e.constructor();for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n]);return t}var t=function(e){var n=new t.Index;return n.pipeline.add(t.trimmer,t.stopWordFilter,t.stemmer),e&&e.call(n,n),n};t.version="0.9.5",lunr=t,t.utils={},t.utils.warn=function(e){return function(t){e.console&&console.warn&&console.warn(t)}}(this),t.utils.toString=function(e){return void 0===e||null===e?"":e.toString()},t.EventEmitter=function(){this.events={}},t.EventEmitter.prototype.addListener=function(){var e=Array.prototype.slice.call(arguments),t=e.pop(),n=e;if("function"!=typeof t)throw new TypeError("last argument must be a function");n.forEach(function(e){this.hasHandler(e)||(this.events[e]=[]),this.events[e].push(t)},this)},t.EventEmitter.prototype.removeListener=function(e,t){if(this.hasHandler(e)){var n=this.events[e].indexOf(t);-1!==n&&(this.events[e].splice(n,1),0==this.events[e].length&&delete this.events[e])}},t.EventEmitter.prototype.emit=function(e){if(this.hasHandler(e)){var t=Array.prototype.slice.call(arguments,1);this.events[e].forEach(function(e){e.apply(void 0,t)},this)}},t.EventEmitter.prototype.hasHandler=function(e){return e in this.events},t.tokenizer=function(e){if(!arguments.length||null===e||void 0===e)return[];if(Array.isArray(e)){var n=e.filter(function(e){return null===e||void 0===e?!1:!0});n=n.map(function(e){return t.utils.toString(e).toLowerCase()});var i=[];return n.forEach(function(e){var n=e.split(t.tokenizer.seperator);i=i.concat(n)},this),i}return e.toString().trim().toLowerCase().split(t.tokenizer.seperator)},t.tokenizer.defaultSeperator=/[\s\-]+/,t.tokenizer.seperator=t.tokenizer.defaultSeperator,t.tokenizer.setSeperator=function(e){null!==e&&void 0!==e&&"object"==typeof e&&(t.tokenizer.seperator=e)},t.tokenizer.resetSeperator=function(){t.tokenizer.seperator=t.tokenizer.defaultSeperator},t.tokenizer.getSeperator=function(){return t.tokenizer.seperator},t.Pipeline=function(){this._queue=[]},t.Pipeline.registeredFunctions={},t.Pipeline.registerFunction=function(e,n){n in t.Pipeline.registeredFunctions&&t.utils.warn("Overwriting existing registered function: "+n),e.label=n,t.Pipeline.registeredFunctions[n]=e},t.Pipeline.getRegisteredFunction=function(e){return e in t.Pipeline.registeredFunctions!=!0?null:t.Pipeline.registeredFunctions[e]},t.Pipeline.warnIfFunctionNotRegistered=function(e){var n=e.label&&e.label in this.registeredFunctions;n||t.utils.warn("Function is not registered with pipeline. This may cause problems when serialising the index.\n",e)},t.Pipeline.load=function(e){var n=new t.Pipeline;return e.forEach(function(e){var i=t.Pipeline.getRegisteredFunction(e);if(!i)throw new Error("Cannot load un-registered function: "+e);n.add(i)}),n},t.Pipeline.prototype.add=function(){var e=Array.prototype.slice.call(arguments);e.forEach(function(e){t.Pipeline.warnIfFunctionNotRegistered(e),this._queue.push(e)},this)},t.Pipeline.prototype.after=function(e,n){t.Pipeline.warnIfFunctionNotRegistered(n);var i=this._queue.indexOf(e);if(-1===i)throw new Error("Cannot find existingFn");this._queue.splice(i+1,0,n)},t.Pipeline.prototype.before=function(e,n){t.Pipeline.warnIfFunctionNotRegistered(n);var i=this._queue.indexOf(e);if(-1===i)throw new Error("Cannot find existingFn");this._queue.splice(i,0,n)},t.Pipeline.prototype.remove=function(e){var t=this._queue.indexOf(e);-1!==t&&this._queue.splice(t,1)},t.Pipeline.prototype.run=function(e){for(var t=[],n=e.length,i=this._queue.length,o=0;n>o;o++){for(var r=e[o],s=0;i>s&&(r=this._queue[s](r,o,e),void 0!==r&&null!==r);s++);void 0!==r&&null!==r&&t.push(r)}return t},t.Pipeline.prototype.reset=function(){this._queue=[]},t.Pipeline.prototype.get=function(){return this._queue},t.Pipeline.prototype.toJSON=function(){return this._queue.map(function(e){return t.Pipeline.warnIfFunctionNotRegistered(e),e.label})},t.Index=function(){this._fields=[],this._ref="id",this.pipeline=new t.Pipeline,this.documentStore=new t.DocumentStore,this.index={},this.eventEmitter=new t.EventEmitter,this._idfCache={},this.on("add","remove","update",function(){this._idfCache={}}.bind(this))},t.Index.prototype.on=function(){var e=Array.prototype.slice.call(arguments);return this.eventEmitter.addListener.apply(this.eventEmitter,e)},t.Index.prototype.off=function(e,t){return this.eventEmitter.removeListener(e,t)},t.Index.load=function(e){e.version!==t.version&&t.utils.warn("version mismatch: current "+t.version+" importing "+e.version);var n=new this;n._fields=e.fields,n._ref=e.ref,n.documentStore=t.DocumentStore.load(e.documentStore),n.pipeline=t.Pipeline.load(e.pipeline),n.index={};for(var i in e.index)n.index[i]=t.InvertedIndex.load(e.index[i]);return n},t.Index.prototype.addField=function(e){return this._fields.push(e),this.index[e]=new t.InvertedIndex,this},t.Index.prototype.setRef=function(e){return this._ref=e,this},t.Index.prototype.saveDocument=function(e){return this.documentStore=new t.DocumentStore(e),this},t.Index.prototype.addDoc=function(e,n){if(e){var n=void 0===n?!0:n,i=e[this._ref];this.documentStore.addDoc(i,e),this._fields.forEach(function(n){var o=this.pipeline.run(t.tokenizer(e[n]));this.documentStore.addFieldLength(i,n,o.length);var r={};o.forEach(function(e){e in r?r[e]+=1:r[e]=1},this);for(var s in r){var u=r[s];u=Math.sqrt(u),this.index[n].addToken(s,{ref:i,tf:u})}},this),n&&this.eventEmitter.emit("add",e,this)}},t.Index.prototype.removeDocByRef=function(e){if(e&&this.documentStore.isDocStored()!==!1&&this.documentStore.hasDoc(e)){var t=this.documentStore.getDoc(e);this.removeDoc(t,!1)}},t.Index.prototype.removeDoc=function(e,n){if(e){var n=void 0===n?!0:n,i=e[this._ref];this.documentStore.hasDoc(i)&&(this.documentStore.removeDoc(i),this._fields.forEach(function(n){var o=this.pipeline.run(t.tokenizer(e[n]));o.forEach(function(e){this.index[n].removeToken(e,i)},this)},this),n&&this.eventEmitter.emit("remove",e,this))}},t.Index.prototype.updateDoc=function(e,t){var t=void 0===t?!0:t;this.removeDocByRef(e[this._ref],!1),this.addDoc(e,!1),t&&this.eventEmitter.emit("update",e,this)},t.Index.prototype.idf=function(e,t){var n="@"+t+"/"+e;if(Object.prototype.hasOwnProperty.call(this._idfCache,n))return this._idfCache[n];var i=this.index[t].getDocFreq(e),o=1+Math.log(this.documentStore.length/(i+1));return this._idfCache[n]=o,o},t.Index.prototype.getFields=function(){return this._fields.slice()},t.Index.prototype.search=function(e,n){if(!e)return[];e="string"==typeof e?{any:e}:JSON.parse(JSON.stringify(e));var i=null;null!=n&&(i=JSON.stringify(n));for(var o=new t.Configuration(i,this.getFields()).get(),r={},s=Object.keys(e),u=0;u0&&t.push(e);for(var i in n)"docs"!==i&&"df"!==i&&this.expandToken(e+i,t,n[i]);return t},t.InvertedIndex.prototype.toJSON=function(){return{root:this.root}},t.Configuration=function(e,n){var e=e||"";if(void 0==n||null==n)throw new Error("fields should not be null");this.config={};var i;try{i=JSON.parse(e),this.buildUserConfig(i,n)}catch(o){t.utils.warn("user configuration parse failed, will use default configuration"),this.buildDefaultConfig(n)}},t.Configuration.prototype.buildDefaultConfig=function(e){this.reset(),e.forEach(function(e){this.config[e]={boost:1,bool:"OR",expand:!1}},this)},t.Configuration.prototype.buildUserConfig=function(e,n){var i="OR",o=!1;if(this.reset(),"bool"in e&&(i=e.bool||i),"expand"in e&&(o=e.expand||o),"fields"in e)for(var r in e.fields)if(n.indexOf(r)>-1){var s=e.fields[r],u=o;void 0!=s.expand&&(u=s.expand),this.config[r]={boost:s.boost||0===s.boost?s.boost:1,bool:s.bool||i,expand:u}}else t.utils.warn("field name in user configuration not found in index instance fields");else this.addAllFields2UserConfig(i,o,n)},t.Configuration.prototype.addAllFields2UserConfig=function(e,t,n){n.forEach(function(n){this.config[n]={boost:1,bool:e,expand:t}},this)},t.Configuration.prototype.get=function(){return this.config},t.Configuration.prototype.reset=function(){this.config={}},lunr.SortedSet=function(){this.length=0,this.elements=[]},lunr.SortedSet.load=function(e){var t=new this;return t.elements=e,t.length=e.length,t},lunr.SortedSet.prototype.add=function(){var e,t;for(e=0;e1;){if(r===e)return o;e>r&&(t=o),r>e&&(n=o),i=n-t,o=t+Math.floor(i/2),r=this.elements[o]}return r===e?o:-1},lunr.SortedSet.prototype.locationFor=function(e){for(var t=0,n=this.elements.length,i=n-t,o=t+Math.floor(i/2),r=this.elements[o];i>1;)e>r&&(t=o),r>e&&(n=o),i=n-t,o=t+Math.floor(i/2),r=this.elements[o];return r>e?o:e>r?o+1:void 0},lunr.SortedSet.prototype.intersect=function(e){for(var t=new lunr.SortedSet,n=0,i=0,o=this.length,r=e.length,s=this.elements,u=e.elements;;){if(n>o-1||i>r-1)break;s[n]!==u[i]?s[n]u[i]&&i++:(t.add(s[n]),n++,i++)}return t},lunr.SortedSet.prototype.clone=function(){var e=new lunr.SortedSet;return e.elements=this.toArray(),e.length=e.elements.length,e},lunr.SortedSet.prototype.union=function(e){var t,n,i;this.length>=e.length?(t=this,n=e):(t=e,n=this),i=t.clone();for(var o=0,r=n.toArray();o

\n"}, {"fullname": "multitax.CustomTx", "modulename": "multitax", "qualname": "CustomTx", "type": "class", "doc": "

\n", "bases": "multitax.multitax.MultiTax"}, {"fullname": "multitax.CustomTx.__init__", "modulename": "multitax", "qualname": "CustomTx.__init__", "type": "function", "doc": "

CustomTx()

\n\n

Parameters:

\n\n
    \n
  • cols [list, dict]: List of fields to be parsed or a dictionary with {field: column index}. Options: \"node\", \"parent\", \"rank\", \"name\"
  • \n
  • sep [str]: Separator of fields
  • \n
  • **kwargs defined at multitax.multitax.MultiTax
  • \n
\n\n

Example:

\n\n
tax_custom1 = CustomTx(files=\"my_custom_tax.tsv\", cols=[\"node\",\"parent\",\"rank\"])\ntax_custom2 = CustomTx(files=\"my_custom_tax.tsv\", cols={\"node\": 0, \"parent\": 1, \"name\": 5, \"rank\": 3})\n
\n", "signature": "(\n self,\n cols: list = ['node', 'parent', 'rank', 'name'],\n sep: str = '\\t',\n **kwargs\n)", "funcdef": "def"}, {"fullname": "multitax.DummyTx", "modulename": "multitax", "qualname": "DummyTx", "type": "class", "doc": "

\n", "bases": "multitax.multitax.MultiTax"}, {"fullname": "multitax.DummyTx.__init__", "modulename": "multitax", "qualname": "DummyTx.__init__", "type": "function", "doc": "

DummyTx() - Dummy empty taxonomy

\n\n

Parameters:

\n\n
    \n
  • **kwargs defined at multitax.multitax.MultiTax
  • \n
\n", "signature": "(self, **kwargs)", "funcdef": "def"}, {"fullname": "multitax.GreengenesTx", "modulename": "multitax", "qualname": "GreengenesTx", "type": "class", "doc": "

\n", "bases": "multitax.multitax.MultiTax"}, {"fullname": "multitax.GreengenesTx.__init__", "modulename": "multitax", "qualname": "GreengenesTx.__init__", "type": "function", "doc": "

Main constructor of MultiTax and sub-classes

\n\n

Parameters:

\n\n
    \n
  • files [str, list]: One or more local files to parse.
  • \n
  • urls [str, list]: One or more urls to download and parse.
  • \n
  • output_prefix [str]: Directory to write downloaded files.
  • \n
  • root_node [str]: Define an alternative root node.
  • \n
  • root_parent [str]: Define the root parent node identifier.
  • \n
  • root_name [str]: Define an alternative root name. Set to None to use original name.
  • \n
  • root_rank [str]: Define an alternative root rank. Set to None to use original name.
  • \n
  • undefined_node [str]: Define a default return value for undefined nodes.
  • \n
  • undefined_name [str]: Define a default return value for undefined names.
  • \n
  • undefined_rank [str]: Define a default return value for undefined ranks.
  • \n
  • build_node_children [bool]: Build node,children dict (otherwise it will be created on first use).
  • \n
  • build_name_nodes [bool]: Build name,nodes dict (otherwise it will be created on first use).
  • \n
  • build_rank_nodes [bool]: Build rank,nodes dict (otherwise it will be created on first use).
  • \n
  • extended_names [bool]: Parse extended names if available.
  • \n
\n\n

Example:

\n\n
tax_ncbi = NcbiTx()\ntax_gtdb = GtdbTx(files=[\"file1.gz\", \"file2.txt\"])\ntax_silva = SilvaTx(urls=[\"https://www.arb-silva.de/fileadmin/silva_databases/current/Exports/taxonomy/tax_slv_lsu_138.1.txt.gz\"])\ntax_ott = OttTx(root_node=\"844192\")\ntax_gg = GreengenesTx(output_prefix=\"save/to/prefix_\")\n
\n", "signature": "(self, **kwargs)", "funcdef": "def"}, {"fullname": "multitax.GtdbTx", "modulename": "multitax", "qualname": "GtdbTx", "type": "class", "doc": "

\n", "bases": "multitax.multitax.MultiTax"}, {"fullname": "multitax.GtdbTx.__init__", "modulename": "multitax", "qualname": "GtdbTx.__init__", "type": "function", "doc": "

Main constructor of MultiTax and sub-classes

\n\n

Parameters:

\n\n
    \n
  • files [str, list]: One or more local files to parse.
  • \n
  • urls [str, list]: One or more urls to download and parse.
  • \n
  • output_prefix [str]: Directory to write downloaded files.
  • \n
  • root_node [str]: Define an alternative root node.
  • \n
  • root_parent [str]: Define the root parent node identifier.
  • \n
  • root_name [str]: Define an alternative root name. Set to None to use original name.
  • \n
  • root_rank [str]: Define an alternative root rank. Set to None to use original name.
  • \n
  • undefined_node [str]: Define a default return value for undefined nodes.
  • \n
  • undefined_name [str]: Define a default return value for undefined names.
  • \n
  • undefined_rank [str]: Define a default return value for undefined ranks.
  • \n
  • build_node_children [bool]: Build node,children dict (otherwise it will be created on first use).
  • \n
  • build_name_nodes [bool]: Build name,nodes dict (otherwise it will be created on first use).
  • \n
  • build_rank_nodes [bool]: Build rank,nodes dict (otherwise it will be created on first use).
  • \n
  • extended_names [bool]: Parse extended names if available.
  • \n
\n\n

Example:

\n\n
tax_ncbi = NcbiTx()\ntax_gtdb = GtdbTx(files=[\"file1.gz\", \"file2.txt\"])\ntax_silva = SilvaTx(urls=[\"https://www.arb-silva.de/fileadmin/silva_databases/current/Exports/taxonomy/tax_slv_lsu_138.1.txt.gz\"])\ntax_ott = OttTx(root_node=\"844192\")\ntax_gg = GreengenesTx(output_prefix=\"save/to/prefix_\")\n
\n", "signature": "(self, **kwargs)", "funcdef": "def"}, {"fullname": "multitax.NcbiTx", "modulename": "multitax", "qualname": "NcbiTx", "type": "class", "doc": "

\n", "bases": "multitax.multitax.MultiTax"}, {"fullname": "multitax.NcbiTx.__init__", "modulename": "multitax", "qualname": "NcbiTx.__init__", "type": "function", "doc": "

Main constructor of MultiTax and sub-classes

\n\n

Parameters:

\n\n
    \n
  • files [str, list]: One or more local files to parse.
  • \n
  • urls [str, list]: One or more urls to download and parse.
  • \n
  • output_prefix [str]: Directory to write downloaded files.
  • \n
  • root_node [str]: Define an alternative root node.
  • \n
  • root_parent [str]: Define the root parent node identifier.
  • \n
  • root_name [str]: Define an alternative root name. Set to None to use original name.
  • \n
  • root_rank [str]: Define an alternative root rank. Set to None to use original name.
  • \n
  • undefined_node [str]: Define a default return value for undefined nodes.
  • \n
  • undefined_name [str]: Define a default return value for undefined names.
  • \n
  • undefined_rank [str]: Define a default return value for undefined ranks.
  • \n
  • build_node_children [bool]: Build node,children dict (otherwise it will be created on first use).
  • \n
  • build_name_nodes [bool]: Build name,nodes dict (otherwise it will be created on first use).
  • \n
  • build_rank_nodes [bool]: Build rank,nodes dict (otherwise it will be created on first use).
  • \n
  • extended_names [bool]: Parse extended names if available.
  • \n
\n\n

Example:

\n\n
tax_ncbi = NcbiTx()\ntax_gtdb = GtdbTx(files=[\"file1.gz\", \"file2.txt\"])\ntax_silva = SilvaTx(urls=[\"https://www.arb-silva.de/fileadmin/silva_databases/current/Exports/taxonomy/tax_slv_lsu_138.1.txt.gz\"])\ntax_ott = OttTx(root_node=\"844192\")\ntax_gg = GreengenesTx(output_prefix=\"save/to/prefix_\")\n
\n", "signature": "(self, **kwargs)", "funcdef": "def"}, {"fullname": "multitax.NcbiTx.merged", "modulename": "multitax", "qualname": "NcbiTx.merged", "type": "function", "doc": "

Returns relative entry from the merged.dmp file of a given node.

\n", "signature": "(self, node: str)", "funcdef": "def"}, {"fullname": "multitax.NcbiTx.latest", "modulename": "multitax", "qualname": "NcbiTx.latest", "type": "function", "doc": "

Returns latest/updated version of a given node.\nIf node is already the latests, returns itself.\nMainly used for NCBI (merged.dmp) and OTT (forwards.tsv)

\n", "signature": "(self, node: str)", "funcdef": "def"}, {"fullname": "multitax.NcbiTx.stats", "modulename": "multitax", "qualname": "NcbiTx.stats", "type": "function", "doc": "

Returns a dict with general numbers of the taxonomic tree

\n\n

Example:

\n\n
from pprint import pprint\nfrom multitax import GtdbTx\ntax = GtdbTx()\n\npprint(tax.stats())\n{'leaves': 30238,\n 'names': 42739,\n 'nodes': 42739,\n 'ranked_leaves': Counter({'species': 30238}),\n 'ranked_nodes': Counter({'species': 30238,\n                          'genus': 8778,\n                          'family': 2323,\n                          'order': 930,\n                          'class': 337,\n                          'phylum': 131,\n                          'domain': 1,\n                          'root': 1}),\n 'ranks': 42739}\n
\n", "signature": "(self)", "funcdef": "def"}, {"fullname": "multitax.NcbiTx.search_name", "modulename": "multitax", "qualname": "NcbiTx.search_name", "type": "function", "doc": "

Search node by exact or partial name.

\n\n

Default order (can be skipped with force_extended=True):

\n\n

1) Search names defined as \"scientific name\" on nodes.dmp

\n\n

2) If nothing was found, search text in all other categories (must be activated with NcbiTx(extended_names=True))

\n\n

Parameters:

\n\n
    \n
  • text [str]: Text to search.
  • \n
  • rank [str]: Filter results by rank.
  • \n
  • exact [bool]: Exact or partial name search (both case sensitive).
  • \n
  • force_extended [bool]: Search for text in all categories at once.
  • \n
\n\n

Returns: list of matching nodes

\n", "signature": "(\n self,\n text: str,\n rank: str = None,\n exact: bool = True,\n force_extended: bool = False\n)", "funcdef": "def"}, {"fullname": "multitax.OttTx", "modulename": "multitax", "qualname": "OttTx", "type": "class", "doc": "

\n", "bases": "multitax.multitax.MultiTax"}, {"fullname": "multitax.OttTx.__init__", "modulename": "multitax", "qualname": "OttTx.__init__", "type": "function", "doc": "

Main constructor of MultiTax and sub-classes

\n\n

Parameters:

\n\n
    \n
  • files [str, list]: One or more local files to parse.
  • \n
  • urls [str, list]: One or more urls to download and parse.
  • \n
  • output_prefix [str]: Directory to write downloaded files.
  • \n
  • root_node [str]: Define an alternative root node.
  • \n
  • root_parent [str]: Define the root parent node identifier.
  • \n
  • root_name [str]: Define an alternative root name. Set to None to use original name.
  • \n
  • root_rank [str]: Define an alternative root rank. Set to None to use original name.
  • \n
  • undefined_node [str]: Define a default return value for undefined nodes.
  • \n
  • undefined_name [str]: Define a default return value for undefined names.
  • \n
  • undefined_rank [str]: Define a default return value for undefined ranks.
  • \n
  • build_node_children [bool]: Build node,children dict (otherwise it will be created on first use).
  • \n
  • build_name_nodes [bool]: Build name,nodes dict (otherwise it will be created on first use).
  • \n
  • build_rank_nodes [bool]: Build rank,nodes dict (otherwise it will be created on first use).
  • \n
  • extended_names [bool]: Parse extended names if available.
  • \n
\n\n

Example:

\n\n
tax_ncbi = NcbiTx()\ntax_gtdb = GtdbTx(files=[\"file1.gz\", \"file2.txt\"])\ntax_silva = SilvaTx(urls=[\"https://www.arb-silva.de/fileadmin/silva_databases/current/Exports/taxonomy/tax_slv_lsu_138.1.txt.gz\"])\ntax_ott = OttTx(root_node=\"844192\")\ntax_gg = GreengenesTx(output_prefix=\"save/to/prefix_\")\n
\n", "signature": "(self, **kwargs)", "funcdef": "def"}, {"fullname": "multitax.OttTx.forwards", "modulename": "multitax", "qualname": "OttTx.forwards", "type": "function", "doc": "

Returns relative entry from the forwards.tsv file of a given node.

\n", "signature": "(self, node: str)", "funcdef": "def"}, {"fullname": "multitax.OttTx.latest", "modulename": "multitax", "qualname": "OttTx.latest", "type": "function", "doc": "

Returns latest/updated version of a given node.\nIf node is already the latests, returns itself.\nMainly used for NCBI (merged.dmp) and OTT (forwards.tsv)

\n", "signature": "(self, node: str)", "funcdef": "def"}, {"fullname": "multitax.OttTx.stats", "modulename": "multitax", "qualname": "OttTx.stats", "type": "function", "doc": "

Returns a dict with general numbers of the taxonomic tree

\n\n

Example:

\n\n
from pprint import pprint\nfrom multitax import GtdbTx\ntax = GtdbTx()\n\npprint(tax.stats())\n{'leaves': 30238,\n 'names': 42739,\n 'nodes': 42739,\n 'ranked_leaves': Counter({'species': 30238}),\n 'ranked_nodes': Counter({'species': 30238,\n                          'genus': 8778,\n                          'family': 2323,\n                          'order': 930,\n                          'class': 337,\n                          'phylum': 131,\n                          'domain': 1,\n                          'root': 1}),\n 'ranks': 42739}\n
\n", "signature": "(self)", "funcdef": "def"}, {"fullname": "multitax.OttTx.search_name", "modulename": "multitax", "qualname": "OttTx.search_name", "type": "function", "doc": "

Search node by exact or partial name.

\n\n

Default order (can be skipped with force_extended=True):

\n\n

1) Search default names defined on \"taxonomy.tsv\"

\n\n

2) If nothing was found, search in all other names defined on \"synonyms.tsv\" (must be activated with OttTx(extended_names=True))

\n\n

Parameters:

\n\n
    \n
  • text [str]: Text to search.
  • \n
  • rank [str]: Filter results by rank.
  • \n
  • exact [bool]: Exact or partial name search (both case sensitive).
  • \n
  • force_extended [bool]: Search for text in all categories at once.
  • \n
\n\n

Returns: list of matching nodes

\n", "signature": "(\n self,\n text: str,\n rank: str = None,\n exact: bool = True,\n force_extended: bool = False\n)", "funcdef": "def"}, {"fullname": "multitax.SilvaTx", "modulename": "multitax", "qualname": "SilvaTx", "type": "class", "doc": "

\n", "bases": "multitax.multitax.MultiTax"}, {"fullname": "multitax.SilvaTx.__init__", "modulename": "multitax", "qualname": "SilvaTx.__init__", "type": "function", "doc": "

Main constructor of MultiTax and sub-classes

\n\n

Parameters:

\n\n
    \n
  • files [str, list]: One or more local files to parse.
  • \n
  • urls [str, list]: One or more urls to download and parse.
  • \n
  • output_prefix [str]: Directory to write downloaded files.
  • \n
  • root_node [str]: Define an alternative root node.
  • \n
  • root_parent [str]: Define the root parent node identifier.
  • \n
  • root_name [str]: Define an alternative root name. Set to None to use original name.
  • \n
  • root_rank [str]: Define an alternative root rank. Set to None to use original name.
  • \n
  • undefined_node [str]: Define a default return value for undefined nodes.
  • \n
  • undefined_name [str]: Define a default return value for undefined names.
  • \n
  • undefined_rank [str]: Define a default return value for undefined ranks.
  • \n
  • build_node_children [bool]: Build node,children dict (otherwise it will be created on first use).
  • \n
  • build_name_nodes [bool]: Build name,nodes dict (otherwise it will be created on first use).
  • \n
  • build_rank_nodes [bool]: Build rank,nodes dict (otherwise it will be created on first use).
  • \n
  • extended_names [bool]: Parse extended names if available.
  • \n
\n\n

Example:

\n\n
tax_ncbi = NcbiTx()\ntax_gtdb = GtdbTx(files=[\"file1.gz\", \"file2.txt\"])\ntax_silva = SilvaTx(urls=[\"https://www.arb-silva.de/fileadmin/silva_databases/current/Exports/taxonomy/tax_slv_lsu_138.1.txt.gz\"])\ntax_ott = OttTx(root_node=\"844192\")\ntax_gg = GreengenesTx(output_prefix=\"save/to/prefix_\")\n
\n", "signature": "(self, **kwargs)", "funcdef": "def"}, {"fullname": "multitax.multitax", "modulename": "multitax.multitax", "type": "module", "doc": "

\n"}, {"fullname": "multitax.multitax.MultiTax", "modulename": "multitax.multitax", "qualname": "MultiTax", "type": "class", "doc": "

\n"}, {"fullname": "multitax.multitax.MultiTax.__init__", "modulename": "multitax.multitax", "qualname": "MultiTax.__init__", "type": "function", "doc": "

Main constructor of MultiTax and sub-classes

\n\n

Parameters:

\n\n
    \n
  • files [str, list]: One or more local files to parse.
  • \n
  • urls [str, list]: One or more urls to download and parse.
  • \n
  • output_prefix [str]: Directory to write downloaded files.
  • \n
  • root_node [str]: Define an alternative root node.
  • \n
  • root_parent [str]: Define the root parent node identifier.
  • \n
  • root_name [str]: Define an alternative root name. Set to None to use original name.
  • \n
  • root_rank [str]: Define an alternative root rank. Set to None to use original name.
  • \n
  • undefined_node [str]: Define a default return value for undefined nodes.
  • \n
  • undefined_name [str]: Define a default return value for undefined names.
  • \n
  • undefined_rank [str]: Define a default return value for undefined ranks.
  • \n
  • build_node_children [bool]: Build node,children dict (otherwise it will be created on first use).
  • \n
  • build_name_nodes [bool]: Build name,nodes dict (otherwise it will be created on first use).
  • \n
  • build_rank_nodes [bool]: Build rank,nodes dict (otherwise it will be created on first use).
  • \n
  • extended_names [bool]: Parse extended names if available.
  • \n
\n\n

Example:

\n\n
tax_ncbi = NcbiTx()\ntax_gtdb = GtdbTx(files=[\"file1.gz\", \"file2.txt\"])\ntax_silva = SilvaTx(urls=[\"https://www.arb-silva.de/fileadmin/silva_databases/current/Exports/taxonomy/tax_slv_lsu_138.1.txt.gz\"])\ntax_ott = OttTx(root_node=\"844192\")\ntax_gg = GreengenesTx(output_prefix=\"save/to/prefix_\")\n
\n", "signature": "(\n self,\n files: list = None,\n urls: list = None,\n output_prefix: str = None,\n root_node: str = None,\n root_parent: str = '0',\n root_name: str = None,\n root_rank: str = None,\n undefined_node: str = None,\n undefined_name: str = None,\n undefined_rank: str = None,\n build_name_nodes: bool = False,\n build_node_children: bool = False,\n build_rank_nodes: bool = False,\n extended_names: bool = False\n)", "funcdef": "def"}, {"fullname": "multitax.multitax.MultiTax.version", "modulename": "multitax.multitax", "qualname": "MultiTax.version", "type": "variable", "doc": "

\n", "default_value": " = '1.1.1'"}, {"fullname": "multitax.multitax.MultiTax.children", "modulename": "multitax.multitax", "qualname": "MultiTax.children", "type": "function", "doc": "

Returns list of direct children nodes of a given node.

\n", "signature": "(self, node: str)", "funcdef": "def"}, {"fullname": "multitax.multitax.MultiTax.search_name", "modulename": "multitax.multitax", "qualname": "MultiTax.search_name", "type": "function", "doc": "

Search node by exact or partial name

\n\n

Parameters:

\n\n
    \n
  • text [str]: Text to search.
  • \n
  • rank [str]: Filter results by rank.
  • \n
  • exact [bool]: Exact or partial name search (both case sensitive).
  • \n
\n\n

Returns: list of matching nodes

\n", "signature": "(self, text: str, rank: str = None, exact: bool = True)", "funcdef": "def"}, {"fullname": "multitax.multitax.MultiTax.nodes_rank", "modulename": "multitax.multitax", "qualname": "MultiTax.nodes_rank", "type": "function", "doc": "

Returns list of nodes of a given rank.

\n", "signature": "(self, rank: str)", "funcdef": "def"}, {"fullname": "multitax.multitax.MultiTax.parent", "modulename": "multitax.multitax", "qualname": "MultiTax.parent", "type": "function", "doc": "

Returns parent node of a given node.

\n", "signature": "(self, node: str)", "funcdef": "def"}, {"fullname": "multitax.multitax.MultiTax.rank", "modulename": "multitax.multitax", "qualname": "MultiTax.rank", "type": "function", "doc": "

Returns the rank of a given node.

\n", "signature": "(self, node: str)", "funcdef": "def"}, {"fullname": "multitax.multitax.MultiTax.name", "modulename": "multitax.multitax", "qualname": "MultiTax.name", "type": "function", "doc": "

Returns name of a given node.

\n", "signature": "(self, node: str)", "funcdef": "def"}, {"fullname": "multitax.multitax.MultiTax.latest", "modulename": "multitax.multitax", "qualname": "MultiTax.latest", "type": "function", "doc": "

Returns latest/updated version of a given node.\nIf node is already the latests, returns itself.\nMainly used for NCBI (merged.dmp) and OTT (forwards.tsv)

\n", "signature": "(self, node: str)", "funcdef": "def"}, {"fullname": "multitax.multitax.MultiTax.leaves", "modulename": "multitax.multitax", "qualname": "MultiTax.leaves", "type": "function", "doc": "

Returns a list of leaf nodes of a given node.

\n", "signature": "(self, node: str = None)", "funcdef": "def"}, {"fullname": "multitax.multitax.MultiTax.lineage", "modulename": "multitax.multitax", "qualname": "MultiTax.lineage", "type": "function", "doc": "

Returns a o list with the lineage of a given node.\nIf ranks is provide, returns only nodes annotated with such ranks.\nIf root_node is provided, use it instead of default root of tree.

\n", "signature": "(self, node: str, root_node: str = None, ranks: list = None)", "funcdef": "def"}, {"fullname": "multitax.multitax.MultiTax.rank_lineage", "modulename": "multitax.multitax", "qualname": "MultiTax.rank_lineage", "type": "function", "doc": "

Returns a list with the rank lineage of a given node.

\n", "signature": "(self, node: str, root_node: str = None, ranks: list = None)", "funcdef": "def"}, {"fullname": "multitax.multitax.MultiTax.name_lineage", "modulename": "multitax.multitax", "qualname": "MultiTax.name_lineage", "type": "function", "doc": "

Returns a list with the name lineage of a given node.

\n", "signature": "(self, node: str, root_node: str = None, ranks: list = None)", "funcdef": "def"}, {"fullname": "multitax.multitax.MultiTax.parent_rank", "modulename": "multitax.multitax", "qualname": "MultiTax.parent_rank", "type": "function", "doc": "

Returns the parent node of a given rank in the specified rank.

\n", "signature": "(self, node: str, rank: str)", "funcdef": "def"}, {"fullname": "multitax.multitax.MultiTax.stats", "modulename": "multitax.multitax", "qualname": "MultiTax.stats", "type": "function", "doc": "

Returns a dict with general numbers of the taxonomic tree

\n\n

Example:

\n\n
from pprint import pprint\nfrom multitax import GtdbTx\ntax = GtdbTx()\n\npprint(tax.stats())\n{'leaves': 30238,\n 'names': 42739,\n 'nodes': 42739,\n 'ranked_leaves': Counter({'species': 30238}),\n 'ranked_nodes': Counter({'species': 30238,\n                          'genus': 8778,\n                          'family': 2323,\n                          'order': 930,\n                          'class': 337,\n                          'phylum': 131,\n                          'domain': 1,\n                          'root': 1}),\n 'ranks': 42739}\n
\n", "signature": "(self)", "funcdef": "def"}, {"fullname": "multitax.multitax.MultiTax.build_lineages", "modulename": "multitax.multitax", "qualname": "MultiTax.build_lineages", "type": "function", "doc": "

Stores lineages in memory for faster access

\n\n

Returns: None

\n", "signature": "(self, root_node: str = None, ranks: list = None)", "funcdef": "def"}, {"fullname": "multitax.multitax.MultiTax.clear_lineages", "modulename": "multitax.multitax", "qualname": "MultiTax.clear_lineages", "type": "function", "doc": "

Clear built lineages.

\n\n

Returns: None

\n", "signature": "(self)", "funcdef": "def"}, {"fullname": "multitax.multitax.MultiTax.check_consistency", "modulename": "multitax.multitax", "qualname": "MultiTax.check_consistency", "type": "function", "doc": "

Checks consistency of the tree

\n\n

Returns: raise an AssertionError otherwise None

\n", "signature": "(self)", "funcdef": "def"}, {"fullname": "multitax.multitax.MultiTax.filter", "modulename": "multitax.multitax", "qualname": "MultiTax.filter", "type": "function", "doc": "

Filters taxonomy given a list of nodes.\nBy default keep all the ancestors of the given nodes.\nIf desc=True, keep all descendants instead.\nDeletes built lineages.

\n\n

Returns: None

\n\n

Example:

\n\n
from multitax import GtdbTx\ntax = GtdbTx()\n\ntax.lineage('s__Enterovibrio marina')\n# ['1', 'd__Bacteria', 'p__Proteobacteria', 'c__Gammaproteobacteria', 'o__Enterobacterales', 'f__Vibrionaceae', 'g__Enterovibrio', 's__Enterovibrio marina']\n# Keep only ancestors of 'g__Enterovibrio'\ntax.filter('g__Enterovibrio')\n\n# Reload taxonomy\ntax = GtdbTx()\n# Keep only descendants of 'g__Enterovibrio'\ntax.filter('g__Enterovibrio', desc=True)\n
\n", "signature": "(self, nodes: list, desc: bool = False)", "funcdef": "def"}, {"fullname": "multitax.multitax.MultiTax.write", "modulename": "multitax.multitax", "qualname": "MultiTax.write", "type": "function", "doc": "

Writes loaded taxonomy to a file.

\n\n

Parameters:

\n\n
    \n
  • cols [list]: Options: \"node\", \"latest\", \"parent\", \"rank\", \"name\", \"leaves\", \"children\", \"lineage\", \"rank_lineage\", \"name_lineage\"
  • \n
  • sep [str]: Separator of fields
  • \n
  • sep_multi [str]: Separator of multi-valued fields
  • \n
  • ranks [list]: Ranks to report
  • \n
  • gz [bool]: Gzip output
  • \n
\n\n

Returns: None

\n", "signature": "(\n self,\n output_file: str,\n cols: list = ['node', 'parent', 'rank', 'name'],\n sep: str = '\\t',\n sep_multi: str = '|',\n ranks: list = None,\n gz: bool = False\n)", "funcdef": "def"}, {"fullname": "multitax.utils", "modulename": "multitax.utils", "type": "module", "doc": "

\n"}, {"fullname": "multitax.utils.open_files", "modulename": "multitax.utils", "qualname": "open_files", "type": "function", "doc": "

Parameters:

\n\n
    \n
  • files [list]: List of files to open (text, \".gz\", \".tar.gz\", \".tgz\")
  • \n
\n\n

Returns:

\n\n
    \n
  • OrderedDict {file: file handler} (same order as input)
  • \n
\n", "signature": "(files: list)", "funcdef": "def"}, {"fullname": "multitax.utils.download_files", "modulename": "multitax.utils", "qualname": "download_files", "type": "function", "doc": "

Download and open files (memory/stream) or write to disk (multitax.utils.save_urls)

\n\n

Parameters:

\n\n
    \n
  • urls [list]: List of files to download (text, \".gz\", \".tar.gz\", \".tgz\")
  • \n
  • output_prefix [str]: Output directory to save files
  • \n
\n\n

Returns:

\n\n
    \n
  • OrderedDict {file: file handler} (same order as input)
  • \n
\n", "signature": "(urls: list, output_prefix: str = None)", "funcdef": "def"}, {"fullname": "multitax.utils.close_files", "modulename": "multitax.utils", "qualname": "close_files", "type": "function", "doc": "

Parameters:

\n\n
    \n
  • fhs [dict]: {file: file handler}
  • \n
\n\n

Returns: Nothing

\n", "signature": "(fhs: dict)", "funcdef": "def"}, {"fullname": "multitax.utils.save_urls", "modulename": "multitax.utils", "qualname": "save_urls", "type": "function", "doc": "

Parameters:

\n\n
    \n
  • urls [list]: List of urls to download
  • \n
  • output_prefix [str]: Output directory to save files
  • \n
\n\n

Returns:

\n\n
    \n
  • list of files saved
  • \n
\n", "signature": "(urls: list, output_prefix: str)", "funcdef": "def"}, {"fullname": "multitax.utils.load_url_mem", "modulename": "multitax.utils", "qualname": "load_url_mem", "type": "function", "doc": "

Parameters:

\n\n
    \n
  • url [str]: URL to load into memory
  • \n
\n\n

Returns:

\n\n
    \n
  • io.BytesIO of the requested url
  • \n
\n", "signature": "(url: str)", "funcdef": "def"}, {"fullname": "multitax.utils.check_file", "modulename": "multitax.utils", "qualname": "check_file", "type": "function", "doc": "

\n", "signature": "(file: str)", "funcdef": "def"}, {"fullname": "multitax.utils.check_no_file", "modulename": "multitax.utils", "qualname": "check_no_file", "type": "function", "doc": "

\n", "signature": "(file: str)", "funcdef": "def"}, {"fullname": "multitax.utils.check_dir", "modulename": "multitax.utils", "qualname": "check_dir", "type": "function", "doc": "

\n", "signature": "(prefix: str)", "funcdef": "def"}, {"fullname": "multitax.utils.reverse_dict", "modulename": "multitax.utils", "qualname": "reverse_dict", "type": "function", "doc": "

\n", "signature": "(d: dict)", "funcdef": "def"}, {"fullname": "multitax.utils.join_check", "modulename": "multitax.utils", "qualname": "join_check", "type": "function", "doc": "

\n", "signature": "(elements, sep: str)", "funcdef": "def"}, {"fullname": "multitax.utils.filter_function", "modulename": "multitax.utils", "qualname": "filter_function", "type": "function", "doc": "

\n", "signature": "(elements, function, value)", "funcdef": "def"}]; + + // mirrored in build-search-index.js (part 1) + // Also split on html tags. this is a cheap heuristic, but good enough. + elasticlunr.tokenizer.setSeperator(/[\s\-.;&_'"=,()]+|<[^>]*>/); + + let searchIndex; + if (docs._isPrebuiltIndex) { + console.info("using precompiled search index"); + searchIndex = elasticlunr.Index.load(docs); + } else { + console.time("building search index"); + // mirrored in build-search-index.js (part 2) + searchIndex = elasticlunr(function () { + this.pipeline.remove(elasticlunr.stemmer); + this.pipeline.remove(elasticlunr.stopWordFilter); + this.addField("qualname"); + this.addField("fullname"); + this.addField("annotation"); + this.addField("default_value"); + this.addField("signature"); + this.addField("bases"); + this.addField("doc"); + this.setRef("fullname"); + }); + for (let doc of docs) { + searchIndex.addDoc(doc); + } + console.timeEnd("building search index"); + } + + return (term) => searchIndex.search(term, { + fields: { + qualname: {boost: 4}, + fullname: {boost: 2}, + annotation: {boost: 2}, + default_value: {boost: 2}, + signature: {boost: 2}, + bases: {boost: 2}, + doc: {boost: 1}, + }, + expand: true + }); +})(); \ No newline at end of file