mutcleaner.cleaners.archstabms_1e10_custom_cleaners#
Functions
|
Add wild-type sequences based on library identifiers. |
|
compute the mutations by the wt_seq and mut_seq and generate mutation column |
|
Convert pairwise energetic couplings to double-mutant free-energy changes. |
- mutcleaner.cleaners.archstabms_1e10_custom_cleaners.add_wild_type_sequences_by_library(dataset, library_sequences, library_column='library', sequence_column='wt_sequence')[source]#
Add wild-type sequences based on library identifiers.
- Parameters:
dataset (
DataFrame) – Input dataset.library_sequences (
Dict[int,str]) – Mapping from library identifiers to wild-type sequences.library_column (
str) – Column containing library identifiers.sequence_column (
str) – Output column for wild-type sequences.
- Return type:
DataFrame- Returns:
Dataset with the wild-type sequence column added.
- Raises:
ValueError – If any library identifier has no corresponding wild-type sequence.
- mutcleaner.cleaners.archstabms_1e10_custom_cleaners.compute_mutations(dataset, name_column='name', WT_column='WT', mut_seq='mut_seq')[source]#
compute the mutations by the wt_seq and mut_seq and generate mutation column
- Parameters:
dataset (
DataFrame)name_column (
str) – Grouping key column.WT_column (
str) – column used to check whether wt or mutmut_seq (
str) – Column containing the amino-acid sequence for that row (treated as the mutated sequence for mutants and the WT sequence for the WT row).
- Return type:
DataFrame
- mutcleaner.cleaners.archstabms_1e10_custom_cleaners.convert_pairwise_couplings_to_ddg(dataset, group_columns=None, mutation_column='mut_info', label_column='label', mutation_separator=',')[source]#
Convert pairwise energetic couplings to double-mutant free-energy changes.
For a double mutant containing mutations A and B, the total free-energy change relative to the wild type is calculated as:
ΔΔG(A,B) = ΔΔG(A) + ΔΔG(B) + ΔΔΔG(A,B)
Single-mutant labels are left unchanged. Double mutants missing either constituent single-mutant label are moved to the failed dataset.
- Parameters:
dataset (
DataFrame) – Input dataset containing single- and double-mutant energy terms.group_columns (
Optional[List[str]]) – Columns identifying the protein and biophysical trait within which single-mutant labels are matched. Defaults to["name"].mutation_column (
str) – Column containing mutation descriptions.label_column (
str) – Column containing inferred free-energy terms.mutation_separator (
str) – Separator between individual mutations.
- Return type:
Tuple[DataFrame,DataFrame]- Returns:
A tuple containing:
- successful_datasetpd.DataFrame
Single mutants and double mutants successfully converted to ΔΔG.
- failed_datasetpd.DataFrame
Double mutants missing at least one constituent single-mutant label, with an additional
error_messagecolumn.
- Raises:
ValueError – If required columns are missing or a single mutation has multiple label measurements within the same group.
Examples
>>> df = pd.DataFrame({ ... "name": ["proteinA"] * 5, ... "mut_info": [ ... "A0G", ... "B1V", ... "A0G,B1V", ... "C2D", ... "A0G,D3E", ... ], ... "label": [0.4, -0.1, 0.2, 0.3, 0.5], ... }) >>> successful, failed = convert_pairwise_couplings_to_ddg(df) >>> successful["label"].tolist() [0.4, -0.1, 0.5, 0.3] >>> failed["mut_info"].tolist() ['A0G,D3E']