gt4sd.algorithms.prediction.paccmann.core module¶
Prediction algorithms based on PaccMann
Summary¶
Classes:
Configuration to predict affinity for a given ligand/protrin target pair. |
|
PaccMann predictor. |
Reference¶
- class PaccMann(configuration, target=None)[source]¶
Bases:
GeneratorAlgorithm
[S
,T
]PaccMann predictor.
- __init__(configuration, target=None)[source]¶
Instantiate PaccMann for prediction.
- Parameters
configuration (
AlgorithmConfiguration
[~S, ~T]) – domain and application specification defining parameters, types and validations.target (
Optional
[~T,None
]) – a target for which to generate items.
Example
An example for predicting affinity for a given ligand and target protein pair:
config = AffinityPredictor( protein_targets=[ "MVLSPADKTNVKAAWGKVGAHAGEYGAEALERMFLSFPTT", "MVLSPADKTNVKAAWGKVGAHAGEYGAEALERMFLSFPTT", ], ligands=[ "CONN=COc1cc2ccccc2c11Occncc(Cl)c1N(O)O", "ClCCC(O1)C(C(N=C1C(=O)Nc1cccc(F)c1F)SO)C", ] ) algorithm = PaccMann(configuration=config) items = list(algorithm.sample(1)) print(items)
- get_generator(configuration, target)[source]¶
Get the function to perform the prediction via PaccMann’s generator.
- Parameters
configuration (
AlgorithmConfiguration
[~S, ~T]) – helps to set up specific application of PaccMann.target (
Optional
[~T,None
]) – context or condition for the generation.
- Return type
Callable
[[],Iterable
[Any
]]- Returns
callable with target predicting properties using PaccMann.
- __abstractmethods__ = frozenset({})¶
- __annotations__ = {'generate': 'Untargeted', 'generator': 'Union[Untargeted, Targeted[T]]', 'max_runtime': 'int', 'max_samples': 'int', 'target': 'Optional[T]'}¶
- __doc__ = 'PaccMann predictor.'¶
- __module__ = 'gt4sd.algorithms.prediction.paccmann.core'¶
- __orig_bases__ = (gt4sd.algorithms.core.GeneratorAlgorithm[~S, ~T],)¶
- __parameters__ = (~S, ~T)¶
- _abc_impl = <_abc._abc_data object>¶
- class AffinityPredictor(*args, **kwargs)[source]¶
Bases:
AffinityPredictor
,Generic
[T
]Configuration to predict affinity for a given ligand/protrin target pair.
- algorithm_type: ClassVar[str] = 'prediction'¶
General type of generative algorithm.
- domain: ClassVar[str] = 'materials'¶
General application domain. Hints at input/output types.
- algorithm_version: str = 'v0'¶
To differentiate between different versions of an application.
There is no imposed naming convention.
- protein_targets: List[str]¶
- ligands: List[str]¶
- confidence: bool = False¶
- get_conditional_generator(resources_path)[source]¶
Instantiate the actual predictor implementation.
- Parameters
resources_path (
str
) – local path to model files.- Return type
- Returns
instance with
gt4sd.algorithms.prediction.affinity._predicto.implementation.BimodalMCAAffinityPredictor.predict()
method for predicting affinity.
- __annotations__ = {'algorithm_application': 'ClassVar[str]', 'algorithm_name': 'ClassVar[str]', 'algorithm_type': typing.ClassVar[str], 'algorithm_version': <class 'str'>, 'confidence': <class 'bool'>, 'domain': typing.ClassVar[str], 'ligands': typing.List[str], 'protein_targets': typing.List[str]}¶
- __dataclass_fields__ = {'algorithm_application': Field(name='algorithm_application',type=typing.ClassVar[str],default='AffinityPredictor',default_factory=<dataclasses._MISSING_TYPE object>,init=True,repr=True,hash=None,compare=True,metadata=mappingproxy({}),kw_only=<dataclasses._MISSING_TYPE object>,_field_type=_FIELD_CLASSVAR), 'algorithm_name': Field(name='algorithm_name',type=typing.ClassVar[str],default='PaccMann',default_factory=<dataclasses._MISSING_TYPE object>,init=True,repr=True,hash=None,compare=True,metadata=mappingproxy({}),kw_only=<dataclasses._MISSING_TYPE object>,_field_type=_FIELD_CLASSVAR), 'algorithm_type': Field(name='algorithm_type',type=typing.ClassVar[str],default='prediction',default_factory=<dataclasses._MISSING_TYPE object>,init=True,repr=True,hash=None,compare=True,metadata=mappingproxy({}),kw_only=<dataclasses._MISSING_TYPE object>,_field_type=_FIELD_CLASSVAR), 'algorithm_version': Field(name='algorithm_version',type=<class 'str'>,default='v0',default_factory=<dataclasses._MISSING_TYPE object>,init=True,repr=True,hash=None,compare=True,metadata=mappingproxy({}),kw_only=False,_field_type=_FIELD), 'confidence': Field(name='confidence',type=<class 'bool'>,default=False,default_factory=<dataclasses._MISSING_TYPE object>,init=True,repr=True,hash=None,compare=True,metadata=mappingproxy({'description': 'Whether the confidence for the prediction should be returned.'}),kw_only=False,_field_type=_FIELD), 'domain': Field(name='domain',type=typing.ClassVar[str],default='materials',default_factory=<dataclasses._MISSING_TYPE object>,init=True,repr=True,hash=None,compare=True,metadata=mappingproxy({}),kw_only=<dataclasses._MISSING_TYPE object>,_field_type=_FIELD_CLASSVAR), 'ligands': Field(name='ligands',type=typing.List[str],default=<dataclasses._MISSING_TYPE object>,default_factory=<class 'list'>,init=True,repr=True,hash=None,compare=True,metadata=mappingproxy({'description': 'List of ligands in SMILES format.'}),kw_only=False,_field_type=_FIELD), 'protein_targets': Field(name='protein_targets',type=typing.List[str],default=<dataclasses._MISSING_TYPE object>,default_factory=<class 'list'>,init=True,repr=True,hash=None,compare=True,metadata=mappingproxy({'description': 'List of protein targets as AA sequences.'}),kw_only=False,_field_type=_FIELD)}¶
- __dataclass_params__ = _DataclassParams(init=True,repr=True,eq=True,order=False,unsafe_hash=False,frozen=False)¶
- __doc__ = 'Configuration to predict affinity for a given ligand/protrin target pair.'¶
- __eq__(other)¶
Return self==value.
- __hash__ = None¶
- __init__(*args, **kwargs)¶
- __match_args__ = ('algorithm_version', 'protein_targets', 'ligands', 'confidence')¶
- __module__ = 'gt4sd.algorithms.prediction.paccmann.core'¶
- __orig_bases__ = (<class 'types.AffinityPredictor'>, typing.Generic[~T])¶
- __parameters__ = (~T,)¶
- __pydantic_complete__ = True¶
- __pydantic_config__ = {}¶
- __pydantic_core_schema__ = {'cls': <class 'gt4sd.algorithms.prediction.paccmann.core.AffinityPredictor'>, 'config': {'title': 'AffinityPredictor'}, 'fields': ['algorithm_version', 'protein_targets', 'ligands', 'confidence'], 'frozen': False, 'metadata': {'pydantic_js_annotation_functions': [], 'pydantic_js_functions': [functools.partial(<function modify_model_json_schema>, cls=<class 'gt4sd.algorithms.prediction.paccmann.core.AffinityPredictor'>, title=None)]}, 'post_init': False, 'ref': 'types.AffinityPredictor:94662829238256', 'schema': {'collect_init_only': False, 'computed_fields': [], 'dataclass_name': 'AffinityPredictor', 'fields': [{'type': 'dataclass-field', 'name': 'algorithm_version', 'schema': {'type': 'default', 'schema': {'type': 'str'}, 'default': 'v0'}, 'kw_only': False, 'init': True, 'metadata': {'pydantic_js_functions': [], 'pydantic_js_annotation_functions': [<function get_json_schema_update_func.<locals>.json_schema_update_func>]}}, {'type': 'dataclass-field', 'name': 'protein_targets', 'schema': {'type': 'default', 'schema': {'type': 'list', 'items_schema': {'type': 'str'}}, 'default_factory': <class 'list'>}, 'kw_only': False, 'init': True, 'metadata': {'pydantic_js_functions': [], 'pydantic_js_annotation_functions': [<function get_json_schema_update_func.<locals>.json_schema_update_func>]}}, {'type': 'dataclass-field', 'name': 'ligands', 'schema': {'type': 'default', 'schema': {'type': 'list', 'items_schema': {'type': 'str'}}, 'default_factory': <class 'list'>}, 'kw_only': False, 'init': True, 'metadata': {'pydantic_js_functions': [], 'pydantic_js_annotation_functions': [<function get_json_schema_update_func.<locals>.json_schema_update_func>]}}, {'type': 'dataclass-field', 'name': 'confidence', 'schema': {'type': 'default', 'schema': {'type': 'bool'}, 'default': False}, 'kw_only': False, 'init': True, 'metadata': {'pydantic_js_functions': [], 'pydantic_js_annotation_functions': [<function get_json_schema_update_func.<locals>.json_schema_update_func>]}}], 'type': 'dataclass-args'}, 'slots': True, 'type': 'dataclass'}¶
- __pydantic_decorators__ = DecoratorInfos(validators={}, field_validators={}, root_validators={}, field_serializers={}, model_serializers={}, model_validators={}, computed_fields={})¶
- __pydantic_fields__ = {'algorithm_version': FieldInfo(annotation=str, required=False, default='v0', init=True, init_var=False, kw_only=False), 'confidence': FieldInfo(annotation=bool, required=False, default=False, description='Whether the confidence for the prediction should be returned.', init=True, init_var=False, kw_only=False), 'ligands': FieldInfo(annotation=List[str], required=False, default_factory=list, description='List of ligands in SMILES format.', init=True, init_var=False, kw_only=False), 'protein_targets': FieldInfo(annotation=List[str], required=False, default_factory=list, description='List of protein targets as AA sequences.', init=True, init_var=False, kw_only=False)}¶
- __pydantic_serializer__ = SchemaSerializer(serializer=Dataclass( DataclassSerializer { class: Py( 0x00005618684f67f0, ), serializer: Fields( GeneralFieldsSerializer { fields: { "algorithm_version": SerField { key_py: Py( 0x00007f1dc39371e0, ), alias: None, alias_py: None, serializer: Some( WithDefault( WithDefaultSerializer { default: Default( Py( 0x00007f1ea52cf3f0, ), ), serializer: Str( StrSerializer, ), }, ), ), required: true, }, "ligands": SerField { key_py: Py( 0x00007f1dc39384f0, ), alias: None, alias_py: None, serializer: Some( WithDefault( WithDefaultSerializer { default: DefaultFactory( Py( 0x000056185a45ab20, ), ), serializer: List( ListSerializer { item_serializer: Str( StrSerializer, ), filter: SchemaFilter { include: None, exclude: None, }, name: "list[str]", }, ), }, ), ), required: true, }, "protein_targets": SerField { key_py: Py( 0x00007f1dc39384b0, ), alias: None, alias_py: None, serializer: Some( WithDefault( WithDefaultSerializer { default: DefaultFactory( Py( 0x000056185a45ab20, ), ), serializer: List( ListSerializer { item_serializer: Str( StrSerializer, ), filter: SchemaFilter { include: None, exclude: None, }, name: "list[str]", }, ), }, ), ), required: true, }, "confidence": SerField { key_py: Py( 0x00007f1dc393a170, ), alias: None, alias_py: None, serializer: Some( WithDefault( WithDefaultSerializer { default: Default( Py( 0x000056185a463580, ), ), serializer: Bool( BoolSerializer, ), }, ), ), required: true, }, }, computed_fields: Some( ComputedFields( [], ), ), mode: SimpleDict, extra_serializer: None, filter: SchemaFilter { include: None, exclude: None, }, required_fields: 4, }, ), fields: [ Py( 0x00007f1ea52ed250, ), Py( 0x00007f1dc39394f0, ), Py( 0x00007f1dc39398f0, ), Py( 0x00007f1ea69cc4b0, ), ], name: "AffinityPredictor", }, ), definitions=[])¶
- __pydantic_validator__ = SchemaValidator(title="AffinityPredictor", validator=Dataclass( DataclassValidator { strict: false, validator: DataclassArgs( DataclassArgsValidator { fields: [ Field { kw_only: false, name: "algorithm_version", py_name: Py( 0x00007f1ea52ed250, ), init: true, init_only: false, lookup_key: Simple { key: "algorithm_version", py_key: Py( 0x00007f1dc3934350, ), path: LookupPath( [ S( "algorithm_version", Py( 0x00007f1dc3937230, ), ), ], ), }, validator: WithDefault( WithDefaultValidator { default: Default( Py( 0x00007f1ea52cf3f0, ), ), on_error: Raise, validator: Str( StrValidator { strict: false, coerce_numbers_to_str: false, }, ), validate_default: false, copy_default: false, name: "default[str]", undefined: Py( 0x00007f1ea71db950, ), }, ), frozen: false, }, Field { kw_only: false, name: "protein_targets", py_name: Py( 0x00007f1dc39394f0, ), init: true, init_only: false, lookup_key: Simple { key: "protein_targets", py_key: Py( 0x00007f1dc38a6b70, ), path: LookupPath( [ S( "protein_targets", Py( 0x00007f1dc3a361b0, ), ), ], ), }, validator: WithDefault( WithDefaultValidator { default: DefaultFactory( Py( 0x000056185a45ab20, ), ), on_error: Raise, validator: List( ListValidator { strict: false, item_validator: Some( Str( StrValidator { strict: false, coerce_numbers_to_str: false, }, ), ), min_length: None, max_length: None, name: OnceLock( "list[str]", ), fail_fast: false, }, ), validate_default: false, copy_default: false, name: "default[list[str]]", undefined: Py( 0x00007f1ea71db950, ), }, ), frozen: false, }, Field { kw_only: false, name: "ligands", py_name: Py( 0x00007f1dc39398f0, ), init: true, init_only: false, lookup_key: Simple { key: "ligands", py_key: Py( 0x00007f1dc4ffaab0, ), path: LookupPath( [ S( "ligands", Py( 0x00007f1dc3938470, ), ), ], ), }, validator: WithDefault( WithDefaultValidator { default: DefaultFactory( Py( 0x000056185a45ab20, ), ), on_error: Raise, validator: List( ListValidator { strict: false, item_validator: Some( Str( StrValidator { strict: false, coerce_numbers_to_str: false, }, ), ), min_length: None, max_length: None, name: OnceLock( "list[str]", ), fail_fast: false, }, ), validate_default: false, copy_default: false, name: "default[list[str]]", undefined: Py( 0x00007f1ea71db950, ), }, ), frozen: false, }, Field { kw_only: false, name: "confidence", py_name: Py( 0x00007f1ea69cc4b0, ), init: true, init_only: false, lookup_key: Simple { key: "confidence", py_key: Py( 0x00007f1dc3938230, ), path: LookupPath( [ S( "confidence", Py( 0x00007f1dc3938270, ), ), ], ), }, validator: WithDefault( WithDefaultValidator { default: Default( Py( 0x000056185a463580, ), ), on_error: Raise, validator: Bool( BoolValidator { strict: false, }, ), validate_default: false, copy_default: false, name: "default[bool]", undefined: Py( 0x00007f1ea71db950, ), }, ), frozen: false, }, ], positional_count: 4, init_only_count: None, dataclass_name: "AffinityPredictor", validator_name: "dataclass-args[AffinityPredictor]", extra_behavior: Ignore, extras_validator: None, loc_by_alias: true, }, ), class: Py( 0x00005618684f67f0, ), fields: [ Py( 0x00007f1ea52ed250, ), Py( 0x00007f1dc39394f0, ), Py( 0x00007f1dc39398f0, ), Py( 0x00007f1ea69cc4b0, ), ], post_init: None, revalidate: Never, name: "AffinityPredictor", frozen: false, slots: true, }, ), definitions=[], cache_strings=True)¶
- __repr__()¶
Return repr(self).
- __signature__ = <Signature (algorithm_version: str = 'v0', protein_targets: List[str] = <factory>, ligands: List[str] = <factory>, confidence: bool = False) -> None>¶
- __wrapped__¶
alias of
AffinityPredictor