The INDRA CoGEx Neo4j Client (indra_cogex.client.queries
)
- get_drugs_for_side_effect(side_effect, *, client)[source]
Return the drugs for the given side effect.
- get_drugs_for_target(target, *, client)[source]
Return the drugs targeting the given protein.
- Parameters:
client (
Neo4jClient
) – The Neo4j client.
- Return type:
Iterable
[Agent
]- Returns:
The drugs targeting the given protein.
- get_drugs_for_targets(targets, *, client)[source]
Return the drugs targeting each of the given targets.
- get_evidences_for_mesh(mesh_term, include_child_terms=True, *, client)[source]
Return the evidence objects for the given MESH term.
- Parameters:
client (
Neo4jClient
) – The Neo4j client.include_child_terms (
bool
) – If True, also match against the child MESH terms of the given MESH ID
- Return type:
- Returns:
The evidence objects for the given MESH ID grouped into a dict by statement hash.
- get_evidences_for_stmt_hash(stmt_hash, *, client, limit=None, offset=0, remove_medscan=True)[source]
Return the matching evidence objects for the given statement hash.
- Parameters:
client (
Neo4jClient
) – The Neo4j client.stmt_hash (
int
) – The statement hash to query, accepts both string and integer.limit (
Optional
[int
]) – The maximum number of results to return.offset (
int
) – The number of results to skip before returning the first result.remove_medscan (
bool
) – If True, remove the MedScan evidence from the results.
- Return type:
Iterable
[Evidence
]- Returns:
The evidence objects for the given statement hash.
- get_evidences_for_stmt_hashes(stmt_hashes, *, client, limit=None, remove_medscan=True)[source]
Return the matching evidence objects for the given statement hashes.
- Parameters:
client (
Neo4jClient
) – The Neo4j client.stmt_hashes (
Iterable
[int
]) – The statement hashes to query, accepts integers and strings.limit (
Optional
[str
]) – The optional maximum number of evidences returned for each statement hashremove_medscan (
bool
) – If True, remove the MedScan evidence from the results.
- Return type:
- Returns:
A mapping of stmt hash to a list of evidence objects for the given statement hashes.
- get_genes_for_go_term(go_term, include_indirect=False, *, client)[source]
Return the genes associated with the given GO term.
- Parameters:
client (
Neo4jClient
) – The Neo4j client.go_term (
Tuple
[str
,str
]) – The GO term to query. Example:("GO", "GO:0006915")
include_indirect (
bool
) – Should ontological children of the given GO term be queried as well? Defaults to False.
- Return type:
- Returns:
The genes associated with the given GO term.
- get_go_terms_for_gene(gene, include_indirect=False, *, client)[source]
Return the GO terms for the given gene.
- get_mutated_genes(cell_line, *, client)[source]
Return the list of genes that are mutated in a given cell line.
Parameters client:
The Neo4j client.
- cell_line :
The cell line to query.
- get_node_counter(*, client)[source]
Get a count of each entity type.
- Parameters:
client (
Neo4jClient
) – The Neo4j client.- Return type:
- Returns:
A Counter of the entity types.
Warning
This code assumes all nodes only have one label, as in
label[0]
- get_pmids_for_mesh(mesh_term, include_child_terms=True, *, client)[source]
Return the PubMed IDs for the given MESH term.
- Parameters:
client (
Neo4jClient
) – The Neo4j client.include_child_terms (
bool
) – If True, also match against the child MESH terms of the given MESH term.
- Return type:
- Returns:
The PubMed IDs for the given MESH term and, optionally, its child terms.
- get_schema_graph(*, client)[source]
Get a NetworkX graph reflecting the schema of the Neo4j graph.
Generate a PDF diagram (works with PNG and SVG too) with the following:
>>> from networkx.drawing.nx_agraph import to_agraph >>> client = ... >>> graph = get_schema_graph(client=client) >>> to_agraph(graph).draw("~/Desktop/cogex_schema.pdf", prog="dot")
- Return type:
MultiDiGraph
Return the shared pathways for the given list of genes.
- get_stmts_for_mesh(mesh_term, include_child_terms=True, *, client, **kwargs)[source]
Return the statements with evidence for the given MESH ID.
- Parameters:
client (
Neo4jClient
) – The Neo4j client.include_child_terms (
bool
) – If True, also match against the children of the given MESH ID.kwargs – Additional keyword arguments to forward to
get_stmts_for_stmt_hashes()
- Return type:
Iterable
[Statement
]- Returns:
The statements for the given MESH ID.
- get_stmts_for_paper(paper_term, *, client, **kwargs)[source]
Return the statements with evidence from the given PubMed ID.
- Parameters:
client (
Neo4jClient
) – The Neo4j client.paper_term (
Tuple
[str
,str
]) – The term to query. Can be a PubMed ID, PMC id, TRID, or DOI
- Return type:
List
[Statement
]- Returns:
The statements for the given PubMed ID.
- get_stmts_for_pubmeds(pubmeds, *, client, **kwargs)[source]
Return the statements with evidence from the given PubMed ID.
- Parameters:
client (
Neo4jClient
) – The Neo4j client.
- Return type:
List
[Statement
]- Returns:
The statements for the given PubMed identifiers.
Example
from indra_cogex.client.queries import get_stmts_for_pubmeds pubmeds = [20861832, 19503834] stmts = get_stmts_for_pubmeds(pubmeds)
- get_stmts_for_stmt_hashes(stmt_hashes, *, evidence_map=None, client, evidence_limit=None, return_evidence_counts=False, subject_prefix=None, object_prefix=None)[source]
Return the statements for the given statement hashes.
- Parameters:
client (
Neo4jClient
) – The Neo4j client.stmt_hashes (
Iterable
[int
]) – The statement hashes to query.evidence_map (
Optional
[Dict
[int
,List
[Evidence
]]]) – Optionally provide a mapping of stmt hash to a list of evidence objectsevidence_limit (
Optional
[int
]) – An optional maximum number of evidences to return
- Return type:
Union
[List
[Statement
],Tuple
[List
[Statement
],Mapping
[int
,int
]]]- Returns:
The statements for the given statement hashes.
- get_stmts_meta_for_stmt_hashes(stmt_hashes, *, client)[source]
Return the metadata and statements for a given list of hashes
- Parameters:
stmt_hashes (
Iterable
[int
]) – The list of statement hashes to query.client (
Neo4jClient
) – The Neo4j client.
- Return type:
- Returns:
A dict of statements with their metadata
- get_targets_for_drug(drug, *, client)[source]
Return the proteins targeted by the given drug.
- Parameters:
client (
Neo4jClient
) – The Neo4j client.
- Return type:
Iterable
[Agent
]- Returns:
The proteins targeted by the given drug.
- get_targets_for_drugs(drugs, *, client)[source]
Return the proteins targeted by each of the given drugs
- is_gene_in_pathway(gene, pathway, *, client)[source]
Return True if the gene is in the given pathway.
- is_gene_in_tissue(gene, tissue, *, client)[source]
Return True if the gene is expressed in the given tissue.
- is_gene_mutated(gene, cell_line, *, client)[source]
Return True if the gene is mutated in the given cell line.
- is_go_term_for_gene(gene, go_term, *, client)[source]
Return True if the given GO term is associated with the given gene.
- is_side_effect_for_drug(drug, side_effect, *, client)[source]
Return True if the given side effect is associated with the given drug.