mutcleaner.cleaners.human_domainome_sup2_cleaner#
Functions
|
Clean HumanDomainome dataset using configurable pipeline - SupplementaryTable2 |
|
Create HumanDomainome ledataset cleaning pipeline - SupplementaryTable2 |
Classes
Configuration class for HumanDomainome dataset cleaner - SupplementaryTable2. |
- class mutcleaner.cleaners.human_domainome_sup2_cleaner.HumanDomainomeSup2CleanerConfig(num_workers=16, validate_config=True, *, pipeline_name='human_domainome_cleaner', column_mapping=<factory>, filters=<factory>, drop_na_columns=<factory>, type_conversions=<factory>, validation_workers=16, infer_wt_workers=16, handle_multiple_wt='error', label_columns=<factory>, primary_label_column='label_humanDomainome')[source]#
Bases:
BaseCleanerConfigConfiguration class for HumanDomainome dataset cleaner - SupplementaryTable2. Inherits from BaseCleanerConfig and adds HumanDomainome-specific configuration options.
Simply run mutcleaner.download_human_domainome_source_file() to download the dataset.
Alternatively, the raw HumanDomainome file and the wild type fasta file can be obtained from:
Hugging Face: https://huggingface.co/datasets/xulab-research/MutCleaner/blob/main/Human_Domainome_Dataset/SupplementaryTable2.txt
Hugging Face: https://huggingface.co/datasets/xulab-research/MutCleaner/blob/main/Human_Domainome_Dataset/wild_type.fasta
- Attributes:
- column_mappingDict[str, str]
Mapping from source to target column names
- filtersDict[str, Callable]
Filter conditions for data cleaning
- type_conversionsDict[str, str]
Data type conversion specifications
- drop_na_columns: List[str]
List of column names where null values should be dropped
- validation_workersint
Number of workers for mutations validation, set to -1 to use all available CPUs
- infer_wt_workersint
Number of workers for wildtype sequences inference, set to -1 to use all available CPUs
- 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 HumanDomainome-specific configuration parameters
- column_mapping: Dict[str, str]#
- drop_na_columns: List#
- filters: Dict[str, Callable]#
- handle_multiple_wt: Literal['error', 'first', 'separate'] = 'error'#
- infer_wt_workers: int = 16#
- label_columns: List[str]#
- pipeline_name: str = 'human_domainome_cleaner'#
- primary_label_column: str = 'label_humanDomainome'#
- type_conversions: Dict[str, str]#
- validate()[source]#
Validate HumanDomainome-specific configuration parameters
- Raises:
ValueError – If configuration is invalid
- Return type:
None
- validation_workers: int = 16#
- mutcleaner.cleaners.human_domainome_sup2_cleaner.clean_human_domainome_sup2_dataset(pipeline)[source]#
Clean HumanDomainome dataset using configurable pipeline - SupplementaryTable2
- Parameters:
pipeline (
Pipeline) – HumanDomainome dataset cleaning pipeline- Return type:
Tuple[Pipeline,MutationDataset]- Returns:
Pipeline: The cleaned pipeline - MutationDataset: The cleaned HumanDomainome dataset
- Raises:
RuntimeError – If pipeline execution fails
- mutcleaner.cleaners.human_domainome_sup2_cleaner.create_human_domainome_sup2_cleaner(dataset_or_path, config=None)[source]#
Create HumanDomainome ledataset cleaning pipeline - SupplementaryTable2
- Parameters:
dataset_or_path (
Union[str,Path,DataFrame]) – Raw HumanDomainome dataset DataFrame or file path to HumanDomainome - File: SupplementaryTable2.txt from the article ‘Site-saturation mutagenesis of 500 human protein domains’config (
Union[HumanDomainomeSup2CleanerConfig,Dict[str,Any],str,Path,None]) – Configuration for the cleaning pipeline. Can be: - HumanDomainomeCleanerConfig object - Dictionary with configuration parameters (merged with defaults) - Path to JSON configuration file (str or Path) - None (uses default configuration)
- Return type:
- Returns:
The cleaning pipeline
- Raises:
FileNotFoundError – If data file or sequence dictionary file not found
TypeError – If config has invalid type
ValueError – If configuration validation fails
Examples
Basic usage:
>>> pipeline = create_human_domainome_sup2_cleaner( ... "human_domainome.csv" ... ) >>> pipeline, dataset = clean_human_domainome_dataset(pipeline)
Custom configuration:
>>> config = { ... "process_workers": 8, ... "type_conversions": {"label_humanDomainome": "float32"} ... } >>> pipeline = create_human_domainome_sup2_cleaner( ... "human_domainome.csv" ... config=config ... )
Load configuration from file:
>>> pipeline = create_human_domainome_sup2_cleaner( ... "data.csv", ... config="config.json" ... )