import jalview.schemes.ColourSchemeI;
import jalview.schemes.ResidueProperties;
import jalview.structure.AtomSpec;
-import jalview.structure.StructureMapping;
import jalview.structure.StructureMappingcommandSet;
import jalview.structure.StructureSelectionManager;
import jalview.structures.models.AAStructureBindingModel;
import java.util.BitSet;
import java.util.Collections;
import java.util.Hashtable;
-import java.util.Iterator;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
* @see
* https://www.cgl.ucsf.edu/chimera/docs/UsersGuide/midas/match.html
*/
- command.append("match ").append(getModelSpec(pdbfnum)).append(":");
+ command.append("match ").append(getModelSpec(pdbfnum))
+ .append(":");
command.append(selcom[pdbfnum]);
command.append("@").append(
structures[pdbfnum].isRna ? PHOSPHORUS : ALPHACARBON);
* @param pdbfnum
* @return
*/
- protected String getModelSpec(int pdbfnum)
+ @Override
+ public String getModelSpec(int pdbfnum)
{
if (pdbfnum < 0 || pdbfnum >= getPdbCount())
{
*/
List<ChimeraModel> maps = chimeraMaps.get(getStructureFiles()[pdbfnum]);
boolean hasSubModels = maps != null && maps.size() > 1;
- return "#" + String.valueOf(pdbfnum) + (hasSubModels ? ".1" : "");
+ String spec = "#" + String.valueOf(pdbfnum);
+ return hasSubModels ? spec + ".1" : spec;
}
/**
protected StructureMappingcommandSet[] getColourBySequenceCommands(
String[] files, AlignmentViewPanel viewPanel)
{
- return ChimeraCommands.getColourBySequenceCommand(getSsm(), files,
- this, viewPanel);
+ return ChimeraCommands.getColourBySequenceCommand(files, viewPanel,
+ this);
}
/**
}
StructureMappingcommandSet commandSet = ChimeraCommands
- .getSetAttributeCommandsForFeatures(getSsm(), files,
- getSequence(), avp);
+ .getSetAttributeCommandsForFeatures(avp, this);
String[] commands = commandSet.commands;
if (commands.length > 10)
{
{
StringBuilder cmd = new StringBuilder(128);
cmd.append("~display; ~ribbon;");
- String atomSpec = getMappedResidues(av);
+
+ AtomSpecModel model = getShownResidues(av);
+ String atomSpec = ChimeraCommands.getAtomSpec(model, this);
+
cmd.append("ribbon ").append(atomSpec);
if (!isShowAlignmentOnly())
{
}
sendChimeraCommand(cmd.toString(), false);
}
-
- /**
- * Builds a Chimera atomSpec of residues mapped from sequences, of the format
- * (#model:residues.chain)
- *
- * <pre>
- * #0:2-94.A | #1:1-93.C | #2:1-93.A
- * </pre>
- *
- * Only residues visible in the alignment are included, that is, hidden columns
- * and sequences are excluded.
- *
- * @param av
- * @return
- */
- private String getMappedResidues(AlignViewportI av)
- {
- AlignmentI alignment = av.getAlignment();
- final int width = alignment.getWidth();
-
- String[] files = getStructureFiles();
-
- StringBuilder atomSpec = new StringBuilder(256);
-
- for (int pdbfnum = 0; pdbfnum < files.length; pdbfnum++)
- {
- StructureMapping[] mappings = getSsm().getMapping(files[pdbfnum]);
-
- /*
- * Find the first mapped sequence (if any) for this PDB entry which is in
- * the alignment
- */
- final int seqCountForPdbFile = getSequence()[pdbfnum].length;
- for (int s = 0; s < seqCountForPdbFile; s++)
- {
- for (StructureMapping mapping : mappings)
- {
- final SequenceI theSequence = getSequence()[pdbfnum][s];
- if (mapping.getSequence() == theSequence
- && alignment.findIndex(theSequence) > -1)
- {
- String chainCd = mapping.getChain();
- if (!isShowChain(mapping.getPdbId(), chainCd))
- {
- continue;
- }
- Iterator<int[]> visible;
- if (isShowAlignmentOnly() && isHideHiddenRegions())
- {
- visible = alignment.getHiddenColumns()
- .getVisContigsIterator(0, width, true);
- }
- else
- {
- visible = Collections.singletonList(new int[] { 0, width })
- .iterator();
- }
- while (visible.hasNext())
- {
- int[] visibleRegion = visible.next();
- int seqStartPos = theSequence.findPosition(visibleRegion[0]);
- int seqEndPos = theSequence.findPosition(visibleRegion[1]);
- List<int[]> residueRanges = mapping
- .getPDBResNumRanges(seqStartPos, seqEndPos);
- if (!residueRanges.isEmpty())
- {
- if (atomSpec.length() > 0)
- {
- atomSpec.append("| ");
- }
- atomSpec.append(getModelSpec(pdbfnum)).append(":");
- boolean first = true;
- for (int[] range : residueRanges)
- {
- if (!first)
- {
- atomSpec.append(",");
- }
- first = false;
- atomSpec.append(range[0]).append("-").append(range[1]);
- atomSpec.append(".").append(chainCd);
- }
- }
- }
- }
- }
- }
- }
-
- return atomSpec.toString();
- }
}