mutcleaner.cleaners.trpb_cleaner#
Functions
|
Clean TrpB dataset using configurable pipeline |
|
Create TrpB dataset cleaning pipeline |
Classes
|
Configuration class for TrpB dataset cleaner. |
- class mutcleaner.cleaners.trpb_cleaner.TrpBCleanerConfig(pipeline_name='TrpB Cleaning Pipeline', num_workers=16, validate_config=True, column_mapping=<factory>, filters=<factory>, type_conversions=<factory>, wt_sequence='MKGYFGPYGGQYVPEILMGALEELEAAYEGIMKDESFWKEFNDLLRDYAGRPTPLYFARRLSEKYGARVYLKREDLLHTGAHKINNAIGQVLLAKLMGKTRIIAETGAGQHGVATATAAALFGMECVIYMGEEDTIRQKLNVERMKLLGAKVVPVKSGSRTLKDAIDEALRDWITNLQTTYYVFGSVVGPHPYPIIVRNFQKVIGEETKKQIPEKEGRLPDYIVACVSGGSNAAGIFYPFIDSGVKLIGVEAGGEGLETGKHAASLLKGKIGYLHGSKTFVLQDDWGQVQVSHSVSAGLDYSGVGPEHAYWRETGKVLYDAVTDEEALDAFIELSRLEGIIPALESSHALAYLKKINIKGKVVVVNLSGRGDKDLESVLNHPYVRERIRLEHHHHHH', label_columns=<factory>, primary_label_column='label')[source]#
Bases:
BaseCleanerConfigConfiguration class for TrpB dataset cleaner. Inherits from BaseCleanerConfig and adds TrpB-specific configuration options. Simply run mutcleaner.download_trpb_source_file() to download the dataset.
Alternatively, the raw TrpB file can be obtained from:
Hugging Face: https://huggingface.co/datasets/xulab-research/MutCleaner/blob/main/TrpB_Epistasis_Dataset/TrpB_Epistasis_Dataset.csv
- Attributes:
- column_mappingDict[str, str]
Mapping from source to target column names
- filtersDict[str, Any]
Filter conditions for data cleaning
- type_conversionsDict[str, str]
Data type conversion specifications
- is_zero_basedbool
Whether mutation positions are zero-based
- validation_workersint
Number of workers for mutation validation
- infer_wt_workersint
Number of workers for wildtype sequence inference
- handle_multiple_wtLiteral[“error”, “first”, “separate”]
Strategy for handling multiple wildtype sequences
- 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 TrpB-specific configuration parameters
- column_mapping: Dict[str, str]#
- filters: Dict[str, Callable]#
- label_columns: List[str]#
- num_workers: int = 16#
- pipeline_name: str = 'TrpB Cleaning Pipeline'#
- primary_label_column: str = 'label'#
- type_conversions: Dict[str, str]#
- validate()[source]#
Validate TrpB-specific configuration parameters
- Raises:
ValueError – If configuration is invalid
- Return type:
None
- wt_sequence: str = 'MKGYFGPYGGQYVPEILMGALEELEAAYEGIMKDESFWKEFNDLLRDYAGRPTPLYFARRLSEKYGARVYLKREDLLHTGAHKINNAIGQVLLAKLMGKTRIIAETGAGQHGVATATAAALFGMECVIYMGEEDTIRQKLNVERMKLLGAKVVPVKSGSRTLKDAIDEALRDWITNLQTTYYVFGSVVGPHPYPIIVRNFQKVIGEETKKQIPEKEGRLPDYIVACVSGGSNAAGIFYPFIDSGVKLIGVEAGGEGLETGKHAASLLKGKIGYLHGSKTFVLQDDWGQVQVSHSVSAGLDYSGVGPEHAYWRETGKVLYDAVTDEEALDAFIELSRLEGIIPALESSHALAYLKKINIKGKVVVVNLSGRGDKDLESVLNHPYVRERIRLEHHHHHH'#
- mutcleaner.cleaners.trpb_cleaner.clean_trpb_dataset(pipeline)[source]#
Clean TrpB dataset using configurable pipeline
- Parameters:
pipeline (
Pipeline) – TrpB dataset cleaning pipeline- Return type:
Tuple[Pipeline,MutationDataset]- Returns:
Pipeline: The cleaned pipeline - MutationDataset: The cleaned TrpB dataset
Examples
>>> pipeline = create_TrpB_cleaner(df) # df is raw TrpB dataset file Use default configuration:
>>> pipeline, dataset = clean_TrpB_dataset(pipeline)
Use partial configuration:
>>> pipeline, dataset = clean_TrpB_dataset(df, config={ ... "validate_mut_workers": 8, ... })
Load configuration from file:
>>> pipeline, dataset = clean_TrpB_dataset(df, config="config.json")
- mutcleaner.cleaners.trpb_cleaner.create_trpb_cleaner(dataset_or_path, config=None)[source]#
Create TrpB dataset cleaning pipeline
- Parameters:
dataset_or_path (
Union[str,Path]) – Raw dataset DataFrame or file path to TrpB dataset.config (
Union[TrpBCleanerConfig,Dict[str,Any],str,Path,None]) – Configuration for the cleaning pipeline. Can be: - TrpBCleanerConfig 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