mutcleaner.cleaners.mgnify_ddg_cleaner#
Functions
|
Execute the MGnify_ddG dataset cleaning pipeline and package into a MutationDataset. |
|
Create MGnify protein stability dataset cleaning pipeline. |
Classes
|
Configuration class for MGnify protein stability dataset cleaner. |
- class mutcleaner.cleaners.mgnify_ddg_cleaner.MGnifyddGCleanerConfig(pipeline_name='MGnify-ddG', num_workers=16, validate_config=True, column_mapping=<factory>, type_conversions=<factory>, infer_mut_workers=16, aggregation_strategy='mean', nearest_by=<factory>, label_columns=<factory>, primary_label_column='label')[source]#
Bases:
BaseCleanerConfigConfiguration class for MGnify protein stability dataset cleaner. Inherits from BaseCleanerConfig and adds MGnify-specific configuration options.
This configuration is specifically optimized for the MGnify cluster-subset schema which pre-calculates ddG values from sequence pairs without extra environmental columns (such as pH or temperature).
- Attributes:
- column_mappingDict[str, str]
Mapping from source columns to MutCleaner standard columns. Default targets are: ‘WT_name’ -> ‘name’, ‘wt_seq’ -> ‘wt_seq’, ‘mut_seq’ -> ‘mut_seq’, ‘ddG’ -> ‘label’.
- type_conversionsDict[str, str]
Data type conversion specifications. Default forces ‘label’ to ‘float32’.
- infer_mut_workersint
Number of parallel workers used for mutation inference. Set to -1 to use all CPUs.
- aggregation_strategyLiteral[“mean”, “first”, “nearest”]
Strategy to aggregate labels sharing identical mutation keys. Defaults to “mean”.
- nearest_byList[Tuple[str, float]]
Keep mutation by distance metrics. Unused for pure computational subsets.
- label_columnsList[str]
List of score/label columns to process.
- primary_label_columnstr
Primary score column for the dataset package.
Methods
from_dict(config_dict)Create configuration object from dictionary
from_json(json_path)Load configuration from JSON file
get_summary()Get a human-readable summary of the configuration
merge(partial_config)Merge partial configuration with current configuration
to_dict([exclude_callables])Convert configuration to dictionary
to_json(json_path, **json_kwargs)Save configuration to JSON file
validate()Validate MGnify-specific configuration parameters.
- aggregation_strategy: Literal['mean', 'first', 'nearest'] = 'mean'#
- column_mapping: Dict[str, str]#
- infer_mut_workers: int = 16#
- label_columns: List[str]#
- nearest_by: List[Tuple[str, float]]#
- pipeline_name: str = 'MGnify-ddG'#
- primary_label_column: str = 'label'#
- type_conversions: Dict[str, str]#
- mutcleaner.cleaners.mgnify_ddg_cleaner.clean_mgnify_ddg_dataset(pipeline)[source]#
Execute the MGnify_ddG dataset cleaning pipeline and package into a MutationDataset.
- Parameters:
pipeline (
Pipeline) – The pre-constructed MGnify_ddG dataset cleaning pipeline.- Return type:
Tuple[Pipeline,MutationDataset]- Returns:
pipeline: The executed pipeline instance. - mgnify_ddg_dataset: Standardized MutationDataset object containing data.csv, wt.fasta, and metadata.json.
- mutcleaner.cleaners.mgnify_ddg_cleaner.create_mgnify_ddg_cleaner(dataset_or_path=None, config=None)[source]#
Create MGnify protein stability dataset cleaning pipeline.
This function pieces together modular basic cleaners to standardize the MGnify subsets into regularized training matrices for deep learning architectures.
- Parameters:
dataset_or_path (
Union[DataFrame,str,Path,None]) – Raw dataset DataFrame or file path to the raw MGnify_ddG_Dataset.csv file.config (
Union[MGnifyddGCleanerConfig,Dict[str,Any],str,Path,None]) – Configuration instance, parameter dictionary, or path to a JSON config.
- Return type:
- Returns:
The constructed cleaning pipeline instance populated with delayed steps.