import jalview.structure.AtomSpecModel;
import jalview.structure.StructureCommand;
import jalview.structure.StructureCommandI;
+import jalview.structure.StructureCommandsI.AtomSpecType;
/**
* Routines for generating ChimeraX commands for Jalview/ChimeraX binding
}
/**
- * Returns a viewer command to set the given residue attribute value on residues
- * specified by the AtomSpecModel, for example
+ * Returns a viewer command to set the given residue attribute value on
+ * residues specified by the AtomSpecModel, for example
*
* <pre>
* setattr #0/A:3-9,14-20,39-43 res jv_strand 'strand' create true
String attributeValue, AtomSpecModel atomSpecModel)
{
StringBuilder sb = new StringBuilder(128);
- sb.append("setattr ").append(getAtomSpec(atomSpecModel, false));
+ sb.append("setattr ")
+ .append(getAtomSpec(atomSpecModel, AtomSpecType.RESIDUE_ONLY));
sb.append(" res ").append(attributeName).append(" '")
.append(attributeValue).append("'");
sb.append(" create true");
* @return
*/
@Override
- public String getAtomSpec(AtomSpecModel atomSpec, boolean alphaOnly)
+ public String getAtomSpec(AtomSpecModel atomSpec, AtomSpecType specType)
{
StringBuilder sb = new StringBuilder(128);
boolean firstModel = true;
}
firstModel = false;
appendModel(sb, model, atomSpec);
- if (alphaOnly)
+ if (specType == AtomSpecType.ALPHA)
{
- // TODO @P if RNA - add nucleotide flag to AtomSpecModel?
sb.append("@CA");
}
+ if (specType == AtomSpecType.PHOSPHATE)
+ {
+ sb.append("@P");
+ }
}
return sb.toString();
}
@Override
public List<StructureCommandI> superposeStructures(AtomSpecModel ref,
- AtomSpecModel spec)
+ AtomSpecModel spec, AtomSpecType backbone)
{
/*
* Form ChimeraX match command to match spec to ref
* @see https://www.cgl.ucsf.edu/chimerax/docs/user/commands/align.html
*/
StringBuilder cmd = new StringBuilder();
- String atomSpec = getAtomSpec(spec, true);
- String refSpec = getAtomSpec(ref, true);
+ String atomSpec = getAtomSpec(spec, backbone);
+ String refSpec = getAtomSpec(ref, backbone);
cmd.append("align ").append(atomSpec).append(" toAtoms ")
.append(refSpec);
* show superposed residues as ribbon, others as chain
*/
cmd.append("; ribbon ");
- cmd.append(getAtomSpec(spec, false)).append("|");
- cmd.append(getAtomSpec(ref, false)).append("; view");
+ cmd.append(getAtomSpec(spec, AtomSpecType.RESIDUE_ONLY)).append("|");
+ cmd.append(getAtomSpec(ref, AtomSpecType.RESIDUE_ONLY))
+ .append("; view");
return Arrays.asList(new StructureCommand(cmd.toString()));
}