From: <ha...@us...> - 2006-04-14 13:55:58
|
Revision: 4969 Author: hansonr Date: 2006-04-14 06:55:51 -0700 (Fri, 14 Apr 2006) ViewCVS: http://svn.sourceforge.net/jmol/?rev=4969&view=rev Log Message: ----------- Fixes improper handling of missing sequence number in mmCIF files. 1d66.cif: HETATM 1711 CD CD . CD H 4 . ? 33.200 64.497 45.835 1.00 39.60 ? ? ? ? ? 42 CD ? CD 1 HETATM 1712 O O . HOH I 5 . ? 40.594 60.277 53.968 1.00 16.15 ? ? ? ? ? 301 HOH ? O 1 Note the "?" in that last line. That "?" is supposed to be the group sequence number, 42 in the case of CD, 301 in the case of HOH. The program that generates these CIF files is ignoring the group sequence number for HETATM records. Now consider the PDB file: 1d66.pdb: HETATM 1715 CD CD 42 33.200 64.497 45.835 1.00 39.60 1D661802 HETATM 1716 O HOH 301 40.594 60.277 53.968 1.00 16.15 1D661803 Jmol could not distinguish beteen the two numbers because they are not there in the mmCIF file. So it was not considering HOH to be different from CD, and was assigning it that group name. Instead of a group sequence number, Jmol was assigning to both CD and HOH "Integer.MIN_VALUE". My fix assigns a unique negative number to atom.sequenceNumber and also collects atomSerial, only for informational purposes at this point. Bob Hanson Modified Paths: -------------- trunk/Jmol/src/org/jmol/adapter/smarter/CifReader.java Modified: trunk/Jmol/src/org/jmol/adapter/smarter/CifReader.java =================================================================== --- trunk/Jmol/src/org/jmol/adapter/smarter/CifReader.java 2006-04-14 04:42:59 UTC (rev 4968) +++ trunk/Jmol/src/org/jmol/adapter/smarter/CifReader.java 2006-04-14 13:55:51 UTC (rev 4969) @@ -232,12 +232,13 @@ final static byte INS_CODE = 14; final static byte ALT_ID = 15; final static byte GROUP_PDB = 16; - final static byte MODEL_NO = 17; - final static byte ATOM_PROPERTY_MAX = 18; + final static byte SITE_ID = 17; + final static byte MODEL_NO = 18; + final static byte ATOM_PROPERTY_MAX = 19; final static String[] atomFields = { - "_atom_site_type_symbol", + "_atom_site_type_symbol", "_atom_site_label", "_atom_site_label_atom_id", "_atom_site_fract_x", "_atom_site_fract_y", "_atom_site_fract_z", "_atom_site.Cartn_x", "_atom_site.Cartn_y", "_atom_site.Cartn_z", @@ -246,7 +247,7 @@ "_atom_site.label_comp_id", "_atom_site.label_asym_id", "_atom_site.label_seq_id", "_atom_site.pdbx_PDB_ins_code", "_atom_site.label_alt_id", - "_atom_site.group_PDB", + "_atom_site.group_PDB", "_atom_site.id", "_atom_site.pdbx_PDB_model_num", }; @@ -257,7 +258,7 @@ CARTN_X, CARTN_Y, CARTN_Z, OCCUPANCY, B_ISO, COMP_ID, ASYM_ID, SEQ_ID, INS_CODE, - ALT_ID, GROUP_PDB, MODEL_NO, + ALT_ID, GROUP_PDB, SITE_ID, MODEL_NO, }; static { @@ -268,6 +269,8 @@ void processAtomSiteLoopBlock() throws Exception { // logger.log("processAtomSiteLoopBlock()-------------------------"); int currentModelNO = -1; + int missingSequenceNumber = 0; + int atomSerial = 0; int[] fieldTypes = new int[100]; // should be enough boolean[] atomPropertyReferenced = new boolean[ATOM_PROPERTY_MAX]; int fieldCount = parseLoopParameters(atomFields, @@ -388,6 +391,23 @@ break; case SEQ_ID: atom.sequenceNumber = parseInt(field); + if (atom.sequenceNumber == Integer.MIN_VALUE) { + System.out.println("Warning! mmCIF ERROR: Missing SEQ_ID in mmCIF file for #"+atomSerial + " group3=" + atom.group3); + atom.sequenceNumber = --missingSequenceNumber; + } + /* + * 1d66.cif is missing this information, causing Jmol to + * improperly assign "CD" to HOH as group3 in HETATM records. + * + * interestingly, this fix allows for + * + * select -3 + * + * but I wouldn't publicize that. + * + * -- Bob Hanson 206/04/14 + * + */ break; case INS_CODE: char insCode = field.charAt(0); @@ -403,6 +423,22 @@ if ("HETATM".equals(field)) atom.isHetero = true; break; + case SITE_ID: + //atom.atomSerial = parseInt(field); + /* + * I considered the above, but then decided there might be + * a reason we aren't assigning a serial number for atoms in + * a CIF file, maybe to do with the fact that in CIF files we + * are using mapped atom names, whereas in PDB files we are not + * Egon? + * + * So this assignment for now is just for internal purposes. + * + * -- Bob Hanson + * + */ + atomSerial = parseInt(field); + break; case MODEL_NO: int modelNO = parseInt(field); if (modelNO != currentModelNO) { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |