import jalview.analysis.AlignmentUtils;
import jalview.analysis.AnnotationSorter.SequenceAnnotationOrder;
-import jalview.analysis.TreeModel;
import jalview.api.AlignViewportI;
import jalview.api.AlignmentViewPanel;
import jalview.api.FeatureColourI;
import jalview.datamodel.AlignmentI;
import jalview.datamodel.ColumnSelection;
import jalview.datamodel.HiddenColumns;
-import jalview.datamodel.PDBEntry;
import jalview.datamodel.SearchResults;
import jalview.datamodel.SearchResultsI;
import jalview.datamodel.SequenceGroup;
import jalview.datamodel.SequenceI;
+import jalview.datamodel.features.FeatureMatcherSetI;
import jalview.renderer.ResidueShader;
import jalview.schemes.ColourSchemeI;
import jalview.schemes.ColourSchemeProperty;
import jalview.structure.SelectionSource;
import jalview.structure.StructureSelectionManager;
import jalview.structure.VamsasSource;
+import jalview.util.ColorUtils;
import jalview.util.MessageManager;
import jalview.viewmodel.AlignmentViewport;
import jalview.ws.params.AutoCalcSetting;
import java.util.Hashtable;
import java.util.Iterator;
import java.util.List;
-import java.util.Vector;
import javax.swing.JInternalFrame;
{
Font font;
- TreeModel currentTree = null;
-
boolean cursorMode = false;
boolean antiAlias = false;
private Rectangle explodedGeometry;
- String viewName;
+ private String viewName;
/*
* Flag set true on the view that should 'gather' multiple views of the same
setFont(new Font(fontName, style, Integer.parseInt(fontSize)), true);
- alignment
- .setGapCharacter(Cache.getDefault("GAP_SYMBOL", "-").charAt(0));
+ alignment.setGapCharacter(Cache.getDefault("GAP_SYMBOL", "-").charAt(0));
// We must set conservation and consensus before setting colour,
// as Blosum and Clustal require this to be done
- if (hconsensus == null && !isDataset)
+ if (hconsensus == null && !isDataset)
{
- if (!alignment.isNucleotide())
+ if (!alignment.isNucleotide())
{
showConservation = Cache.getDefault("SHOW_CONSERVATION", true);
showQuality = Cache.getDefault("SHOW_QUALITY", true);
showSequenceLogo = Cache.getDefault("SHOW_CONSENSUS_LOGO", false);
normaliseSequenceLogo = Cache.getDefault("NORMALISE_CONSENSUS_LOGO",
false);
+ // for now, use consensus options for Information till it gets its own
+ setShowHMMSequenceLogo(showSequenceLogo);
+ setNormaliseHMMSequenceLogo(normaliseSequenceLogo);
+ setShowInformationHistogram(showConsensusHistogram);
showGroupConsensus = Cache.getDefault("SHOW_GROUP_CONSENSUS", false);
showConsensus = Cache.getDefault("SHOW_IDENTITY", true);
showOccupancy = Cache.getDefault(Preferences.SHOW_OCCUPANCY, true);
}
initAutoAnnotation();
- String colourProperty = alignment.isNucleotide()
+ // initInformation();
+
+ String colourProperty = alignment.isNucleotide()
? Preferences.DEFAULT_COLOUR_NUC
: Preferences.DEFAULT_COLOUR_PROT;
String schemeName = Cache.getProperty(colourProperty);
ResidueColourScheme.NONE);
}
ColourSchemeI colourScheme = ColourSchemeProperty
- .getColourScheme(alignment, schemeName);
+ .getColourScheme(this, alignment, schemeName);
residueShading = new ResidueShader(colourScheme);
if (colourScheme instanceof UserColourScheme)
if (residueShading != null)
{
- residueShading.setConsensus(hconsensus);
+ residueShading.setConsensus(hconsensus);
}
+ setColourAppliesToAllGroups(true);
}
-
+
boolean validCharWidth;
/**
/*
* replace mappings on our alignment
*/
- if (alignment != null && align != null)
+ if (alignment != null && align != null)
{
alignment.setCodonFrames(align.getCodonFrames());
}
}
/**
- * DOCUMENT ME!
- *
- * @param tree
- * DOCUMENT ME!
- */
- public void setCurrentTree(TreeModel tree)
- {
- currentTree = tree;
- }
-
- /**
- * DOCUMENT ME!
- *
- * @return DOCUMENT ME!
- */
- public TreeModel getCurrentTree()
- {
- return currentTree;
- }
-
- /**
- * returns the visible column regions of the alignment
+ * Returns an iterator over the visible column regions of the alignment
*
* @param selectedRegionOnly
* true to just return the contigs intersecting with the selected
{
end = alignment.getWidth();
}
- return (alignment.getHiddenColumns().getVisContigsIterator(start, end));
+
+ return (alignment.getHiddenColumns().getVisContigsIterator(start,
+ end, false));
}
/**
}
public boolean followSelection = true;
-
+
/**
* @return true if view selection should always follow the selections
* broadcast by other selection sources
return StructureSelectionManager
.getStructureSelectionManager(Desktop.instance);
}
-
- /**
- *
- * @param pdbEntries
- * @return an array of SequenceI arrays, one for each PDBEntry, listing which
- * sequences in the alignment hold a reference to it
- */
- public SequenceI[][] collateForPDB(PDBEntry[] pdbEntries)
- {
- List<SequenceI[]> seqvectors = new ArrayList<>();
- for (PDBEntry pdb : pdbEntries)
- {
- List<SequenceI> choosenSeqs = new ArrayList<>();
- for (SequenceI sq : alignment.getSequences())
- {
- Vector<PDBEntry> pdbRefEntries = sq.getDatasetSequence()
- .getAllPDBEntries();
- if (pdbRefEntries == null)
- {
- continue;
- }
- for (PDBEntry pdbRefEntry : pdbRefEntries)
- {
- if (pdbRefEntry.getId().equals(pdb.getId()))
- {
- if (pdbRefEntry.getChainCode() != null
- && pdb.getChainCode() != null)
- {
- if (pdbRefEntry.getChainCode().equalsIgnoreCase(
- pdb.getChainCode()) && !choosenSeqs.contains(sq))
- {
- choosenSeqs.add(sq);
- continue;
- }
- }
- else
- {
- if (!choosenSeqs.contains(sq))
- {
- choosenSeqs.add(sq);
- continue;
- }
- }
-
- }
- }
- }
- seqvectors
- .add(choosenSeqs.toArray(new SequenceI[choosenSeqs.size()]));
- }
- return seqvectors.toArray(new SequenceI[seqvectors.size()][]);
- }
-
+
@Override
public boolean isNormaliseSequenceLogo()
{
return normaliseSequenceLogo;
}
- public void setNormaliseSequenceLogo(boolean state)
+ @Override
+public void setNormaliseSequenceLogo(boolean state)
{
normaliseSequenceLogo = state;
}
+
/**
*
* @return true if alignment characters should be displayed
{
return validCharWidth;
}
-
+
private Hashtable<String, AutoCalcSetting> calcIdParams = new Hashtable<>();
public AutoCalcSetting getCalcIdSettingsFor(String calcId)
AlignFrame newAlignFrame = new AlignFrame(al, AlignFrame.DEFAULT_WIDTH,
AlignFrame.DEFAULT_HEIGHT);
newAlignFrame.setTitle(title);
- newAlignFrame.statusBar.setText(MessageManager
+ newAlignFrame.setStatus(MessageManager
.formatMessage("label.successfully_loaded_file", new Object[]
{ title }));
@Override
public void applyFeaturesStyle(FeatureSettingsModelI featureSettings)
{
+ transferFeaturesStyles(featureSettings, false);
+ }
+
+ /**
+ * Applies the supplied feature settings descriptor to currently known features.
+ * This supports an 'initial configuration' of feature colouring based on a
+ * preset or user favourite. This may then be modified in the usual way using
+ * the Feature Settings dialogue.
+ *
+ * @param featureSettings
+ */
+ @Override
+ public void mergeFeaturesStyle(FeatureSettingsModelI featureSettings)
+ {
+ transferFeaturesStyles(featureSettings, true);
+ }
+
+ /**
+ * when mergeOnly is set, then group and feature visibility or feature colours
+ * are not modified for features and groups already known to the feature
+ * renderer. Feature ordering is always adjusted, and transparency is always set
+ * regardless.
+ *
+ * @param featureSettings
+ * @param mergeOnly
+ */
+ private void transferFeaturesStyles(FeatureSettingsModelI featureSettings,
+ boolean mergeOnly)
+ {
if (featureSettings == null)
{
return;
}
-
+
FeatureRenderer fr = getAlignPanel().getSeqPanel().seqCanvas
.getFeatureRenderer();
+ List<String> origRenderOrder = new ArrayList(),
+ origGroups = new ArrayList();
+ // preserve original render order - allows differentiation between user configured colours and autogenerated ones
+ origRenderOrder.addAll(fr.getRenderOrder());
+ origGroups.addAll(fr.getFeatureGroups());
+
fr.findAllFeatures(true);
List<String> renderOrder = fr.getRenderOrder();
FeaturesDisplayedI displayed = fr.getFeaturesDisplayed();
- displayed.clear();
+ if (!mergeOnly)
+ {
+ // only clear displayed features if we are mergeing
+ displayed.clear();
+ }
// TODO this clears displayed.featuresRegistered - do we care?
-
+ //
+ // JAL-3330 - JBP - yes we do - calling applyFeatureStyle to a view where
+ // feature visibility has already been configured is not very friendly
/*
* set feature colour if specified by feature settings
* set visibility of all features
{
FeatureColourI preferredColour = featureSettings
.getFeatureColour(type);
- if (preferredColour != null)
- {
- fr.setColour(type, preferredColour);
- }
- if (featureSettings.isFeatureDisplayed(type))
+ FeatureMatcherSetI preferredFilters = featureSettings
+ .getFeatureFilters(type);
+
+ FeatureColourI origColour = fr.getFeatureStyle(type);
+ if (!mergeOnly || (!origRenderOrder.contains(type)
+ || origColour == null
+ || (!origColour.isGraduatedColour()
+ && origColour.getColour() != null
+ && origColour.getColour().equals(
+ ColorUtils.createColourFromName(type)))))
{
- displayed.setVisible(type);
+ // if we are merging, only update if there wasn't already a colour defined for
+ // this type
+ if (preferredColour != null)
+ {
+ fr.setColour(type, preferredColour);
+ }
+ if (preferredFilters != null
+ && (!mergeOnly || fr.getFeatureFilter(type) != null))
+ {
+ fr.setFeatureFilter(type, preferredFilters);
+ }
+ if (featureSettings.isFeatureDisplayed(type))
+ {
+ displayed.setVisible(type);
+ }
}
}
*/
for (String group : fr.getFeatureGroups())
{
- fr.setGroupVisibility(group, featureSettings.isGroupDisplayed(group));
+ if (!mergeOnly || !origGroups.contains(group))
+ {
+ // when merging, display groups only if the aren't already marked as not visible
+ fr.setGroupVisibility(group,
+ featureSettings.isGroupDisplayed(group));
+ }
}
/*
fr.setTransparency(featureSettings.getTransparency());
}
+ public String getViewName()
+ {
+ return viewName;
+ }
+
+ public void setViewName(String viewName)
+ {
+ this.viewName = viewName;
+ }
}