private static final StructureCommand SHOW_BACKBONE = new StructureCommand(
"select *; cartoons off; backbone");
- private static final StructureCommand FOCUS_VIEW = new StructureCommand("zoom 0");
+ private static final StructureCommand FOCUS_VIEW = new StructureCommand(
+ "zoom 0");
private static final StructureCommand COLOUR_ALL_WHITE = new StructureCommand(
"select *;color white;");
}
@Override
- public List<StructureCommandI> colourByResidues(Map<String, Color> colours)
+ public List<StructureCommandI> colourByResidues(
+ Map<String, Color> colours)
{
List<StructureCommandI> cmds = super.colourByResidues(colours);
cmds.add(0, COLOUR_ALL_WHITE);
atomSpec.append(" or ");
}
first = false;
- atomSpec.append(":").append(tokens[1]).append(" /").append(tokens[0]);
+ atomSpec.append(":").append(tokens[1]).append(" /")
+ .append(tokens[0]);
}
}
*/
@Override
public List<StructureCommandI> superposeStructures(AtomSpecModel refAtoms,
- AtomSpecModel atomSpec)
+ AtomSpecModel atomSpec, AtomSpecType backbone)
{
StringBuilder sb = new StringBuilder(64);
String refModel = refAtoms.getModels().iterator().next();
* command examples don't include modelspec with atoms, getAtomSpec does;
* it works, so leave it as it is for simplicity
*/
- sb.append(getAtomSpec(atomSpec, true)).append("}{");
- sb.append(getAtomSpec(refAtoms, true)).append("}");
+ sb.append(getAtomSpec(atomSpec, backbone)).append("}{");
+ sb.append(getAtomSpec(refAtoms, backbone)).append("}");
sb.append(" ROTATE TRANSLATE ");
sb.append(getCommandSeparator());
/*
* show residues used for superposition as ribbon
*/
- sb.append("select ").append(getAtomSpec(atomSpec, false)).append("|");
- sb.append(getAtomSpec(refAtoms, false)).append(getCommandSeparator())
- .append("cartoons");
+ sb.append("select ")
+ .append(getAtomSpec(atomSpec, AtomSpecType.RESIDUE_ONLY))
+ .append("|");
+ sb.append(getAtomSpec(refAtoms, AtomSpecType.RESIDUE_ONLY))
+ .append(getCommandSeparator()).append("cartoons");
+ return Arrays.asList(new StructureCommand(sb.toString()));
+ }
+ @Override
+ public List<StructureCommandI> centerViewOn(List<AtomSpecModel> residues)
+ {
+ StringBuilder sb = new StringBuilder(64);
+ sb.append("center ");
+ for (AtomSpecModel ranges : residues)
+ {
+ if (sb.length() > 9)
+ {
+ sb.append(" or ");
+ }
+ sb.append(getAtomSpec(ranges, AtomSpecType.RESIDUE_ONLY));
+ }
return Arrays.asList(new StructureCommand(sb.toString()));
}
@Override
protected StructureCommandI colourResidues(String atomSpec, Color colour)
{
- StringBuilder sb = new StringBuilder(atomSpec.length()+20);
+ StringBuilder sb = new StringBuilder(atomSpec.length() + 20);
sb.append("select ").append(atomSpec).append(getCommandSeparator())
.append("color").append(getColourString(colour));
return new StructureCommand(sb.toString());
* a separate clause in the {@code compare} (superposition) command.
*/
@Override
- public String getAtomSpec(AtomSpecModel model, boolean alphaOnly)
+ public String getAtomSpec(AtomSpecModel model, AtomSpecType specType)
{
StringBuilder sb = new StringBuilder(128);
public StructureCommandI loadFile(String file)
{
// https://chemapps.stolaf.edu/jmol/docs/#loadfiles
- return new StructureCommand("load FILES \"" +
- Platform.escapeBackslashes(file) + "\"");
+ return new StructureCommand(
+ "load FILES \"" + Platform.escapeBackslashes(file) + "\"");
}
/**
* @return
*/
@Deprecated
- private static StringBuilder condenseCommand(
- StringBuilder command,
+ private static StringBuilder condenseCommand(StringBuilder command,
int pos)
{
{
return loadFile(filepath);
}
+
+ @Override
+ public StructureCommandI closeViewer()
+ {
+ return null; // not an external viewer
+ }
}