Hi,
I am trying to load a structure from PDB and then calculate pairwise residue energies between residues in the structure. For this, I want to first load the scorefxn and then the structure (or viceversa), but whenever I try, either of them gives me a segfault, i.e. if I do scorefxn = get_fa_scorefxn(); pose_from_pdb() the latter crashes and if I do the opposite, get_fa_scorefxn() crashes.
This is a code that used to work fine, so I am a bit confused as to what might be going wrong. I know the segfault could be caused by trying to load wrong files or pointing at objects that don’t exist, but I can’t see anything wrong. I am pasting my code below, I was wondering if there is anything obviously wrong?
Thank you!
from rosetta import *
rosetta.init()
from toolbox import cleanATOM
from rosetta import get_fa_scorefxn
from rosetta.core.scoring import *
from Bio.PDB import *
class TCRpep_select(Select): #function to create TCR + peptide PDB
def accept_chain(self, chain, alpha_chain = "A", beta_chain = "B", pep_chain = "P"):
if chain.full_id[2] == str(alpha_chain) or chain.full_id[2] == str(beta_chain) or chain.full_id[2] == str(pep_chain):
return 1
else:
return 0
Parser = PDBParser()
structure = Parser.get_structure(structure_id, folder + filename)
scorefxn = get_fa_scorefxn()
io = PDBIO()
io.set_structure(structure)
io.save(folder + "TCR_peptide_only/" + structure_id +"_TCR_peptide.pdb", TCRpep_select())
cleanATOM(folder + "TCR_peptide_only/"structure_id +"_TCR_peptide.pdb")
pdb_TCR_pep = pose_from_pdb(str(folder + "TCR_peptide_only/" + structure_id + "_TCR_peptide.clean.pdb"))