orthomap.qlin module

Author: Kristian K Ullrich date: April 2023 email: ullrich@evolbio.mpg.de License: GPL-3

orthomap.qlin.add_argparse_args(parser: ArgumentParser)

This function attaches individual argument specifications to the parser.

Parameters:

parser (argparse.ArgumentParser) – An argparse.ArgumentParser.

orthomap.qlin.define_parser()

A helper function for using qlin.py via the terminal.

Returns:

An argparse.ArgumentParser.

Return type:

argparse.ArgumentParser

orthomap.qlin.get_lineage_topo(qt)

This function returns a species lineage as a tree object for a query species given as taxID.

Parameters:

qt (str) – The taxID of the queried species.

Returns:

The lineage of the queried species as an ete3.Tree.

Return type:

ete3.Tree

Example

>>> from orthomap import qlin
>>> lineage_tree = qlin.get_lineage_topo(qt='10090')
>>> lineage_tree
orthomap.qlin.get_oldest_common(ql, tl)

This function returns the oldest common ancestor (OCA) by comparing the lineage information of a query species and a target species.

The target species can also be a list of LCA values to find the oldest among the given LCA.

Parameters:
  • ql (list) – Query species lineage information.

  • tl (list) – Target species lineage information.

Returns:

oldest common ancestor (OCA).

Return type:

str

Example

>>> from orthomap import qlin
>>> # get query species taxonomic lineage information
>>> _, _, query_lineage, _, _, _, _, _ = qlin.get_qlin(q='Caenorhabditis elegans')
>>> # get target species taxonomic lineage information
>>> _, _, target_lineage, _, _, _, _, _ = qlin.get_qlin(q='Mus musculus')
>>> # get oldest common node
>>> qlin.get_oldest_common(ql=query_lineage, tl=target_lineage)
orthomap.qlin.get_qlin(ncbi=None, q=None, qt=None, quiet=False)

This function searches the NCBI taxonomic database for results matching the query name or query taxID.

Note that if the user specifies both the name and the taxID of a species, the returning result is based on the taxID.

Parameters:
  • ncbi (ete3.NCBITaxa) – The NCBI taxonomic database.

  • q (str) – The name of the queried species.

  • qt (str) – The taxID of the queried species.

  • quiet (bool) – Specify if output should be quiet.

Returns:

A list of information for the queried species such as: query name, query taxID, query lineage, query lineage dictionary, query lineage zip, query lineage names, reverse query lineage, query kingdom

Return type:

list

Example

>>> from ete3 import NCBITaxa
>>> from orthomap import qlin
>>> qlin.get_qlin(q='Danio rerio')
orthomap.qlin.get_youngest_common(ql, tl)

This function returns the lowest common ancestor (LCA) by comparing the lineage information of a query and a target species.

Parameters:
  • ql (list) – Query species lineage information.

  • tl (list) – Target species lineage information.

Returns:

lowest common ancestor (LCA).

Return type:

str

Example

>>> from orthomap import qlin
>>> # get query species taxonomic lineage information
>>> _, _, query_lineage, _, _, _, _, _ = qlin.get_qlin(q='Caenorhabditis elegans')
>>> # get target species taxonomic lineage information
>>> _, _, target_lineage, _, _, _, _, _ = qlin.get_qlin(q='Mus musculus')
>>> # get youngest common node
>>> qlin.get_youngest_common(ql=query_lineage, tl=target_lineage)
orthomap.qlin.main()

The main function that is being called when qlin is used via the terminal.