mutcleaner.cleaners.human_domainome_sup4_cleaner#

Functions

clean_human_domainome_sup4_dataset(pipeline)

Clean HumanDomainome dataset using configurable pipeline

create_human_domainome_sup4_cleaner(...[, ...])

Create HumanDomainome dataset cleaning pipeline - SupplementaryTable4

Classes

HumanDomainomeSup4CleanerConfig([...])

Configuration class for HumanDomainome dataset cleaner - SupplementaryTable4.

class mutcleaner.cleaners.human_domainome_sup4_cleaner.HumanDomainomeSup4CleanerConfig(num_workers=16, validate_config=True, *, pipeline_name='human_domainome_cleaner', sequence_source, header_parser=<function parse_uniprot_header>, column_mapping=<factory>, type_conversions=<factory>, drop_na_columns=<factory>, is_zero_based=False, process_workers=16, label_columns=<factory>, primary_label_column='label_humanDomainome')[source]#

Bases: BaseCleanerConfig

Configuration class for HumanDomainome dataset cleaner - SupplementaryTable4. Inherits from BaseCleanerConfig and adds HumanDomainome-specific configuration options.

Simply run mutcleaner.download_human_domainome_source_file() to download the dataset.

Attributes:
sequence_sourceUnion[str, Path]

Path to the file containing UniProt ID to sequence mapping

header_parserCallable[[str], Tuple[str, Dict[str, str]]]

Parse UniProt FASTA header to extract ID and metadata

column_mappingDict[str, str]

Mapping from source to target column names

type_conversionsDict[str, str]

Data type conversion specifications

drop_na_columns: List[str]

List of column names where null values should be dropped

is_zero_basedbool

Whether mutation positions are zero-based

process_workersint

Number of workers for parallel processing

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

header_parser()

Parse UniProt FASTA header to extract ID and metadata

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#
header_parser()#

Parse UniProt FASTA header to extract ID and metadata

Parameters:

header (str) – FASTA header line (without ‘>’)

Return type:

Tuple[str, Dict[str, str]]

Returns:

(sequence_id, metadata_dict)

Examples

>>> parse_uniprot_header("sp|P12345|PROT_HUMAN Protein description OS=Homo sapiens")
('P12345', {'db': 'sp', 'entry_name': 'PROT_HUMAN', 'description': 'Protein description OS=Homo sapiens'})
>>> parse_uniprot_header("P12345|PROT_HUMAN Description")
('P12345', {'entry_name': 'PROT_HUMAN', 'description': 'Description'})
>>> parse_uniprot_header("P12345")
('P12345', {})
is_zero_based: bool = False#
label_columns: List[str]#
pipeline_name: str = 'human_domainome_cleaner'#
primary_label_column: str = 'label_humanDomainome'#
process_workers: int = 16#
sequence_source: str | Path#
type_conversions: Dict[str, str]#
validate()[source]#

Validate HumanDomainome-specific configuration parameters

Raises:

ValueError – If configuration is invalid

Return type:

None

mutcleaner.cleaners.human_domainome_sup4_cleaner.clean_human_domainome_sup4_dataset(pipeline)[source]#

Clean HumanDomainome dataset using configurable pipeline

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_sup4_cleaner.create_human_domainome_sup4_cleaner(dataset_or_path, sequence_source, config=None)[source]#

Create HumanDomainome dataset cleaning pipeline - SupplementaryTable4

Parameters:
  • dataset_or_path (Union[str, Path, DataFrame]) – Raw HumanDomainome dataset DataFrame or file path to HumanDomainome - File: SupplementaryTable4.txt from the article ‘Site-saturation mutagenesis of 500 human protein domains’

  • sequence_source (Union[str, Path]) – Path to file containing UniProt ID to sequence mapping

  • config (Union[HumanDomainomeSup4CleanerConfig, 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:

Pipeline

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_sup4_cleaner(
...     "human_domainome.csv",
...     "uniprot_sequences.fasta"
... )
>>> pipeline, dataset = clean_human_domainome_dataset(pipeline)

Custom configuration:

>>> config = {
...     "process_workers": 8,
...     "type_conversions": {"label_humanDomainome": "float32"}
... }
>>> pipeline = create_human_domainome_sup4_cleaner(
...     "human_domainome.csv",
...     "sequences.csv",
...     config=config
... )

Load configuration from file:

>>> pipeline = create_human_domainome_sup4_cleaner(
...     "data.csv",
...     "sequences.fasta",
...     config="config.json"
... )