repository_name stringlengths 5 67 | func_path_in_repository stringlengths 4 234 | func_name stringlengths 0 314 | whole_func_string stringlengths 52 3.87M | language stringclasses 6
values | func_code_string stringlengths 52 3.87M | func_documentation_string stringlengths 1 47.2k | func_code_url stringlengths 85 339 |
|---|---|---|---|---|---|---|---|
sorgerlab/indra | indra/sources/biopax/processor.py | BiopaxProcessor.get_gef | def get_gef(self):
"""Extract Gef INDRA Statements from the BioPAX model.
This method uses a custom BioPAX Pattern
(one that is not implemented PatternBox) to query for controlled
BiochemicalReactions in which the same protein is in complex with
GDP on the left hand side and in ... | python | def get_gef(self):
"""Extract Gef INDRA Statements from the BioPAX model.
This method uses a custom BioPAX Pattern
(one that is not implemented PatternBox) to query for controlled
BiochemicalReactions in which the same protein is in complex with
GDP on the left hand side and in ... | Extract Gef INDRA Statements from the BioPAX model.
This method uses a custom BioPAX Pattern
(one that is not implemented PatternBox) to query for controlled
BiochemicalReactions in which the same protein is in complex with
GDP on the left hand side and in complex with GTP on the
... | https://github.com/sorgerlab/indra/blob/79a70415832c5702d7a820c7c9ccc8e25010124b/indra/sources/biopax/processor.py#L474-L531 |
sorgerlab/indra | indra/sources/biopax/processor.py | BiopaxProcessor.get_gap | def get_gap(self):
"""Extract Gap INDRA Statements from the BioPAX model.
This method uses a custom BioPAX Pattern
(one that is not implemented PatternBox) to query for controlled
BiochemicalReactions in which the same protein is in complex with
GTP on the left hand side and in ... | python | def get_gap(self):
"""Extract Gap INDRA Statements from the BioPAX model.
This method uses a custom BioPAX Pattern
(one that is not implemented PatternBox) to query for controlled
BiochemicalReactions in which the same protein is in complex with
GTP on the left hand side and in ... | Extract Gap INDRA Statements from the BioPAX model.
This method uses a custom BioPAX Pattern
(one that is not implemented PatternBox) to query for controlled
BiochemicalReactions in which the same protein is in complex with
GTP on the left hand side and in complex with GDP on the
... | https://github.com/sorgerlab/indra/blob/79a70415832c5702d7a820c7c9ccc8e25010124b/indra/sources/biopax/processor.py#L533-L590 |
sorgerlab/indra | indra/sources/biopax/processor.py | BiopaxProcessor._get_entity_mods | def _get_entity_mods(bpe):
"""Get all the modifications of an entity in INDRA format"""
if _is_entity(bpe):
features = bpe.getFeature().toArray()
else:
features = bpe.getEntityFeature().toArray()
mods = []
for feature in features:
if not _is_mo... | python | def _get_entity_mods(bpe):
"""Get all the modifications of an entity in INDRA format"""
if _is_entity(bpe):
features = bpe.getFeature().toArray()
else:
features = bpe.getEntityFeature().toArray()
mods = []
for feature in features:
if not _is_mo... | Get all the modifications of an entity in INDRA format | https://github.com/sorgerlab/indra/blob/79a70415832c5702d7a820c7c9ccc8e25010124b/indra/sources/biopax/processor.py#L633-L646 |
sorgerlab/indra | indra/sources/biopax/processor.py | BiopaxProcessor._get_generic_modification | def _get_generic_modification(self, mod_class):
"""Get all modification reactions given a Modification class."""
mod_type = modclass_to_modtype[mod_class]
if issubclass(mod_class, RemoveModification):
mod_gain_const = mcct.LOSS
mod_type = modtype_to_inverse[mod_type]
... | python | def _get_generic_modification(self, mod_class):
"""Get all modification reactions given a Modification class."""
mod_type = modclass_to_modtype[mod_class]
if issubclass(mod_class, RemoveModification):
mod_gain_const = mcct.LOSS
mod_type = modtype_to_inverse[mod_type]
... | Get all modification reactions given a Modification class. | https://github.com/sorgerlab/indra/blob/79a70415832c5702d7a820c7c9ccc8e25010124b/indra/sources/biopax/processor.py#L648-L721 |
sorgerlab/indra | indra/sources/biopax/processor.py | BiopaxProcessor._construct_modification_pattern | def _construct_modification_pattern():
"""Construct the BioPAX pattern to extract modification reactions."""
# The following constraints were pieced together based on the
# following two higher level constrains: pb.controlsStateChange(),
# pb.controlsPhosphorylation().
p = _bpp('... | python | def _construct_modification_pattern():
"""Construct the BioPAX pattern to extract modification reactions."""
# The following constraints were pieced together based on the
# following two higher level constrains: pb.controlsStateChange(),
# pb.controlsPhosphorylation().
p = _bpp('... | Construct the BioPAX pattern to extract modification reactions. | https://github.com/sorgerlab/indra/blob/79a70415832c5702d7a820c7c9ccc8e25010124b/indra/sources/biopax/processor.py#L788-L826 |
sorgerlab/indra | indra/sources/biopax/processor.py | BiopaxProcessor._extract_mod_from_feature | def _extract_mod_from_feature(mf):
"""Extract the type of modification and the position from
a ModificationFeature object in the INDRA format."""
# ModificationFeature / SequenceModificationVocabulary
mf_type = mf.getModificationType()
if mf_type is None:
return None
... | python | def _extract_mod_from_feature(mf):
"""Extract the type of modification and the position from
a ModificationFeature object in the INDRA format."""
# ModificationFeature / SequenceModificationVocabulary
mf_type = mf.getModificationType()
if mf_type is None:
return None
... | Extract the type of modification and the position from
a ModificationFeature object in the INDRA format. | https://github.com/sorgerlab/indra/blob/79a70415832c5702d7a820c7c9ccc8e25010124b/indra/sources/biopax/processor.py#L875-L922 |
sorgerlab/indra | indra/sources/biopax/processor.py | BiopaxProcessor._get_entref | def _get_entref(bpe):
"""Returns the entity reference of an entity if it exists or
return the entity reference that was passed in as argument."""
if not _is_reference(bpe):
try:
er = bpe.getEntityReference()
except AttributeError:
return No... | python | def _get_entref(bpe):
"""Returns the entity reference of an entity if it exists or
return the entity reference that was passed in as argument."""
if not _is_reference(bpe):
try:
er = bpe.getEntityReference()
except AttributeError:
return No... | Returns the entity reference of an entity if it exists or
return the entity reference that was passed in as argument. | https://github.com/sorgerlab/indra/blob/79a70415832c5702d7a820c7c9ccc8e25010124b/indra/sources/biopax/processor.py#L1224-L1234 |
sorgerlab/indra | indra/sources/trips/processor.py | _stmt_location_to_agents | def _stmt_location_to_agents(stmt, location):
"""Apply an event location to the Agents in the corresponding Statement.
If a Statement is in a given location we represent that by requiring all
Agents in the Statement to be in that location.
"""
if location is None:
return
agents = stmt.a... | python | def _stmt_location_to_agents(stmt, location):
"""Apply an event location to the Agents in the corresponding Statement.
If a Statement is in a given location we represent that by requiring all
Agents in the Statement to be in that location.
"""
if location is None:
return
agents = stmt.a... | Apply an event location to the Agents in the corresponding Statement.
If a Statement is in a given location we represent that by requiring all
Agents in the Statement to be in that location. | https://github.com/sorgerlab/indra/blob/79a70415832c5702d7a820c7c9ccc8e25010124b/indra/sources/trips/processor.py#L1710-L1721 |
sorgerlab/indra | indra/sources/trips/processor.py | _get_db_refs | def _get_db_refs(term):
"""Extract database references for a TERM."""
db_refs = {}
# Here we extract the text name of the Agent
# There are two relevant tags to consider here.
# The <text> tag typically contains a larger phrase surrounding the
# term but it contains the term in a raw, non-canoni... | python | def _get_db_refs(term):
"""Extract database references for a TERM."""
db_refs = {}
# Here we extract the text name of the Agent
# There are two relevant tags to consider here.
# The <text> tag typically contains a larger phrase surrounding the
# term but it contains the term in a raw, non-canoni... | Extract database references for a TERM. | https://github.com/sorgerlab/indra/blob/79a70415832c5702d7a820c7c9ccc8e25010124b/indra/sources/trips/processor.py#L1754-L1913 |
sorgerlab/indra | indra/sources/trips/processor.py | TripsProcessor.get_all_events | def get_all_events(self):
"""Make a list of all events in the TRIPS EKB.
The events are stored in self.all_events.
"""
self.all_events = {}
events = self.tree.findall('EVENT')
events += self.tree.findall('CC')
for e in events:
event_id = e.attrib['id'... | python | def get_all_events(self):
"""Make a list of all events in the TRIPS EKB.
The events are stored in self.all_events.
"""
self.all_events = {}
events = self.tree.findall('EVENT')
events += self.tree.findall('CC')
for e in events:
event_id = e.attrib['id'... | Make a list of all events in the TRIPS EKB.
The events are stored in self.all_events. | https://github.com/sorgerlab/indra/blob/79a70415832c5702d7a820c7c9ccc8e25010124b/indra/sources/trips/processor.py#L98-L114 |
sorgerlab/indra | indra/sources/trips/processor.py | TripsProcessor.get_activations | def get_activations(self):
"""Extract direct Activation INDRA Statements."""
act_events = self.tree.findall("EVENT/[type='ONT::ACTIVATE']")
inact_events = self.tree.findall("EVENT/[type='ONT::DEACTIVATE']")
inact_events += self.tree.findall("EVENT/[type='ONT::INHIBIT']")
for even... | python | def get_activations(self):
"""Extract direct Activation INDRA Statements."""
act_events = self.tree.findall("EVENT/[type='ONT::ACTIVATE']")
inact_events = self.tree.findall("EVENT/[type='ONT::DEACTIVATE']")
inact_events += self.tree.findall("EVENT/[type='ONT::INHIBIT']")
for even... | Extract direct Activation INDRA Statements. | https://github.com/sorgerlab/indra/blob/79a70415832c5702d7a820c7c9ccc8e25010124b/indra/sources/trips/processor.py#L116-L174 |
sorgerlab/indra | indra/sources/trips/processor.py | TripsProcessor.get_activations_causal | def get_activations_causal(self):
"""Extract causal Activation INDRA Statements."""
# Search for causal connectives of type ONT::CAUSE
ccs = self.tree.findall("CC/[type='ONT::CAUSE']")
for cc in ccs:
factor = cc.find("arg/[@role=':FACTOR']")
outcome = cc.find("arg... | python | def get_activations_causal(self):
"""Extract causal Activation INDRA Statements."""
# Search for causal connectives of type ONT::CAUSE
ccs = self.tree.findall("CC/[type='ONT::CAUSE']")
for cc in ccs:
factor = cc.find("arg/[@role=':FACTOR']")
outcome = cc.find("arg... | Extract causal Activation INDRA Statements. | https://github.com/sorgerlab/indra/blob/79a70415832c5702d7a820c7c9ccc8e25010124b/indra/sources/trips/processor.py#L176-L235 |
sorgerlab/indra | indra/sources/trips/processor.py | TripsProcessor.get_activations_stimulate | def get_activations_stimulate(self):
"""Extract Activation INDRA Statements via stimulation."""
# TODO: extract to other patterns:
# - Stimulation by EGF activates ERK
# - Stimulation by EGF leads to ERK activation
# Search for stimulation event
stim_events = self.tree.fi... | python | def get_activations_stimulate(self):
"""Extract Activation INDRA Statements via stimulation."""
# TODO: extract to other patterns:
# - Stimulation by EGF activates ERK
# - Stimulation by EGF leads to ERK activation
# Search for stimulation event
stim_events = self.tree.fi... | Extract Activation INDRA Statements via stimulation. | https://github.com/sorgerlab/indra/blob/79a70415832c5702d7a820c7c9ccc8e25010124b/indra/sources/trips/processor.py#L237-L303 |
sorgerlab/indra | indra/sources/trips/processor.py | TripsProcessor.get_degradations | def get_degradations(self):
"""Extract Degradation INDRA Statements."""
deg_events = self.tree.findall("EVENT/[type='ONT::CONSUME']")
for event in deg_events:
if event.attrib['id'] in self._static_events:
continue
affected = event.find(".//*[@role=':AFFECT... | python | def get_degradations(self):
"""Extract Degradation INDRA Statements."""
deg_events = self.tree.findall("EVENT/[type='ONT::CONSUME']")
for event in deg_events:
if event.attrib['id'] in self._static_events:
continue
affected = event.find(".//*[@role=':AFFECT... | Extract Degradation INDRA Statements. | https://github.com/sorgerlab/indra/blob/79a70415832c5702d7a820c7c9ccc8e25010124b/indra/sources/trips/processor.py#L305-L354 |
sorgerlab/indra | indra/sources/trips/processor.py | TripsProcessor.get_regulate_amounts | def get_regulate_amounts(self):
"""Extract Increase/DecreaseAmount Statements."""
pos_events = []
neg_events = []
pattern = "EVENT/[type='ONT::STIMULATE']/arg2/[type='ONT::TRANSCRIBE']/.."
pos_events += self.tree.findall(pattern)
pattern = "EVENT/[type='ONT::INCREASE']/ar... | python | def get_regulate_amounts(self):
"""Extract Increase/DecreaseAmount Statements."""
pos_events = []
neg_events = []
pattern = "EVENT/[type='ONT::STIMULATE']/arg2/[type='ONT::TRANSCRIBE']/.."
pos_events += self.tree.findall(pattern)
pattern = "EVENT/[type='ONT::INCREASE']/ar... | Extract Increase/DecreaseAmount Statements. | https://github.com/sorgerlab/indra/blob/79a70415832c5702d7a820c7c9ccc8e25010124b/indra/sources/trips/processor.py#L416-L490 |
sorgerlab/indra | indra/sources/trips/processor.py | TripsProcessor.get_active_forms | def get_active_forms(self):
"""Extract ActiveForm INDRA Statements."""
act_events = self.tree.findall("EVENT/[type='ONT::ACTIVATE']")
def _agent_is_basic(agent):
if not agent.mods and not agent.mutations \
and not agent.bound_conditions and not agent.location:
... | python | def get_active_forms(self):
"""Extract ActiveForm INDRA Statements."""
act_events = self.tree.findall("EVENT/[type='ONT::ACTIVATE']")
def _agent_is_basic(agent):
if not agent.mods and not agent.mutations \
and not agent.bound_conditions and not agent.location:
... | Extract ActiveForm INDRA Statements. | https://github.com/sorgerlab/indra/blob/79a70415832c5702d7a820c7c9ccc8e25010124b/indra/sources/trips/processor.py#L556-L604 |
sorgerlab/indra | indra/sources/trips/processor.py | TripsProcessor.get_active_forms_state | def get_active_forms_state(self):
"""Extract ActiveForm INDRA Statements."""
for term in self._isolated_terms:
act = term.find('features/active')
if act is None:
continue
if act.text == 'TRUE':
is_active = True
elif act.text... | python | def get_active_forms_state(self):
"""Extract ActiveForm INDRA Statements."""
for term in self._isolated_terms:
act = term.find('features/active')
if act is None:
continue
if act.text == 'TRUE':
is_active = True
elif act.text... | Extract ActiveForm INDRA Statements. | https://github.com/sorgerlab/indra/blob/79a70415832c5702d7a820c7c9ccc8e25010124b/indra/sources/trips/processor.py#L606-L635 |
sorgerlab/indra | indra/sources/trips/processor.py | TripsProcessor.get_complexes | def get_complexes(self):
"""Extract Complex INDRA Statements."""
bind_events = self.tree.findall("EVENT/[type='ONT::BIND']")
bind_events += self.tree.findall("EVENT/[type='ONT::INTERACT']")
for event in bind_events:
if event.attrib['id'] in self._static_events:
... | python | def get_complexes(self):
"""Extract Complex INDRA Statements."""
bind_events = self.tree.findall("EVENT/[type='ONT::BIND']")
bind_events += self.tree.findall("EVENT/[type='ONT::INTERACT']")
for event in bind_events:
if event.attrib['id'] in self._static_events:
... | Extract Complex INDRA Statements. | https://github.com/sorgerlab/indra/blob/79a70415832c5702d7a820c7c9ccc8e25010124b/indra/sources/trips/processor.py#L637-L693 |
sorgerlab/indra | indra/sources/trips/processor.py | TripsProcessor.get_modifications | def get_modifications(self):
"""Extract all types of Modification INDRA Statements."""
# Get all the specific mod types
mod_event_types = list(ont_to_mod_type.keys())
# Add ONT::PTMs as a special case
mod_event_types += ['ONT::PTM']
mod_events = []
for mod_event_t... | python | def get_modifications(self):
"""Extract all types of Modification INDRA Statements."""
# Get all the specific mod types
mod_event_types = list(ont_to_mod_type.keys())
# Add ONT::PTMs as a special case
mod_event_types += ['ONT::PTM']
mod_events = []
for mod_event_t... | Extract all types of Modification INDRA Statements. | https://github.com/sorgerlab/indra/blob/79a70415832c5702d7a820c7c9ccc8e25010124b/indra/sources/trips/processor.py#L695-L715 |
sorgerlab/indra | indra/sources/trips/processor.py | TripsProcessor.get_modifications_indirect | def get_modifications_indirect(self):
"""Extract indirect Modification INDRA Statements."""
# Get all the specific mod types
mod_event_types = list(ont_to_mod_type.keys())
# Add ONT::PTMs as a special case
mod_event_types += ['ONT::PTM']
def get_increase_events(mod_event... | python | def get_modifications_indirect(self):
"""Extract indirect Modification INDRA Statements."""
# Get all the specific mod types
mod_event_types = list(ont_to_mod_type.keys())
# Add ONT::PTMs as a special case
mod_event_types += ['ONT::PTM']
def get_increase_events(mod_event... | Extract indirect Modification INDRA Statements. | https://github.com/sorgerlab/indra/blob/79a70415832c5702d7a820c7c9ccc8e25010124b/indra/sources/trips/processor.py#L717-L821 |
sorgerlab/indra | indra/sources/trips/processor.py | TripsProcessor.get_agents | def get_agents(self):
"""Return list of INDRA Agents corresponding to TERMs in the EKB.
This is meant to be used when entities e.g. "phosphorylated ERK",
rather than events need to be extracted from processed natural
language. These entities with their respective states are represented
... | python | def get_agents(self):
"""Return list of INDRA Agents corresponding to TERMs in the EKB.
This is meant to be used when entities e.g. "phosphorylated ERK",
rather than events need to be extracted from processed natural
language. These entities with their respective states are represented
... | Return list of INDRA Agents corresponding to TERMs in the EKB.
This is meant to be used when entities e.g. "phosphorylated ERK",
rather than events need to be extracted from processed natural
language. These entities with their respective states are represented
as INDRA Agents.
... | https://github.com/sorgerlab/indra/blob/79a70415832c5702d7a820c7c9ccc8e25010124b/indra/sources/trips/processor.py#L1059-L1074 |
sorgerlab/indra | indra/sources/trips/processor.py | TripsProcessor.get_term_agents | def get_term_agents(self):
"""Return dict of INDRA Agents keyed by corresponding TERMs in the EKB.
This is meant to be used when entities e.g. "phosphorylated ERK",
rather than events need to be extracted from processed natural
language. These entities with their respective states are r... | python | def get_term_agents(self):
"""Return dict of INDRA Agents keyed by corresponding TERMs in the EKB.
This is meant to be used when entities e.g. "phosphorylated ERK",
rather than events need to be extracted from processed natural
language. These entities with their respective states are r... | Return dict of INDRA Agents keyed by corresponding TERMs in the EKB.
This is meant to be used when entities e.g. "phosphorylated ERK",
rather than events need to be extracted from processed natural
language. These entities with their respective states are represented
as INDRA Agents. Fu... | https://github.com/sorgerlab/indra/blob/79a70415832c5702d7a820c7c9ccc8e25010124b/indra/sources/trips/processor.py#L1076-L1110 |
sorgerlab/indra | indra/sources/trips/processor.py | TripsProcessor._get_evidence_text | def _get_evidence_text(self, event_tag):
"""Extract the evidence for an event.
Pieces of text linked to an EVENT are fragments of a sentence. The
EVENT refers to the paragraph ID and the "uttnum", which corresponds
to a sentence ID. Here we find and return the full sentence from which
... | python | def _get_evidence_text(self, event_tag):
"""Extract the evidence for an event.
Pieces of text linked to an EVENT are fragments of a sentence. The
EVENT refers to the paragraph ID and the "uttnum", which corresponds
to a sentence ID. Here we find and return the full sentence from which
... | Extract the evidence for an event.
Pieces of text linked to an EVENT are fragments of a sentence. The
EVENT refers to the paragraph ID and the "uttnum", which corresponds
to a sentence ID. Here we find and return the full sentence from which
the event was taken. | https://github.com/sorgerlab/indra/blob/79a70415832c5702d7a820c7c9ccc8e25010124b/indra/sources/trips/processor.py#L1596-L1613 |
sorgerlab/indra | indra/assemblers/pybel/assembler.py | _get_agent_grounding | def _get_agent_grounding(agent):
"""Convert an agent to the corresponding PyBEL DSL object (to be filled with variants later)."""
def _get_id(_agent, key):
_id = _agent.db_refs.get(key)
if isinstance(_id, list):
_id = _id[0]
return _id
hgnc_id = _get_id(agent, 'HGNC')
... | python | def _get_agent_grounding(agent):
"""Convert an agent to the corresponding PyBEL DSL object (to be filled with variants later)."""
def _get_id(_agent, key):
_id = _agent.db_refs.get(key)
if isinstance(_id, list):
_id = _id[0]
return _id
hgnc_id = _get_id(agent, 'HGNC')
... | Convert an agent to the corresponding PyBEL DSL object (to be filled with variants later). | https://github.com/sorgerlab/indra/blob/79a70415832c5702d7a820c7c9ccc8e25010124b/indra/assemblers/pybel/assembler.py#L463-L518 |
sorgerlab/indra | indra/assemblers/pybel/assembler.py | get_causal_edge | def get_causal_edge(stmt, activates):
"""Returns the causal, polar edge with the correct "contact"."""
any_contact = any(
evidence.epistemics.get('direct', False)
for evidence in stmt.evidence
)
if any_contact:
return pc.DIRECTLY_INCREASES if activates else pc.DIRECTLY_DECREASES
... | python | def get_causal_edge(stmt, activates):
"""Returns the causal, polar edge with the correct "contact"."""
any_contact = any(
evidence.epistemics.get('direct', False)
for evidence in stmt.evidence
)
if any_contact:
return pc.DIRECTLY_INCREASES if activates else pc.DIRECTLY_DECREASES
... | Returns the causal, polar edge with the correct "contact". | https://github.com/sorgerlab/indra/blob/79a70415832c5702d7a820c7c9ccc8e25010124b/indra/assemblers/pybel/assembler.py#L568-L577 |
sorgerlab/indra | indra/assemblers/pybel/assembler.py | PybelAssembler.to_database | def to_database(self, manager=None):
"""Send the model to the PyBEL database
This function wraps :py:func:`pybel.to_database`.
Parameters
----------
manager : Optional[pybel.manager.Manager]
A PyBEL database manager. If none, first checks the PyBEL
confi... | python | def to_database(self, manager=None):
"""Send the model to the PyBEL database
This function wraps :py:func:`pybel.to_database`.
Parameters
----------
manager : Optional[pybel.manager.Manager]
A PyBEL database manager. If none, first checks the PyBEL
confi... | Send the model to the PyBEL database
This function wraps :py:func:`pybel.to_database`.
Parameters
----------
manager : Optional[pybel.manager.Manager]
A PyBEL database manager. If none, first checks the PyBEL
configuration for ``PYBEL_CONNECTION`` then checks th... | https://github.com/sorgerlab/indra/blob/79a70415832c5702d7a820c7c9ccc8e25010124b/indra/assemblers/pybel/assembler.py#L149-L170 |
sorgerlab/indra | indra/assemblers/pybel/assembler.py | PybelAssembler.to_web | def to_web(self, host=None, user=None, password=None):
"""Send the model to BEL Commons by wrapping :py:func:`pybel.to_web`
The parameters ``host``, ``user``, and ``password`` all check the
PyBEL configuration, which is located at
``~/.config/pybel/config.json`` by default
Para... | python | def to_web(self, host=None, user=None, password=None):
"""Send the model to BEL Commons by wrapping :py:func:`pybel.to_web`
The parameters ``host``, ``user``, and ``password`` all check the
PyBEL configuration, which is located at
``~/.config/pybel/config.json`` by default
Para... | Send the model to BEL Commons by wrapping :py:func:`pybel.to_web`
The parameters ``host``, ``user``, and ``password`` all check the
PyBEL configuration, which is located at
``~/.config/pybel/config.json`` by default
Parameters
----------
host : Optional[str]
... | https://github.com/sorgerlab/indra/blob/79a70415832c5702d7a820c7c9ccc8e25010124b/indra/assemblers/pybel/assembler.py#L172-L202 |
sorgerlab/indra | indra/assemblers/pybel/assembler.py | PybelAssembler.save_model | def save_model(self, path, output_format=None):
"""Save the :class:`pybel.BELGraph` using one of the outputs from
:py:mod:`pybel`
Parameters
----------
path : str
The path to output to
output_format : Optional[str]
Output format as ``cx``, ``pickl... | python | def save_model(self, path, output_format=None):
"""Save the :class:`pybel.BELGraph` using one of the outputs from
:py:mod:`pybel`
Parameters
----------
path : str
The path to output to
output_format : Optional[str]
Output format as ``cx``, ``pickl... | Save the :class:`pybel.BELGraph` using one of the outputs from
:py:mod:`pybel`
Parameters
----------
path : str
The path to output to
output_format : Optional[str]
Output format as ``cx``, ``pickle``, ``json`` or defaults to ``bel`` | https://github.com/sorgerlab/indra/blob/79a70415832c5702d7a820c7c9ccc8e25010124b/indra/assemblers/pybel/assembler.py#L204-L224 |
sorgerlab/indra | indra/assemblers/pybel/assembler.py | PybelAssembler._add_nodes_edges | def _add_nodes_edges(self, subj_agent, obj_agent, relation, evidences):
"""Given subj/obj agents, relation, and evidence, add nodes/edges."""
subj_data, subj_edge = _get_agent_node(subj_agent)
obj_data, obj_edge = _get_agent_node(obj_agent)
# If we failed to create nodes for subject or o... | python | def _add_nodes_edges(self, subj_agent, obj_agent, relation, evidences):
"""Given subj/obj agents, relation, and evidence, add nodes/edges."""
subj_data, subj_edge = _get_agent_node(subj_agent)
obj_data, obj_edge = _get_agent_node(obj_agent)
# If we failed to create nodes for subject or o... | Given subj/obj agents, relation, and evidence, add nodes/edges. | https://github.com/sorgerlab/indra/blob/79a70415832c5702d7a820c7c9ccc8e25010124b/indra/assemblers/pybel/assembler.py#L249-L261 |
sorgerlab/indra | indra/assemblers/pybel/assembler.py | PybelAssembler._assemble_regulate_activity | def _assemble_regulate_activity(self, stmt):
"""Example: p(HGNC:MAP2K1) => act(p(HGNC:MAPK1))"""
act_obj = deepcopy(stmt.obj)
act_obj.activity = stmt._get_activity_condition()
# We set is_active to True here since the polarity is encoded
# in the edge (decreases/increases)
... | python | def _assemble_regulate_activity(self, stmt):
"""Example: p(HGNC:MAP2K1) => act(p(HGNC:MAPK1))"""
act_obj = deepcopy(stmt.obj)
act_obj.activity = stmt._get_activity_condition()
# We set is_active to True here since the polarity is encoded
# in the edge (decreases/increases)
... | Example: p(HGNC:MAP2K1) => act(p(HGNC:MAPK1)) | https://github.com/sorgerlab/indra/blob/79a70415832c5702d7a820c7c9ccc8e25010124b/indra/assemblers/pybel/assembler.py#L263-L272 |
sorgerlab/indra | indra/assemblers/pybel/assembler.py | PybelAssembler._assemble_modification | def _assemble_modification(self, stmt):
"""Example: p(HGNC:MAP2K1) => p(HGNC:MAPK1, pmod(Ph, Thr, 185))"""
sub_agent = deepcopy(stmt.sub)
sub_agent.mods.append(stmt._get_mod_condition())
activates = isinstance(stmt, AddModification)
relation = get_causal_edge(stmt, activates)
... | python | def _assemble_modification(self, stmt):
"""Example: p(HGNC:MAP2K1) => p(HGNC:MAPK1, pmod(Ph, Thr, 185))"""
sub_agent = deepcopy(stmt.sub)
sub_agent.mods.append(stmt._get_mod_condition())
activates = isinstance(stmt, AddModification)
relation = get_causal_edge(stmt, activates)
... | Example: p(HGNC:MAP2K1) => p(HGNC:MAPK1, pmod(Ph, Thr, 185)) | https://github.com/sorgerlab/indra/blob/79a70415832c5702d7a820c7c9ccc8e25010124b/indra/assemblers/pybel/assembler.py#L274-L280 |
sorgerlab/indra | indra/assemblers/pybel/assembler.py | PybelAssembler._assemble_regulate_amount | def _assemble_regulate_amount(self, stmt):
"""Example: p(HGNC:ELK1) => p(HGNC:FOS)"""
activates = isinstance(stmt, IncreaseAmount)
relation = get_causal_edge(stmt, activates)
self._add_nodes_edges(stmt.subj, stmt.obj, relation, stmt.evidence) | python | def _assemble_regulate_amount(self, stmt):
"""Example: p(HGNC:ELK1) => p(HGNC:FOS)"""
activates = isinstance(stmt, IncreaseAmount)
relation = get_causal_edge(stmt, activates)
self._add_nodes_edges(stmt.subj, stmt.obj, relation, stmt.evidence) | Example: p(HGNC:ELK1) => p(HGNC:FOS) | https://github.com/sorgerlab/indra/blob/79a70415832c5702d7a820c7c9ccc8e25010124b/indra/assemblers/pybel/assembler.py#L282-L286 |
sorgerlab/indra | indra/assemblers/pybel/assembler.py | PybelAssembler._assemble_gef | def _assemble_gef(self, stmt):
"""Example: act(p(HGNC:SOS1), ma(gef)) => act(p(HGNC:KRAS), ma(gtp))"""
gef = deepcopy(stmt.gef)
gef.activity = ActivityCondition('gef', True)
ras = deepcopy(stmt.ras)
ras.activity = ActivityCondition('gtpbound', True)
self._add_nodes_edges(... | python | def _assemble_gef(self, stmt):
"""Example: act(p(HGNC:SOS1), ma(gef)) => act(p(HGNC:KRAS), ma(gtp))"""
gef = deepcopy(stmt.gef)
gef.activity = ActivityCondition('gef', True)
ras = deepcopy(stmt.ras)
ras.activity = ActivityCondition('gtpbound', True)
self._add_nodes_edges(... | Example: act(p(HGNC:SOS1), ma(gef)) => act(p(HGNC:KRAS), ma(gtp)) | https://github.com/sorgerlab/indra/blob/79a70415832c5702d7a820c7c9ccc8e25010124b/indra/assemblers/pybel/assembler.py#L288-L294 |
sorgerlab/indra | indra/assemblers/pybel/assembler.py | PybelAssembler._assemble_gap | def _assemble_gap(self, stmt):
"""Example: act(p(HGNC:RASA1), ma(gap)) =| act(p(HGNC:KRAS), ma(gtp))"""
gap = deepcopy(stmt.gap)
gap.activity = ActivityCondition('gap', True)
ras = deepcopy(stmt.ras)
ras.activity = ActivityCondition('gtpbound', True)
self._add_nodes_edges... | python | def _assemble_gap(self, stmt):
"""Example: act(p(HGNC:RASA1), ma(gap)) =| act(p(HGNC:KRAS), ma(gtp))"""
gap = deepcopy(stmt.gap)
gap.activity = ActivityCondition('gap', True)
ras = deepcopy(stmt.ras)
ras.activity = ActivityCondition('gtpbound', True)
self._add_nodes_edges... | Example: act(p(HGNC:RASA1), ma(gap)) =| act(p(HGNC:KRAS), ma(gtp)) | https://github.com/sorgerlab/indra/blob/79a70415832c5702d7a820c7c9ccc8e25010124b/indra/assemblers/pybel/assembler.py#L296-L302 |
sorgerlab/indra | indra/assemblers/pybel/assembler.py | PybelAssembler._assemble_active_form | def _assemble_active_form(self, stmt):
"""Example: p(HGNC:ELK1, pmod(Ph)) => act(p(HGNC:ELK1), ma(tscript))"""
act_agent = Agent(stmt.agent.name, db_refs=stmt.agent.db_refs)
act_agent.activity = ActivityCondition(stmt.activity, True)
activates = stmt.is_active
relation = get_caus... | python | def _assemble_active_form(self, stmt):
"""Example: p(HGNC:ELK1, pmod(Ph)) => act(p(HGNC:ELK1), ma(tscript))"""
act_agent = Agent(stmt.agent.name, db_refs=stmt.agent.db_refs)
act_agent.activity = ActivityCondition(stmt.activity, True)
activates = stmt.is_active
relation = get_caus... | Example: p(HGNC:ELK1, pmod(Ph)) => act(p(HGNC:ELK1), ma(tscript)) | https://github.com/sorgerlab/indra/blob/79a70415832c5702d7a820c7c9ccc8e25010124b/indra/assemblers/pybel/assembler.py#L304-L310 |
sorgerlab/indra | indra/assemblers/pybel/assembler.py | PybelAssembler._assemble_complex | def _assemble_complex(self, stmt):
"""Example: complex(p(HGNC:MAPK14), p(HGNC:TAB1))"""
complex_data, _ = _get_complex_node(stmt.members)
if complex_data is None:
logger.info('skip adding complex with no members: %s', stmt.members)
return
self.model.add_node_from_... | python | def _assemble_complex(self, stmt):
"""Example: complex(p(HGNC:MAPK14), p(HGNC:TAB1))"""
complex_data, _ = _get_complex_node(stmt.members)
if complex_data is None:
logger.info('skip adding complex with no members: %s', stmt.members)
return
self.model.add_node_from_... | Example: complex(p(HGNC:MAPK14), p(HGNC:TAB1)) | https://github.com/sorgerlab/indra/blob/79a70415832c5702d7a820c7c9ccc8e25010124b/indra/assemblers/pybel/assembler.py#L312-L318 |
sorgerlab/indra | indra/assemblers/pybel/assembler.py | PybelAssembler._assemble_conversion | def _assemble_conversion(self, stmt):
"""Example: p(HGNC:HK1) => rxn(reactants(a(CHEBI:"CHEBI:17634")),
products(a(CHEBI:"CHEBI:4170")))"""
pybel_lists = ([], [])
for pybel_list, agent_list in \
zip(pybel_lists, (stmt.obj_from, s... | python | def _assemble_conversion(self, stmt):
"""Example: p(HGNC:HK1) => rxn(reactants(a(CHEBI:"CHEBI:17634")),
products(a(CHEBI:"CHEBI:4170")))"""
pybel_lists = ([], [])
for pybel_list, agent_list in \
zip(pybel_lists, (stmt.obj_from, s... | Example: p(HGNC:HK1) => rxn(reactants(a(CHEBI:"CHEBI:17634")),
products(a(CHEBI:"CHEBI:4170"))) | https://github.com/sorgerlab/indra/blob/79a70415832c5702d7a820c7c9ccc8e25010124b/indra/assemblers/pybel/assembler.py#L320-L344 |
sorgerlab/indra | indra/assemblers/pybel/assembler.py | PybelAssembler._assemble_autophosphorylation | def _assemble_autophosphorylation(self, stmt):
"""Example: complex(p(HGNC:MAPK14), p(HGNC:TAB1)) =>
p(HGNC:MAPK14, pmod(Ph, Tyr, 100))"""
sub_agent = deepcopy(stmt.enz)
mc = stmt._get_mod_condition()
sub_agent.mods.append(mc)
# FIXME Ignore... | python | def _assemble_autophosphorylation(self, stmt):
"""Example: complex(p(HGNC:MAPK14), p(HGNC:TAB1)) =>
p(HGNC:MAPK14, pmod(Ph, Tyr, 100))"""
sub_agent = deepcopy(stmt.enz)
mc = stmt._get_mod_condition()
sub_agent.mods.append(mc)
# FIXME Ignore... | Example: complex(p(HGNC:MAPK14), p(HGNC:TAB1)) =>
p(HGNC:MAPK14, pmod(Ph, Tyr, 100)) | https://github.com/sorgerlab/indra/blob/79a70415832c5702d7a820c7c9ccc8e25010124b/indra/assemblers/pybel/assembler.py#L346-L359 |
sorgerlab/indra | indra/assemblers/pybel/assembler.py | PybelAssembler._assemble_transphosphorylation | def _assemble_transphosphorylation(self, stmt):
"""Example: complex(p(HGNC:EGFR)) =>
p(HGNC:EGFR, pmod(Ph, Tyr, 1173))"""
# Check our assumptions about the bound condition of the enzyme
assert len(stmt.enz.bound_conditions) == 1
assert stmt.enz.b... | python | def _assemble_transphosphorylation(self, stmt):
"""Example: complex(p(HGNC:EGFR)) =>
p(HGNC:EGFR, pmod(Ph, Tyr, 1173))"""
# Check our assumptions about the bound condition of the enzyme
assert len(stmt.enz.bound_conditions) == 1
assert stmt.enz.b... | Example: complex(p(HGNC:EGFR)) =>
p(HGNC:EGFR, pmod(Ph, Tyr, 1173)) | https://github.com/sorgerlab/indra/blob/79a70415832c5702d7a820c7c9ccc8e25010124b/indra/assemblers/pybel/assembler.py#L361-L371 |
sorgerlab/indra | indra/assemblers/pysb/sites.py | get_binding_site_name | def get_binding_site_name(agent):
"""Return a binding site name from a given agent."""
# Try to construct a binding site name based on parent
grounding = agent.get_grounding()
if grounding != (None, None):
uri = hierarchies['entity'].get_uri(grounding[0], grounding[1])
# Get highest leve... | python | def get_binding_site_name(agent):
"""Return a binding site name from a given agent."""
# Try to construct a binding site name based on parent
grounding = agent.get_grounding()
if grounding != (None, None):
uri = hierarchies['entity'].get_uri(grounding[0], grounding[1])
# Get highest leve... | Return a binding site name from a given agent. | https://github.com/sorgerlab/indra/blob/79a70415832c5702d7a820c7c9ccc8e25010124b/indra/assemblers/pysb/sites.py#L68-L84 |
sorgerlab/indra | indra/assemblers/pysb/sites.py | get_mod_site_name | def get_mod_site_name(mod_condition):
"""Return site names for a modification."""
if mod_condition.residue is None:
mod_str = abbrevs[mod_condition.mod_type]
else:
mod_str = mod_condition.residue
mod_pos = mod_condition.position if \
mod_condition.position is not None else ''
... | python | def get_mod_site_name(mod_condition):
"""Return site names for a modification."""
if mod_condition.residue is None:
mod_str = abbrevs[mod_condition.mod_type]
else:
mod_str = mod_condition.residue
mod_pos = mod_condition.position if \
mod_condition.position is not None else ''
... | Return site names for a modification. | https://github.com/sorgerlab/indra/blob/79a70415832c5702d7a820c7c9ccc8e25010124b/indra/assemblers/pysb/sites.py#L87-L96 |
sorgerlab/indra | indra/sources/hprd/api.py | process_flat_files | def process_flat_files(id_mappings_file, complexes_file=None, ptm_file=None,
ppi_file=None, seq_file=None, motif_window=7):
"""Get INDRA Statements from HPRD data.
Of the arguments, `id_mappings_file` is required, and at least one of
`complexes_file`, `ptm_file`, and `ppi_file` must ... | python | def process_flat_files(id_mappings_file, complexes_file=None, ptm_file=None,
ppi_file=None, seq_file=None, motif_window=7):
"""Get INDRA Statements from HPRD data.
Of the arguments, `id_mappings_file` is required, and at least one of
`complexes_file`, `ptm_file`, and `ppi_file` must ... | Get INDRA Statements from HPRD data.
Of the arguments, `id_mappings_file` is required, and at least one of
`complexes_file`, `ptm_file`, and `ppi_file` must also be given. If
`ptm_file` is given, `seq_file` must also be given.
Note that many proteins (> 1,600) in the HPRD content are associated with
... | https://github.com/sorgerlab/indra/blob/79a70415832c5702d7a820c7c9ccc8e25010124b/indra/sources/hprd/api.py#L22-L104 |
sorgerlab/indra | indra/assemblers/pysb/preassembler.py | PysbPreassembler._gather_active_forms | def _gather_active_forms(self):
"""Collect all the active forms of each Agent in the Statements."""
for stmt in self.statements:
if isinstance(stmt, ActiveForm):
base_agent = self.agent_set.get_create_base_agent(stmt.agent)
# Handle the case where an activity ... | python | def _gather_active_forms(self):
"""Collect all the active forms of each Agent in the Statements."""
for stmt in self.statements:
if isinstance(stmt, ActiveForm):
base_agent = self.agent_set.get_create_base_agent(stmt.agent)
# Handle the case where an activity ... | Collect all the active forms of each Agent in the Statements. | https://github.com/sorgerlab/indra/blob/79a70415832c5702d7a820c7c9ccc8e25010124b/indra/assemblers/pysb/preassembler.py#L28-L39 |
sorgerlab/indra | indra/assemblers/pysb/preassembler.py | PysbPreassembler.replace_activities | def replace_activities(self):
"""Replace ative flags with Agent states when possible."""
logger.debug('Running PySB Preassembler replace activities')
# TODO: handle activity hierarchies
new_stmts = []
def has_agent_activity(stmt):
"""Return True if any agents in the ... | python | def replace_activities(self):
"""Replace ative flags with Agent states when possible."""
logger.debug('Running PySB Preassembler replace activities')
# TODO: handle activity hierarchies
new_stmts = []
def has_agent_activity(stmt):
"""Return True if any agents in the ... | Replace ative flags with Agent states when possible. | https://github.com/sorgerlab/indra/blob/79a70415832c5702d7a820c7c9ccc8e25010124b/indra/assemblers/pysb/preassembler.py#L41-L105 |
sorgerlab/indra | indra/assemblers/pysb/preassembler.py | PysbPreassembler.add_reverse_effects | def add_reverse_effects(self):
"""Add Statements for the reverse effects of some Statements.
For instance, if a protein is phosphorylated but never dephosphorylated
in the model, we add a generic dephosphorylation here. This step is
usually optional in the assembly process.
"""
... | python | def add_reverse_effects(self):
"""Add Statements for the reverse effects of some Statements.
For instance, if a protein is phosphorylated but never dephosphorylated
in the model, we add a generic dephosphorylation here. This step is
usually optional in the assembly process.
"""
... | Add Statements for the reverse effects of some Statements.
For instance, if a protein is phosphorylated but never dephosphorylated
in the model, we add a generic dephosphorylation here. This step is
usually optional in the assembly process. | https://github.com/sorgerlab/indra/blob/79a70415832c5702d7a820c7c9ccc8e25010124b/indra/assemblers/pysb/preassembler.py#L107-L156 |
sorgerlab/indra | indra/preassembler/sitemapper.py | _get_uniprot_id | def _get_uniprot_id(agent):
"""Return the UniProt ID for an agent, looking up in HGNC if necessary.
If the UniProt ID is a list then return the first ID by default.
"""
up_id = agent.db_refs.get('UP')
hgnc_id = agent.db_refs.get('HGNC')
if up_id is None:
if hgnc_id is None:
... | python | def _get_uniprot_id(agent):
"""Return the UniProt ID for an agent, looking up in HGNC if necessary.
If the UniProt ID is a list then return the first ID by default.
"""
up_id = agent.db_refs.get('UP')
hgnc_id = agent.db_refs.get('HGNC')
if up_id is None:
if hgnc_id is None:
... | Return the UniProt ID for an agent, looking up in HGNC if necessary.
If the UniProt ID is a list then return the first ID by default. | https://github.com/sorgerlab/indra/blob/79a70415832c5702d7a820c7c9ccc8e25010124b/indra/preassembler/sitemapper.py#L333-L354 |
sorgerlab/indra | indra/preassembler/sitemapper.py | SiteMapper.map_sites | def map_sites(self, stmts):
"""Check a set of statements for invalid modification sites.
Statements are checked against Uniprot reference sequences to determine
if residues referred to by post-translational modifications exist at
the given positions.
If there is nothing amiss w... | python | def map_sites(self, stmts):
"""Check a set of statements for invalid modification sites.
Statements are checked against Uniprot reference sequences to determine
if residues referred to by post-translational modifications exist at
the given positions.
If there is nothing amiss w... | Check a set of statements for invalid modification sites.
Statements are checked against Uniprot reference sequences to determine
if residues referred to by post-translational modifications exist at
the given positions.
If there is nothing amiss with a statement (modifications on any o... | https://github.com/sorgerlab/indra/blob/79a70415832c5702d7a820c7c9ccc8e25010124b/indra/preassembler/sitemapper.py#L203-L246 |
sorgerlab/indra | indra/preassembler/sitemapper.py | SiteMapper._map_agent_sites | def _map_agent_sites(self, agent):
"""Check an agent for invalid sites and update if necessary.
Parameters
----------
agent : :py:class:`indra.statements.Agent`
Agent to check for invalid modification sites.
Returns
-------
tuple
The firs... | python | def _map_agent_sites(self, agent):
"""Check an agent for invalid sites and update if necessary.
Parameters
----------
agent : :py:class:`indra.statements.Agent`
Agent to check for invalid modification sites.
Returns
-------
tuple
The firs... | Check an agent for invalid sites and update if necessary.
Parameters
----------
agent : :py:class:`indra.statements.Agent`
Agent to check for invalid modification sites.
Returns
-------
tuple
The first element is a list of MappedSite objects, the... | https://github.com/sorgerlab/indra/blob/79a70415832c5702d7a820c7c9ccc8e25010124b/indra/preassembler/sitemapper.py#L248-L289 |
sorgerlab/indra | indra/preassembler/sitemapper.py | SiteMapper._map_agent_mod | def _map_agent_mod(self, agent, mod_condition):
"""Map a single modification condition on an agent.
Parameters
----------
agent : :py:class:`indra.statements.Agent`
Agent to check for invalid modification sites.
mod_condition : :py:class:`indra.statements.ModConditio... | python | def _map_agent_mod(self, agent, mod_condition):
"""Map a single modification condition on an agent.
Parameters
----------
agent : :py:class:`indra.statements.Agent`
Agent to check for invalid modification sites.
mod_condition : :py:class:`indra.statements.ModConditio... | Map a single modification condition on an agent.
Parameters
----------
agent : :py:class:`indra.statements.Agent`
Agent to check for invalid modification sites.
mod_condition : :py:class:`indra.statements.ModCondition`
Modification to check for validity and map.
... | https://github.com/sorgerlab/indra/blob/79a70415832c5702d7a820c7c9ccc8e25010124b/indra/preassembler/sitemapper.py#L291-L324 |
sorgerlab/indra | indra/mechlinker/__init__.py | _get_graph_reductions | def _get_graph_reductions(graph):
"""Return transitive reductions on a DAG.
This is used to reduce the set of activities of a BaseAgent to the most
specific one(s) possible. For instance, if a BaseAgent is know to have
'activity', 'catalytic' and 'kinase' activity, then this function will
return {'... | python | def _get_graph_reductions(graph):
"""Return transitive reductions on a DAG.
This is used to reduce the set of activities of a BaseAgent to the most
specific one(s) possible. For instance, if a BaseAgent is know to have
'activity', 'catalytic' and 'kinase' activity, then this function will
return {'... | Return transitive reductions on a DAG.
This is used to reduce the set of activities of a BaseAgent to the most
specific one(s) possible. For instance, if a BaseAgent is know to have
'activity', 'catalytic' and 'kinase' activity, then this function will
return {'activity': 'kinase', 'catalytic': 'kinase... | https://github.com/sorgerlab/indra/blob/79a70415832c5702d7a820c7c9ccc8e25010124b/indra/mechlinker/__init__.py#L764-L795 |
sorgerlab/indra | indra/mechlinker/__init__.py | MechLinker.gather_explicit_activities | def gather_explicit_activities(self):
"""Aggregate all explicit activities and active forms of Agents.
This function iterates over self.statements and extracts explicitly
stated activity types and active forms for Agents.
"""
for stmt in self.statements:
agents = stm... | python | def gather_explicit_activities(self):
"""Aggregate all explicit activities and active forms of Agents.
This function iterates over self.statements and extracts explicitly
stated activity types and active forms for Agents.
"""
for stmt in self.statements:
agents = stm... | Aggregate all explicit activities and active forms of Agents.
This function iterates over self.statements and extracts explicitly
stated activity types and active forms for Agents. | https://github.com/sorgerlab/indra/blob/79a70415832c5702d7a820c7c9ccc8e25010124b/indra/mechlinker/__init__.py#L39-L66 |
sorgerlab/indra | indra/mechlinker/__init__.py | MechLinker.gather_implicit_activities | def gather_implicit_activities(self):
"""Aggregate all implicit activities and active forms of Agents.
Iterate over self.statements and collect the implied activities
and active forms of Agents that appear in the Statements.
Note that using this function to collect implied Agent activi... | python | def gather_implicit_activities(self):
"""Aggregate all implicit activities and active forms of Agents.
Iterate over self.statements and collect the implied activities
and active forms of Agents that appear in the Statements.
Note that using this function to collect implied Agent activi... | Aggregate all implicit activities and active forms of Agents.
Iterate over self.statements and collect the implied activities
and active forms of Agents that appear in the Statements.
Note that using this function to collect implied Agent activities can
be risky. Assume, for instance, ... | https://github.com/sorgerlab/indra/blob/79a70415832c5702d7a820c7c9ccc8e25010124b/indra/mechlinker/__init__.py#L68-L127 |
sorgerlab/indra | indra/mechlinker/__init__.py | MechLinker.require_active_forms | def require_active_forms(self):
"""Rewrites Statements with Agents' active forms in active positions.
As an example, the enzyme in a Modification Statement can be expected
to be in an active state. Similarly, subjects of RegulateAmount and
RegulateActivity Statements can be expected to ... | python | def require_active_forms(self):
"""Rewrites Statements with Agents' active forms in active positions.
As an example, the enzyme in a Modification Statement can be expected
to be in an active state. Similarly, subjects of RegulateAmount and
RegulateActivity Statements can be expected to ... | Rewrites Statements with Agents' active forms in active positions.
As an example, the enzyme in a Modification Statement can be expected
to be in an active state. Similarly, subjects of RegulateAmount and
RegulateActivity Statements can be expected to be in an active form.
This function... | https://github.com/sorgerlab/indra/blob/79a70415832c5702d7a820c7c9ccc8e25010124b/indra/mechlinker/__init__.py#L166-L221 |
sorgerlab/indra | indra/mechlinker/__init__.py | MechLinker.reduce_activities | def reduce_activities(self):
"""Rewrite the activity types referenced in Statements for consistency.
Activity types are reduced to the most specific form whenever possible.
For instance, if 'kinase' is the only specific activity type known
for the BaseAgent of BRAF, its generic 'activit... | python | def reduce_activities(self):
"""Rewrite the activity types referenced in Statements for consistency.
Activity types are reduced to the most specific form whenever possible.
For instance, if 'kinase' is the only specific activity type known
for the BaseAgent of BRAF, its generic 'activit... | Rewrite the activity types referenced in Statements for consistency.
Activity types are reduced to the most specific form whenever possible.
For instance, if 'kinase' is the only specific activity type known
for the BaseAgent of BRAF, its generic 'activity' forms are rewritten
to 'kinas... | https://github.com/sorgerlab/indra/blob/79a70415832c5702d7a820c7c9ccc8e25010124b/indra/mechlinker/__init__.py#L223-L251 |
sorgerlab/indra | indra/mechlinker/__init__.py | MechLinker.infer_complexes | def infer_complexes(stmts):
"""Return inferred Complex from Statements implying physical interaction.
Parameters
----------
stmts : list[indra.statements.Statement]
A list of Statements to infer Complexes from.
Returns
-------
linked_stmts : list[ind... | python | def infer_complexes(stmts):
"""Return inferred Complex from Statements implying physical interaction.
Parameters
----------
stmts : list[indra.statements.Statement]
A list of Statements to infer Complexes from.
Returns
-------
linked_stmts : list[ind... | Return inferred Complex from Statements implying physical interaction.
Parameters
----------
stmts : list[indra.statements.Statement]
A list of Statements to infer Complexes from.
Returns
-------
linked_stmts : list[indra.mechlinker.LinkedStatement]
... | https://github.com/sorgerlab/indra/blob/79a70415832c5702d7a820c7c9ccc8e25010124b/indra/mechlinker/__init__.py#L254-L274 |
sorgerlab/indra | indra/mechlinker/__init__.py | MechLinker.infer_activations | def infer_activations(stmts):
"""Return inferred RegulateActivity from Modification + ActiveForm.
This function looks for combinations of Modification and ActiveForm
Statements and infers Activation/Inhibition Statements from them.
For example, if we know that A phosphorylates B, and th... | python | def infer_activations(stmts):
"""Return inferred RegulateActivity from Modification + ActiveForm.
This function looks for combinations of Modification and ActiveForm
Statements and infers Activation/Inhibition Statements from them.
For example, if we know that A phosphorylates B, and th... | Return inferred RegulateActivity from Modification + ActiveForm.
This function looks for combinations of Modification and ActiveForm
Statements and infers Activation/Inhibition Statements from them.
For example, if we know that A phosphorylates B, and the
phosphorylated form of B is act... | https://github.com/sorgerlab/indra/blob/79a70415832c5702d7a820c7c9ccc8e25010124b/indra/mechlinker/__init__.py#L277-L328 |
sorgerlab/indra | indra/mechlinker/__init__.py | MechLinker.infer_active_forms | def infer_active_forms(stmts):
"""Return inferred ActiveForm from RegulateActivity + Modification.
This function looks for combinations of Activation/Inhibition
Statements and Modification Statements, and infers an ActiveForm
from them. For example, if we know that A activates B and
... | python | def infer_active_forms(stmts):
"""Return inferred ActiveForm from RegulateActivity + Modification.
This function looks for combinations of Activation/Inhibition
Statements and Modification Statements, and infers an ActiveForm
from them. For example, if we know that A activates B and
... | Return inferred ActiveForm from RegulateActivity + Modification.
This function looks for combinations of Activation/Inhibition
Statements and Modification Statements, and infers an ActiveForm
from them. For example, if we know that A activates B and
A phosphorylates B, then we can infer... | https://github.com/sorgerlab/indra/blob/79a70415832c5702d7a820c7c9ccc8e25010124b/indra/mechlinker/__init__.py#L331-L385 |
sorgerlab/indra | indra/mechlinker/__init__.py | MechLinker.infer_modifications | def infer_modifications(stmts):
"""Return inferred Modification from RegulateActivity + ActiveForm.
This function looks for combinations of Activation/Inhibition Statements
and ActiveForm Statements that imply a Modification Statement.
For example, if we know that A activates B, and pho... | python | def infer_modifications(stmts):
"""Return inferred Modification from RegulateActivity + ActiveForm.
This function looks for combinations of Activation/Inhibition Statements
and ActiveForm Statements that imply a Modification Statement.
For example, if we know that A activates B, and pho... | Return inferred Modification from RegulateActivity + ActiveForm.
This function looks for combinations of Activation/Inhibition Statements
and ActiveForm Statements that imply a Modification Statement.
For example, if we know that A activates B, and phosphorylated B is
active, then we ca... | https://github.com/sorgerlab/indra/blob/79a70415832c5702d7a820c7c9ccc8e25010124b/indra/mechlinker/__init__.py#L388-L441 |
sorgerlab/indra | indra/mechlinker/__init__.py | MechLinker.replace_complexes | def replace_complexes(self, linked_stmts=None):
"""Remove Complex Statements that can be inferred out.
This function iterates over self.statements and looks for Complex
Statements that either match or are refined by inferred Complex
Statements that were linked (provided as the linked_st... | python | def replace_complexes(self, linked_stmts=None):
"""Remove Complex Statements that can be inferred out.
This function iterates over self.statements and looks for Complex
Statements that either match or are refined by inferred Complex
Statements that were linked (provided as the linked_st... | Remove Complex Statements that can be inferred out.
This function iterates over self.statements and looks for Complex
Statements that either match or are refined by inferred Complex
Statements that were linked (provided as the linked_stmts argument).
It removes Complex Statements from s... | https://github.com/sorgerlab/indra/blob/79a70415832c5702d7a820c7c9ccc8e25010124b/indra/mechlinker/__init__.py#L443-L475 |
sorgerlab/indra | indra/mechlinker/__init__.py | MechLinker.replace_activations | def replace_activations(self, linked_stmts=None):
"""Remove RegulateActivity Statements that can be inferred out.
This function iterates over self.statements and looks for
RegulateActivity Statements that either match or are refined by
inferred RegulateActivity Statements that were link... | python | def replace_activations(self, linked_stmts=None):
"""Remove RegulateActivity Statements that can be inferred out.
This function iterates over self.statements and looks for
RegulateActivity Statements that either match or are refined by
inferred RegulateActivity Statements that were link... | Remove RegulateActivity Statements that can be inferred out.
This function iterates over self.statements and looks for
RegulateActivity Statements that either match or are refined by
inferred RegulateActivity Statements that were linked
(provided as the linked_stmts argument).
I... | https://github.com/sorgerlab/indra/blob/79a70415832c5702d7a820c7c9ccc8e25010124b/indra/mechlinker/__init__.py#L477-L514 |
sorgerlab/indra | indra/mechlinker/__init__.py | BaseAgentSet.get_create_base_agent | def get_create_base_agent(self, agent):
"""Return BaseAgent from an Agent, creating it if needed.
Parameters
----------
agent : indra.statements.Agent
Returns
-------
base_agent : indra.mechlinker.BaseAgent
"""
try:
base_agent = self.... | python | def get_create_base_agent(self, agent):
"""Return BaseAgent from an Agent, creating it if needed.
Parameters
----------
agent : indra.statements.Agent
Returns
-------
base_agent : indra.mechlinker.BaseAgent
"""
try:
base_agent = self.... | Return BaseAgent from an Agent, creating it if needed.
Parameters
----------
agent : indra.statements.Agent
Returns
-------
base_agent : indra.mechlinker.BaseAgent | https://github.com/sorgerlab/indra/blob/79a70415832c5702d7a820c7c9ccc8e25010124b/indra/mechlinker/__init__.py#L540-L557 |
sorgerlab/indra | indra/mechlinker/__init__.py | AgentState.apply_to | def apply_to(self, agent):
"""Apply this object's state to an Agent.
Parameters
----------
agent : indra.statements.Agent
The agent to which the state should be applied
"""
agent.bound_conditions = self.bound_conditions
agent.mods = self.mods
... | python | def apply_to(self, agent):
"""Apply this object's state to an Agent.
Parameters
----------
agent : indra.statements.Agent
The agent to which the state should be applied
"""
agent.bound_conditions = self.bound_conditions
agent.mods = self.mods
... | Apply this object's state to an Agent.
Parameters
----------
agent : indra.statements.Agent
The agent to which the state should be applied | https://github.com/sorgerlab/indra/blob/79a70415832c5702d7a820c7c9ccc8e25010124b/indra/mechlinker/__init__.py#L713-L725 |
sorgerlab/indra | indra/tools/live_curation.py | submit_curation | def submit_curation():
"""Submit curations for a given corpus.
The submitted curations are handled to update the probability model but
there is no return value here. The update_belief function can be called
separately to calculate update belief scores.
Parameters
----------
corpus_id : str... | python | def submit_curation():
"""Submit curations for a given corpus.
The submitted curations are handled to update the probability model but
there is no return value here. The update_belief function can be called
separately to calculate update belief scores.
Parameters
----------
corpus_id : str... | Submit curations for a given corpus.
The submitted curations are handled to update the probability model but
there is no return value here. The update_belief function can be called
separately to calculate update belief scores.
Parameters
----------
corpus_id : str
The ID of the corpus ... | https://github.com/sorgerlab/indra/blob/79a70415832c5702d7a820c7c9ccc8e25010124b/indra/tools/live_curation.py#L239-L265 |
sorgerlab/indra | indra/tools/live_curation.py | update_beliefs | def update_beliefs():
"""Return updated beliefs based on current probability model."""
if request.json is None:
abort(Response('Missing application/json header.', 415))
# Get input parameters
corpus_id = request.json.get('corpus_id')
try:
belief_dict = curator.update_beliefs(corpus_i... | python | def update_beliefs():
"""Return updated beliefs based on current probability model."""
if request.json is None:
abort(Response('Missing application/json header.', 415))
# Get input parameters
corpus_id = request.json.get('corpus_id')
try:
belief_dict = curator.update_beliefs(corpus_i... | Return updated beliefs based on current probability model. | https://github.com/sorgerlab/indra/blob/79a70415832c5702d7a820c7c9ccc8e25010124b/indra/tools/live_curation.py#L269-L280 |
sorgerlab/indra | indra/tools/live_curation.py | LiveCurator.reset_scorer | def reset_scorer(self):
"""Reset the scorer used for couration."""
self.scorer = get_eidos_bayesian_scorer()
for corpus_id, corpus in self.corpora.items():
corpus.curations = {} | python | def reset_scorer(self):
"""Reset the scorer used for couration."""
self.scorer = get_eidos_bayesian_scorer()
for corpus_id, corpus in self.corpora.items():
corpus.curations = {} | Reset the scorer used for couration. | https://github.com/sorgerlab/indra/blob/79a70415832c5702d7a820c7c9ccc8e25010124b/indra/tools/live_curation.py#L95-L99 |
sorgerlab/indra | indra/tools/live_curation.py | LiveCurator.get_corpus | def get_corpus(self, corpus_id):
"""Return a corpus given an ID.
If the corpus ID cannot be found, an InvalidCorpusError is raised.
Parameters
----------
corpus_id : str
The ID of the corpus to return.
Returns
-------
Corpus
The ... | python | def get_corpus(self, corpus_id):
"""Return a corpus given an ID.
If the corpus ID cannot be found, an InvalidCorpusError is raised.
Parameters
----------
corpus_id : str
The ID of the corpus to return.
Returns
-------
Corpus
The ... | Return a corpus given an ID.
If the corpus ID cannot be found, an InvalidCorpusError is raised.
Parameters
----------
corpus_id : str
The ID of the corpus to return.
Returns
-------
Corpus
The corpus with the given ID. | https://github.com/sorgerlab/indra/blob/79a70415832c5702d7a820c7c9ccc8e25010124b/indra/tools/live_curation.py#L101-L120 |
sorgerlab/indra | indra/tools/live_curation.py | LiveCurator.submit_curation | def submit_curation(self, corpus_id, curations):
"""Submit correct/incorrect curations fo a given corpus.
Parameters
----------
corpus_id : str
The ID of the corpus to which the curations apply.
curations : dict
A dict of curations with keys corresponding... | python | def submit_curation(self, corpus_id, curations):
"""Submit correct/incorrect curations fo a given corpus.
Parameters
----------
corpus_id : str
The ID of the corpus to which the curations apply.
curations : dict
A dict of curations with keys corresponding... | Submit correct/incorrect curations fo a given corpus.
Parameters
----------
corpus_id : str
The ID of the corpus to which the curations apply.
curations : dict
A dict of curations with keys corresponding to Statement UUIDs and
values corresponding to ... | https://github.com/sorgerlab/indra/blob/79a70415832c5702d7a820c7c9ccc8e25010124b/indra/tools/live_curation.py#L122-L172 |
sorgerlab/indra | indra/tools/live_curation.py | LiveCurator.update_beliefs | def update_beliefs(self, corpus_id):
"""Return updated belief scores for a given corpus.
Parameters
----------
corpus_id : str
The ID of the corpus for which beliefs are to be updated.
Returns
-------
dict
A dictionary of belief scores wi... | python | def update_beliefs(self, corpus_id):
"""Return updated belief scores for a given corpus.
Parameters
----------
corpus_id : str
The ID of the corpus for which beliefs are to be updated.
Returns
-------
dict
A dictionary of belief scores wi... | Return updated belief scores for a given corpus.
Parameters
----------
corpus_id : str
The ID of the corpus for which beliefs are to be updated.
Returns
-------
dict
A dictionary of belief scores with keys corresponding to Statement
U... | https://github.com/sorgerlab/indra/blob/79a70415832c5702d7a820c7c9ccc8e25010124b/indra/tools/live_curation.py#L174-L200 |
sorgerlab/indra | indra/sources/eidos/scala_utils.py | get_python_list | def get_python_list(scala_list):
"""Return list from elements of scala.collection.immutable.List"""
python_list = []
for i in range(scala_list.length()):
python_list.append(scala_list.apply(i))
return python_list | python | def get_python_list(scala_list):
"""Return list from elements of scala.collection.immutable.List"""
python_list = []
for i in range(scala_list.length()):
python_list.append(scala_list.apply(i))
return python_list | Return list from elements of scala.collection.immutable.List | https://github.com/sorgerlab/indra/blob/79a70415832c5702d7a820c7c9ccc8e25010124b/indra/sources/eidos/scala_utils.py#L7-L12 |
sorgerlab/indra | indra/sources/eidos/scala_utils.py | get_python_dict | def get_python_dict(scala_map):
"""Return a dict from entries in a scala.collection.immutable.Map"""
python_dict = {}
keys = get_python_list(scala_map.keys().toList())
for key in keys:
python_dict[key] = scala_map.apply(key)
return python_dict | python | def get_python_dict(scala_map):
"""Return a dict from entries in a scala.collection.immutable.Map"""
python_dict = {}
keys = get_python_list(scala_map.keys().toList())
for key in keys:
python_dict[key] = scala_map.apply(key)
return python_dict | Return a dict from entries in a scala.collection.immutable.Map | https://github.com/sorgerlab/indra/blob/79a70415832c5702d7a820c7c9ccc8e25010124b/indra/sources/eidos/scala_utils.py#L15-L21 |
sorgerlab/indra | indra/sources/eidos/scala_utils.py | get_python_json | def get_python_json(scala_json):
"""Return a JSON dict from a org.json4s.JsonAST"""
def convert_node(node):
if node.__class__.__name__ in ('org.json4s.JsonAST$JValue',
'org.json4s.JsonAST$JObject'):
# Make a dictionary and then convert each value
... | python | def get_python_json(scala_json):
"""Return a JSON dict from a org.json4s.JsonAST"""
def convert_node(node):
if node.__class__.__name__ in ('org.json4s.JsonAST$JValue',
'org.json4s.JsonAST$JObject'):
# Make a dictionary and then convert each value
... | Return a JSON dict from a org.json4s.JsonAST | https://github.com/sorgerlab/indra/blob/79a70415832c5702d7a820c7c9ccc8e25010124b/indra/sources/eidos/scala_utils.py#L24-L69 |
sorgerlab/indra | indra/databases/relevance_client.py | get_heat_kernel | def get_heat_kernel(network_id):
"""Return the identifier of a heat kernel calculated for a given network.
Parameters
----------
network_id : str
The UUID of the network in NDEx.
Returns
-------
kernel_id : str
The identifier of the heat kernel calculated for the given netw... | python | def get_heat_kernel(network_id):
"""Return the identifier of a heat kernel calculated for a given network.
Parameters
----------
network_id : str
The UUID of the network in NDEx.
Returns
-------
kernel_id : str
The identifier of the heat kernel calculated for the given netw... | Return the identifier of a heat kernel calculated for a given network.
Parameters
----------
network_id : str
The UUID of the network in NDEx.
Returns
-------
kernel_id : str
The identifier of the heat kernel calculated for the given network. | https://github.com/sorgerlab/indra/blob/79a70415832c5702d7a820c7c9ccc8e25010124b/indra/databases/relevance_client.py#L17-L40 |
sorgerlab/indra | indra/databases/relevance_client.py | get_relevant_nodes | def get_relevant_nodes(network_id, query_nodes):
"""Return a set of network nodes relevant to a given query set.
A heat diffusion algorithm is used on a pre-computed heat kernel for the
given network which starts from the given query nodes. The nodes
in the network are ranked according to heat score wh... | python | def get_relevant_nodes(network_id, query_nodes):
"""Return a set of network nodes relevant to a given query set.
A heat diffusion algorithm is used on a pre-computed heat kernel for the
given network which starts from the given query nodes. The nodes
in the network are ranked according to heat score wh... | Return a set of network nodes relevant to a given query set.
A heat diffusion algorithm is used on a pre-computed heat kernel for the
given network which starts from the given query nodes. The nodes
in the network are ranked according to heat score which is a measure
of relevance with respect to the qu... | https://github.com/sorgerlab/indra/blob/79a70415832c5702d7a820c7c9ccc8e25010124b/indra/databases/relevance_client.py#L43-L79 |
sorgerlab/indra | indra/belief/__init__.py | _get_belief_package | def _get_belief_package(stmt):
"""Return the belief packages of a given statement recursively."""
# This list will contain the belief packages for the given statement
belief_packages = []
# Iterate over all the support parents
for st in stmt.supports:
# Recursively get all the belief package... | python | def _get_belief_package(stmt):
"""Return the belief packages of a given statement recursively."""
# This list will contain the belief packages for the given statement
belief_packages = []
# Iterate over all the support parents
for st in stmt.supports:
# Recursively get all the belief package... | Return the belief packages of a given statement recursively. | https://github.com/sorgerlab/indra/blob/79a70415832c5702d7a820c7c9ccc8e25010124b/indra/belief/__init__.py#L415-L431 |
sorgerlab/indra | indra/belief/__init__.py | sample_statements | def sample_statements(stmts, seed=None):
"""Return statements sampled according to belief.
Statements are sampled independently according to their
belief scores. For instance, a Staement with a belief
score of 0.7 will end up in the returned Statement list
with probability 0.7.
Parameters
... | python | def sample_statements(stmts, seed=None):
"""Return statements sampled according to belief.
Statements are sampled independently according to their
belief scores. For instance, a Staement with a belief
score of 0.7 will end up in the returned Statement list
with probability 0.7.
Parameters
... | Return statements sampled according to belief.
Statements are sampled independently according to their
belief scores. For instance, a Staement with a belief
score of 0.7 will end up in the returned Statement list
with probability 0.7.
Parameters
----------
stmts : list[indra.statements.Sta... | https://github.com/sorgerlab/indra/blob/79a70415832c5702d7a820c7c9ccc8e25010124b/indra/belief/__init__.py#L434-L462 |
sorgerlab/indra | indra/belief/__init__.py | evidence_random_noise_prior | def evidence_random_noise_prior(evidence, type_probs, subtype_probs):
"""Determines the random-noise prior probability for this evidence.
If the evidence corresponds to a subtype, and that subtype has a curated
prior noise probability, use that.
Otherwise, gives the random-noise prior for the overall ... | python | def evidence_random_noise_prior(evidence, type_probs, subtype_probs):
"""Determines the random-noise prior probability for this evidence.
If the evidence corresponds to a subtype, and that subtype has a curated
prior noise probability, use that.
Otherwise, gives the random-noise prior for the overall ... | Determines the random-noise prior probability for this evidence.
If the evidence corresponds to a subtype, and that subtype has a curated
prior noise probability, use that.
Otherwise, gives the random-noise prior for the overall rule type. | https://github.com/sorgerlab/indra/blob/79a70415832c5702d7a820c7c9ccc8e25010124b/indra/belief/__init__.py#L465-L483 |
sorgerlab/indra | indra/belief/__init__.py | tag_evidence_subtype | def tag_evidence_subtype(evidence):
"""Returns the type and subtype of an evidence object as a string,
typically the extraction rule or database from which the statement
was generated.
For biopax, this is just the database name.
Parameters
----------
statement: indra.statements.Evidence
... | python | def tag_evidence_subtype(evidence):
"""Returns the type and subtype of an evidence object as a string,
typically the extraction rule or database from which the statement
was generated.
For biopax, this is just the database name.
Parameters
----------
statement: indra.statements.Evidence
... | Returns the type and subtype of an evidence object as a string,
typically the extraction rule or database from which the statement
was generated.
For biopax, this is just the database name.
Parameters
----------
statement: indra.statements.Evidence
The statement which we wish to subtyp... | https://github.com/sorgerlab/indra/blob/79a70415832c5702d7a820c7c9ccc8e25010124b/indra/belief/__init__.py#L486-L528 |
sorgerlab/indra | indra/belief/__init__.py | SimpleScorer.score_evidence_list | def score_evidence_list(self, evidences):
"""Return belief score given a list of supporting evidences."""
def _score(evidences):
if not evidences:
return 0
# Collect all unique sources
sources = [ev.source_api for ev in evidences]
uniq_sour... | python | def score_evidence_list(self, evidences):
"""Return belief score given a list of supporting evidences."""
def _score(evidences):
if not evidences:
return 0
# Collect all unique sources
sources = [ev.source_api for ev in evidences]
uniq_sour... | Return belief score given a list of supporting evidences. | https://github.com/sorgerlab/indra/blob/79a70415832c5702d7a820c7c9ccc8e25010124b/indra/belief/__init__.py#L110-L154 |
sorgerlab/indra | indra/belief/__init__.py | SimpleScorer.score_statement | def score_statement(self, st, extra_evidence=None):
"""Computes the prior belief probability for an INDRA Statement.
The Statement is assumed to be de-duplicated. In other words,
the Statement is assumed to have
a list of Evidence objects that supports it. The prior probability of
... | python | def score_statement(self, st, extra_evidence=None):
"""Computes the prior belief probability for an INDRA Statement.
The Statement is assumed to be de-duplicated. In other words,
the Statement is assumed to have
a list of Evidence objects that supports it. The prior probability of
... | Computes the prior belief probability for an INDRA Statement.
The Statement is assumed to be de-duplicated. In other words,
the Statement is assumed to have
a list of Evidence objects that supports it. The prior probability of
the Statement is calculated based on the number of Evidences... | https://github.com/sorgerlab/indra/blob/79a70415832c5702d7a820c7c9ccc8e25010124b/indra/belief/__init__.py#L156-L182 |
sorgerlab/indra | indra/belief/__init__.py | SimpleScorer.check_prior_probs | def check_prior_probs(self, statements):
"""Throw Exception if BeliefEngine parameter is missing.
Make sure the scorer has all the information needed to compute
belief scores of each statement in the provided list, and raises an
exception otherwise.
Parameters
---------... | python | def check_prior_probs(self, statements):
"""Throw Exception if BeliefEngine parameter is missing.
Make sure the scorer has all the information needed to compute
belief scores of each statement in the provided list, and raises an
exception otherwise.
Parameters
---------... | Throw Exception if BeliefEngine parameter is missing.
Make sure the scorer has all the information needed to compute
belief scores of each statement in the provided list, and raises an
exception otherwise.
Parameters
----------
statements : list[indra.statements.Stateme... | https://github.com/sorgerlab/indra/blob/79a70415832c5702d7a820c7c9ccc8e25010124b/indra/belief/__init__.py#L184-L204 |
sorgerlab/indra | indra/belief/__init__.py | BayesianScorer.update_probs | def update_probs(self):
"""Update the internal probability values given the counts."""
# We deal with the prior probsfirst
# This is a fixed assumed value for systematic error
syst_error = 0.05
prior_probs = {'syst': {}, 'rand': {}}
for source, (p, n) in self.prior_counts... | python | def update_probs(self):
"""Update the internal probability values given the counts."""
# We deal with the prior probsfirst
# This is a fixed assumed value for systematic error
syst_error = 0.05
prior_probs = {'syst': {}, 'rand': {}}
for source, (p, n) in self.prior_counts... | Update the internal probability values given the counts. | https://github.com/sorgerlab/indra/blob/79a70415832c5702d7a820c7c9ccc8e25010124b/indra/belief/__init__.py#L232-L258 |
sorgerlab/indra | indra/belief/__init__.py | BayesianScorer.update_counts | def update_counts(self, prior_counts, subtype_counts):
"""Update the internal counts based on given new counts.
Parameters
----------
prior_counts : dict
A dictionary of counts of the form [pos, neg] for
each source.
subtype_counts : dict
A di... | python | def update_counts(self, prior_counts, subtype_counts):
"""Update the internal counts based on given new counts.
Parameters
----------
prior_counts : dict
A dictionary of counts of the form [pos, neg] for
each source.
subtype_counts : dict
A di... | Update the internal counts based on given new counts.
Parameters
----------
prior_counts : dict
A dictionary of counts of the form [pos, neg] for
each source.
subtype_counts : dict
A dictionary of counts of the form [pos, neg] for
each sub... | https://github.com/sorgerlab/indra/blob/79a70415832c5702d7a820c7c9ccc8e25010124b/indra/belief/__init__.py#L260-L285 |
sorgerlab/indra | indra/belief/__init__.py | BeliefEngine.set_prior_probs | def set_prior_probs(self, statements):
"""Sets the prior belief probabilities for a list of INDRA Statements.
The Statements are assumed to be de-duplicated. In other words,
each Statement in the list passed to this function is assumed to have
a list of Evidence objects that support it.... | python | def set_prior_probs(self, statements):
"""Sets the prior belief probabilities for a list of INDRA Statements.
The Statements are assumed to be de-duplicated. In other words,
each Statement in the list passed to this function is assumed to have
a list of Evidence objects that support it.... | Sets the prior belief probabilities for a list of INDRA Statements.
The Statements are assumed to be de-duplicated. In other words,
each Statement in the list passed to this function is assumed to have
a list of Evidence objects that support it. The prior probability of
each Statement i... | https://github.com/sorgerlab/indra/blob/79a70415832c5702d7a820c7c9ccc8e25010124b/indra/belief/__init__.py#L311-L329 |
sorgerlab/indra | indra/belief/__init__.py | BeliefEngine.set_hierarchy_probs | def set_hierarchy_probs(self, statements):
"""Sets hierarchical belief probabilities for INDRA Statements.
The Statements are assumed to be in a hierarchical relation graph with
the supports and supported_by attribute of each Statement object having
been set.
The hierarchical be... | python | def set_hierarchy_probs(self, statements):
"""Sets hierarchical belief probabilities for INDRA Statements.
The Statements are assumed to be in a hierarchical relation graph with
the supports and supported_by attribute of each Statement object having
been set.
The hierarchical be... | Sets hierarchical belief probabilities for INDRA Statements.
The Statements are assumed to be in a hierarchical relation graph with
the supports and supported_by attribute of each Statement object having
been set.
The hierarchical belief probability of each Statement is calculated
... | https://github.com/sorgerlab/indra/blob/79a70415832c5702d7a820c7c9ccc8e25010124b/indra/belief/__init__.py#L331-L391 |
sorgerlab/indra | indra/belief/__init__.py | BeliefEngine.set_linked_probs | def set_linked_probs(self, linked_statements):
"""Sets the belief probabilities for a list of linked INDRA Statements.
The list of LinkedStatement objects is assumed to come from the
MechanismLinker. The belief probability of the inferred Statement is
assigned the joint probability of i... | python | def set_linked_probs(self, linked_statements):
"""Sets the belief probabilities for a list of linked INDRA Statements.
The list of LinkedStatement objects is assumed to come from the
MechanismLinker. The belief probability of the inferred Statement is
assigned the joint probability of i... | Sets the belief probabilities for a list of linked INDRA Statements.
The list of LinkedStatement objects is assumed to come from the
MechanismLinker. The belief probability of the inferred Statement is
assigned the joint probability of its source Statements.
Parameters
--------... | https://github.com/sorgerlab/indra/blob/79a70415832c5702d7a820c7c9ccc8e25010124b/indra/belief/__init__.py#L393-L409 |
sorgerlab/indra | indra/sources/rlimsp/processor.py | get_agent_from_entity_info | def get_agent_from_entity_info(entity_info):
"""Return an INDRA Agent by processing an entity_info dict."""
# This will be the default name. If we get a gene name, it will
# override this rawtext name.
raw_text = entity_info['entityText']
name = raw_text
# Get the db refs.
refs = {'TEXT': r... | python | def get_agent_from_entity_info(entity_info):
"""Return an INDRA Agent by processing an entity_info dict."""
# This will be the default name. If we get a gene name, it will
# override this rawtext name.
raw_text = entity_info['entityText']
name = raw_text
# Get the db refs.
refs = {'TEXT': r... | Return an INDRA Agent by processing an entity_info dict. | https://github.com/sorgerlab/indra/blob/79a70415832c5702d7a820c7c9ccc8e25010124b/indra/sources/rlimsp/processor.py#L169-L250 |
sorgerlab/indra | indra/sources/rlimsp/processor.py | RlimspProcessor.extract_statements | def extract_statements(self):
"""Extract the statements from the json."""
for p_info in self._json:
para = RlimspParagraph(p_info, self.doc_id_type)
self.statements.extend(para.get_statements())
return | python | def extract_statements(self):
"""Extract the statements from the json."""
for p_info in self._json:
para = RlimspParagraph(p_info, self.doc_id_type)
self.statements.extend(para.get_statements())
return | Extract the statements from the json. | https://github.com/sorgerlab/indra/blob/79a70415832c5702d7a820c7c9ccc8e25010124b/indra/sources/rlimsp/processor.py#L19-L24 |
sorgerlab/indra | indra/sources/rlimsp/processor.py | RlimspParagraph._get_agent | def _get_agent(self, entity_id):
"""Convert the entity dictionary into an INDRA Agent."""
if entity_id is None:
return None
entity_info = self._entity_dict.get(entity_id)
if entity_info is None:
logger.warning("Entity key did not resolve to entity.")
... | python | def _get_agent(self, entity_id):
"""Convert the entity dictionary into an INDRA Agent."""
if entity_id is None:
return None
entity_info = self._entity_dict.get(entity_id)
if entity_info is None:
logger.warning("Entity key did not resolve to entity.")
... | Convert the entity dictionary into an INDRA Agent. | https://github.com/sorgerlab/indra/blob/79a70415832c5702d7a820c7c9ccc8e25010124b/indra/sources/rlimsp/processor.py#L49-L58 |
sorgerlab/indra | indra/sources/rlimsp/processor.py | RlimspParagraph._get_evidence | def _get_evidence(self, trigger_id, args, agent_coords, site_coords):
"""Get the evidence using the info in the trigger entity."""
trigger_info = self._entity_dict[trigger_id]
# Get the sentence index from the trigger word.
s_idx_set = {self._entity_dict[eid]['sentenceIndex']
... | python | def _get_evidence(self, trigger_id, args, agent_coords, site_coords):
"""Get the evidence using the info in the trigger entity."""
trigger_info = self._entity_dict[trigger_id]
# Get the sentence index from the trigger word.
s_idx_set = {self._entity_dict[eid]['sentenceIndex']
... | Get the evidence using the info in the trigger entity. | https://github.com/sorgerlab/indra/blob/79a70415832c5702d7a820c7c9ccc8e25010124b/indra/sources/rlimsp/processor.py#L84-L115 |
sorgerlab/indra | indra/tools/reading/readers.py | get_reader_classes | def get_reader_classes(parent=Reader):
"""Get all childless the descendants of a parent class, recursively."""
children = parent.__subclasses__()
descendants = children[:]
for child in children:
grandchildren = get_reader_classes(child)
if grandchildren:
descendants.remove(ch... | python | def get_reader_classes(parent=Reader):
"""Get all childless the descendants of a parent class, recursively."""
children = parent.__subclasses__()
descendants = children[:]
for child in children:
grandchildren = get_reader_classes(child)
if grandchildren:
descendants.remove(ch... | Get all childless the descendants of a parent class, recursively. | https://github.com/sorgerlab/indra/blob/79a70415832c5702d7a820c7c9ccc8e25010124b/indra/tools/reading/readers.py#L761-L770 |
sorgerlab/indra | indra/tools/reading/readers.py | get_reader_class | def get_reader_class(reader_name):
"""Get a particular reader class by name."""
for reader_class in get_reader_classes():
if reader_class.name.lower() == reader_name.lower():
return reader_class
else:
logger.error("No such reader: %s" % reader_name)
return None | python | def get_reader_class(reader_name):
"""Get a particular reader class by name."""
for reader_class in get_reader_classes():
if reader_class.name.lower() == reader_name.lower():
return reader_class
else:
logger.error("No such reader: %s" % reader_name)
return None | Get a particular reader class by name. | https://github.com/sorgerlab/indra/blob/79a70415832c5702d7a820c7c9ccc8e25010124b/indra/tools/reading/readers.py#L773-L780 |
sorgerlab/indra | indra/tools/reading/readers.py | Content.from_file | def from_file(cls, file_path, compressed=False, encoded=False):
"""Create a content object from a file path."""
file_id = '.'.join(path.basename(file_path).split('.')[:-1])
file_format = file_path.split('.')[-1]
content = cls(file_id, file_format, compressed, encoded)
content.fil... | python | def from_file(cls, file_path, compressed=False, encoded=False):
"""Create a content object from a file path."""
file_id = '.'.join(path.basename(file_path).split('.')[:-1])
file_format = file_path.split('.')[-1]
content = cls(file_id, file_format, compressed, encoded)
content.fil... | Create a content object from a file path. | https://github.com/sorgerlab/indra/blob/79a70415832c5702d7a820c7c9ccc8e25010124b/indra/tools/reading/readers.py#L100-L107 |
sorgerlab/indra | indra/tools/reading/readers.py | Content.from_string | def from_string(cls, id, format, raw_content, compressed=False,
encoded=False):
"""Create a Content object from string/bytes content."""
content = cls(id, format, compressed, encoded)
content._raw_content = raw_content
return content | python | def from_string(cls, id, format, raw_content, compressed=False,
encoded=False):
"""Create a Content object from string/bytes content."""
content = cls(id, format, compressed, encoded)
content._raw_content = raw_content
return content | Create a Content object from string/bytes content. | https://github.com/sorgerlab/indra/blob/79a70415832c5702d7a820c7c9ccc8e25010124b/indra/tools/reading/readers.py#L110-L115 |
sorgerlab/indra | indra/tools/reading/readers.py | Content.change_id | def change_id(self, new_id):
"""Change the id of this content."""
self._load_raw_content()
self._id = new_id
self.get_filename(renew=True)
self.get_filepath(renew=True)
return | python | def change_id(self, new_id):
"""Change the id of this content."""
self._load_raw_content()
self._id = new_id
self.get_filename(renew=True)
self.get_filepath(renew=True)
return | Change the id of this content. | https://github.com/sorgerlab/indra/blob/79a70415832c5702d7a820c7c9ccc8e25010124b/indra/tools/reading/readers.py#L123-L129 |
sorgerlab/indra | indra/tools/reading/readers.py | Content.change_format | def change_format(self, new_format):
"""Change the format label of this content.
Note that this does NOT actually alter the format of the content, only
the label.
"""
self._load_raw_content()
self._format = new_format
self.get_filename(renew=True)
self.ge... | python | def change_format(self, new_format):
"""Change the format label of this content.
Note that this does NOT actually alter the format of the content, only
the label.
"""
self._load_raw_content()
self._format = new_format
self.get_filename(renew=True)
self.ge... | Change the format label of this content.
Note that this does NOT actually alter the format of the content, only
the label. | https://github.com/sorgerlab/indra/blob/79a70415832c5702d7a820c7c9ccc8e25010124b/indra/tools/reading/readers.py#L131-L141 |
sorgerlab/indra | indra/tools/reading/readers.py | Content.set_location | def set_location(self, new_location):
"""Set/change the location of this content.
Note that this does NOT change the actual location of the file. To do
so, use the `copy_to` method.
"""
self._load_raw_content()
self._location = new_location
self.get_filepath(rene... | python | def set_location(self, new_location):
"""Set/change the location of this content.
Note that this does NOT change the actual location of the file. To do
so, use the `copy_to` method.
"""
self._load_raw_content()
self._location = new_location
self.get_filepath(rene... | Set/change the location of this content.
Note that this does NOT change the actual location of the file. To do
so, use the `copy_to` method. | https://github.com/sorgerlab/indra/blob/79a70415832c5702d7a820c7c9ccc8e25010124b/indra/tools/reading/readers.py#L143-L152 |
sorgerlab/indra | indra/tools/reading/readers.py | Content.get_text | def get_text(self):
"""Get the loaded, decompressed, and decoded text of this content."""
self._load_raw_content()
if self._text is None:
assert self._raw_content is not None
ret_cont = self._raw_content
if self.compressed:
ret_cont = zlib.deco... | python | def get_text(self):
"""Get the loaded, decompressed, and decoded text of this content."""
self._load_raw_content()
if self._text is None:
assert self._raw_content is not None
ret_cont = self._raw_content
if self.compressed:
ret_cont = zlib.deco... | Get the loaded, decompressed, and decoded text of this content. | https://github.com/sorgerlab/indra/blob/79a70415832c5702d7a820c7c9ccc8e25010124b/indra/tools/reading/readers.py#L164-L176 |
sorgerlab/indra | indra/tools/reading/readers.py | Content.get_filename | def get_filename(self, renew=False):
"""Get the filename of this content.
If the file name doesn't already exist, we created it as {id}.{format}.
"""
if self._fname is None or renew:
self._fname = '%s.%s' % (self._id, self._format)
return self._fname | python | def get_filename(self, renew=False):
"""Get the filename of this content.
If the file name doesn't already exist, we created it as {id}.{format}.
"""
if self._fname is None or renew:
self._fname = '%s.%s' % (self._id, self._format)
return self._fname | Get the filename of this content.
If the file name doesn't already exist, we created it as {id}.{format}. | https://github.com/sorgerlab/indra/blob/79a70415832c5702d7a820c7c9ccc8e25010124b/indra/tools/reading/readers.py#L178-L185 |
sorgerlab/indra | indra/tools/reading/readers.py | Content.get_filepath | def get_filepath(self, renew=False):
"""Get the file path, joining the name and location for this file.
If no location is given, it is assumed to be "here", e.g. ".".
"""
if self._location is None or renew:
self._location = '.'
return path.join(self._location, self.g... | python | def get_filepath(self, renew=False):
"""Get the file path, joining the name and location for this file.
If no location is given, it is assumed to be "here", e.g. ".".
"""
if self._location is None or renew:
self._location = '.'
return path.join(self._location, self.g... | Get the file path, joining the name and location for this file.
If no location is given, it is assumed to be "here", e.g. ".". | https://github.com/sorgerlab/indra/blob/79a70415832c5702d7a820c7c9ccc8e25010124b/indra/tools/reading/readers.py#L187-L194 |
sorgerlab/indra | indra/tools/reading/readers.py | ReadingData.get_statements | def get_statements(self, reprocess=False):
"""General method to create statements."""
if self._statements is None or reprocess:
# Handle the case that there is no content.
if self.content is None:
self._statements = []
return []
# Map ... | python | def get_statements(self, reprocess=False):
"""General method to create statements."""
if self._statements is None or reprocess:
# Handle the case that there is no content.
if self.content is None:
self._statements = []
return []
# Map ... | General method to create statements. | https://github.com/sorgerlab/indra/blob/79a70415832c5702d7a820c7c9ccc8e25010124b/indra/tools/reading/readers.py#L241-L282 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.