label.create_image_of = Create {0} image of {1}
label.click_to_edit = Click to edit, right-click for menu
label.by_annotation_tooltip = Annotation Colour is configured from the main Colour menu
+label.show_alignment_only = Show alignment only
+label.hide_hidden_regions = Hide hidden columns / sequences
\ No newline at end of file
label.check_file_matches_sequence_ids_alignment = Comprobar que el fichero coincide con el ID de la secuencia en el alineamiento.
label.problem_reading_tcoffee_score_file = Problema de lectura del fichero de puntuaciones T-COFFEE
label.source_to_target = {0} a {1}
-label.per_sequence_only= Sólo por secuencia
+label.per_sequence_
+= Sólo por secuencia
label.to_file = a fichero
label.to_textbox = a cuadro de texto
label.jalview = Jalview
label.create_image_of = Crear imagen {0} de {1}
label.click_to_edit = Haga clic para editar, clic en el botón derecho para ver el menú
label.by_annotation_tooltip = El color de anotación se configura desde el menú principal de colores
+label.show_alignment_only = Mostrar solo alineamiento
+label.hide_hidden_regions = Ocultar columnas / secuencias ocultas
\ No newline at end of file
import jalview.api.AlignViewportI;
import jalview.api.AlignmentViewPanel;
import jalview.api.FeatureRenderer;
-import jalview.api.SequenceRenderer;
import jalview.datamodel.AlignmentI;
import jalview.datamodel.HiddenColumns;
import jalview.datamodel.PDBEntry;
/**
* @param files
- * @param sr
* @param viewPanel
* @return
*/
@Override
protected StructureMappingcommandSet[] getColourBySequenceCommands(
- String[] files, SequenceRenderer sr, AlignmentViewPanel viewPanel)
+ String[] files, AlignmentViewPanel viewPanel)
{
return JmolCommands.getColourBySequenceCommand(getSsm(), files,
- getSequence(), sr, viewPanel);
+ this, viewPanel);
}
/**
import jalview.structure.StructureMapping;
import jalview.structure.StructureMappingcommandSet;
import jalview.structure.StructureSelectionManager;
+import jalview.structures.models.AAStructureBindingModel;
import java.awt.Color;
import java.util.ArrayList;
*/
public static StructureMappingcommandSet[] getColourBySequenceCommand(
StructureSelectionManager ssm, String[] files,
+ AAStructureBindingModel binding, AlignmentViewPanel viewPanel)
+ {
+ SequenceRenderer sr = binding.getSequenceRenderer(viewPanel);
+ SequenceI[][] sequence = binding.getSequence();
+ return getColourBySequenceCommand(ssm, files, sequence, sr, viewPanel);
+ }
+
+ public static StructureMappingcommandSet[] getColourBySequenceCommand(
+ StructureSelectionManager ssm, String[] files,
SequenceI[][] sequence, SequenceRenderer sr,
AlignmentViewPanel viewPanel)
{
AlignViewportI viewport = viewPanel.getAlignViewport();
HiddenColumns cs = viewport.getAlignment().getHiddenColumns();
AlignmentI al = viewport.getAlignment();
- List<StructureMappingcommandSet> cset = new ArrayList<StructureMappingcommandSet>();
+ List<StructureMappingcommandSet> cset = new ArrayList<>();
for (int pdbfnum = 0; pdbfnum < files.length; pdbfnum++)
{
StructureMapping[] mapping = ssm.getMapping(files[pdbfnum]);
StringBuffer command = new StringBuffer();
StructureMappingcommandSet smc;
- ArrayList<String> str = new ArrayList<String>();
+ ArrayList<String> str = new ArrayList<>();
if (mapping == null || mapping.length < 1)
{
import jalview.structure.StructureMapping;
import jalview.structure.StructureMappingcommandSet;
import jalview.structure.StructureSelectionManager;
+import jalview.structures.models.AAStructureBindingModel;
import jalview.util.ColorUtils;
import jalview.util.Comparison;
*/
public static StructureMappingcommandSet[] getColourBySequenceCommand(
StructureSelectionManager ssm, String[] files,
+ AAStructureBindingModel binding, AlignmentViewPanel viewPanel)
+ {
+ SequenceRenderer sr = binding.getSequenceRenderer(viewPanel);
+ SequenceI[][] sequence = binding.getSequence();
+ boolean hideHiddenRegions = binding.isShowAlignmentOnly()
+ && binding.isHideHiddenRegions();
+
+ return getColourBySequenceCommand(ssm, files, sequence, sr,
+ hideHiddenRegions, viewPanel);
+ }
+
+ static StructureMappingcommandSet[] getColourBySequenceCommand(
+ StructureSelectionManager ssm, String[] files,
SequenceI[][] sequence, SequenceRenderer sr,
- AlignmentViewPanel viewPanel)
+ boolean hideHiddenRegions, AlignmentViewPanel viewPanel)
{
Map<Object, AtomSpecModel> colourMap = buildColoursMap(ssm, files,
- sequence, sr, viewPanel);
+ sequence, sr, hideHiddenRegions, viewPanel);
List<String> colourCommands = buildColourCommands(colourMap);
}
/**
- * <pre>
- * Build a data structure which records contiguous subsequences for each colour.
+ * Build a data structure which records contiguous subsequences for each colour.
* From this we can easily generate the Chimera command for colour by sequence.
+ *
+ * <pre>
* Color
* Model number
* Chain
* list of start/end ranges
- * Ordering is by order of addition (for colours and positions), natural ordering (for models and chains)
* </pre>
+ *
+ * Ordering is by order of addition (for colours and positions), natural
+ * ordering (for models and chains)
+ *
+ * @param ssm
+ * @param files
+ * @param sequence
+ * @param sr
+ * @param hideHiddenRegions
+ * @param viewPanel
+ * @return
*/
protected static Map<Object, AtomSpecModel> buildColoursMap(
StructureSelectionManager ssm, String[] files,
SequenceI[][] sequence, SequenceRenderer sr,
- AlignmentViewPanel viewPanel)
+ boolean hideHiddenRegions, AlignmentViewPanel viewPanel)
{
FeatureRenderer fr = viewPanel.getFeatureRenderer();
FeatureColourFinder finder = new FeatureColourFinder(fr);
Color colour = sr.getResidueColour(seq, r, finder);
/*
- * hidden regions are shown gray
- * todo: iterate over visible columns only
+ * hidden regions are shown gray or, optionally, ignored
*/
if (!cs.isVisible(r))
{
- continue; // colour = Color.GRAY;
+ if (hideHiddenRegions)
+ {
+ continue;
+ }
+ else
+ {
+ colour = Color.GRAY;
+ }
}
final String chain = mapping[m].getChain();
import jalview.api.AlignViewportI;
import jalview.api.AlignmentViewPanel;
-import jalview.api.SequenceRenderer;
import jalview.api.structures.JalviewStructureDisplayI;
import jalview.bin.Cache;
import jalview.datamodel.AlignmentI;
/**
* @param files
- * @param sr
* @param viewPanel
* @return
*/
@Override
protected StructureMappingcommandSet[] getColourBySequenceCommands(
- String[] files, SequenceRenderer sr, AlignmentViewPanel viewPanel)
+ String[] files, AlignmentViewPanel viewPanel)
{
return ChimeraCommands.getColourBySequenceCommand(getSsm(), files,
- getSequence(), sr, viewPanel);
+ this, viewPanel);
}
/**
continue;
}
Iterator<int[]> visible;
- if (isShowAlignmentOnly())
+ if (isShowAlignmentOnly() && isHideHiddenRegions())
{
visible = alignment.getHiddenColumns()
.getVisContigsIterator(0, width, true);
});
viewMenu.add(seqColourBy);
- showAlignmentOnly = new JCheckBoxMenuItem("Visible alignment only");
+ showAlignmentOnly = new JCheckBoxMenuItem(
+ MessageManager.getString("label.show_alignment_only"));
showAlignmentOnly.addActionListener(new ActionListener()
{
@Override
public void actionPerformed(ActionEvent e)
{
+ hideHiddenRegions.setEnabled(showAlignmentOnly.isSelected());
getBinding().setShowAlignmentOnly(showAlignmentOnly.isSelected());
getBinding().showStructures(getAlignmentPanel().getAlignViewport(),
true);
});
viewMenu.add(showAlignmentOnly);
+ hideHiddenRegions = new JCheckBoxMenuItem(
+ MessageManager.getString("label.hide_hidden_regions"));
+ hideHiddenRegions.setEnabled(false);
+ hideHiddenRegions.addActionListener(new ActionListener()
+ {
+ @Override
+ public void actionPerformed(ActionEvent e)
+ {
+ getBinding().setHideHiddenRegions(hideHiddenRegions.isSelected());
+ getBinding().showStructures(getAlignmentPanel().getAlignViewport(),
+ false);
+ }
+ });
+ viewMenu.add(hideHiddenRegions);
+
final ItemListener handler = new ItemListener()
{
@Override
protected JCheckBoxMenuItem showAlignmentOnly;
+ protected JCheckBoxMenuItem hideHiddenRegions;
+
protected JMenuItem fitToWindow;
protected JRadioButtonMenuItem seqColour;
// TODO make private once showStructures() deals with this
protected List<String> chainsToShow;
+ private boolean hideHiddenRegions;
+
/**
* Data bean class to simplify parameterisation in superposeStructures
*/
public abstract void setBackgroundColour(Color col);
protected abstract StructureMappingcommandSet[] getColourBySequenceCommands(
- String[] files, SequenceRenderer sr, AlignmentViewPanel avp);
+ String[] files, AlignmentViewPanel avp);
/**
* returns the current sequenceRenderer that should be used to colour the
}
String[] files = getStructureFiles();
- SequenceRenderer sr = getSequenceRenderer(alignmentv);
-
StructureMappingcommandSet[] colourBySequenceCommands = getColourBySequenceCommands(
- files, sr, alignmentv);
+ files, alignmentv);
colourBySequence(colourBySequenceCommands);
}
}
/**
- * Answers true if only mapped visible residues in the alignment should be
- * visible in the structure viewer, else false
+ * Answers true if only residues mapped to the alignment should be shown in the
+ * structure viewer, else false
*
* @return
*/
}
/**
+ * Sets the flag for hiding regions of structure which are hidden in the
+ * alignment (only applies when the structure viewer is restricted to the
+ * alignment only)
+ *
+ * @param b
+ */
+ public void setHideHiddenRegions(boolean b)
+ {
+ hideHiddenRegions = b;
+ }
+
+ /**
+ * Answers true if regions hidden in the alignment should also be hidden in the
+ * structure viewer, else false (only applies when the structure viewer is
+ * restricted to the alignment only)
+ *
+ * @return
+ */
+ public boolean isHideHiddenRegions()
+ {
+ return hideHiddenRegions;
+ }
+
+ /**
* Shows the structures in the viewer, without changing their colouring. This is
* to support toggling of whether the whole structure is shown, or only residues
* mapped to visible regions of the alignment.
public void testBuildColourCommands()
{
- Map<Object, AtomSpecModel> map = new LinkedHashMap<Object, AtomSpecModel>();
+ Map<Object, AtomSpecModel> map = new LinkedHashMap<>();
ChimeraCommands.addColourRange(map, Color.blue, 0, 2, 5, "A");
ChimeraCommands.addColourRange(map, Color.blue, 0, 7, 7, "B");
ChimeraCommands.addColourRange(map, Color.blue, 0, 9, 23, "A");
// Colours should appear in the Chimera command in the order in which
// they were added; within colour, by model, by chain, ranges in start order
+ // all prefixed with #808080 to colour hidden regions (if shown) gray
String command = ChimeraCommands.buildColourCommands(map).get(0);
assertEquals(
command,
- "color #0000ff #0:2-5.A,9-23.A,7.B|#1:1.A,4-7.B; color #ffff00 #1:3-5.A,8.A; color #ff0000 #0:3-9.A");
+ "color #808080; color #0000ff #0:2-5.A,9-23.A,7.B|#1:1.A,4-7.B; color #ffff00 #1:3-5.A,8.A; color #ff0000 #0:3-9.A");
}
@Test(groups = { "Functional" })
/*
* make a map of { featureType, {featureValue, {residue range specification } } }
*/
- Map<String, Map<Object, AtomSpecModel>> featuresMap = new LinkedHashMap<String, Map<Object, AtomSpecModel>>();
- Map<Object, AtomSpecModel> featureValues = new HashMap<Object, AtomSpecModel>();
+ Map<String, Map<Object, AtomSpecModel>> featuresMap = new LinkedHashMap<>();
+ Map<Object, AtomSpecModel> featureValues = new HashMap<>();
/*
* start with just one feature/value...
/*
* map residues 1-10 to residues 21-30 (atoms 105-150) in structures
*/
- HashMap<Integer, int[]> map = new HashMap<Integer, int[]>();
+ HashMap<Integer, int[]> map = new HashMap<>();
for (int pos = 1; pos <= seq1.getLength(); pos++)
{
map.put(pos, new int[] { 20 + pos, 5 * (20 + pos) });
ssm.addStructureMapping(sm2);
StructureMappingcommandSet[] commands = ChimeraCommands
- .getColourBySequenceCommand(ssm, files, seqs, sr, af.alignPanel);
+ .getColourBySequenceCommand(ssm, files, seqs, sr, false,
+ af.alignPanel);
assertEquals(1, commands.length);
assertEquals(1, commands[0].commands.length);
String theCommand = commands[0].commands[0];
@Override
protected StructureMappingcommandSet[] getColourBySequenceCommands(
- String[] files, SequenceRenderer sr, AlignmentViewPanel avp)
+ String[] files, AlignmentViewPanel avp)
{
// TODO Auto-generated method stub
return null;
@Override
protected StructureMappingcommandSet[] getColourBySequenceCommands(
- String[] files, SequenceRenderer sr, AlignmentViewPanel avp)
+ String[] files, AlignmentViewPanel avp)
{
return null;
}