← Về thư mục
skills/protein-mutation-enhancement/kernel.py
- validate_sequence · function · L100-L109 — def validate_sequence(sequence: str, alphabet: str = AA_ALPHABET) -> str
- parse_mutation · function · L112-L134 — def parse_mutation(mutation: str, sequence: str | None = None) -> dict
- normalize_mutations · function · L137-L162 — def normalize_mutations( mutations: str | Mapping | Sequence, sequence: str | None = None, ) -> list[dict]
- mutation_id · function · L165-L175 — def mutation_id( mutations: str | Mapping | Sequence, sequence: str | None = None ) -> str
- apply_mutations · function · L178-L184 — def apply_mutations(sequence: str, mutations: str | Mapping | Sequence) -> str
- enumerate_mutants · function · L187-L262 — def enumerate_mutants( sequence: str, positions: Sequence[int] | None = None, substitutions: Mapping[int | str, Iterable[str] | str] | None = None, max_order: int = 1, seeds: Sequence[str | Mapping | Sequence] | None = None, limit: int | None = None, include_wild_type: bool = False, alphabet: str = AA_ALPHABET, ) -> list[dict]
- add_variant · function · L219-L233 — def add_variant(muts: Sequence[Mapping]) -> bool
- property_score · function · L265-L281 — def property_score(mutations: str | Mapping | Sequence) -> float
- read_score_table · function · L284-L297 — def read_score_table(path: str | Path, id_column: str = "id") -> dict[str, dict]
- write_fasta · function · L300-L308 — def write_fasta(candidates: Sequence[Mapping], path: str | Path) -> None
- rank_mutants · function · L311-L362 — def rank_mutants( candidates: Sequence[Mapping], score_tables: Sequence[Mapping | Sequence[Mapping]] | None = None, weights: Mapping[str, float] | None = None, directions: Mapping[str, str] | None = None, acceptance_thresholds: Mapping[str, float] | None = None, ) -> list[dict]
- run_selection_round · function · L365-L391 — def run_selection_round( candidates: Sequence[Mapping], score_tables: Sequence[Mapping | Sequence[Mapping]] | None = None, weights: Mapping[str, float] | None = None, directions: Mapping[str, str] | None = None, acceptance_thresholds: Mapping[str, float] | None = None, top_k: int = 20, ) -> dict
- suggest_next_positions · function · L394-L412 — def suggest_next_positions( ranked_candidates: Sequence[Mapping], max_positions: int = 10, ) -> list[int]
- write_ranked_json · function · L415-L417 — def write_ranked_json(result: Mapping, path: str | Path) -> None
- _coerce_mutation · function · L420-L447 — def _coerce_mutation(item, sequence: str | None) -> dict
- _validate_mutation_set · function · L450-L465 — def _validate_mutation_set(mutations: Sequence[Mapping]) -> list[dict]
- _normalize_positions · function · L468-L476 — def _normalize_positions(positions: Sequence[int] | None, length: int) -> list[int]
- _normalize_substitutions · function · L479-L498 — def _normalize_substitutions( sequence: str, positions: Sequence[int], substitutions: Mapping[int | str, Iterable[str] | str] | None, alphabet: str, ) -> dict[int, list[str]]
- _merge_candidates · function · L501-L514 — def _merge_candidates( candidates: Sequence[Mapping], score_tables: Sequence[Mapping | Sequence[Mapping]], ) -> list[dict]
- _as_score_table · function · L517-L520 — def _as_score_table(table: Mapping | Sequence[Mapping]) -> dict[str, dict]
- _records_to_table · function · L523-L535 — def _records_to_table( records: Sequence[Mapping], id_column: str = "id", ) -> dict[str, dict]
- _coerce_score_row · function · L538-L541 — def _coerce_score_row(value) -> dict
- _coerce_number · function · L544-L552 — def _coerce_number(value)
- _normalize_metric · function · L555-L571 — def _normalize_metric( rows: Sequence[Mapping], metric: str, direction: str ) -> dict[str, float]
- _passes_thresholds · function · L574-L588 — def _passes_thresholds( row: Mapping, thresholds: Mapping[str, float], directions: Mapping[str, str], ) -> bool
- _is_number · function · L591-L592 — def _is_number(value) -> bool
- _clamp · function · L595-L596 — def _clamp(value: float, lo: float = 0.0, hi: float = 1.0) -> float
- _residue_at · function · L599-L604 — def _residue_at(sequence: str, pos: int) -> str