Skip to content

Commit

Permalink
Makes sure that the position in the variant is accurate by relying on…
Browse files Browse the repository at this point in the history
… the residue information
  • Loading branch information
miguelgondu committed Oct 24, 2023
1 parent 30ff002 commit dea47d5
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 9 deletions.
8 changes: 1 addition & 7 deletions examples/using_rasp/querying_rasp.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,7 @@
"""
from pathlib import Path

import numpy as np

from poli.objective_repository.rasp.register import RaspBlackBox, RaspProblemFactory
from poli.core.problem_setup_information import ProblemSetupInformation

from poli.core.util.proteins.defaults import AMINO_ACIDS
from poli.core.util.proteins.pdb_parsing import parse_pdb_as_residue_strings
from poli.objective_repository.rasp.register import RaspProblemFactory


THIS_DIR = Path(__file__).parent.resolve()
Expand Down
16 changes: 14 additions & 2 deletions src/poli/core/util/proteins/rasp/rasp.py
Original file line number Diff line number Diff line change
Expand Up @@ -396,8 +396,14 @@ def create_df_structure(
for mutant_residue_string in mutant_residue_strings:
if mutant_residue_string == wildtype_residue_string:
# Then we append a mock mutation.
original_residue_as_single_character = wildtype_residue_string[0]
position_in_chain = res_info.iloc[0]["pos"]
mutant_residue_as_single_character = wildtype_residue_string[0]

mutations_in_rasp_format.append(
wildtype_residue_string[0] + f"{1}" + wildtype_residue_string[0]
original_residue_as_single_character
+ f"{position_in_chain}"
+ mutant_residue_as_single_character
)
continue

Expand All @@ -406,8 +412,14 @@ def create_df_structure(
)
for edit_ in edits_:
_, i, _ = edit_
original_residue_as_single_character = wildtype_residue_string[i]
position_in_chain = res_info.iloc[i]["pos"]
mutant_residue_as_single_character = mutant_residue_string[i]

mutations_in_rasp_format.append(
wildtype_residue_string[i] + f"{i+1}" + mutant_residue_string[i]
original_residue_as_single_character
+ f"{position_in_chain}"
+ mutant_residue_as_single_character
)

# Filter df_structure to only contain the mutations in
Expand Down

0 comments on commit dea47d5

Please sign in to comment.