Menu

Iterating over aminoacid chain

Help
2004-01-11
2004-04-06
  • Urban Hafner

    Urban Hafner - 2004-01-11

    Hej,
    I'm currently starting to use mmLib. The first thing I tried was to calculate the phi and psi angles in a protein. While doing that I realized that I was iterating through the aminoacids alphabetically! Is there some way to iterate through all residues in the 'right' order (ie. as they are in the protein)? Here is my script:

    #!/usr/bin/env python

    from optparse import OptionParser
    import mmLib.FileLoader
    import sys

    parser = OptionParser()
    parser.add_option("-i", "--input", dest="input", default=sys.stdin,
        help="read coordinates from INFILE (defaults to STDIN)",metavar="INFILE")
    parser.add_option("-o", "--output", dest="output", default=sys.stdout,
        help="write model to OUTFILE (defaults to STDOUT)",metavar="OUTFILE")
    (options, args) = parser.parse_args()

    # create mmLib.Structure.Structure object
    structure = mmLib.FileLoader.LoadStructure(fil=options.input)

    for aa in structure.iter_amino_acids():
        print aa

    As testfile I've used 'd1iuz__.ent' from ASTRAL. You can find it here: http://www.cip.informatik.uni-muenchen.de/~hafner/mmlib/d1iuz__.ent and the script also http://www.cip.informatik.uni-muenchen.de/~hafner/mmlib/shackle

    I tried this with Version 0.5 and cvs HEAD. Both give the same result.

    Urban

     
    • Jay Painter

      Jay Painter - 2004-04-06

      Sorry I've taken so long to get back to you, SF didn't send a email to my personal account.

      I belive your Python version is too old.  The AminoAcidResidue objects have comparison operator overloading which has changed over the last several versions of Python.  I suggest compiling and install Python-2.3.3 in a seperate directory (such as /usr/local/python-2.3.3).  For mmLib, the Python version must be at least 2.1.

      -Jay

       

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.