def _makeUniverse(self): from MMTK.Proteins import Protein, PeptideChain from MMTK.ForceFields import CalphaForceField self.universe = self.raw_trajectory.universe self.proteins = self.universe.objectList(Protein) universe_calpha = MMTK.InfiniteUniverse(CalphaForceField(2.5)) calpha_map = {} for protein in self.proteins: chains_calpha = [] for chain in protein: chains_calpha.append( PeptideChain(chain.sequence(), model='calpha')) protein_calpha = Protein(chains_calpha) universe_calpha.addObject(protein_calpha) for i in range(len(protein)): chain = protein[i] chain_calpha = protein_calpha[i] for j in range(len(chain)): calpha_map[chain[j].peptide.C_alpha] = \ chain_calpha[j].peptide.C_alpha chain_calpha[j].peptide.C_alpha.setMass(1.) conf = self.raw_trajectory[0] for atom, calpha in calpha_map.items(): calpha.setPosition(conf[atom]) self.universe_calpha = universe_calpha universe_calpha.configuration() self.map = universe_calpha.numberOfAtoms() * [None] for atom, calpha in calpha_map.items(): self.map[calpha.index] = atom.index
def retrievePeptideChain(self, sequence, mol_system_chain): from MMTK.Proteins import PeptideChain, Residue chain = PeptideChain(None) n_terminus = \ mol_system_chain.residues[0].molResidue.chemCompVar.linking == "start" c_terminus = \ mol_system_chain.residues[-1].molResidue.chemCompVar.linking == "end" chain.version_spec = { 'n_terminus': n_terminus, 'c_terminus': c_terminus, 'model': 'all', 'circular': False } numbers = [r.seqId for r in mol_system_chain.residues] chain.groups = [] n = 0 for residue, number in zip(sequence, numbers): n = n + 1 r = Residue(residue, 'all') r.name = r.symbol + str(number) r.sequence_number = n r.parent = chain chain.groups.append(r) chain._setupChain(False, {}, None) return chain
def retrievePeptideChain(self, sequence, mol_system_chain): from MMTK.Proteins import PeptideChain, Residue chain = PeptideChain(None) n_terminus = \ mol_system_chain.residues[0].molResidue.chemCompVar.linking == "start" c_terminus = \ mol_system_chain.residues[-1].molResidue.chemCompVar.linking == "end" chain.version_spec = {'n_terminus': n_terminus, 'c_terminus': c_terminus, 'model': 'all', 'circular': False} numbers = [r.seqId for r in mol_system_chain.residues] chain.groups = [] n = 0 for residue, number in zip(sequence, numbers): n = n + 1 r = Residue(residue, 'all') r.name = r.symbol + str(number) r.sequence_number = n r.parent = chain chain.groups.append(r) chain._setupChain(False, {}, None) return chain
# The first file contains a monomer, the second one a tetramer in # which each chain is almost identical to the monomer from the first # file. We have to cut off the last (incomplete) residue from the # monomer and the last three residues of each chain of the tetramers # to get matching sequences. We'll just deal with one of the chains of # the tetramer here. monomer = configuration1.peptide_chains[0] monomer.removeResidues(-1, None) tetramer_1 = configuration2.peptide_chains[0] tetramer_1.removeResidues(-3, None) # Next we build a PeptideChain for the monomer. We use a C-alpha # model, which is sufficient for the purpose of this script. chain = PeptideChain(monomer, model='calpha') # How big is this beast? For a quick guess, print the size of the smallest # rectangular box containing it: p1, p2 = chain.boundingBox() print "Size of a bounding box: %4.2f x %4.2f x %4.2f nm" % tuple(p2-p1) # Formalities: we define a universe and put the chain inside. # Then we make a copy of the configuration of the universe for later use. # This is necessary because configurations are defined only for # universes (for various good reasons...). universe = InfiniteUniverse() universe.addObject(chain) monomer_configuration = copy(universe.configuration())
# The first file contains a monomer, the second one a tetramer in # which each chain is almost identical to the monomer from the first # file. We have to cut off the last (incomplete) residue from the # monomer and the last three residues of each chain of the tetramers # to get matching sequences. We'll just deal with one of the chains of # the tetramer here. monomer = configuration1.peptide_chains[0] monomer.removeResidues(-1, None) tetramer_1 = configuration2.peptide_chains[0] tetramer_1.removeResidues(-3, None) # Next we build a PeptideChain for the monomer. We use a C-alpha # model, which is sufficient for the purpose of this script. chain = PeptideChain(monomer, model='calpha') # How big is this beast? For a quick guess, print the size of the smallest # rectangular box containing it: p1, p2 = chain.boundingBox() print("Size of a bounding box: %4.2f x %4.2f x %4.2f nm" % tuple(p2 - p1)) # Formalities: we define a universe and put the chain inside. # Then we make a copy of the configuration of the universe for later use. # This is necessary because configurations are defined only for # universes (for various good reasons...). universe = InfiniteUniverse() universe.addObject(chain) monomer_configuration = copy(universe.configuration())
# The first file contains a monomer, the second one a tetramer in # which each chain is almost identical to the monomer from the first # file. We have to cut off the last (incomplete) residue from the # monomer and the last three residues of each chain of the tetramers # to get matching sequences. We'll just deal with one of the chains of # the tetramer here. monomer = configuration1.peptide_chains[0] monomer.removeResidues(-1, None) tetramer_1 = configuration2.peptide_chains[0] tetramer_1.removeResidues(-3, None) # Next we build a PeptideChain for the monomer. We have to specify # that we have no C terminus (missing) and no hydrogens. chain = PeptideChain(monomer, model='no_hydrogens', c_terminus=0) # How big is this beast? For a quick guess, print the size of the smallest # rectangular box containing it: p1, p2 = chain.boundingBox() print "Size of a bounding box: %4.2f x %4.2f x %4.2f nm" % tuple(p2-p1) # Formalities: we define a universe and put the chain inside. # Then we make a copy of the configuration of the universe for later use. # This is necessary because configurations are defined only for # universes (for various good reasons...). universe = InfiniteUniverse() universe.addObject(chain) monomer_configuration = copy(universe.configuration())
# Choose all objects of class "Protein" proteins = universe.objectList(Protein) # Construct an initial configuration in which the proteins are contiguous. conf = universe.contiguousObjectConfiguration(proteins) # Construct a C_alpha representation and a mapping from the "real" # C_alpha atoms to their counterparts in the reduced model. universe_calpha = InfiniteUniverse() index = 0 map = [] for protein in proteins: chains_calpha = [] for chain in protein: chains_calpha.append(PeptideChain(chain.sequence(), model='calpha')) protein_calpha = Protein(chains_calpha) universe_calpha.addObject(protein_calpha) for i in range(len(protein)): chain = protein[i] chain_calpha = protein_calpha[i] for j in range(len(chain)): r = conf[chain[j].peptide.C_alpha] chain_calpha[j].peptide.C_alpha.setPosition(r) chain_calpha[j].peptide.C_alpha.index = index map.append(chain[j].peptide.C_alpha.index) index = index + 1 universe_calpha.configuration() # Open the new trajectory for just the interesting objects. trajectory_calpha = Trajectory(universe_calpha, 'calpha_trajectory.nc', 'w')
configuration = PDBConfiguration('insulin.pdb') # Cut off the first three residues of the third chain. configuration.peptide_chains[2].removeResidues(0, 3) # Mark the second chain as modified for chain in configuration.peptide_chains: chain.modified = 0 configuration.peptide_chains[2].modified = 1 # Construct the peptide chain objects without hydrogens. For # modified chains, don't use the N-terminal form for the fist residue. chains = [] for chain in configuration.peptide_chains: if chain.modified: chains.append(PeptideChain(chain, model='no_hydrogens', n_terminus=0)) else: chains.append(PeptideChain(chain, model='no_hydrogens')) # Make the protein object. insulin = Protein(chains) # # Stop here, since the last "problem" is just an illustration, # you can't run it directly because there is no "special residue" # definition. # if 0: # # Fourth problem: construct a protein with a non-standard residue.