mutcleaner.cleaners.ddg_dtm_cleaners#
Functions
|
Clean ddG-dTm dataset using configurable pipeline |
|
Create ddG-dTm dataset cleaning pipeline |
Classes
|
Configuration class for ddG-dTm dataset cleaner. |
- class mutcleaner.cleaners.ddg_dtm_cleaners.DdgDtmCleanerConfig(pipeline_name='ddG-dTm', num_workers=16, validate_config=True, column_mapping=<factory>, type_conversions=<factory>, infer_mut_workers=16, aggregation_strategy='nearest', nearest_by=<factory>, label_columns=<factory>, primary_label_column='label')[source]#
Bases:
BaseCleanerConfigConfiguration class for ddG-dTm dataset cleaner. Inherits from BaseCleanerConfig and adds ddG-dTm-specific configuration options.
Simply run mutcleaner.download_ddg_dtm_source_file() to download the dataset.
Alternatively, the raw ddG-dTm files can be obtained from:
Hugging Face: https://huggingface.co/datasets/xulab-research/MutCleaner/tree/main/ddG_Dataset
Hugging Face: https://huggingface.co/datasets/xulab-research/MutCleaner/tree/main/dTm_Dataset
- Attributes:
- column_mappingDict[str, str]
Mapping from source to target column names
- type_conversionsDict[str, str]
Data type conversion specifications
- infer_mut_workersint
Number of workers for mutation inference, set to -1 to use all available CPUs
- aggregation_strategyLiteral[“mean”, “first”, “nearest”]
Aggregate labels by name, see aggregate_labels_by_name for details
- nearest_byList[Tuple[str, float]]
Keep mutation by distance, see aggregate_labels_by_name for details
- label_columnsList[str]
List of score columns to process
- primary_label_columnstr
Primary score column for the dataset
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 ddG-dTm-specific configuration parameters
- aggregation_strategy: Literal['mean', 'first', 'nearest'] = 'nearest'#
- column_mapping: Dict[str, str]#
- infer_mut_workers: int = 16#
- label_columns: List[str]#
- nearest_by: List[Tuple[str, float]]#
- pipeline_name: str = 'ddG-dTm'#
- primary_label_column: str = 'label'#
- type_conversions: Dict[str, str]#
- mutcleaner.cleaners.ddg_dtm_cleaners.clean_ddg_dtm_dataset(pipeline)[source]#
Clean ddG-dTm dataset using configurable pipeline
- Parameters:
pipeline (
Pipeline) – ddG-dTm dataset cleaning pipeline- Return type:
Tuple[Pipeline,MutationDataset]- Returns:
Pipeline: The cleaned pipeline - MutationDataset: The cleaned ddG-dTm dataset
Examples
>>> pipeline = create_ddg_dtm_cleaner(df) # df is raw ddG-dTm dataset file
Use default configuration:
>>> pipeline, dataset = clean_ddg_dtm_dataset(pipeline)
Use partial configuration:
>>> pipeline, dataset = clean_ddg_dtm_dataset(df, config={ ... "infer_mut_workers": 8, ... })
Load configuration from file:
>>> pipeline, dataset = clean_ddg_dtm_dataset(df, config="config.json")
- mutcleaner.cleaners.ddg_dtm_cleaners.create_ddg_dtm_cleaner(dataset_or_path=None, config=None)[source]#
Create ddG-dTm dataset cleaning pipeline
- Parameters:
dataset_or_path (
Union[DataFrame,str,Path,None]) – Raw dataset DataFrame or file path to ddG-dTm dataset.config (
Union[DdgDtmCleanerConfig,Dict[str,Any],str,Path,None]) – Configuration for the cleaning pipeline. Can be: - DdgDtmCleanerConfig object - Dictionary with configuration parameters (merged with defaults) - Path to JSON configuration file (str or Path) - None (uses default configuration)
- Return type:
- Returns:
Pipeline: The cleaning pipeline used
- Raises:
TypeError – If config has invalid type
ValueError – If configuration validation fails
Notes
Label columns (dTm or ddG) are automatically detected and added to the pipeline.