nedrex package
Submodules
nedrex.bicon module
Functions to use the BiCoN routes in a NeDRex API instance
- This module contains the following functions:
bicon_request - submits a request to NeDRex to run BiCoN
check_bicon_status - gets details of a submitted BiCoN job
download_bicon_data - download results for a completed BiCoN job
- nedrex.bicon.bicon_request(expression_file: IO[str], lg_min: int = 10, lg_max: int = 15, network: str = 'DEFAULT') str[source]
Submits a request to NeDRex to run BiCoN and returns the job UID
- Parameters
expression_file (IO[str]) – A handle to an IO object (e.g., open file) containing expression data
lg_min (int, optional) – The minimum desired size of the solution subnetworks (the default is 10)
lg_max (int, optional) – The maximum desired size of the solution subnetworks (the default is 15)
network (str, optional) – The GGI network to use for running BiCoN (default is “DEFAULT”, which is a PPI-based GGI network)
- Returns
str – The unique ID of the submitted BiCoN job
- nedrex.bicon.check_bicon_status(uid: str) Dict[str, Any][source]
Gets the status of a submitted BiCoN job
- Parameters
uid (str) – The unique ID of a BiCoN job
- Returns
dict[str, Any] – Details of the current BiCoN job; the status of job is stored using the status key
- nedrex.bicon.download_bicon_data(uid: str, target: Optional[str] = None) str[source]
Downloads results for a submitted BiCoN job
- Parameters
uid (str) – The unique ID of a BiCoN job
target (str, optional) – The target file path for the downloaded data. If not specified, this defaults <cwd>/<uid>.zip
- Returns
str – The path to which the downloaded data was saved.
nedrex.closeness module
Functions to run closeness centrality routes in a NeDRex API instance
As described in Sadegh et al, 2021, closeness centrality (CC) is a node centrality measure that prioritizes nodes in a network based on the lengths of their shortest paths to all other nodes in a network. NeDRex implements a modified version where closeness is calulcated with respect to selected seeds.
- nedrex.closeness.check_closeness_status(uid: str) Dict[str, Any]
Gets details of a submitted closeness centrality job
- Parameters
uid (str) – The unique ID of a closeness centrality job
- Returns
dict[str, Any] – Details of the current closeness centrality job; the status of job is stored using the status key
- nedrex.closeness.closeness_submit(seeds: List[str], only_direct_drugs: bool = True, only_approved_drugs: bool = True, N: Optional[int] = None) str[source]
Submit a request to NeDRex to run closeness centrality analysis
- Parameters
seeds (list[str]) – A list of seed proteins with which to run closeness centrality analysis
only_direct_drugs (bool, optional) – True (default) returns only drugs that target seeds; False also includes drugs in the vicinity of seeds
only_approved_drugs (bool, optional) – True (default) returns only drugs that have an approved use, False will also return drugs that are not approved (e.g., experimental)
N (int, optional) – The number of drugs to return. If, when ordered by rank, there are additional drugs with the same score of the Nth drug, then these drugs are also returned.
- Returns
str – The unique ID of the closness centrality job.
nedrex.comorbiditome module
Functions to access the comorbiditome in NeDRex
- nedrex.comorbiditome.check_comorbiditome_status(uid: str) Dict[str, Any]
Gets details of a submitted comorbiditome build job
- Parameters
uid (str) – The unique ID of a comorbiditome build job
- Returns
dict[str, Any] – Details of the current comorbiditome build job; the status of job is stored using the status key
- nedrex.comorbiditome.download_comorbiditome_build(uid: str, fmt: Literal['tsv', 'graphml'], save_path: Optional[str] = None) Optional[str][source]
Download a completed comorbiditome build
- Parameters
uid (str) – The UID of the comorbiditome build job.
fmt (Formats) – The format to return the comorbiditome in. Should be one of tsv or graphml.
save_path (str | None, optional) – Where to save the graph. If a string is provided (representing a filepath), then the graph is saved to this file. If None, then the graph is returned as a string. Default is None.
- Returns
str | None – If save_path is set, then None is returned. Otherwise, the graph is returned a string.
- nedrex.comorbiditome.get_icd10_associations(nodes: List[str], edge_type: Literal['gene_associated_with_disorder', 'drug_has_indication', 'drug_has_contraindication', 'drug_targets_disorder_associated_gene_product']) Dict[str, List[str]][source]
Get edge types from NeDRex, with disorder IDs mapped to ICD-10
This function takes as arguments an edge_type, which is a string specifying the edge type of interest, and a list of nodes. nodes should contain a list of primary IDs for the nodes of the _non_ disorder type in a relationship that you wish to obtain associations for.
For example, you could select the gene_associated_with_disorder edge type and pass in the CFTR gene as your disorder of interest, [“entrez.1080”].
Note that one edge type, drug_targets_disorder_associated_gene_product, is an inferred edge. This follows the path of:
(drug)-[has_target]-(protein)
(protein)-[encoded_by]-(gene)
(gene)-[associated_with]-(disorder)
- Parameters
nodes (list[str]) – A list of node IDs for the non-disorder member of relationships
edge_type (str) – The edge type you with to obtain relationships for
- Returns
dict[str, list[str]] – A dictionary mapping input nodes to the disorders they have a relationship with (in the ICD-10 namespace).
- nedrex.comorbiditome.map_icd10_to_mondo(disorders: List[str]) Dict[str, List[str]][source]
Map a list of disorders in ICD10 to the MONDO namespace
In moving between ICD10 and MONDO, the scope of the disorder may change. A term in ICD10 may be broader, more specific, or only partially overlap with the scope of a MONDO disorder.
- Parameters
disorders (list[str]) – A list of disorders in the ICD-10 namespace.
- Returns
dict[str, list[str]] – A dictionary mapping input ICD-10 codes to MONDO codes.
- nedrex.comorbiditome.map_mondo_to_icd10(disorders: List[str], only_3char: bool = False, exclude_3char: bool = False) Dict[str, List[str]][source]
Map a list of disorders in MONDO to the ICD10 namespace
In moving between MONDO and ICD10, the scope of the disorder may change. A term in MONDO may be broader, more specific, or only partially overlap with the scope of an ICD10 disorder.
- Parameters
disorders (list[str]) – A list of disorders in the MONDO namespace
only_3char (bool, optional) – Whether to only include 3-character ICD-10 codes, by default False
exclude_3char (bool, optional) – Whether to exclude 3-character ICD-10 codes, by default False
- Returns
dict[str, list[str]] – A dictionary mapping input MONDO codes to ICD-10 codes
- nedrex.comorbiditome.submit_comorbiditome_build(max_phi_cor: Optional[float] = None, min_phi_cor: Optional[float] = None, max_p_value: Optional[float] = None, min_p_value: Optional[float] = None, mondo: Optional[list[str]] = None) str[source]
Submit a comorbiditome build request
- Parameters
max_phi_cor (float | None, optional) – The maximum phi correlation to include an edge in the comorbiditome, by default None (no maximum)
min_phi_cor (float | None, optional) – The minimum phi correlation to include an edge in the comorbiditome, by default None (no minimum)
max_p_value (float | None, optional) – The maximum p-value to include an edge in the network, by default None (no maximum)
min_p_value (float | None, optional) – The minimum p-value to include an edge in the network, by default None (no minimum)
mondo (list[str] | None, optional) – MONDO nodes to map to ICD-10 and induce a subnetwork of the comorbiditome, by default None (no subnetwork induced)
- Returns
str – UID of the submitted comorbiditome job
nedrex.core module
Module containing functions relating to the general routes in the NeDRex API
This module contains functions that access the general routes, and also routes for obtaining API keys.
- nedrex.core.api_keys_active() bool[source]
Checks whether API keys are active for the instance of NeDRex set in the config
- Returns
bool – True if the API keys are required, otherwise False.
- nedrex.core.get_api_key(*, accept_eula: bool = False) str[source]
Obtains a new API key for the NeDRex API.
- Parameters
accept_eula (bool) – Parameter reflecting whether the user of the library accepts the terms of the NeDRex end user licence agreement (EULA). Defaults to False. Must be set to True to acquire an API key.
- Returns
str – An API key that can be used to access the NeDRex platform.
- nedrex.core.get_collection_attributes(coll_type: str, include_counts: bool = False) Any[source]
Gets the available attributes in NeDRex for the given type
- Parameters
coll_type (str) – The name of the collection
include_counts (bool, optional) – If True, returns the counts for each attribute. If False, just returns a list of the attributes. Default is False.
- Returns
Union[Dict[str, Any], List[str]] – If include_counts is False, this returns a list of the attributes that members of the collections have. If include_counts is true, this returns a dictionary that includes the counts.
Examples
>>> get_collection_attributes(protein) ['primaryDomainId', 'comments', 'created', 'dataSources', 'displayName', 'domainIds', 'geneName', 'sequence', 'synonyms', 'taxid', 'type', 'updated']
>>> get_collection_attributes(protein, include_counts=True) {'attribute_counts': {'comments': 204906, 'created': 204906, 'dataSources': 204906, 'displayName': 204906, 'domainIds': 204906, 'geneName': 204906, 'primaryDomainId': 204906, 'sequence': 204906, 'synonyms': 204906, 'taxid': 204906, 'type': 204906, 'updated': 204906}, 'document_count': 204906}
- nedrex.core.get_edge_types() List[str][source]
Gets a list of the edge types stored in NeDRexDB
- Returns
list[str] – A list of edge types in NeDRexDB
- nedrex.core.get_edges(edge_type: str, limit: Optional[int] = None, offset: Optional[int] = None) Any[source]
Returns edges in NeDRex of the given type
- Parameters
edge_type (str) – The edge type to collect
limit (int, optional) – A limit for the number of records to be returned. The default is determined by querying the API.
offset (int, optional) – The number of records to skip before returning records. Default is 0 (no records skipped).
- Returns
list[dict[str, Any]] – The edges in NeDRex returned by the API.
- nedrex.core.get_node_ids(coll_type: str) Any[source]
Returns a list of node identifiers in NeDRex for the given type
- Parameters
coll_type (str) – The node type to get IDs for
- Returns
list[str] – The list of available node IDs for the specificed node type
- nedrex.core.get_node_types() List[str][source]
Gets a list of the node types stored in NeDRexDB
- Returns
list[str] – A list of node types in NeDRexDB
- nedrex.core.get_nodes(node_type: str, attributes: Optional[List[str]] = None, node_ids: Optional[List[str]] = None, limit: Optional[int] = None, offset: int = 0) Any[source]
Returns nodes in NeDRex of the given type
- Parameters
node_type (str) – The node type to collect
attributes (list[str], optional) – A list of attributes to return for the collected nodes. The default, None, returns all attributes.
node_ids (list[str], optional) – A list of IDs of specific nodes to be returned. The default (None) does no filtering by node ID.
limit (int, optional) – A limit for the number of records to be returned. The default is determined by querying the API.
offset (int, optional) – The number of records to skip before returning records. Default is 0 (no records skipped).
- Returns
list[dict[str, Any]] – The nodes in NeDRex returned by the API.
- nedrex.core.get_pagination_limit() int[source]
Gets the pagination limit for the NeDRexDB instance
- Returns
int – The pagination limit for the NeDRexDB instance
- nedrex.core.iter_edges(edge_type: str) Generator[Dict[str, Any], None, None][source]
A function that returns a generator to iterate over edges
This function is useful if you wish to get all edges in a particular collection, but do not want to manually handle offsets and limits.
- Parameters
edge_type (str) – The edge type to collect
- Yields
dict[str, Any] – An edge in NeDRex returned by the API
- nedrex.core.iter_nodes(node_type: str, attributes: Optional[List[str]] = None, node_ids: Optional[List[str]] = None) Generator[Dict[str, Any], None, None][source]
A function that returns a generator to iterate over nodes
This function is useful if you wish to get all nodes in a particular collection, but do not want to manually handle offsets and limits.
- Parameters
node_type (str) – The node type to collect
attributes (list[str], optional) – A list of attributes to return for the collected nodes. The default, None, returns all attributes.
node_ids (list[str], optional) – A list of IDs of specific nodes to be returned. The default (None) does no filtering by node ID.
- Yields
dict[str, Any] – A node in NeDRex returned by the API
nedrex.diamond module
Functions to run the DIAMOnD routes in a NeDRex API instance
As described in Sadegh et al, 2021, DIAMOnD identifies a candidate disease module around a set of known disease genes (seeds) by greedily adding nodes with a high connectivity significance to the modules.
- nedrex.diamond.check_diamond_status(uid: str) Dict[str, Any]
Returns details of a submitted DIAMOnD job
- Parameters
uid (str) – The unique ID of a DIAMOnD job
- Returns
dict[str, Any] – Details of the DIAMOnD job with the given unique ID; the status of the job is stored using the status key
- nedrex.diamond.diamond_submit(seeds: List[str], n: int, alpha: int = 1, network: str = 'DEFAULT', edges: str = 'all') str[source]
Submit a request to NeDRex to run DIAMOnD analysis
- Parameters
seeds (list[str]) – A list of seed genes or proteins with which to run DIAMOnD
n (int) – The maximum number of nodes at which to stop the algorithm
alpha (int, optional) – Weight given to seeds. The default value is 1.
network (str, optional) – NeDRexDB-based network to run DIAMOnD analysis with. The default network, DEFAULT uses a GGI/PPI network based on experimental PPIs.
edges (str, optional) – Option affecting which edges are returned in the results. Options are all, which return edges in the GGI/PPI between nodes in the DIAMOnD module, and limited, which only return edges between seeds and new nodes. The default is all.
- Returns
str – The unique ID of the DIAMOnD job.
nedrex.disorder module
Module containing python functions to access the disorder routes in the NeDRex API
- nedrex.disorder.get_disorder_ancestors(codes: Union[str, List[str]]) Any
Returns the ID(s) of nodes that are ancestors of the input ID(s)
- Parameters
codes (str | list[str]) – A disorder ID (or list of disorder IDs) to get the ancestors of. Note that this can be in any valid namespace (e.g., mesh.D006980).
- Returns
dict[str, list[str]] – A dictionary that maps the input terms (in MONDO ID space) to a list of their ancestors. This means that input IDs in a non-MONDO namespace will not appear in the result (see example).
Examples
>>> get_disorder_ancestors("mesh.D006980") {'mondo.0004425': ['mondo.0000001', 'mondo.0003240', 'mondo.0005151']}
- nedrex.disorder.get_disorder_children(codes: Union[str, List[str]]) Any
Returns the ID(s) of nodes that are children of the input ID(s)
- Parameters
codes (str | list[str]) – A disorder ID (or list of disorder IDs) to get the children of. Note that this can be in any valid namespace (e.g., mesh.D006980).
- Returns
dict[str, list[str]] – A dictionary that maps the input terms (in MONDO ID space) to a list of their children. This means that input IDs in a non-MONDO namespace will not appear in the result (see example).
Examples
>>> get_disorder_children("mesh.D006980") {'mondo.0004425': ['mondo.0001104', 'mondo.0001252', 'mondo.0006996', 'mondo.0007784', 'mondo.0009043', 'mondo.0011309', 'mondo.0012203', 'mondo.0014448']}
- nedrex.disorder.get_disorder_descendants(codes: Union[str, List[str]]) Any
Returns the ID(s) of nodes that are descentants of the input ID(s)
- Parameters
codes (str | list[str]) – A disorder ID (or list of disorder IDs) to get the descendants of. Note that this can be in any valid namespace (e.g., mesh.D006980).
- Returns
dict[str, list[str]] – A dictionary that maps the input terms (in MONDO ID space) to a list of their descendants. This means that input IDs in a non MONDO namespace will not appear in the result (see example).
Examples
>>> get_disorder_descendants("mesh.D006980") {'mondo.0004425': ['mondo.0001104', 'mondo.0001252', 'mondo.0001555', 'mondo.0005364', 'mondo.0006996', 'mondo.0007784', 'mondo.0008569', 'mondo.0009043', 'mondo.0010131', 'mondo.0010138', 'mondo.0010304', 'mondo.0011309', 'mondo.0011314', 'mondo.0012203', 'mondo.0014448', 'mondo.0019854', 'mondo.0019855', 'mondo.0019860', 'mondo.0019861', 'mondo.0033925']}
- nedrex.disorder.get_disorder_parents(codes: Union[str, List[str]]) Any
Returns the ID(s) of nodes that are parents of the input ID(s)
- Parameters
codes (str | list[str]) – A disorder ID (or list of disorder IDs) to get the parents of. Note that this can be in any valid namespace (e.g., mesh.D006980).
- Returns
dict[str, list[str]] – A dictionary that maps the input terms (in MONDO ID space) to a list of their parents. This means that input IDs in a non-MONDO namespace will not appear in the result (see example).
Examples
>>> get_disorder_parents("mesh.D006980") {'mondo.0004425': ['mondo.0003240']}
- nedrex.disorder.search_by_icd10(codes: Union[str, List[str]]) Any
Obtains NeDRex disorder nodes by ICD-10 codes
- Parameters
codes (str | list[str]) – An ICD-10 code (or list of ICD-10 codes) to search for in NeDRexDB
- Returns
list[dict[str, Any]] – Disorder records from NeDRexDB
nedrex.domino module
Functions to run DOMINO routes in a NeDRex API instance
As described by Levi et al. (2021), DOMINO is an algorithm for detecting active network modules.
- nedrex.domino.domino_submit(seeds: List[str], network: str = 'DEFAULT') str[source]
Submit a request to NeDRex to run DOMINO analysis
- Parameters
seeds (list[str]) – A list of seed genes or proteins with which to run DOMINO analysis
network (str, optional) – NeDRexDB-based network to run DOMINO analysis with. The defaut network, DEFAULT uses a GGI/PPI network based on experimental PPIs.
- Returns
str – The unique ID of the DOMINO job.
nedrex.exceptions module
- exception nedrex.exceptions.ConfigError[source]
Bases:
NeDRexError
nedrex.graph module
- nedrex.graph.build_request(nodes: Optional[List[str]] = None, edges: Optional[List[str]] = None, ppi_evidence: Optional[List[str]] = None, include_ppi_self_loops: bool = False, taxid: Optional[List[int]] = None, drug_groups: Optional[List[str]] = None, concise: bool = True, include_omim: bool = True, disgenet_threshold: float = 0.0, use_omim_ids: bool = False, split_drug_types: bool = False) str[source]
Submit a build request to NeDRex to build a graph
- Parameters
nodes (list[str], optional) – The list of node types to be included in the graph. The default is [“disorder”, “drug”, “gene”, “protein”]
edges (list[str], optional) – The list of edge types to be included in the graph. The default is [“disorder_is_subtype_of_disorder”, “drug_has_indication”, “drug_has_target”, “protein_encoded_by_gene”, “protein_interacts_with_protein”,]
ppi_evidence (list[str], optional) – A list of evidence types – for a PPI edge to be included in the graph, it must be asserted with evidence listed in ppi_evidence. Possible values are exp (experimental), pred (predicted) and ortho (orthologous). The default is [exp].
include_ppi_self_loops (bool, optional) – Whether or not to include self-loops for PPI edges. The default, False, does not include PPI self-loops.
taxid (list[int], optional) – A list of NCBI taxonomy IDs with which to filter proteins in the network. The default is [9606,], which includes only Homo sapiens proteins. Note that, at the time of writing, NeDRexDB only has Homo sapiens proteins.
drug_groups (list[str], optional) – A list of drug groups with which to filter drugs to be included in the graph. The default, [“approved”,], only includes drugs that have an approved use.
concise (bool, optional) – Whether or not to return a concise view of the network. The default, True, removes some attributes from nodes and edges in the network to result in a smaller, more tractable network.
include_omim (bool, optional) – Whether or not to include gene-disorder associations from OMIM. The default, True, includes these gene-disorder associations.
disgenet_threshold (float, optional) – The threshold at which to include gene-disorder associations from DisGeNET. DisGeNET gene-disorder associations are given a score in the range [0,1], reflecting factors such as the number of sources and the level of curation. Edges with a score ≥ the given threshold are kept. The default value is 0.0
use_omim_ids (bool, optional) – Whether or not to use OMIM IDs on disorder nodes instead of MONDO IDs (where possible). The default, False, uses MONDO IDs for all disorder nodes.
split_drug_types (bool, optional) – Whether or not to split “Drug” nodes into “SmallMoleculeDrug” and “BiotechDrug”. The default, False, consolidates all drugs into a single “Drug” type.
- Returns
str – The unique ID of the graph build job.
Notes
For more information on the DisGeNET score, see https://www.disgenet.org/dbinfo#score
- nedrex.graph.check_build_status(uid: str) Dict[str, Any][source]
Returns the details of a submitted graph build job
- Parameters
uid (str) – The unique ID of a graph build job
- Returns
dict[str, Any] – Details of the graph build job with the given unique ID; the status of the job is stored using the status key
- nedrex.graph.download_graph(uid: str, target: Optional[str] = None) str[source]
Downloads the resultant graph of a submitted graph build job
- Parameters
uid (str) – The unique ID of a graph build job
target (str, optional) – The target file path for the downloaded data. If not specified, this defaults to <cwd>/<uid>.graphml
- Returns
str – The path to which the downloaded data was saved.
nedrex.kpm module
- nedrex.kpm.kpm_submit(seeds: List[str], k: int, network: str = 'DEFAULT') str[source]
Submit a request to a NeDRex instance to run KPM analysis
- Parameters
seeds (list[str]) – A list of seed genes or proteins with which to run KPM analysis
k (int) – The number of gene or protein exceptions to allow in KPM analysis
network (str, optional) – NeDRexDB-based network to run DOMINO analysis with. The defaut network, DEFAULT uses a GGI/PPI network based on experimental PPIs.
- Returns
str – The unique ID of a KPM job.
nedrex.must module
Functions to run MuST routes in a NeDRex API instance
As described in Sadegh et al., 2021, MuSt extracts a connected subnetwork which potentially incorporates the genes/proteins involved in a disease pathway/mechanism.
- nedrex.must.must_request(seeds: List[str], hubpenalty: float, multiple: bool, trees: int, maxit: int, network: str = 'DEFAULT') str[source]
Submit a request to a NeDRex instance to run MuST analysis
- Parameters
seeds (list[str]) – A list of seed genes or proteins with which to run MuST analysis
hubpenalty (float) – The penalty for hub nodes in the MuST algorithm. Setting a non-zero hubpenalty extracts mechanisms more specific to the disorder of interest.
multiple (bool) – A parameter indicating whether or not to return multiple resulting Steiner trees from MuST.
maxit (int) – The maximum number of iterations to run MuST for.
network (str, optional) – NeDRexDB-based network to run MuST analysis with. The default network, DEFAULT uses a GGI/PPI network based on experimental PPIs.
- Returns
str – The Unique ID of the MuST job
nedrex.neo4j module
Module containing a function providing access to Neo4j NeDRex
nedrex.ppi module
Module containing a function to access PPI routes in a NeDRex instance
- nedrex.ppi.ppis(evidence: Iterable[str], skip: int = 0, limit: Optional[int] = None) List[Dict[str, Any]][source]
Obtain PPIs from a NeDRex instance
- Parameters
evidence (iterable[str]) – A list of evidence types with which to filter PPIs. Valid values are “exp” (experimental), “pred” (predicted), and “ortho” (orthologous).
skip (int, optional) – The number of records to skip before returning PPIs. The default value is 0 (skip no records).
limit (int, optional) – The number of records to return. The default value, None, uses the maximum pagination limit for the NeDRex instance being queried.
- Returns
list[dict[str, Any]] – A list of PPI edges returned from the NeDRexAPI.
nedrex.relations module
- nedrex.relations.get_drugs_indicated_for_disorders(disorder_list: Iterable[str]) Dict[str, List[str]][source]
Gets the drugs that are indicated for supplied disorders
- Parameters
disorder_list (iterable[str]) – A list of disorders to get indicated drugs for. Disorder IDs should be provided in the MONDO namespace, and may optionally be prefixed with mondo. (but this is not required).
- Returns
dict[str, list[str]] – A dictionary that maps disorder IDs to lists of indicated drugs. It should be noted that disorder IDs in the resultant dictionary do not have the mondo. prefix. Additionally, drug IDs do not have a drugbank. prefix.
- nedrex.relations.get_drugs_targetting_gene_products(gene_list: Iterable[Union[int, str]]) Dict[str, List[str]][source]
Get drugs that target the products of genes in a supplied gene list
- Parameters
gene_list (iterable[str | int]) – A list of genes. These genes should be Entrez gene IDs, and can be provided as either a string or an integer. The may optionally be prefixed with “entrez.”, but this is not required.
- Returns
dict[str, list[str]] – A dictionary that maps gene IDs to lists of drugs which target the protein products of the gene. It should be noted that gene IDs are converted to strings in the resultant dictionary, and they do not have the entrez. prefix. Additionally, drug IDs do not have a drugbank. prefix.
- nedrex.relations.get_drugs_targetting_proteins(protein_list: Iterable[str]) Dict[str, List[str]][source]
Gets drugs that target proteins in a supplied protein list
- Parameters
protein_list (iterable[str]) – A list of protein IDs to get targetting drugs for. Protein IDs should be provided in the UniProt namespace, and may optionally be prefixed with uniprot. (but this is not required).
- Returns
dict[str, list[str]] – A dictionary that maps protein IDs to lists of the drugs that target them. It should be noted that protein IDs in the resultant dictionary do not have the uniprot. prefix. Additionally, drug IDs do not have a drugbank. prefix.
- nedrex.relations.get_encoded_proteins(gene_list: Iterable[Union[int, str]]) Dict[str, List[str]][source]
Gets the proteins that are encoded by genes in a supplied gene list
- Parameters
gene_list (iterable[str | int]) – A list of genes to get the encoded protein for. These genes should be Entrez gene IDs, and can be provided as either a string or an integer. The may optionally be prefixed with “entrez.”, but this is not required.
- Returns
dict[str, list[str]] – A dictionary that maps gene IDs to lists of encoded proteins. It should be noted that genes IDs are convered to string in the resultant dictionary, and they do not have the entrez. prefix. Additionally, the protein IDs do not have the uniprot. prefix.
nedrex.robust module
Functions to access the ROBUST routes in a NeDRex API instance
As described in Bernett, et al. (2022), ROBUST carries out robust disease module mining via enumeration of diverse prise-collecting Steiner trees.
- nedrex.robust.check_robust_status(uid: str) Dict[str, Any]
Gets details of a submitted ROBUST job
- Parameters
uid (str) – The unique ID of a ROBUST job
- Returns
dict[str, Any] – Details of the ROBUST job; the status of job is stored using the status key
- nedrex.robust.download_robust_results(uid: str) str[source]
Downloads results of a ROBUST analysis job
- Parameters
uid (str) – The unique ID of a ROBUST job
- Returns
str – A string containing the ROBUST analysis results
- nedrex.robust.robust_submit(seeds: List[str], network: str = 'DEFAULT', initial_fraction: float = 0.25, reduction_factor: float = 0.9, num_trees: int = 30, threshold: float = 0.1) str[source]
Submits a request to run ROBUST analysis
- Parameters
seeds (list[str]) – A list of seed proteins with which to run ROBUST analysis
network (str, optional) – NeDRexDB-based network to run ROBUST analysis with. The default network, DEFAULT uses a GGI/PPI network based on experimental PPIs
initial_fraction (float, optional) – The initial fraction to use for ROBUST, by default 0.25
reduction_factor (float, optional) – The reduction factor to use for ROBUST, by default 0.9
num_trees (int, optional) – The number of Steiner trees to be computed, by default 30
threshold (float, optional) – The threshold value to use for ROBUST, by default 0.1
- Returns
str – The UID of the ROBUST analysis job.
nedrex.static module
Code to access static data in the NeDRex API
- nedrex.static.download_lengths_map(target: Optional[str] = None) None[source]
Obtains the lengths.map file
The lengths.map file is required for some versions of the NeDRex app.
- Parameters
target (str, optional) – The file location to save the file, with the default being lengths.map in the current directory.
nedrex.trustrank module
Functions to run TrustRank analysis routes in a NeDRex API instance
As described in Sadegh et al, 2021, “TrustRank is a modification of Google’s PageRank algorithm, where the initial trust score is iteratively propagated from seed nodes to adjest nodes using the network topology. It prioritises nodes in a network based on how well they are connected to a (trusted) set of seed nodes.”
- nedrex.trustrank.check_trustrank_status(uid: str) Dict[str, Any]
Gets details of a submitted TrustRank analysis job
- Parameters
uid (str) – The unique ID of a TrustRank job
- Returns
dict[str, Any] – Details of the TrustRank job; the status of job is stored using the status key
- nedrex.trustrank.download_trustrank_results(uid: str) str[source]
Downloads results of a TrustRank analysis job
- Parameters
uid (str) – The unique ID of a TrustRank job
- Returns
str – A string containing the TrustRank analysis results
- nedrex.trustrank.trustrank_submit(seeds: List[str], damping_factor: float = 0.85, only_direct_drugs: bool = True, only_approved_drugs: bool = True, n: Optional[int] = None) str[source]
Submit a job to the NeDRexAPI to run TrustRank analysis
- Parameters
seeds (list[str]) – A list of seed proteins with which to run TrustRank analysis
damping_factor (float, optional) – The damping factor value, which controls rate of trust propagation across the network. The default is 0.85
only_direct_drugs (bool, optional) – Specifies whether to return only drugs that target the seed nodes. The default, True, only returns drugs that target seed nodes
only_approved_drugs (bool, optional) – Specifies whether to filter drugs that are not approved. The default, filters non-approved drugs (True)
n (int, optional) – The number of results to return. If there are additional results that have the same score as the n-th highest ranking drug, these are also returned
- Returns
str – The UID for the TrustRank job
nedrex.validation module
Functions to run the validation routes of a NeDRex API instance
- nedrex.validation.check_validation_status(uid: str) Dict[str, Any]
Gets details of a validation job
- Parameters
uid (str) – The unique ID of a validation job
- Returns
dict[str, Any] – Details of the validation job; the status of job is stored using the status key
- nedrex.validation.drug_validation_submit(test_drugs: List[str], true_drugs: List[str], permutations: int, only_approved_drugs: bool = True) str[source]
Validation of drug lists computed by NeDRex
- Parameters
test_drugs (list[str]) – The drugs that were predicted by a NeDRex drug repurposing algorithm
true_drugs (list[str]) – A list of drugs that are indicated for the disorder
permutations (int) – The number of permutations to run in validation
only_approved_drugs (bool, optional) – Whether to use approved drugs only (True) or all drugs (False). Default is True
- Returns
str – The UID of the joint validation job
- nedrex.validation.joint_validation_submit(module_members: List[str], module_member_type: str, test_drugs: List[str], true_drugs: List[str], permutations: int, only_approved_drugs: bool = True) str[source]
Joint validation of disease modules and drug lists computed by NeDRex
- Parameters
module_members (list[str]) – The members of the disease module predicted by NeDRex
module_member_type (str) – The type of the module members (should be drug or gene)
test_drugs (list[str]) – The drugs that were predicted by a NeDRex drug repurposing algorithm
true_drugs (list[str]) – A list of drugs that are indicated for the disorder
permutations (int) – The number of permutations to run in validation
only_approved_drugs (bool:) – Whether to use approved drugs only (True) or all drugs (False). Default is True
- Returns
str – The UID of the joint validation job
- nedrex.validation.module_validation_submit(module_members: List[str], module_member_type: str, true_drugs: List[str], permutations: int, only_approved_drugs: bool = True) str[source]
Validation of disease modules computed by NeDRex
- Parameters
module_members (list[str]) – The module members predicted by NeDRex
module_member_type (str) – The type of the module members (should be drug or gene)
true_drugs (list[str]) – A list of drugs that are indicated for the disorder
permutations (int) – The number of permutations to run in validation
only_approved_drugs (bool, optional) – Whether to use approved drugs only (True) or all drugs (False). Default is True
- Returns
str – The UID of the joint validation job
nedrex.variants module
- nedrex.variants.get_effect_choices() List[str][source]
Gets a list of possible effect values for variant-disorder edges
- Returns
list[str] – A list of possible values in the effect array attribute of variant-disorder associations.
- nedrex.variants.get_review_status_choices() List[str][source]
Gets a list of possible reviewStatus values for variant-disorder edges
- Returns
list[str] – A list of possible values in the reviewStatus (string) attribute of variant-disorder associations.
- nedrex.variants.get_variant_based_disorder_associated_genes(disorder_id: str, review_status: Optional[List[str]] = None, effect: Optional[List[str]] = None) List[str][source]
Gets a list of genes associated with a disorder using variant relations
- Parameters
disorder_id (str) – The disorder ID to get associated genes for
review_status (list[str], optional) – A list of review statuses to filter on. The default, None, returns only associations with “practical guideline” or “reviewed by expert panel” as the review status
effect (list[str], optional) – A list of effect values to filter on. The default, None, returns only associations with “Pathogenic”, “Likely pathogenic”, or “Pathogenic/Likely pathogenic” as a listed effect
- Returns
list[str] – A list of genes associated with the query disorder
- nedrex.variants.get_variant_based_gene_associated_disorders(gene_id: str, review_status: Optional[List[str]] = None, effect: Optional[List[str]] = None) List[str][source]
Gets a list of disorders associated with a gene using variant relations
- Parameters
gene_id (str) – The gene ID to get associated disorders for
review_status (list[str], optional) – A list of review statuses to filter on. The default, None, returns only associations with “practical guideline” or “reviewed by expert panel” as the review status
effect (list[str], optional) – A list of effect values to filter on. The default, None, returns only associations with “Pathogenic”, “Likely pathogenic”, or “Pathogenic/Likely pathogenic” as a listed effect
- Returns
list[str] – A list of disorders associated with the query gene
- nedrex.variants.get_variant_disorder_associations(variant_ids: Optional[List[str]] = None, disorder_ids: Optional[List[str]] = None, review_status: Optional[List[str]] = None, effect: Optional[List[str]] = None, limit: Optional[int] = None, offset: int = 0) List[Dict[str, Any]][source]
Gets variant-disorder associations based on requested filtering
- Parameters
variant_ids (list[str], optional) – A list of variant IDs to filter on. The default, None, does no variant ID-based filtering
disorder_ids (list[str], optional) – A list of disorder IDs to filter on. The default, None, does no disorder ID-based filtering
review_status (list[str], optional) – A list of review statuses to filter on. The default, None, returns only associations with “practical guideline” or “reviewed by expert panel” as the review status
effect (list[str], optional) – A list of effect values to filter on. The default, None, returns only associations with “Pathogenic”, “Likely pathogenic”, or “Pathogenic/Likely pathogenic” as a listed effect
limit (int, optional) – The maximum number of records to return. The default, None, uses the API’s “pagination_max” value to set the limit
offset (int, optional) – The offset to use before returning records. The default is 0
- Returns
list[dict[str, Any]] – A list of variant-disorder association records matching the specified query
- nedrex.variants.get_variant_gene_associations(variant_ids: Optional[List[str]] = None, gene_ids: Optional[List[str]] = None, limit: Optional[int] = None, offset: int = 0) List[Dict[str, Any]][source]
Gets variant-gene associations based on requested filtering
- Parameters
variant_ids (list[str], optional) – A list of variant IDs to filter on. The default, None, does no variant ID-based filtering
gene_ids (list[str], optional) – A list of gene IDs to filter on. The default, None, does no gene ID-based filtering
limit (int, optional) – The maximum number of records to return. The default, None, uses the API’s “pagination_max” value to set the limit
offset (int, optional) – The offset to use before returning records. The default is 0
- Returns
list[dict[str, Any]] – A list of variant-gene association records matching the specified query
- nedrex.variants.iter_variant_disorder_associations(variant_ids: Optional[List[str]] = None, disorder_ids: Optional[List[str]] = None, review_status: Optional[List[str]] = None, effect: Optional[List[str]] = None) Generator[Dict[str, Any], None, None][source]
Iterator over variant-disorder associations
- Parameters
variant_ids (list[str], optional) – A list of variant IDs to filter on. The default, None, does no variant ID-based filtering
disorder_ids (list[str], optional) – A list of disorder IDs to filter on. The default, None, does no disorder ID-based filtering
review_status (list[str], optional) – A list of review statuses to filter on. The default, None, returns only associations with “practical guideline” or “reviewed by expert panel” as the review status
effect (list[str], optional) – A list of effect values to filter on. The default, None, returns only associations with “Pathogenic”, “Likely pathogenic”, or “Pathogenic/Likely pathogenic” as a listed effect
- Yields
dict[str, Any] – A variant-disorder association matching the requested filtering
- nedrex.variants.iter_variant_gene_associations(variant_ids: Optional[List[str]] = None, gene_ids: Optional[List[str]] = None) Generator[Dict[str, Any], None, None][source]
Iterator over variant-gene associations
- Parameters
variant_ids (list[str], optional) – A list of variant IDs to filter on. The default, None, does no variant ID-based filtering
gene_ids (list[str], optional) – A list of gene IDs to filter on. The default, None, does no gene ID-based filtering
- Yields
dict[str, Any] – A variant-gene association matching the requested filtering
nedrex.vpd module
- nedrex.vpd.get_vpd(disorder: str, number_of_patients: int, out_dir: str) Optional[str][source]
Downloads a .zip archive with the requested virtual patient data to the given directory.
- Parameters
disorder (str) – The MONDO ID of the disorder (e.g., mondo.0000090) for which the virtual patient should be retrieved.
number_of_patients (int) – The number of simulated patients in the dataset. Can be 1, 10, or 100.
out_dir (str) – The absolute path of the directory where the virtual patient data should be stored.
- Returns
str, optional – Absolute path of the downloaded zip archive or None if the requested resource does not exist.
Module contents
Top-level package for python-nedrex.