Difference between revisions of "Tutorial::Mutating Residues"
From MSL-Libraries
Jump to navigationJump to searchLine 1: | Line 1: | ||
− | + | ||
Revision as of 04:22, 15 July 2010
This is an example on how to make mutations and add conformations (rotamers) in MSL. This tutorial explains functions in the PDBTopology and others.
Complete source of example_mutation_rotamers.cpp
Error creating thumbnail: File missing
To compile
% make bin/example_mutation_rotamers
To run the program
Go to the main directory and run the command (note, the location of the exampleFiles subdirectory needs to be provided as an argument)
% bin/example_mutation_rotamers exampleFiles library/rotlib/balanced/rotlib-balanced-200.txt
Program description
// Read pdb file into a System object
System sys;
sys.readPdb(pdbFile);
// Get one of the residues : chain B position 4
Residue &res = sys.getIdentity("B,1");
// Create a PDBTopology object
PDBTopology pdbTop;
// Set a rotamer library and use atoms defined in the rotamer library to build
pdbTop.readRotamerLibrary((string)argv[2]);
pdbTop.setAddAtomsFromRotLib(true);
// Get backbone atoms
AtomPointerVector backboneAtoms = pdbTop.getBackboneAtoms(res);
// ********* MUTATE *************** //
// B,2,ASP to B,2,ASN and get 3 ASN rotamers
AtomContainer newAtoms = pdbTop.getResidue("B,1,ASN",backboneAtoms,3);
// Add atoms to the system
sys.getPosition("B,1").addIdentity(newAtoms.getAtomPointers(),"ASN");
sys.getPosition("B,1").setActiveIdentity("ASN");
// Write out new pdb with an Asn at position 1, chain B. instead of Asp.
sys.writePdb("/tmp/example00005_withAsn.pdb");
cout << "Wrote file /tmp/example00005_withAsn.pdb , has Asn instead of Asp\n";
// Change conformation , First conformation is 2. Write out conformation 0 and 1.
sys.getResidue("B,1,ASN").setActiveConformation(0);
sys.writePdb("/tmp/example00005_withAsn_rotamer0.pdb");
cout << "Wrote file /tmp/example00005_withAsn_rotamer0.pdb , has Asn (alternate rotamer) instead of Asp\n";
sys.getResidue("B,1,ASN").setActiveConformation(1);
sys.writePdb("/tmp/example00005_withAsn_rotamer1.pdb");
cout << "Wrote file /tmp/example00005_withAsn_rotamer1.pdb , has Asn (alternate rotamer) instead of Asp\n";