You are here

How can I automate mutations with PyRosetta or other Rosetta software?

8 posts / 0 new
Last post
How can I automate mutations with PyRosetta or other Rosetta software?
#1

I need to create mutant peptides with Rosetta to use in Virtual Screening, the mutations need to be kinda ''random'' (not chosen directly by me) and, if possible, following an evolutionary bias (genetic algorithm). I'm really new at protein modelling and I have only used AlphaFold. Rosetta has many ways to use, and I'm kinda lost, should I use Rosetta Scripts or PyRosetta? Can I do this with both? I haven't found any tutorial that explains how to create mutant peptides following a genetic algorithm with rosetta :(  I don't know where to start.

Category: 
Post Situation: 
Mon, 2023-07-03 19:35
archaeopteryx

You can do this with either PyRosetta or Rosetta Scripts.

The pyrosetta function is here:

 

Check out this notebook for a full example

https://nbviewer.org/github/RosettaCommons/PyRosetta.notebooks/blob/master/notebooks/06.08-Point-Mutation-Scan.ipynb

Pretty old but partially relevant thread 

https://www.rosettacommons.org/content/making-mutations-pyrosetta

 

Tue, 2023-07-04 00:23
ajasja

Ok, thank you so much, I think this notebook will be pretty useful for what I'm trying to do.

Btw, maybe I expressed myself wrong, what I'm trying to do is something like: input an aminoacid sequence, define a max number of mutations, the program will mutate this sequence to a lowest energy sequence respecting the max number of mutations and giving this as output. 

Tue, 2023-07-04 11:06
archaeopteryx

With typical Rosetta mutation protocols, we don't have a "max number of mutations" setting.  Instead, what you can do is use the FavorNativeResidue mover (also accessible through PyRosetta) to add a slight penalty for making mutations. By adjusting the strength of that penalty, you can adjust how likely Rosetta is to make a mutation. With some experimentation, you should get Rosetta making about the right number of mutations for what you want.  That won't be a hard-and-fast limit, though, and you would likely need to add a post-filtering step if you want to make sure that no designs exceed your limit. (But with Rosetta design you typically run a large number of designs and filter out most of them anyway -- you're just adding number of mutations in addition to whatever other criteria you'd use.)

Also note that if your max number of mutations is one, you might be better off with some sort of scanning process, rather than using the Rosetta Packer to do design. (Which is set up for combinitorial optimization.)

Wed, 2023-07-05 08:30
rmoretti

I've tried to write some code with the help of chatGPT, asking the chat for: defining a n° of max mutations, using full atom score function to evaluate the best mutations, making a list to store the mutations and further evaluate them, to give the 2 best mutations.

Part of the code is in brazilian portuguese (I translated the comments #) but mutaçao means mutation and mutado means mutated. It seems to work, but I didn't have time to study and try to improve the code this week, hope I can get more time to improve my rosetta skills in near future.

 

from pyrosetta import *
from pyrosetta.toolbox import *

init()

peptide_sequence = 'KIWSPIFFGFK'
pose = pose_from_sequence(peptide_sequence)

scorefxn = get_fa_scorefxn()

numero_maximo_mutacoes = 2
numero_estruturas_geradas = 10

melhores_mutacoes = []

# Iterate over each position in the peptide sequence
for i in range(1, pose.total_residue() + 1):
    original_residue = pose.residue(i).name1()

    # Iterate over each possible mutation at the current position
    for mutant_aa in 'ACDEFGHIKLMNPQRSTVWY':
        if mutant_aa == original_residue:
            continue

        # Clone the original pose
        pose_mutada = pose.clone()

        # Mutate the residue at the current position
        pyrosetta.toolbox.mutate_residue(pose_mutada, i, mutant_aa)

        # Calculate the score for the mutated pose
        score = scorefxn(pose_mutada)

        # Store the mutated pose and its score in the list
        melhores_mutacoes.append((pose_mutada.clone(), score))

# Sort the mutations based on their scores in ascending order
melhores_mutacoes.sort(key=lambda x: x[1])

# Print the top-ranked mutated structures and their scores
for n in range(min(numero_estruturas_geradas, len(melhores_mutacoes))):
    mutacao, score = melhores_mutacoes[n]
    print("Mutation:", mutacao.sequence())
    print("Score:", score)
 

Wed, 2023-07-05 19:59
archaeopteryx

Btw I just need to test all the possibilities of mutations and have, as output, the best 2 mutations that gives the lowest energy structure, not generate the structure itself (that can be made in other code if I have the wright aminoacid sequence, I need to know the sequence). I'm getting kinda crazy, I thought it would be easier lol

Wed, 2023-07-05 19:23
archaeopteryx

If you're interested in doing a single point mutation scan, that's an approach. (Though I'd load an actual structure from a PDB, rather than generating an extended chain from sequence.  There's probably not much mutational information from rescoring an extended chain with mutations.)

However, note that you don't ever use your numero_maximo_mutacoes setting -- this code is only going to make single point mutations. If you do want multiple mutations, you could extend the process by nesting the loops, but there's probably faster ways of doing it -- exhaustive combinitorial mutation scans have exponential scaling in runtime.

Thu, 2023-07-06 08:20
rmoretti

Is there a easier way to run cartesian_ddG 2020 for point mutation scan using `pyrosetta.rosetta.protocols.ddg.CartesianddG.run` :  https://graylab.jhu.edu/PyRosetta.documentation/pyrosetta.rosetta.protocols.ddg.CartesianddG.html#pyrosetta.rosetta.protocols.ddg.CartesianddG.run ? Would you be able to provide an example?

Sat, 2024-01-27 05:48
arjan-hada