src/pybel/io/triples/api.py
def to_triple(
    graph: BELGraph,
    u: BaseEntity,
    v: BaseEntity,
    key: str,
) -> Optional[Tuple[str, str, str]]:  # noqa: C901
    """Get the triples' strings that should be written to the file."""
    data = graph[u][v][key]

    # order is important
    _converters = [
        converters.ListComplexHasComponentConverter,
        converters.PartOfNamedComplexConverter,
        converters.SubprocessPartOfBiologicalProcessConverter,
        converters.ProteinPartOfBiologicalProcessConverter,
        converters.AbundancePartOfPopulationConverter,
        converters.PopulationPartOfAbundanceConverter,
        converters.RegulatesActivityConverter,
        converters.MiRNADecreasesExpressionConverter,
        converters.MiRNADirectlyDecreasesExpressionConverter,
        converters.AbundanceDirectlyDecreasesProteinActivityConverter,
        converters.AbundanceDirectlyIncreasesProteinActivityConverter,
        converters.IsAConverter,
        converters.EquivalenceConverter,
        converters.CorrelationConverter,
        converters.AssociationConverter,
        converters.DrugIndicationConverter,
        converters.DrugSideEffectConverter,
        converters.RegulatesAmountConverter,
        converters.ProcessCausalConverter,
        converters.IncreasesAmountConverter,
        converters.DecreasesAmountConverter,
        converters.NoChangeAmountConverter,
        converters.IncreasesActivityConverter,
        converters.DecreasesActivityConverter,
        converters.NoChangeActivityConverter,
        converters.ReactionHasProductConverter,
        converters.ReactionHasReactantConverter,
        converters.ReactionHasCatalystConverter,
        converters.HasVariantConverter,
        converters.IncreasesDegradationConverter,
        converters.DecreasesDegradationConverter,
        converters.RegulatesDegradationConverter,
        converters.NoChangeDegradationConverter,
        converters.TranscriptionFactorForConverter,
        converters.HomomultimerConverter,
        converters.BindsGeneConverter,
        converters.BindsProteinConverter,
        converters.ProteinRegulatesComplex,
    ]

    for converter in _converters:
        if converter.predicate(u, v, key, data):
            return converter.convert(u, v, key, data)

    logger.warning('unhandled: {}'.format(graph.edge_to_bel(u, v, data)))
Get the triples' strings that should be written to the file.
Get the triples' strings that should be written to the file.
Get the triples ' strings that should be written to the file .
def to_triple(
    graph: BELGraph,
    u: BaseEntity,
    v: BaseEntity,
    key: str,
) -> Optional[Tuple[str, str, str]]:  
    data = graph[u][v][key]
    _converters = [
        converters.ListComplexHasComponentConverter,
        converters.PartOfNamedComplexConverter,
        converters.SubprocessPartOfBiologicalProcessConverter,
        converters.ProteinPartOfBiologicalProcessConverter,
        converters.AbundancePartOfPopulationConverter,
        converters.PopulationPartOfAbundanceConverter,
        converters.RegulatesActivityConverter,
        converters.MiRNADecreasesExpressionConverter,
        converters.MiRNADirectlyDecreasesExpressionConverter,
        converters.AbundanceDirectlyDecreasesProteinActivityConverter,
        converters.AbundanceDirectlyIncreasesProteinActivityConverter,
        converters.IsAConverter,
        converters.EquivalenceConverter,
        converters.CorrelationConverter,
        converters.AssociationConverter,
        converters.DrugIndicationConverter,
        converters.DrugSideEffectConverter,
        converters.RegulatesAmountConverter,
        converters.ProcessCausalConverter,
        converters.IncreasesAmountConverter,
        converters.DecreasesAmountConverter,
        converters.NoChangeAmountConverter,
        converters.IncreasesActivityConverter,
        converters.DecreasesActivityConverter,
        converters.NoChangeActivityConverter,
        converters.ReactionHasProductConverter,
        converters.ReactionHasReactantConverter,
        converters.ReactionHasCatalystConverter,
        converters.HasVariantConverter,
        converters.IncreasesDegradationConverter,
        converters.DecreasesDegradationConverter,
        converters.RegulatesDegradationConverter,
        converters.NoChangeDegradationConverter,
        converters.TranscriptionFactorForConverter,
        converters.HomomultimerConverter,
        converters.BindsGeneConverter,
        converters.BindsProteinConverter,
        converters.ProteinRegulatesComplex,
    ]
    for converter in _converters:
        if converter.predicate(u, v, key, data):
            return converter.convert(u, v, key, data)
    logger.warning('unhandled: {}'.format(graph.edge_to_bel(u, v, data)))
def to_triple ( graph : BELGraph , u : BaseEntity , v : BaseEntity , key : str , ) -> Optional [ Tuple [ str , str , str ] ] : data = graph [ u ] [ v ] [ key ] _converters = [ converters . ListComplexHasComponentConverter , converters . PartOfNamedComplexConverter , converters . SubprocessPartOfBiologicalProcessConverter , converters . ProteinPartOfBiologicalProcessConverter , converters . AbundancePartOfPopulationConverter , converters . PopulationPartOfAbundanceConverter , converters . RegulatesActivityConverter , converters . MiRNADecreasesExpressionConverter , converters . MiRNADirectlyDecreasesExpressionConverter , converters . AbundanceDirectlyDecreasesProteinActivityConverter , converters . AbundanceDirectlyIncreasesProteinActivityConverter , converters . IsAConverter , converters . EquivalenceConverter , converters . CorrelationConverter , converters . AssociationConverter , converters . DrugIndicationConverter , converters . DrugSideEffectConverter , converters . RegulatesAmountConverter , converters . ProcessCausalConverter , converters . IncreasesAmountConverter , converters . DecreasesAmountConverter , converters . NoChangeAmountConverter , converters . IncreasesActivityConverter , converters . DecreasesActivityConverter , converters . NoChangeActivityConverter , converters . ReactionHasProductConverter , converters . ReactionHasReactantConverter , converters . ReactionHasCatalystConverter , converters . HasVariantConverter , converters . IncreasesDegradationConverter , converters . DecreasesDegradationConverter , converters . RegulatesDegradationConverter , converters . NoChangeDegradationConverter , converters . TranscriptionFactorForConverter , converters . HomomultimerConverter , converters . BindsGeneConverter , converters . BindsProteinConverter , converters . ProteinRegulatesComplex , ] for converter in _converters : if converter . predicate ( u , v , key , data ) : return converter . convert ( u , v , key , data ) logger . warning ( 'unhandled: {}' . format ( graph . edge_to_bel ( u , v , data ) ) )
Get the triples' strings that should be written to the file.
Get the triples ' strings that should be written to the file .
# noqa: C901 """Get the triples' strings that should be written to the file.""" # order is important
graph
BELGraph
u
BaseEntity
v
BaseEntity
key
str