Tutorial::Mutating Residues

From MSL-Libraries
Jump to navigationJump to search

This is an example on how to make mutations and add conformations (rotamers) in MSL. There are multiple ways to do this in MSL, here we describe the simplest way (only needing a rotamer library). This tutorial explains functions in the PDBTopology and others.


Complete source of example_mutation_rotamers.cpp


Error creating thumbnail: File missing
Mutation and rotamers built by this example


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 1
	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,1,ASP to B,1,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";



Back to the tutorial page