Revision: 5136
Author: hansonr
Date: 2006-05-17 21:15:42 -0700 (Wed, 17 May 2006)
ViewCVS: http://svn.sourceforge.net/jmol/?rev=5136&view=rev
Log Message:
-----------
bob200603 adds color insertion
Modified Paths:
--------------
branches/bob200603/Jmol/src/org/jmol/viewer/Atom.java
branches/bob200603/Jmol/src/org/jmol/viewer/ColorManager.java
branches/bob200603/Jmol/src/org/jmol/viewer/Eval.java
branches/bob200603/Jmol/src/org/jmol/viewer/Frame.java
branches/bob200603/Jmol/src/org/jmol/viewer/Group.java
branches/bob200603/Jmol/src/org/jmol/viewer/JmolConstants.java
branches/bob200603/Jmol/src/org/jmol/viewer/Mmset.java
branches/bob200603/Jmol/src/org/jmol/viewer/Model.java
branches/bob200603/Jmol/src/org/jmol/viewer/ModelManager.java
branches/bob200603/Jmol/src/org/jmol/viewer/Token.java
Modified: branches/bob200603/Jmol/src/org/jmol/viewer/Atom.java
===================================================================
--- branches/bob200603/Jmol/src/org/jmol/viewer/Atom.java 2006-05-18
04:14:22 UTC (rev 5135)
+++ branches/bob200603/Jmol/src/org/jmol/viewer/Atom.java 2006-05-18
04:15:42 UTC (rev 5136)
@@ -750,6 +750,12 @@
return group.getSeqcodeString();
}
+ char getInsertionCode() {
+ if (group == null)
+ return '\0';
+ return group.getInsertionCode();
+ }
+
String getModelTag() {
if (group == null)
return null;
Modified: branches/bob200603/Jmol/src/org/jmol/viewer/ColorManager.java
===================================================================
--- branches/bob200603/Jmol/src/org/jmol/viewer/ColorManager.java
2006-05-18 04:14:22 UTC (rev 5135)
+++ branches/bob200603/Jmol/src/org/jmol/viewer/ColorManager.java
2006-05-18 04:15:42 UTC (rev 5136)
@@ -121,6 +121,7 @@
int argb = 0;
int index;
Frame frame;
+ //System.out.println("colormanager "+palette);
if ("cpk" == palette) {
// Note that CPK colors can be changed based upon user preference
// therefore, a changable colix is allocated in this case
@@ -200,11 +201,20 @@
argb = JmolConstants.argbsRoygbScale[index];
} else if ("altloc" == palette) {
frame = viewer.getFrame();
+ //very inefficient!
index = quantize(frame.getAltLocIndexInModel(atom.modelIndex,
(char) atom.alternateLocationID), 0, frame
.getAltLocCountInModel(atom.modelIndex),
JmolConstants.argbsRoygbScale.length);
argb = JmolConstants.argbsRoygbScale[index];
+ } else if ("insertion" == palette) {
+ frame = viewer.getFrame();
+ //very inefficient!
+ index = quantize(frame.getInsertionCodeIndexInModel(atom.modelIndex,
+ atom.getInsertionCode()), 0, frame
+ .getInsertionCountInModel(atom.modelIndex),
+ JmolConstants.argbsRoygbScale.length);
+ argb = JmolConstants.argbsRoygbScale[index];
} else {
System.out.println("ColorManager.getColixAtomPalette:"
+ " unrecognized color palette:" + palette);
Modified: branches/bob200603/Jmol/src/org/jmol/viewer/Eval.java
===================================================================
--- branches/bob200603/Jmol/src/org/jmol/viewer/Eval.java 2006-05-18
04:14:22 UTC (rev 5135)
+++ branches/bob200603/Jmol/src/org/jmol/viewer/Eval.java 2006-05-18
04:15:42 UTC (rev 5136)
@@ -700,6 +700,10 @@
evalError("boolean or number expected");
}
+ void booleanOrNumberExpected(String orWhat) throws ScriptException {
+ evalError("boolean, number, or \"" + orWhat + "\" expected");
+ }
+
void expressionOrDecimalExpected() throws ScriptException {
evalError("(atom expression) or decimal number expected");
}
@@ -948,7 +952,7 @@
mad = -1;
break;
default:
- booleanOrNumberExpected();
+ booleanOrNumberExpected("or dotted");
}
return mad;
}
@@ -1453,6 +1457,7 @@
case Token.monomer:
case Token.molecule:
case Token.altloc:
+ case Token.insertion:
colorObject(Token.atom, 1);
return;
case Token.rubberband:
@@ -1564,6 +1569,7 @@
case Token.temperature:
case Token.fixedtemp:
case Token.altloc:
+ case Token.insertion:
break;
case Token.group:
viewer.calcSelectedGroupsCount();
@@ -1795,7 +1801,8 @@
// also need to turn off backbones, ribbons, strands, cartoons
for (int shapeType = JmolConstants.SHAPE_MIN_SELECTION_INDEPENDENT;
--shapeType >= 0;)
- viewer.setShapeSize(shapeType, 0);
+ if (shapeType != JmolConstants.SHAPE_MEASURES)
+ viewer.setShapeSize(shapeType, 0);
viewer.setLabel(null);
Modified: branches/bob200603/Jmol/src/org/jmol/viewer/Frame.java
===================================================================
--- branches/bob200603/Jmol/src/org/jmol/viewer/Frame.java 2006-05-18
04:14:22 UTC (rev 5135)
+++ branches/bob200603/Jmol/src/org/jmol/viewer/Frame.java 2006-05-18
04:15:42 UTC (rev 5136)
@@ -722,14 +722,31 @@
return altLocList.indexOf(alternateLocationID) + 1;
}
+ int getInsertionCodeIndexInModel(int modelIndex, char insertionCode) {
+ if(insertionCode == '\0')
+ return 0;
+ String codeList = getInsertionListInModel(modelIndex);
+ if(codeList == null)
+ return 0;
+ return codeList.indexOf(insertionCode) + 1;
+ }
+
String getAltLocListInModel(int modelIndex) {
return (String) getModelAuxiliaryInfo(modelIndex,"altLocs");
}
+ String getInsertionListInModel(int modelIndex) {
+ return (String) getModelAuxiliaryInfo(modelIndex,"insertionCodes");
+ }
+
int getAltLocCountInModel(int modelIndex) {
return mmset.getNAltLocs(modelIndex);
}
+ int getInsertionCountInModel(int modelIndex) {
+ return mmset.getNInsertions(modelIndex);
+ }
+
Properties getModelSetProperties() {
return mmset.getModelSetProperties();
}
Modified: branches/bob200603/Jmol/src/org/jmol/viewer/Group.java
===================================================================
--- branches/bob200603/Jmol/src/org/jmol/viewer/Group.java 2006-05-18
04:14:22 UTC (rev 5135)
+++ branches/bob200603/Jmol/src/org/jmol/viewer/Group.java 2006-05-18
04:15:42 UTC (rev 5136)
@@ -208,6 +208,12 @@
: "" + (seqcode >> 8) + '^' + (char)(seqcode & 0xFF);
}
+ char getInsertionCode() {
+ if (seqcode == Integer.MIN_VALUE)
+ return '\0';
+ return (char)(seqcode & 0xFF);
+ }
+
final void selectAtoms(BitSet bs) {
for (int i = firstAtomIndex; i <= lastAtomIndex; ++i)
bs.set(i);
Modified: branches/bob200603/Jmol/src/org/jmol/viewer/JmolConstants.java
===================================================================
--- branches/bob200603/Jmol/src/org/jmol/viewer/JmolConstants.java
2006-05-18 04:14:22 UTC (rev 5135)
+++ branches/bob200603/Jmol/src/org/jmol/viewer/JmolConstants.java
2006-05-18 04:15:42 UTC (rev 5136)
@@ -42,7 +42,7 @@
// for now, just update this by hand
// perhaps use ant filter later ... but mth doesn't like it :-(
public final static String copyright = "(C) 2006 Jmol Development";
- public final static String version = "10.x.01(branch bob200603)";
+ public final static String version = "10.x.02(branch bob200603)";
public final static String cvsDate = "$Date$";
public final static String date = cvsDate.substring(7, 23);
Modified: branches/bob200603/Jmol/src/org/jmol/viewer/Mmset.java
===================================================================
--- branches/bob200603/Jmol/src/org/jmol/viewer/Mmset.java 2006-05-18
04:14:22 UTC (rev 5135)
+++ branches/bob200603/Jmol/src/org/jmol/viewer/Mmset.java 2006-05-18
04:15:42 UTC (rev 5136)
@@ -217,6 +217,10 @@
return models[modelIndex].nAltLocs;
}
+ int getNInsertions(int modelIndex) {
+ return models[modelIndex].nInsertions;
+ }
+
void setModelNameNumberProperties(int modelIndex, String modelName,
int modelNumber,
Properties modelProperties,
@@ -227,8 +231,10 @@
this.modelProperties[modelIndex] = modelProperties;
this.modelAuxiliaryInfo[modelIndex] = modelAuxiliaryInfo;
models[modelIndex] = new Model(this, modelIndex, modelName);
- String altLocs = (String) getModelAuxiliaryInfo(modelIndex, "altLocs");
- models[modelIndex].setNAltLocs(altLocs == null ? 0 : altLocs.length());
+ String codes = (String) getModelAuxiliaryInfo(modelIndex, "altLocs");
+ models[modelIndex].setNAltLocs(codes == null ? 0 : codes.length());
+ codes = (String) getModelAuxiliaryInfo(modelIndex, "insertionCodes");
+ models[modelIndex].setNInsertions(codes == null ? 0 : codes.length());
models[modelIndex].isPDB = isPDB;
}
Modified: branches/bob200603/Jmol/src/org/jmol/viewer/Model.java
===================================================================
--- branches/bob200603/Jmol/src/org/jmol/viewer/Model.java 2006-05-18
04:14:22 UTC (rev 5135)
+++ branches/bob200603/Jmol/src/org/jmol/viewer/Model.java 2006-05-18
04:15:42 UTC (rev 5136)
@@ -34,6 +34,7 @@
int firstMolecule;
int moleculeCount;
int nAltLocs;
+ int nInsertions;
boolean isPDB = false;
private int chainCount = 0;
private Chain[] chains = new Chain[8];
@@ -57,6 +58,10 @@
this.nAltLocs = nAltLocs;
}
+ void setNInsertions(int nInsertions) {
+ this.nInsertions = nInsertions;
+ }
+
void freeze() {
// System.out.println("Mmset.freeze() chainCount=" + chainCount);
chains = (Chain[])Util.setLength(chains, chainCount);
Modified: branches/bob200603/Jmol/src/org/jmol/viewer/ModelManager.java
===================================================================
--- branches/bob200603/Jmol/src/org/jmol/viewer/ModelManager.java
2006-05-18 04:14:22 UTC (rev 5135)
+++ branches/bob200603/Jmol/src/org/jmol/viewer/ModelManager.java
2006-05-18 04:15:42 UTC (rev 5136)
@@ -980,8 +980,11 @@
info.put("chain", (chainID == '\0' ? "" : "" + chainID ));
info.put("atomID", new Integer(atom.getSpecialAtomID()));
info.put("groupID", new Integer(atom.getGroupID()));
- info.put("altLocation", new String(""+atom.alternateLocationID));
-
+ if (atom.alternateLocationID != '\0')
+ info.put("altLocation", new String(""+atom.alternateLocationID));
+ char ch = atom.getInsertionCode();
+ if (ch != '\0')
+ info.put("insertionCode", new String(""+ch));
info.put("structure", new Integer(atom.getProteinStructureType()));
info.put("polymerLength", new Integer(atom.getPolymerLength()));
info.put("occupancy", new Integer(atom.getOccupancy()));
Modified: branches/bob200603/Jmol/src/org/jmol/viewer/Token.java
===================================================================
--- branches/bob200603/Jmol/src/org/jmol/viewer/Token.java 2006-05-18
04:14:22 UTC (rev 5135)
+++ branches/bob200603/Jmol/src/org/jmol/viewer/Token.java 2006-05-18
04:15:42 UTC (rev 5136)
@@ -298,6 +298,7 @@
final static int dollarsign = objectid | 19;
final static int connected = expression | 20;
final static int altloc = expression | 21;
+ final static int insertion = expression | 22;
// miguel 2005 01 01
// these are used to demark the beginning and end of expressions
@@ -425,7 +426,7 @@
final static String[] atomPropertyNames = {
"atomno", "elemno", "resno", "radius", "temperature", "model",
"_bondedcount", "_groupID", "_atomID", "_structure", "occupancy",
- "polymerLength", "molecule", "altloc"};
+ "polymerLength", "molecule", "altloc","insertion"};
/*
Note that the RasMol scripting language is case-insensitive.
@@ -459,7 +460,11 @@
"labels", null,
"load", new Token(load, varArgCount, "load"),
"molecule", new Token(molecule, "molecule"),
+ "molecules", null,
"altloc", new Token(altloc, "altloc"),
+ "altlocs", null,
+ "insertion", new Token(insertion, "insertion"),
+ "insertions", null,
"monitor", new Token(monitor, varArgCount, "monitor"),
"monitors", null,
"measure", null,
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