Revision: 5135
Author: hansonr
Date: 2006-05-17 21:14:22 -0700 (Wed, 17 May 2006)
ViewCVS: http://svn.sourceforge.net/jmol/?rev=5135&view=rev
Log Message:
-----------
bob200603 adds auxiliaryinfo for insertion codes.
Modified Paths:
--------------
branches/bob200603/Jmol/src/org/jmol/adapter/smarter/AtomSetCollection.java
branches/bob200603/Jmol/src/org/jmol/adapter/smarter/CifReader.java
branches/bob200603/Jmol/src/org/jmol/adapter/smarter/PdbReader.java
Modified:
branches/bob200603/Jmol/src/org/jmol/adapter/smarter/AtomSetCollection.java
===================================================================
--- branches/bob200603/Jmol/src/org/jmol/adapter/smarter/AtomSetCollection.java
2006-05-17 15:33:55 UTC (rev 5134)
+++ branches/bob200603/Jmol/src/org/jmol/adapter/smarter/AtomSetCollection.java
2006-05-18 04:14:22 UTC (rev 5135)
@@ -167,9 +167,8 @@
void freeze() {
System.out.println("AtomSetCollection.freeze; atomCount = " + atomCount);
- if (hasAlternateLocations()) {
- getAltLocLists();
- }
+ getAltLocLists();
+ getInsertionLists();
}
void discardPreviousAtoms() {
@@ -773,7 +772,7 @@
}
////////////////////////////////////////////////////////////////
- // special support for alternate locations
+ // special support for alternate locations and insertion codes
////////////////////////////////////////////////////////////////
boolean hasAlternateLocations() {
@@ -784,6 +783,8 @@
}
void getAltLocLists() {
+ if (!hasAlternateLocations())
+ return;
String[] lists = new String[atomSetCount];
for (int i = 0; i < atomSetCount; i++)
lists[i] = "";
@@ -797,4 +798,29 @@
if (lists[i].length() > 0)
setAtomSetAuxiliaryInfo("altLocs", lists[i], i);
}
+
+ boolean hasInsertions() {
+ for (int i = atomCount; --i >= 0; )
+ if (atoms[i].insertionCode != '\0')
+ return true;
+ return false;
+ }
+
+ void getInsertionLists() {
+ if (!hasInsertions())
+ return;
+ String[] lists = new String[atomSetCount];
+ for (int i = 0; i < atomSetCount; i++)
+ lists[i] = "";
+ for (int i = 0; i < atomCount; i++) {
+ char id = atoms[i].insertionCode;
+ if (id == '\0' || lists[atoms[i].atomSetIndex].indexOf(id) >= 0)
+ continue;
+ lists[atoms[i].atomSetIndex] += id;
+ }
+ for (int i = 0; i < atomSetCount; i++)
+ if (lists[i].length() > 0)
+ setAtomSetAuxiliaryInfo("insertionCodes", lists[i], i);
+ }
+
}
Modified: branches/bob200603/Jmol/src/org/jmol/adapter/smarter/CifReader.java
===================================================================
--- branches/bob200603/Jmol/src/org/jmol/adapter/smarter/CifReader.java
2006-05-17 15:33:55 UTC (rev 5134)
+++ branches/bob200603/Jmol/src/org/jmol/adapter/smarter/CifReader.java
2006-05-18 04:14:22 UTC (rev 5135)
@@ -70,7 +70,6 @@
float[] notionalUnitcell;
String spaceGroup;
boolean coordinatesAreFractional;
- String altLocIds = "";
void initializeUnitcell() {
iHaveUnitCell = false;
@@ -209,7 +208,6 @@
line = reader.readLine().trim();
// logger.log("trimmed line:" + line);
if (line.startsWith("_atom_site_") || line.startsWith("_atom_site.")) {
- altLocIds = "";
processAtomSiteLoopBlock();
atomSetCollection.setAtomSetName(thisDataSetName);
atomSetCollection.setCoordinatesAreFractional(coordinatesAreFractional);
@@ -224,8 +222,6 @@
//but no symmetry info, not fractional coordinates
}
}
- if (altLocIds.length() > 0)
- atomSetCollection.setAtomSetAuxiliaryInfo("altLocIds", "" + altLocIds);
return;
}
if (line.startsWith("_geom_bond")) {
@@ -450,8 +446,6 @@
if (alternateLocationID == '?' || alternateLocationID == '.')
break;
atom.alternateLocationID = alternateLocationID;
- if (altLocIds.indexOf("" + alternateLocationID) < 0)
- altLocIds += alternateLocationID;
break;
case GROUP_PDB:
isPDB = true;
Modified: branches/bob200603/Jmol/src/org/jmol/adapter/smarter/PdbReader.java
===================================================================
--- branches/bob200603/Jmol/src/org/jmol/adapter/smarter/PdbReader.java
2006-05-17 15:33:55 UTC (rev 5134)
+++ branches/bob200603/Jmol/src/org/jmol/adapter/smarter/PdbReader.java
2006-05-18 04:14:22 UTC (rev 5135)
@@ -39,7 +39,6 @@
boolean isNMRdata;
String spaceGroup;
float[] notionalUnitcell = new float[6];
- String altLocIds = "";
final Hashtable htFormul = new Hashtable();
String currentGroup3;
@@ -75,9 +74,6 @@
continue;
}
if (line.startsWith("MODEL ")) {
- if (altLocIds.length() > 0)
- atomSetCollection.setAtomSetAuxiliaryInfo("altLocIds", "" +
altLocIds);
- altLocIds = "";
iHaveUnitcell = false;
model();
continue;
@@ -120,8 +116,6 @@
if (isNMRdata)
atomSetCollection.notionalUnitcell =
atomSetCollection.pdbScaleMatrix = atomSetCollection.pdbScaleTranslate
= null;
- if (altLocIds.length() > 0)
- atomSetCollection.setAtomSetAuxiliaryInfo("altLocIds", "" + altLocIds);
return atomSetCollection;
}
@@ -210,11 +204,8 @@
Atom atom = new Atom();
atom.elementSymbol = elementSymbol;
atom.atomName = atomName;
- if (charAlternateLocation != ' ') {
+ if (charAlternateLocation != ' ')
atom.alternateLocationID = charAlternateLocation;
- if (altLocIds.indexOf("" + charAlternateLocation) < 0)
- altLocIds += charAlternateLocation;
- }
atom.formalCharge = charge;
atom.occupancy = occupancy;
atom.bfactor = bfactor;
This was sent by the SourceForge.net collaborative development platform, the
world's largest Open Source development site.
-------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
Jmol-commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/jmol-commits