AlignmentViewPanel viewPanel, boolean isChimeraX)
{
Map<String, Map<Object, AtomSpecModel>> featureMap = buildFeaturesMap(
- ssm, files, seqs, viewPanel);
+ ssm, files, seqs, viewPanel, isChimeraX);
List<String> commands = buildSetAttributeCommands(featureMap,
isChimeraX);
* @param files
* @param seqs
* @param viewPanel
+ * @param isChimeraX
* @return
*/
protected static Map<String, Map<Object, AtomSpecModel>> buildFeaturesMap(
StructureSelectionManager ssm, String[] files, SequenceI[][] seqs,
- AlignmentViewPanel viewPanel)
+ AlignmentViewPanel viewPanel, boolean isChimeraX)
{
Map<String, Map<Object, AtomSpecModel>> theMap = new LinkedHashMap<>();
AlignmentI alignment = viewPanel.getAlignment();
for (int pdbfnum = 0; pdbfnum < files.length; pdbfnum++)
{
+ final int modelNumber = pdbfnum + (isChimeraX ? 1 : 0);
StructureMapping[] mapping = ssm.getMapping(files[pdbfnum]);
if (mapping == null || mapping.length < 1)
if (!visibleFeatures.isEmpty())
{
scanSequenceFeatures(visibleFeatures, structureMapping, seq,
- theMap, pdbfnum);
+ theMap, modelNumber);
}
if (showLinkedFeatures)
{
scanComplementFeatures(complementRenderer, structureMapping,
- seq, theMap, pdbfnum);
+ seq, theMap, modelNumber);
}
}
}
* add a command to set the attribute on the mapped residues
* Put values in single quotes, encoding any embedded single quotes
*/
+ AtomSpecModel atomSpecModel = values.get(value);
StringBuilder sb = new StringBuilder(128);
+ sb.append("setattr ");
+ if (isChimeraX)
+ {
+ sb.append(atomSpecModel.getAtomSpecX());
+ }
String featureValue = value.toString();
featureValue = featureValue.replaceAll("\\'", "'");
- sb.append("setattr r ").append(attributeName).append(" '")
+ sb.append(" res ").append(attributeName).append(" '")
.append(featureValue).append("' ");
- AtomSpecModel atomSpecModel = values.get(value);
- sb.append(isChimeraX ? atomSpecModel.getAtomSpecX()
- : atomSpecModel.getAtomSpec());
+ if (isChimeraX)
+ {
+ sb.append(" create true");
+ }
+ else
+ {
+ sb.append(atomSpecModel.getAtomSpec());
+ }
commands.add(sb.toString());
}
}
*/
protected void sendCommandsByFile(String[] commands)
{
+ boolean toChimeraX = viewer.isChimeraX();
try
{
- File tmp = File.createTempFile("chim", ".com");
+ File tmp = File.createTempFile("chim", toChimeraX ? ".cxc" : ".com");
tmp.deleteOnExit();
PrintWriter out = new PrintWriter(new FileOutputStream(tmp));
for (String command : commands)
out.flush();
out.close();
String path = tmp.getAbsolutePath();
- sendAsynchronousCommand("open cmd:" + path, null);
+ String command = "open " + (toChimeraX ? "" : "cmd:") + path;
+ sendAsynchronousCommand(command, null);
} catch (IOException e)
{
System.err.println("Sending commands to Chimera via file failed with "