[Biopython-dev] [Biopython - Bug #2943] (Closed) MMCIFParser only handling a single model.

redmine at redmine.open-bio.org redmine at redmine.open-bio.org
Mon Apr 23 13:00:15 EDT 2012


Issue #2943 has been updated by Peter Cock.

Status changed from New to Closed
% Done changed from 0 to 100

This should be working on the trunk now ready for Biopython 1.60 - thanks Lenna. See this commit and those preceding it:
https://github.com/biopython/biopython/commit/2ac67cd14682a4bbad9e09654485914f9495138d

If we've missed anything please reopen this bug. Thanks Paul!
----------------------------------------
Bug #2943: MMCIFParser only handling a single model.
https://redmine.open-bio.org/issues/2943

Author: TallPaul empty
Status: Closed
Priority: Normal
Assignee: Biopython Dev Mailing List
Category: Main Distribution
Target version: 1.52
URL: 


MMCIFParser as-written only handles a single model in a protein. Any protein that has multiple modesl with repeating chains and residues will get an exception since the residue ID will already exist. Please make the following changes in MMCIFParser.py:

Change the __doc__ setting:
#Optional __DOC__ change if the new MMCIFlex is not used nor the changes
#to MMCIF2Dict based on the new MMCIFlex.
#Mod by Paul T. Bathen to reflect MMCIFlex built solely in Python
__doc__="mmCIF parser (implemented solely in Python, no lex/flex/C code needed)" 

Regardles of the DOC changes:
Insert the following model_list line 
        occupancy_list=mmcif_dict["_atom_site.occupancy"]
        fieldname_list=mmcif_dict["_atom_site.group_PDB"]
        #Added by Paul T. Bathen Nov 2009
        model_list=mmcif_dict["_atom_site.pdbx_PDB_model_num"]
        try:
 
Make the following changes:
        #Modified by Paul T. Bathen Nov 2009: comment out this line
        #current_model_id=0
        structure_builder=self._structure_builder
        structure_builder.init_structure(structure_id)
        #Modified by Paul T. Bathen Nov 2009: comment out this line
        #structure_builder.init_model(current_model_id)
        structure_builder.init_seg(" ")
        #Added by Paul T. Bathen Nov 2009
        current_model_id = -1

Make the following changes in the for loop:
            #Note by Paul T. Bathen: should MMCIFParser include 
            #the HOH and WAT stmts in PDBParser immediately below?
            #if fieldname=="HETATM":
            #    if resname=="HOH" or resname=="WAT":
            #        hetero_flag="W"
            #    else:
            #        hetero_flag="H"

            if fieldname=="HETATM":
                hetatm_flag="H"
            else:
                hetatm_flag=" "
 
            #Added by Paul T. Bathen Nov 2009
            model_id = model_list[i]
            if current_model_id != model_id:
                current_model_id = model_id
                structure_builder.init_model(current_model_id)
            #end of addition

After these changes took place, and with the new MMCIFlex and MMCIF2Dict in place, I was able to parse and test 2beg.cif and pdb2beg.ent and both parsed with the same number of models, chains, and residues. 

Paul


-- 
You have received this notification because you have either subscribed to it, or are involved in it.
To change your notification preferences, please click here and login: http://redmine.open-bio.org



More information about the Biopython-dev mailing list