17
$\begingroup$

My background is in genomics, but I have recently been working with problems related to protein structure. I wrote a few relevant programs in C, building my own PDB file parser from scratch in the process. I didn't worry about making a really robust parser, I just knew that building one myself would be the best way to force myself to really understand the PDB format.

Now that I've gone through this process, I'm looking for something a bit more robust and mature. Are there are any open-source protein structure libraries implemented in C? I was able to find a few on Google, but I had never heard of any of them before and they don't seem to be very mature or stable. A slightly related question: is everyone really doing all of these types of computations using Python? or homebrew code?

PS. I'm essentially looking for a library that includes a PDB file parser, functions for calculating bond angles, bond lengths, torsion angles, surface accessible surface area, etc.

$\endgroup$
8
$\begingroup$

There is a C++ library which is quite mature. This is probably as close as you will get to C. I myself haven't found any usable C library yet. You could use the C++ library and still write most of your code in C using extern C { } in the C++ code.

$\endgroup$
6
$\begingroup$

OpenBabel is C++, but it's commonly used for general structural things - its main focus is conversion between and the ability to read a wide range of formats. As far as I know it doesn't have the ability to calculate SAS areas, though.

$\endgroup$
  • 3
    $\begingroup$ Just a note. Let I report that OpenBabel is great, but GPL, which can be a problem if the software developed with it has to go commercial. $\endgroup$ – Stefano Borini Nov 29 '11 at 22:12
  • $\begingroup$ If you are considering commercial utility, I would recommend looking at OEChem (eyesopen.com/oechem-tk) from OpenEye and its associated other libraries (which include robust tools for surface calculations amongst other things). It isn't free or open source, but it is robust and widely used throughout the industry. $\endgroup$ – Joe Corkery Dec 6 '11 at 21:31
4
$\begingroup$

To start with your "related question": I do PDB parsing in Python, even when the subsequent processing needs to be done in some compiled language for speed. C is simply not a good language for parsing, in particular not for messy formats like PDB. And that's probably why there aren't any stable and mature PDB parsers in C.

Something else you can consider, assuming your goal is to work with structures from the PDB, is to use the mmCIF format rather than the PDB format. mmCIF is much more regular and thus easier to parse. You also get more parseable information from the mmCIF version of the PDB entries than from the PDB versions. You can find a C parser for mmCIF on the PDB Web site (it's called CIFPARSE), although you will note that its development has been dropped in favor of a C++ rewrite called CIFPARSE-OBJ.

$\endgroup$
3
$\begingroup$

I know this is about C, but there is a great way to do this using the GLGRAPHICS library, which implements OPENGL in Processing (a java based framework with c++ like syntax). OpenGL is basically the same regardless of what language you use, so Java shouldn't make too big of a performance difference. Anyway, the GLGRAPHICS library comes with a pdb viewer that works out of the box. Its super easy to tweak and the Processing forum has a really responsive following. It could be a good starting point.

GLGRAPHICS Library http://sourceforge.net/projects/glgraphics/files/glgraphics/1.0/ see GLGRAPHICS/examples/PDBview

Processing http://processing.org/

Lastly, you might want to check out this (less 3d but still cool example) http://www.mydisk.se/tgn380/webpage/RECEPTOR/

$\endgroup$
3
$\begingroup$

If you're willing to go with C++, then I'd recommend ESBTL.

Instead of dealing with files in PDB format, you might consider downloading them from the Protein Data Bank in PDBML format, which is actually XML. You can then parse PDBML files using your favorite XML library for C (for example, with Libxml2).

$\endgroup$
1
$\begingroup$

While this is prehaps not the intended use of the software, I have found the parsers and general protein-structure processing methods found within the VMD source code to be robust and comprehensive.

VMD is an open-source molecular visualisation tool. It is relatively staright-forward to extend when that is appropriate, otherwise code can be cannibalised from it.

$\endgroup$
  • $\begingroup$ VMD is free but not Open Source. You have to ask for access to the source code and you may not redistribute it. $\endgroup$ – khinsen Dec 5 '11 at 9:42
  • $\begingroup$ @khinsen The license is at ks.uiuc.edu/Research/vmd/current/LICENSE.html and it does allow the distribution of derivative works. As far as I'm aware you do need to register to get the source code, but that is an automated process, just like getting the executable package. $\endgroup$ – Stewart Dec 9 '11 at 9:42
  • $\begingroup$ There are severe restrictions to derivative work. You can distribute it freely only if it contains at most 10% of VMD code, which may not represent more than 50% of the derivative work. In practice, you cannot distribute a somewhat modified version of VMD. You can only distribute a patch and ask people to get VMD from the official server. That's not Open Source by my standards. $\endgroup$ – khinsen Dec 9 '11 at 11:59
1
$\begingroup$

PDB files can be read and manipulated easily in C++ using the open-source (BSD licensed) chemkit library.

As an example here is some code that will read in a PDB file for hemoglobin (PDB ID: 2DHB) and print out the total number of atoms, number of chains, and solvent accessible surface area:

#include <iostream>

#include <chemkit/polymer.h>
#include <chemkit/polymerfile.h>
#include <chemkit/molecularsurface.h>

using namespace chemkit;

int main()
{
    PolymerFile file("2DHB.pdb");
    bool ok = file.read();
    if(!ok){
        std::cerr << "Failed to read file: " << file.errorString() << std::endl;
        return -1;
    }

    Polymer *protein = file.polymer();
    if(!protein){
        std::cerr << "File is empty." << std::endl;
        return -1;
    }

    std::cout << "Number of Atoms: " << protein->atomCount() << std::endl;
    std::cout << "Number of Chains: " << protein->chainCount() << std::endl;

    MolecularSurface surface(protein);
    surface.setSurfaceType(MolecularSurface::SolventAccessible);

    std::cout << "Surface Area: " << surface.surfaceArea() << " A^2" << std::endl;

    return 0;
}

Output:

Number of Atoms: 2201
Number of Chains: 2
Surface Area: 14791 A^2

For more information see the documentation for the classes presented above:

$\endgroup$
0
$\begingroup$

You might also consider another "language" like CNS, which is specifically designed for working with molecular structures and has the functions you mentioned.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.