Skip to content
dstoeckel edited this page Mar 16, 2015 · 2 revisions

How can I assign chemical shifts from NMRStar file to a protein?

This is a short example on how to assign chemical shifts to a molecule. First you need to read an NMRStarFile and the corresponding pdb file.

Use the class NMRStarFile::BALLToBMRBMapper to create a mapping between one of the protein's chains and the NMRStarFile data.

Finally, the method assignShifts assigns the chemical shifts to the atoms of the given chain as a property named ShiftModule::PROPERTY__EXPERIMENTAL__SHIFT.

C++

#include <BALL/FORMAT/NMRStarFile.h>
#include <BALL/STRUCTURE/peptides.h>
#include <BALL/NMR/shiftModel.h>

   // read a protein
   PDBFile infile("myFile.pdb");
   System system;
   infile >> system;
   Chain& chain = *(system.beginChain());

   // read the NMRStar file
   NMRStarFile nmr_file; 
   nmr_file.open("myFile.bmr");
   nmr_file.read();

   // compute an alignment 	
   String pdb_alignment = Peptides::GetSequence(chain);
   String nmr_alignment = nmr_file.getResidueSequence();
   ...

   // generate a mapping based on the alignment
   NMRStarFile::BALLToBMRBMapper mapper(chain, nmr_file);
   mapper.createMapping(pdb_alignment, nmr_alignment);

   // assign the chemical shifts as properties 
   nmr_file.assignShifts(mapper);

   ...

   for (AtomIterator at_it = chain.beginAtom(); at_it != chain.endAtom(); at_it++)
   {
      if (at_it->hasProperty(ShiftModule::PROPERTY__EXPERIMENTAL__SHIFT))
      {
	cout << at_it->getFullName() << " has shift " 
	     << at_it->getProperty(ShiftModule::PROPERTY__EXPERIMENTAL__SHIFT).getFloat() << endl;
      }
   }

The mapper class provides inter alia the methods getNumberOfMismatches() and getNumberOfGabs() to gain more information of the atom matching.

Apart from chemical shifts further information of an NMRStarFile like, e.g., can be accessed as well:

  • getEntryInformation()
  • getMolecularInformation()
  • getSampleConditionByName(String name)
  • getNumberOfSamples()
  • getMonomericPolymer(const String& name)
  • getShiftReferenceSets()
  • getNMRSpectrometers()
  • hasHshifts()
  • hasCshifts()
  • hasNshifts()
  • ...

python

import sys
from BALL import * 

# read a protein
pdbfile = PDBFile("myPDB_file.pdb"))
S = System()
pdbfile.read(S)
chain = S.getChain(0)

# read the NMRStar file
nmr_file = BALL.NMRStarFile("myBMRBfile.str", BALL.OpenMode(BALL.File.MODE_IN))

# compute an alignment
pdb_alignment = Peptides.GetSequence(chain)
nmr_alignment = nmr_file.getResidueSequence()
...

Clone this wiki locally