_id
stringlengths
2
7
title
stringlengths
1
88
partition
stringclasses
3 values
text
stringlengths
31
13.1k
language
stringclasses
1 value
meta_information
dict
q246000
_fusion_legacy_handler
train
def _fusion_legacy_handler(_, __, tokens): """Handle a legacy fusion.""" if RANGE_5P not in tokens: tokens[RANGE_5P] = {FUSION_MISSING: '?'} if RANGE_3P
python
{ "resource": "" }
q246001
to_csv
train
def to_csv(graph: BELGraph, file: Optional[TextIO] = None, sep: Optional[str] = None) -> None: """Write the graph as a tab-separated edge list. The resulting file will contain the following columns: 1. Source BEL term 2. Relation 3. Target BEL term 4. Edge data dictionary See the Data Mod...
python
{ "resource": "" }
q246002
to_csv_path
train
def to_csv_path(graph: BELGraph, path: str, sep: Optional[str] = None) -> None: """Write the graph as a tab-separated edge list to a file
python
{ "resource": "" }
q246003
to_sif
train
def to_sif(graph: BELGraph, file: Optional[TextIO] = None, sep: Optional[str] = None) -> None: """Write the graph as a tab-separated SIF file. The resulting file will contain the following columns: 1. Source BEL term 2. Relation 3. Target BEL term This format is simple and can be used readily...
python
{ "resource": "" }
q246004
to_sif_path
train
def to_sif_path(graph: BELGraph, path: str, sep: Optional[str] = None) -> None: """Write the graph as a tab-separated SIF file. to a file
python
{ "resource": "" }
q246005
Seeding.append_sample
train
def append_sample(self, **kwargs) -> 'Seeding': """Add seed induction methods. Kwargs can have ``number_edges`` or ``number_seed_nodes``. :returns: self for fluid API """ data = {
python
{ "resource": "" }
q246006
Seeding.run
train
def run(self, graph): """Seed the graph or return none if not possible. :type graph: pybel.BELGraph :rtype: Optional[pybel.BELGraph] """ if not self: log.debug('no seeding, returning graph: %s', graph) return graph subgraphs = [] for see...
python
{ "resource": "" }
q246007
Seeding.dump
train
def dump(self, file, sort_keys: bool = True, **kwargs) -> None: """Dump this
python
{ "resource": "" }
q246008
Seeding.dumps
train
def dumps(self, sort_keys: bool = True, **kwargs) -> str: """Dump this
python
{ "resource": "" }
q246009
_single_function_inclusion_filter_builder
train
def _single_function_inclusion_filter_builder(func: str) -> NodePredicate: # noqa: D202 """Build a function inclusion filter for a single function.""" def function_inclusion_filter(_: BELGraph, node: BaseEntity) -> bool:
python
{ "resource": "" }
q246010
_collection_function_inclusion_builder
train
def _collection_function_inclusion_builder(funcs: Iterable[str]) -> NodePredicate: """Build a function inclusion filter for a collection of functions.""" funcs = set(funcs) if not funcs: raise ValueError('can not build function inclusion filter with empty list of functions') def functions_incl...
python
{ "resource": "" }
q246011
data_missing_key_builder
train
def data_missing_key_builder(key: str) -> NodePredicate: # noqa: D202 """Build a filter that passes only on nodes that don't have the given key in their data dictionary. :param str key: A key for the
python
{ "resource": "" }
q246012
build_node_data_search
train
def build_node_data_search(key: str, data_predicate: Callable[[Any], bool]) -> NodePredicate: # noqa: D202 """Build a filter for nodes whose associated data with the given key passes the given predicate. :param key: The node data dictionary key to check :param data_predicate: The filter to apply to the no...
python
{ "resource": "" }
q246013
build_node_graph_data_search
train
def build_node_graph_data_search(key: str, data_predicate: Callable[[Any], bool]): # noqa: D202 """Build a function for testing data associated with the node in the graph. :param key: The node data dictionary key to check :param data_predicate: The filter to apply to the node data dictionary """ ...
python
{ "resource": "" }
q246014
namespace_inclusion_builder
train
def namespace_inclusion_builder(namespace: Strings) -> NodePredicate: """Build a predicate for namespace inclusion.""" if isinstance(namespace, str): def namespace_filter(_: BELGraph, node: BaseEntity) -> bool: """Pass only for a node that has the enclosed namespace.""" return NA...
python
{ "resource": "" }
q246015
IdentifierParser.has_namespace
train
def has_namespace(self, namespace: str) -> bool: """Check that the namespace has either been defined
python
{ "resource": "" }
q246016
IdentifierParser.has_enumerated_namespace_name
train
def has_enumerated_namespace_name(self, namespace: str, name: str) -> bool: """Check that the namespace is defined by an enumeration and that the name is a member."""
python
{ "resource": "" }
q246017
IdentifierParser.has_regex_namespace_name
train
def has_regex_namespace_name(self, namespace: str, name: str) -> bool: """Check that the namespace is defined as a regular expression and the name matches it."""
python
{ "resource": "" }
q246018
IdentifierParser.has_namespace_name
train
def has_namespace_name(self, line: str, position: int, namespace: str, name: str) -> bool: """Check that the namespace is defined and has the given name.""" self.raise_for_missing_namespace(line, position, namespace, name)
python
{ "resource": "" }
q246019
IdentifierParser.raise_for_missing_namespace
train
def raise_for_missing_namespace(self, line: str, position: int, namespace: str, name: str) -> None: """Raise an exception if the namespace is not defined.""" if not self.has_namespace(namespace):
python
{ "resource": "" }
q246020
IdentifierParser.raise_for_missing_name
train
def raise_for_missing_name(self, line: str, position: int, namespace: str, name: str) -> None: """Raise an exception if the namespace is not defined or if it does not validate the given name.""" self.raise_for_missing_namespace(line, position, namespace, name) if self.has_enumerated_namespace(n...
python
{ "resource": "" }
q246021
IdentifierParser.raise_for_missing_default
train
def raise_for_missing_default(self, line: str, position: int, name: str) -> None: """Raise an exeception if the name does not belong to the default namespace.""" if not self.default_namespace: raise ValueError('Default namespace is not set')
python
{ "resource": "" }
q246022
IdentifierParser.handle_identifier_qualified
train
def handle_identifier_qualified(self, line: str, position: int, tokens: ParseResults) -> ParseResults: """Handle parsing a qualified identifier.""" namespace, name = tokens[NAMESPACE], tokens[NAME]
python
{ "resource": "" }
q246023
IdentifierParser.handle_namespace_default
train
def handle_namespace_default(self, line: str, position: int, tokens: ParseResults) -> ParseResults: """Handle parsing
python
{ "resource": "" }
q246024
IdentifierParser.handle_namespace_lenient
train
def handle_namespace_lenient(line: str, position: int, tokens: ParseResults) -> ParseResults: """Handle parsing an identifier for name missing a namespac ethat are outside the default namespace."""
python
{ "resource": "" }
q246025
IdentifierParser.handle_namespace_invalid
train
def handle_namespace_invalid(self, line: str, position: int, tokens: ParseResults) -> None: """Raise an exception when parsing a name missing a namespace.""" name
python
{ "resource": "" }
q246026
hbp_namespace
train
def hbp_namespace(name: str, sha: Optional[str] = None) -> str: """Format a namespace URL.""" return
python
{ "resource": "" }
q246027
edge_predicate
train
def edge_predicate(func: DictEdgePredicate) -> EdgePredicate: # noqa: D202 """Decorate an edge predicate function that only takes a dictionary as its singular argument. Apply this as a decorator to a function that takes a single argument, a PyBEL node data dictionary, to make sure that it can also accept ...
python
{ "resource": "" }
q246028
has_pubmed
train
def has_pubmed(edge_data: EdgeData) -> bool: """Check if the edge has a PubMed citation.""" return CITATION in edge_data
python
{ "resource": "" }
q246029
has_authors
train
def has_authors(edge_data: EdgeData) -> bool: """Check if the edge contains author information for its citation.""" return CITATION
python
{ "resource": "" }
q246030
_has_modifier
train
def _has_modifier(edge_data: EdgeData, modifier: str) -> bool: """Check if the edge has the given modifier. :param edge_data: The edge data dictionary :param modifier: The modifier to check. One of :data:`pybel.constants.ACTIVITY`,
python
{ "resource": "" }
q246031
edge_has_annotation
train
def edge_has_annotation(edge_data: EdgeData, key: str) -> Optional[Any]: """Check if an edge has the given annotation. :param edge_data: The data dictionary from a BELGraph's edge :param key: An annotation key :return: If the annotation key is present in the current data dictionary For example, it...
python
{ "resource": "" }
q246032
get_gene_substitution_language
train
def get_gene_substitution_language() -> ParserElement: """Build a gene substitution parser.""" parser_element = gsub_tag + nest( dna_nucleotide(GSUB_REFERENCE), ppc.integer(GSUB_POSITION),
python
{ "resource": "" }
q246033
Query.append_seeding_induction
train
def append_seeding_induction(self, nodes: Union[BaseEntity, List[BaseEntity], List[Dict]]) -> Seeding: """Add a seed induction method.
python
{ "resource": "" }
q246034
Query.append_seeding_neighbors
train
def append_seeding_neighbors(self, nodes: Union[BaseEntity, List[BaseEntity], List[Dict]]) -> Seeding: """Add a seed by neighbors.
python
{ "resource": "" }
q246035
Query.run
train
def run(self, manager): """Run this query and returns the resulting BEL graph. :param manager: A cache manager :rtype: Optional[pybel.BELGraph] """
python
{ "resource": "" }
q246036
Query.to_json
train
def to_json(self) -> Dict: """Return this query as a JSON object.""" rv = { 'network_ids': self.network_ids, } if self.seeding: rv['seeding'] = self.seeding.to_json()
python
{ "resource": "" }
q246037
Query.from_json
train
def from_json(data: Mapping) -> 'Query': """Load a query from a JSON dictionary. :param data: A JSON dictionary :raises: QueryMissingNetworksError """ network_ids = data.get('network_ids') if network_ids is None: raise QueryMissingNetworksError('query JSON di...
python
{ "resource": "" }
q246038
handle_molecular_activity_default
train
def handle_molecular_activity_default(_: str, __: int, tokens: ParseResults) -> ParseResults: """Handle a BEL 2.0 style molecular activity with BEL default names."""
python
{ "resource": "" }
q246039
handle_activity_legacy
train
def handle_activity_legacy(_: str, __: int, tokens: ParseResults) -> ParseResults: """Handle BEL 1.0 activities.""" legacy_cls = language.activity_labels[tokens[MODIFIER]]
python
{ "resource": "" }
q246040
handle_legacy_tloc
train
def handle_legacy_tloc(line: str, position: int, tokens: ParseResults) -> ParseResults: """Handle translocations that lack the ``fromLoc`` and ``toLoc`` entries."""
python
{ "resource": "" }
q246041
BELParser.handle_nested_relation
train
def handle_nested_relation(self, line: str, position: int, tokens: ParseResults): """Handle nested statements. If :code:`allow_nested` is False, raises a ``NestedRelationWarning``. :raises: NestedRelationWarning """ if not self.allow_nested: raise NestedRelationWarn...
python
{ "resource": "" }
q246042
BELParser.check_function_semantics
train
def check_function_semantics(self, line: str, position: int, tokens: ParseResults) -> ParseResults: """Raise an exception if the function used on the tokens is wrong. :raises: InvalidFunctionSemantic """ if not self._namespace_dict or NAMESPACE not in tokens: return tokens ...
python
{ "resource": "" }
q246043
BELParser._add_qualified_edge_helper
train
def _add_qualified_edge_helper(self, u, v, relation, annotations, subject_modifier, object_modifier) -> str: """Add a qualified edge from the internal aspects of the parser.""" return self.graph.add_qualified_edge(
python
{ "resource": "" }
q246044
BELParser._add_qualified_edge
train
def _add_qualified_edge(self, u, v, relation, annotations, subject_modifier, object_modifier) -> str: """Add an edge, then adds the opposite direction edge if it should.""" sha512 = self._add_qualified_edge_helper( u, v, relation=relation, annotations=anno...
python
{ "resource": "" }
q246045
BELParser._handle_relation
train
def _handle_relation(self, tokens: ParseResults) -> str: """Handle a relation.""" subject_node_dsl = self.ensure_node(tokens[SUBJECT]) object_node_dsl = self.ensure_node(tokens[OBJECT]) subject_modifier = modifier_po_to_dict(tokens[SUBJECT]) object_modifier = modifier_po_to_dict...
python
{ "resource": "" }
q246046
BELParser._handle_relation_harness
train
def _handle_relation_harness(self, line: str, position: int, tokens: Union[ParseResults, Dict]) -> ParseResults: """Handle BEL relations based on the policy specified on instantiation. Note: this can't be changed after instantiation! """ if not self.control_parser.citation: ...
python
{ "resource": "" }
q246047
BELParser.handle_unqualified_relation
train
def handle_unqualified_relation(self, _, __, tokens: ParseResults) -> ParseResults: """Handle unqualified relations.""" subject_node_dsl = self.ensure_node(tokens[SUBJECT]) object_node_dsl = self.ensure_node(tokens[OBJECT])
python
{ "resource": "" }
q246048
BELParser.ensure_node
train
def ensure_node(self, tokens: ParseResults) -> BaseEntity: """Turn parsed tokens into canonical node name and makes sure its in the graph."""
python
{ "resource": "" }
q246049
BELParser.handle_translocation_illegal
train
def handle_translocation_illegal(self, line: str, position: int, tokens: ParseResults) -> None: """Handle a malformed translocation."""
python
{ "resource": "" }
q246050
LookupManager.get_dsl_by_hash
train
def get_dsl_by_hash(self, node_hash: str) -> Optional[BaseEntity]: """Look up a node by the hash and returns
python
{ "resource": "" }
q246051
LookupManager.get_node_by_hash
train
def get_node_by_hash(self, node_hash: str) -> Optional[Node]: """Look up
python
{ "resource": "" }
q246052
LookupManager.get_nodes_by_hashes
train
def get_nodes_by_hashes(self, node_hashes: List[str]) -> List[Node]: """Look up
python
{ "resource": "" }
q246053
LookupManager.get_edge_by_hash
train
def get_edge_by_hash(self, edge_hash: str) -> Optional[Edge]: """Look up an edge by the
python
{ "resource": "" }
q246054
LookupManager.get_edges_by_hashes
train
def get_edges_by_hashes(self, edge_hashes: List[str]) -> List[Edge]: """Look up several edges
python
{ "resource": "" }
q246055
LookupManager.get_citation_by_pmid
train
def get_citation_by_pmid(self, pubmed_identifier: str) -> Optional[Citation]: """Get a citation object by its PubMed identifier."""
python
{ "resource": "" }
q246056
LookupManager.get_citation_by_reference
train
def get_citation_by_reference(self, type: str, reference: str) -> Optional[Citation]: """Get a citation object
python
{ "resource": "" }
q246057
LookupManager.get_citation_by_hash
train
def get_citation_by_hash(self, citation_hash: str) -> Optional[Citation]: """Get a
python
{ "resource": "" }
q246058
LookupManager.get_author_by_name
train
def get_author_by_name(self, name: str) -> Optional[Author]: """Get an author by
python
{ "resource": "" }
q246059
LookupManager.get_evidence_by_hash
train
def get_evidence_by_hash(self, evidence_hash: str) -> Optional[Evidence]: """Look up
python
{ "resource": "" }
q246060
invert_node_predicate
train
def invert_node_predicate(node_predicate: NodePredicate) -> NodePredicate: # noqa: D202 """Build a node predicate that is the inverse of the given node predicate.""" def inverse_predicate(graph: BELGraph, node: BaseEntity) -> bool:
python
{ "resource": "" }
q246061
concatenate_node_predicates
train
def concatenate_node_predicates(node_predicates: NodePredicates) -> NodePredicate: """Concatenate multiple node predicates to a new predicate that requires all predicates to be met. Example usage: >>> from pybel.dsl import protein, gene >>> from pybel.struct.filters.node_predicates import not_patholog...
python
{ "resource": "" }
q246062
filter_nodes
train
def filter_nodes(graph: BELGraph, node_predicates: NodePredicates) -> Iterable[BaseEntity]: """Apply a set of predicates to the nodes iterator of a BEL graph.""" concatenated_predicate
python
{ "resource": "" }
q246063
get_nodes
train
def get_nodes(graph: BELGraph, node_predicates: NodePredicates) -> Set[BaseEntity]:
python
{ "resource": "" }
q246064
count_passed_node_filter
train
def count_passed_node_filter(graph: BELGraph, node_predicates: NodePredicates) -> int: """Count how many nodes pass a given set of node
python
{ "resource": "" }
q246065
get_gene_leaves
train
def get_gene_leaves(graph) -> Iterable[BaseEntity]: """Iterate over all genes who have only one connection, that's a transcription to its RNA. :param pybel.BELGraph graph: A BEL graph """ for node in get_nodes_by_function(graph, GENE): if graph.in_degree(node) != 0: continue
python
{ "resource": "" }
q246066
get_rna_leaves
train
def get_rna_leaves(graph) -> Iterable[BaseEntity]: """Iterate over all RNAs who have only one connection, that's a translation to its protein. :param pybel.BELGraph graph: A BEL graph """ for node in get_nodes_by_function(graph, RNA): if graph.in_degree(node) != 0: continue
python
{ "resource": "" }
q246067
_entity_list_as_bel
train
def _entity_list_as_bel(entities: Iterable[BaseEntity]) -> str: """Stringify a list of BEL entities."""
python
{ "resource": "" }
q246068
CentralDogma.get_parent
train
def get_parent(self) -> Optional['CentralDogma']: """Get the parent, or none if it's already a reference node. :rtype: Optional[CentralDogma] Example usage: >>> ab42 = Protein(name='APP', namespace='HGNC', variants=[Fragment(start=672,
python
{ "resource": "" }
q246069
CentralDogma.with_variants
train
def with_variants(self, variants: Union['Variant', List['Variant']]) -> 'CentralDogma': """Create a new entity with the given variants. :param variants: An optional variant or list of variants Example Usage: >>> app = Protein(name='APP', namespace='HGNC') >>> ab42 = app.with_v...
python
{ "resource": "" }
q246070
ProteinModification.as_bel
train
def as_bel(self) -> str: """Return this protein modification variant as a BEL string.""" return 'pmod({}{})'.format( str(self[IDENTIFIER]),
python
{ "resource": "" }
q246071
Fragment.range
train
def range(self) -> str: """Get the range of this fragment.""" if FRAGMENT_MISSING in self: return '?'
python
{ "resource": "" }
q246072
Fragment.as_bel
train
def as_bel(self) -> str: """Return this fragment variant as a BEL string.""" res = '"{}"'.format(self.range) if FRAGMENT_DESCRIPTION in self:
python
{ "resource": "" }
q246073
_Transcribable.get_gene
train
def get_gene(self) -> Gene: """Get the corresponding gene or raise an exception if it's not the reference node. :raises: InferCentralDogmaException """ if self.variants: raise InferCentralDogmaException('can not get gene for variant')
python
{ "resource": "" }
q246074
Protein.get_rna
train
def get_rna(self) -> Rna: """Get the corresponding RNA or raise an exception if it's not the reference node. :raises: InferCentralDogmaException """ if self.variants: raise InferCentralDogmaException('can not get rna for variant')
python
{ "resource": "" }
q246075
EnumeratedFusionRange.as_bel
train
def as_bel(self) -> str: """Return this fusion range as a BEL string.""" return '{reference}.{start}_{stop}'.format( reference=self[FUSION_REFERENCE],
python
{ "resource": "" }
q246076
FusionBase.as_bel
train
def as_bel(self) -> str: """Return this fusion as a BEL string.""" return '{}(fus({}:{}, "{}", {}:{}, "{}"))'.format( self._func, self.partner_5p.namespace, self.partner_5p._priority_id, self.range_5p.as_bel(),
python
{ "resource": "" }
q246077
iter_annotation_values
train
def iter_annotation_values(graph, annotation: str) -> Iterable[str]: """Iterate over all of the values for an annotation used in the graph. :param pybel.BELGraph graph: A BEL graph :param str annotation: The annotation to grab """ return ( value
python
{ "resource": "" }
q246078
_group_dict_set
train
def _group_dict_set(iterator): """Make a dict that accumulates the values for each key in an iterator of doubles. :param iter[tuple[A,B]] iterator: An iterator :rtype: dict[A,set[B]] """
python
{ "resource": "" }
q246079
get_annotation_values
train
def get_annotation_values(graph, annotation: str) -> Set[str]: """Get all values for the given annotation. :param pybel.BELGraph graph: A BEL graph :param annotation: The annotation to summarize
python
{ "resource": "" }
q246080
count_relations
train
def count_relations(graph) -> Counter: """Return a histogram over all relationships in a graph. :param pybel.BELGraph graph: A BEL graph :return: A Counter from {relation type: frequency}
python
{ "resource": "" }
q246081
_annotation_iter_helper
train
def _annotation_iter_helper(graph) -> Iterable[str]: """Iterate over the annotation keys. :param pybel.BELGraph graph: A BEL graph """ return ( key for _, _, data
python
{ "resource": "" }
q246082
get_unused_list_annotation_values
train
def get_unused_list_annotation_values(graph) -> Mapping[str, Set[str]]: """Get all of the unused values for list annotations. :param pybel.BELGraph graph: A BEL graph :return: A dictionary of {str annotation: set of str values that aren't used} """ result = {} for annotation, values in graph.an...
python
{ "resource": "" }
q246083
from_lines
train
def from_lines(lines: Iterable[str], **kwargs) -> BELGraph: """Load a BEL graph from an iterable over the lines of a BEL script. :param lines: An iterable of strings (the lines in a BEL script) The remaining keyword arguments are
python
{ "resource": "" }
q246084
from_url
train
def from_url(url: str, **kwargs) -> BELGraph: """Load a BEL graph from a URL resource. :param url: A valid URL pointing to a BEL document The remaining keyword arguments are passed to :func:`pybel.io.line_utils.parse_lines`. """ log.info('Loading from url: %s', url)
python
{ "resource": "" }
q246085
expand_node_predecessors
train
def expand_node_predecessors(universe, graph, node: BaseEntity) -> None: """Expand around the predecessors of the given node in the result graph. :param pybel.BELGraph universe: The graph containing the stuff to add :param pybel.BELGraph graph: The graph to add stuff to :param node: A BEL node """ ...
python
{ "resource": "" }
q246086
expand_node_successors
train
def expand_node_successors(universe, graph, node: BaseEntity) -> None: """Expand around the successors of the given node in the result graph. :param pybel.BELGraph universe: The graph containing the stuff to add :param pybel.BELGraph graph: The graph to add stuff to :param node: A BEL node """ ...
python
{ "resource": "" }
q246087
expand_all_node_neighborhoods
train
def expand_all_node_neighborhoods(universe, graph, filter_pathologies: bool = False) -> None: """Expand the neighborhoods of all nodes in the given graph. :param pybel.BELGraph universe: The graph containing the stuff
python
{ "resource": "" }
q246088
parse_lines
train
def parse_lines(graph: BELGraph, lines: Iterable[str], manager: Optional[Manager] = None, allow_nested: bool = False, citation_clearing: bool = True, use_tqdm: bool = False, tqdm_kwargs: Optional[Mapping[str, Any]] = None, ...
python
{ "resource": "" }
q246089
parse_document
train
def parse_document(graph: BELGraph, enumerated_lines: Iterable[Tuple[int, str]], metadata_parser: MetadataParser, ) -> None: """Parse the lines in the document section of a BEL script.""" parse_document_start_time = time.time() for line_number, line ...
python
{ "resource": "" }
q246090
parse_definitions
train
def parse_definitions(graph: BELGraph, enumerated_lines: Iterable[Tuple[int, str]], metadata_parser: MetadataParser, allow_failures: bool = False, use_tqdm: bool = False, tqdm_kwargs: Optional[Mapping[str, Any]...
python
{ "resource": "" }
q246091
parse_statements
train
def parse_statements(graph: BELGraph, enumerated_lines: Iterable[Tuple[int, str]], bel_parser: BELParser, use_tqdm: bool = False, tqdm_kwargs: Optional[Mapping[str, Any]] = None, ) -> None: """Parse a list of st...
python
{ "resource": "" }
q246092
to_database
train
def to_database(graph, manager: Optional[Manager] = None, store_parts: bool = True, use_tqdm: bool = False): """Store a graph in a database. :param BELGraph graph: A BEL graph :param store_parts: Should the graph be stored in the edge store? :return: If successful, returns the network object from the d...
python
{ "resource": "" }
q246093
from_database
train
def from_database(name: str, version: Optional[str] = None, manager: Optional[Manager] = None): """Load a BEL graph from a database. If name and version are given, finds it exactly with :meth:`pybel.manager.Manager.get_network_by_name_version`. If just the name is given, finds most recent with :meth:`p...
python
{ "resource": "" }
q246094
_node_has_variant
train
def _node_has_variant(node: BaseEntity, variant: str) -> bool: """Return true if the node has at least one of the given variant. :param variant:
python
{ "resource": "" }
q246095
_node_has_modifier
train
def _node_has_modifier(graph: BELGraph, node: BaseEntity, modifier: str) -> bool: """Return true if over any of a nodes edges, it has a given modifier. Modifier can be one of: - :data:`pybel.constants.ACTIVITY`, - :data:`pybel.constants.DEGRADATION` - :data:`pybel.constants.TRANSLOCATION`. ...
python
{ "resource": "" }
q246096
has_activity
train
def has_activity(graph: BELGraph, node: BaseEntity) -> bool: """Return true if over any of the node's edges, it has
python
{ "resource": "" }
q246097
is_degraded
train
def is_degraded(graph: BELGraph, node: BaseEntity) -> bool: """Return true if over any of the node's edges, it is
python
{ "resource": "" }
q246098
is_translocated
train
def is_translocated(graph: BELGraph, node: BaseEntity) -> bool: """Return true if over any of the node's edges, it is
python
{ "resource": "" }
q246099
has_causal_in_edges
train
def has_causal_in_edges(graph: BELGraph, node: BaseEntity) -> bool: """Return true if the node contains any in_edges that are causal.""" return any(
python
{ "resource": "" }