import org.jmol.api.JmolStatusListener;
import org.jmol.api.JmolViewer;
import org.jmol.c.CBK;
-import org.jmol.script.T;
import org.jmol.viewer.Viewer;
public abstract class JalviewJmolBinding extends AAStructureBindingModel
return null;
}
- public Color getColour(int atomIndex, int pdbResNum, String chain,
- String pdbfile)
- {
- if (getModelNum(pdbfile) < 0)
- {
- return null;
- }
- // TODO: verify atomIndex is selecting correct model.
- // return new Color(viewer.getAtomArgb(atomIndex)); Jmol 12.2.4
- int colour = viewer.ms.at[atomIndex].atomPropertyInt(T.color);
- return new Color(colour);
- }
-
/**
* instruct the Jalview binding to update the pdbentries vector if necessary
* prior to matching the jmol view's contents to the list of structure files
@Override
public synchronized String[] getStructureFiles()
{
- List<String> mset = new ArrayList<>();
if (viewer == null)
{
return new String[0];
if (modelFileNames == null)
{
+ List<String> mset = new ArrayList<>();
int modelCount = viewer.ms.mc;
String filePath = null;
for (int i = 0; i < modelCount; ++i)
*/
viewer.evalString("zoom 0");
}
+
+ @Override
+ public int getModelForPdbFile(String fileName, int fileIndex)
+ {
+ return fileIndex;
+ }
}
}
sendChimeraCommand(cmd.toString(), false);
}
+
+ @Override
+ public int getModelForPdbFile(String fileName, int fileIndex)
+ {
+ if (chimeraMaps.containsKey(fileName))
+ {
+ List<ChimeraModel> models = chimeraMaps.get(fileName);
+ if (!models.isEmpty())
+ {
+ return models.get(0).getModelNumber();
+ }
+ }
+ return -1;
+ }
}
for (int pdbfnum = 0; pdbfnum < files.length; pdbfnum++)
{
- StructureMapping[] mappings = getSsm().getMapping(files[pdbfnum]);
+ String fileName = files[pdbfnum];
+ final int modelNumber = getModelForPdbFile(fileName, pdbfnum);
+ StructureMapping[] mappings = getSsm().getMapping(fileName);
/*
* Find the first mapped sequence (if any) for this PDB entry which is in
{
for (int[] range : residueRanges)
{
- model.addRange(pdbfnum, range[0], range[1], chainCd);
+ model.addRange(modelNumber, range[0], range[1], chainCd);
}
}
}
}
/**
+ * Answers the structure viewer's model number for the given PDB file, or -1 if
+ * not found
+ *
+ * @param fileName
+ * @param fileIndex
+ * index of the file in the stored array of file names
+ * @return
+ */
+ public abstract int getModelForPdbFile(String fileName, int fileIndex);
+
+ /**
* Answers a default structure model specification which is simply the string
* form of the model number. Override if needed to specify submodels.
*
for (int pdbfnum = 0; pdbfnum < files.length; pdbfnum++)
{
+ String fileName = files[pdbfnum];
+ final int modelNumber = binding.getModelForPdbFile(fileName, pdbfnum);
StructureMapping[] mapping = binding.getSsm()
- .getMapping(files[pdbfnum]);
+ .getMapping(fileName);
if (mapping == null || mapping.length < 1)
{
if (startPos != -1)
{
StructureCommands.addAtomSpecRange(colourMap, lastColour,
- pdbfnum, startPos,
- lastPos, lastChain);
+ modelNumber, startPos, lastPos, lastChain);
}
startPos = pos;
}
if (lastColour != null)
{
StructureCommands.addAtomSpecRange(colourMap, lastColour,
- pdbfnum,
- startPos, lastPos, lastChain);
+ modelNumber, startPos, lastPos, lastChain);
}
}
}