From c406d789d51e6ac1ff45e3568d37e9ed53025f03 Mon Sep 17 00:00:00 2001 From: gmungoc Date: Mon, 22 Feb 2016 14:32:42 +0000 Subject: [PATCH] JAL-1705 first pass at applying preset feature colouring for EnsemblGene --- src/jalview/api/FeatureSettingsI.java | 7 +- src/jalview/api/FeaturesDisplayedI.java | 2 +- src/jalview/ext/ensembl/EnsemblGene.java | 8 +++ src/jalview/gui/AlignFrame.java | 68 +++++++++++++------- src/jalview/gui/AlignViewport.java | 68 ++++++++++++++++++++ src/jalview/gui/FeatureRenderer.java | 16 +++++ src/jalview/gui/SequenceFetcher.java | 50 +++++--------- src/jalview/schemes/FeatureColourScheme.java | 12 ++-- src/jalview/schemes/GraduatedColor.java | 6 ++ src/jalview/viewmodel/AlignmentViewport.java | 2 +- .../seqfeatures/FeatureRendererModel.java | 14 +++- .../viewmodel/seqfeatures/FeaturesDisplayed.java | 6 +- src/jalview/ws/SequenceFetcher.java | 3 +- src/jalview/ws/seqfetcher/DbSourceProxy.java | 49 ++++++++------ src/jalview/ws/seqfetcher/DbSourceProxyImpl.java | 7 ++ 15 files changed, 226 insertions(+), 92 deletions(-) diff --git a/src/jalview/api/FeatureSettingsI.java b/src/jalview/api/FeatureSettingsI.java index 55f52d2..ddb5edc 100644 --- a/src/jalview/api/FeatureSettingsI.java +++ b/src/jalview/api/FeatureSettingsI.java @@ -1,5 +1,7 @@ package jalview.api; +import java.util.Comparator; + /** * An interface that describes the settings configurable in the Feature Settings * dialog. @@ -7,7 +9,7 @@ package jalview.api; * @author gmcarstairs * */ -public interface FeatureSettingsI +public interface FeatureSettingsI extends Comparator { // note Java 8 will allow default implementations of these methods in the // interface, simplifying instantiating classes @@ -53,7 +55,8 @@ public interface FeatureSettingsI * @param feature2 * @return */ - int compareTo(String feature1, String feature2); + @Override + int compare(String feature1, String feature2); /** * Answers true if features should be initially sorted so that features with a diff --git a/src/jalview/api/FeaturesDisplayedI.java b/src/jalview/api/FeaturesDisplayedI.java index bda1360..32b0565 100644 --- a/src/jalview/api/FeaturesDisplayedI.java +++ b/src/jalview/api/FeaturesDisplayedI.java @@ -44,6 +44,6 @@ public interface FeaturesDisplayedI int getVisibleFeatureCount(); - int getRegisterdFeaturesCount(); + int getRegisteredFeaturesCount(); } diff --git a/src/jalview/ext/ensembl/EnsemblGene.java b/src/jalview/ext/ensembl/EnsemblGene.java index 10841bd..df4e45a 100644 --- a/src/jalview/ext/ensembl/EnsemblGene.java +++ b/src/jalview/ext/ensembl/EnsemblGene.java @@ -1,11 +1,13 @@ package jalview.ext.ensembl; +import jalview.api.FeatureSettingsI; import jalview.datamodel.AlignmentI; import jalview.datamodel.Sequence; import jalview.datamodel.SequenceFeature; import jalview.datamodel.SequenceI; import jalview.io.gff.SequenceOntologyFactory; import jalview.io.gff.SequenceOntologyI; +import jalview.schemes.FeatureColourScheme; import jalview.util.MapList; import jalview.util.StringUtils; @@ -412,4 +414,10 @@ public class EnsemblGene extends EnsemblSeqProxy return ACCESSION_REGEX; } + @Override + public FeatureSettingsI getFeatureColourScheme() + { + return FeatureColourScheme.EnsemblVariants; + } + } diff --git a/src/jalview/gui/AlignFrame.java b/src/jalview/gui/AlignFrame.java index c93b84b..7777324 100644 --- a/src/jalview/gui/AlignFrame.java +++ b/src/jalview/gui/AlignFrame.java @@ -32,6 +32,7 @@ import jalview.api.AlignViewControllerI; import jalview.api.AlignViewportI; import jalview.api.AlignmentViewPanel; import jalview.api.FeatureSettingsControllerI; +import jalview.api.FeatureSettingsI; import jalview.api.SplitContainerI; import jalview.api.ViewStyleI; import jalview.api.analysis.ScoreModelI; @@ -94,9 +95,11 @@ import jalview.schemes.ZappoColourScheme; import jalview.structure.StructureSelectionManager; import jalview.util.MessageManager; import jalview.viewmodel.AlignmentViewport; +import jalview.ws.SequenceFetcher; import jalview.ws.jws1.Discoverer; import jalview.ws.jws2.Jws2Discoverer; import jalview.ws.jws2.jabaws2.Jws2Instance; +import jalview.ws.seqfetcher.ASequenceFetcher; import jalview.ws.seqfetcher.DbSourceProxy; import java.awt.BorderLayout; @@ -962,7 +965,7 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener, @Override public void fetchSequence_actionPerformed(ActionEvent e) { - new SequenceFetcher(this); + new jalview.gui.SequenceFetcher(this); } @Override @@ -4722,11 +4725,28 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener, * alternative protein products for my protein's gene */ List addedPeers = new ArrayList(); - AlignmentI alignment = AlignFrame.this.getViewport().getAlignment(); + AlignmentI alignment = AlignFrame.this.getViewport() + .getAlignment(); Alignment xrefs = CrossRef.findXrefSequences(sel, dna, source, alignment, addedPeers); if (xrefs != null) { + /* + * figure out colour scheme if any to apply to features + */ + ASequenceFetcher sftch = new SequenceFetcher(); + List proxies = sftch.getSourceProxy(source); + FeatureSettingsI featureColourScheme = null; + for (DbSourceProxy proxy : proxies) + { + FeatureSettingsI preferredColours = proxy + .getFeatureColourScheme(); + if (preferredColours != null) + { + featureColourScheme = preferredColours; + break; + } + } Alignment al = makeCrossReferencesAlignment( alignment.getDataset(), xrefs); @@ -4810,6 +4830,7 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener, copyThis.setShowSeqFeatures(showSequenceFeatures); FeatureRenderer myFeatureStyling = alignPanel.getSeqPanel().seqCanvas .getFeatureRenderer(); + /* * copy feature rendering settings to split frame */ @@ -4819,6 +4840,16 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener, copyThis.alignPanel.getSeqPanel().seqCanvas .getFeatureRenderer().transferSettings( myFeatureStyling); + + /* + * apply 'database source' feature configuration + * if any was found + */ + newFrame.getViewport() + .applyFeaturesStyle(featureColourScheme); + copyThis.getViewport() + .applyFeaturesStyle(featureColourScheme); + SplitFrame sf = new SplitFrame(dna ? copyThis : newFrame, dna ? newFrame : copyThis); newFrame.setVisible(true); @@ -4861,8 +4892,7 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener, * @param prods * @return */ - protected Alignment makeCrossReferencesAlignment( -Alignment dataset, + protected Alignment makeCrossReferencesAlignment(Alignment dataset, Alignment prods) { SequenceI[] sprods = new SequenceI[prods.getHeight()]; @@ -5318,10 +5348,10 @@ Alignment dataset, alignPanel.paintAlignment(true); } } - else - { - new FileLoader().LoadFile(viewport, file, protocol, format); - } + else + { + new FileLoader().LoadFile(viewport, file, protocol, format); + } } } if (isAnnotation) @@ -5529,14 +5559,11 @@ Alignment dataset, @Override public void run() { - boolean isNuclueotide = alignPanel.alignFrame - .getViewport().getAlignment() - .isNucleotide(); + boolean isNuclueotide = alignPanel.alignFrame.getViewport() + .getAlignment().isNucleotide(); new jalview.ws.DBRefFetcher(alignPanel.av - .getSequenceSelection(), - alignPanel.alignFrame, null, - alignPanel.alignFrame.featureSettings, - isNuclueotide) + .getSequenceSelection(), alignPanel.alignFrame, null, + alignPanel.alignFrame.featureSettings, isNuclueotide) .fetchDBRefs(false); } }).start(); @@ -5551,7 +5578,7 @@ Alignment dataset, @Override public void run() { - final jalview.ws.SequenceFetcher sf = SequenceFetcher + final jalview.ws.SequenceFetcher sf = jalview.gui.SequenceFetcher .getSequenceFetcherSingleton(me); javax.swing.SwingUtilities.invokeLater(new Runnable() { @@ -5612,8 +5639,7 @@ Alignment dataset, .getSequenceSelection(), alignPanel.alignFrame, dassource, alignPanel.alignFrame.featureSettings, - isNuclueotide) - .fetchDBRefs(false); + isNuclueotide).fetchDBRefs(false); } }).start(); } @@ -5653,8 +5679,7 @@ Alignment dataset, .getSequenceSelection(), alignPanel.alignFrame, dassource, alignPanel.alignFrame.featureSettings, - isNuclueotide) - .fetchDBRefs(false); + isNuclueotide).fetchDBRefs(false); } }).start(); } @@ -5709,8 +5734,7 @@ Alignment dataset, .getSequenceSelection(), alignPanel.alignFrame, dassrc, alignPanel.alignFrame.featureSettings, - isNuclueotide) - .fetchDBRefs(false); + isNuclueotide).fetchDBRefs(false); } }).start(); } diff --git a/src/jalview/gui/AlignViewport.java b/src/jalview/gui/AlignViewport.java index 06dc4c4..f754eb9 100644 --- a/src/jalview/gui/AlignViewport.java +++ b/src/jalview/gui/AlignViewport.java @@ -43,6 +43,9 @@ import jalview.analysis.AnnotationSorter.SequenceAnnotationOrder; import jalview.analysis.NJTree; import jalview.api.AlignViewportI; import jalview.api.AlignmentViewPanel; +import jalview.api.FeatureColourI; +import jalview.api.FeatureSettingsI; +import jalview.api.FeaturesDisplayedI; import jalview.api.ViewStyleI; import jalview.bin.Cache; import jalview.commands.CommandI; @@ -72,6 +75,7 @@ import java.awt.Rectangle; import java.util.ArrayList; import java.util.Hashtable; import java.util.List; +import java.util.Map; import java.util.Vector; import javax.swing.JInternalFrame; @@ -1125,4 +1129,68 @@ public class AlignViewport extends AlignmentViewport implements return true; } + /** + * 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 + */ + public void applyFeaturesStyle(FeatureSettingsI featureSettings) + { + if (featureSettings == null) + { + return; + } + + FeatureRenderer fr = getAlignPanel().getSeqPanel().seqCanvas + .getFeatureRenderer(); + Map featureColours = fr.getFeatureColours(); + fr.findAllFeatures(true); + List renderOrder = fr.getRenderOrder(); + FeaturesDisplayedI displayed = fr.getFeaturesDisplayed(); + displayed.clear(); + // TODO this clears displayed.featuresRegistered - do we care? + + /* + * set feature colour if specified by feature settings + * set visibility of all features + */ + for (String type : renderOrder) + { + FeatureColourI preferredColour = featureSettings + .getFeatureColour(type); + if (preferredColour != null) + { + fr.setColour(type, preferredColour); + } + if (featureSettings.isFeatureDisplayed(type)) + { + displayed.setVisible(type); + } + } + + /* + * set visibility of feature groups + */ + for (String group : fr.getFeatureGroups()) + { + fr.setGroupVisibility(group, featureSettings.isGroupDisplayed(group)); + } + + /* + * order the features + */ + if (featureSettings.optimiseOrder()) + { + // TODO not supported (yet?) + } + else + { + fr.orderFeatures(featureSettings); + } + fr.setTransparency(featureSettings.getTransparency()); + } + } diff --git a/src/jalview/gui/FeatureRenderer.java b/src/jalview/gui/FeatureRenderer.java index a0f1b80..1cf15ac 100644 --- a/src/jalview/gui/FeatureRenderer.java +++ b/src/jalview/gui/FeatureRenderer.java @@ -37,6 +37,8 @@ import java.awt.event.ItemEvent; import java.awt.event.ItemListener; import java.awt.event.MouseAdapter; import java.awt.event.MouseEvent; +import java.util.Arrays; +import java.util.Comparator; import javax.swing.JColorChooser; import javax.swing.JComboBox; @@ -121,6 +123,7 @@ public class FeatureRenderer extends { FeatureColourChooser fcc = null; + @Override public void mousePressed(MouseEvent evt) { if (fcol instanceof Color) @@ -147,6 +150,7 @@ public class FeatureRenderer extends fcc.addActionListener(new ActionListener() { + @Override public void actionPerformed(ActionEvent e) { fcol = fcc.getLastColour(); @@ -182,6 +186,7 @@ public class FeatureRenderer extends overlaps.addItemListener(new ItemListener() { + @Override public void itemStateChanged(ItemEvent e) { int index = overlaps.getSelectedIndex(); @@ -438,4 +443,15 @@ public class FeatureRenderer extends // colour.setForeground(colour.getBackground()); } } + + /** + * Orders features in render precedence (last in order is last to render, so + * displayed on top of other features) + * + * @param order + */ + public void orderFeatures(Comparator order) + { + Arrays.sort(renderOrder, order); + } } diff --git a/src/jalview/gui/SequenceFetcher.java b/src/jalview/gui/SequenceFetcher.java index fc6fb0d..a33fdc3 100755 --- a/src/jalview/gui/SequenceFetcher.java +++ b/src/jalview/gui/SequenceFetcher.java @@ -20,12 +20,11 @@ */ package jalview.gui; +import jalview.api.FeatureSettingsI; import jalview.datamodel.AlignmentI; import jalview.datamodel.DBRefEntry; import jalview.datamodel.SequenceFeature; import jalview.datamodel.SequenceI; -import jalview.io.FormatAdapter; -import jalview.io.IdentifyFile; import jalview.util.DBRefUtils; import jalview.util.MessageManager; import jalview.ws.dbsources.das.api.DasSourceRegistryI; @@ -527,6 +526,8 @@ public class SequenceFetcher extends JPanel implements Runnable .split(";")); Iterator en = Arrays.asList(new String[0]).iterator(); int nqueries = qries.length; + + FeatureSettingsI preferredFeatureColours = null; while (proxies.hasNext() && (en.hasNext() || nextfetch.size() > 0)) { if (!en.hasNext() && nextfetch.size() > 0) @@ -693,6 +694,12 @@ public class SequenceFetcher extends JPanel implements Runnable // Stack results ready for opening in alignment windows if (aresult != null && aresult.size() > 0) { + FeatureSettingsI proxyColourScheme = proxy.getFeatureColourScheme(); + if (proxyColourScheme != null) + { + preferredFeatureColours = proxyColourScheme; + } + AlignmentI ar = null; if (isAliSource) { @@ -743,7 +750,8 @@ public class SequenceFetcher extends JPanel implements Runnable // process results while (presult.size() > 0) { - parseResult(presult.remove(0), presultTitle.remove(0), null); + parseResult(presult.remove(0), presultTitle.remove(0), null, + preferredFeatureColours); } // only remove visual delay after we finished parsing. guiWindow.setProgressBar(null, Thread.currentThread().hashCode()); @@ -771,35 +779,6 @@ public class SequenceFetcher extends JPanel implements Runnable resetDialog(); } - AlignmentI parseResult(String result, String title) - { - String format = new IdentifyFile().identify(result, "Paste"); - AlignmentI sequences = null; - if (FormatAdapter.isValidFormat(format)) - { - sequences = null; - try - { - sequences = new FormatAdapter().readFile(result.toString(), - "Paste", format); - } catch (Exception ex) - { - } - - if (sequences != null) - { - return parseResult(sequences, title, format); - } - } - else - { - showErrorMessage("Error retrieving " + textArea.getText() + " from " - + database.getSelectedItem()); - } - - return null; - } - /** * * @return a standard title for any results retrieved using the currently @@ -811,7 +790,7 @@ public class SequenceFetcher extends JPanel implements Runnable } AlignmentI parseResult(AlignmentI al, String title, - String currentFileFormat) + String currentFileFormat, FeatureSettingsI preferredFeatureColours) { if (al != null && al.getHeight() > 0) @@ -849,6 +828,11 @@ public class SequenceFetcher extends JPanel implements Runnable } } + + if (preferredFeatureColours != null) + { + af.viewport.applyFeaturesStyle(preferredFeatureColours); + } Desktop.addInternalFrame(af, title, AlignFrame.DEFAULT_WIDTH, AlignFrame.DEFAULT_HEIGHT); diff --git a/src/jalview/schemes/FeatureColourScheme.java b/src/jalview/schemes/FeatureColourScheme.java index 4a90b84..308495c 100644 --- a/src/jalview/schemes/FeatureColourScheme.java +++ b/src/jalview/schemes/FeatureColourScheme.java @@ -69,26 +69,26 @@ public enum FeatureColourScheme implements FeatureSettingsI } /** - * Order sequence_variant above exon above the rest + * order to render sequence_variant after exon after the rest */ @Override - public int compareTo(String feature1, String feature2) + public int compare(String feature1, String feature2) { if (SEQUENCE_VARIANT.equals(feature1)) { - return -1; + return +1; } if (SEQUENCE_VARIANT.equals(feature2)) { - return +1; + return -1; } if (EXON.equals(feature1)) { - return -1; + return +1; } if (EXON.equals(feature2)) { - return +1; + return -1; } return 0; } diff --git a/src/jalview/schemes/GraduatedColor.java b/src/jalview/schemes/GraduatedColor.java index 8a55f79..2d1c572 100644 --- a/src/jalview/schemes/GraduatedColor.java +++ b/src/jalview/schemes/GraduatedColor.java @@ -20,6 +20,7 @@ */ package jalview.schemes; +import jalview.api.FeatureColourI; import jalview.datamodel.SequenceFeature; import java.awt.Color; @@ -118,6 +119,11 @@ public class GraduatedColor updateBounds(min, max); } + public GraduatedColor(FeatureColourI col) + { + setColourByLabel(col.isColourByLabel()); + } + public Color getMinColor() { return new Color(lr, lg, lb); diff --git a/src/jalview/viewmodel/AlignmentViewport.java b/src/jalview/viewmodel/AlignmentViewport.java index ab9740c..c5807b7 100644 --- a/src/jalview/viewmodel/AlignmentViewport.java +++ b/src/jalview/viewmodel/AlignmentViewport.java @@ -2104,7 +2104,7 @@ public abstract class AlignmentViewport implements AlignViewportI, public boolean areFeaturesDisplayed() { return featuresDisplayed != null - && featuresDisplayed.getRegisterdFeaturesCount() > 0; + && featuresDisplayed.getRegisteredFeaturesCount() > 0; } /** diff --git a/src/jalview/viewmodel/seqfeatures/FeatureRendererModel.java b/src/jalview/viewmodel/seqfeatures/FeatureRendererModel.java index e912720..5b55e05 100644 --- a/src/jalview/viewmodel/seqfeatures/FeatureRendererModel.java +++ b/src/jalview/viewmodel/seqfeatures/FeatureRendererModel.java @@ -21,6 +21,7 @@ package jalview.viewmodel.seqfeatures; import jalview.api.AlignViewportI; +import jalview.api.FeatureColourI; import jalview.api.FeaturesDisplayedI; import jalview.datamodel.AlignmentI; import jalview.datamodel.SequenceFeature; @@ -58,7 +59,7 @@ public abstract class FeatureRendererModel implements protected Object currentColour; /* - * ordering of rendering, where last means on top + * feature types in ordering of rendering, where last means on top */ protected String[] renderOrder; @@ -632,9 +633,18 @@ public abstract class FeatureRendererModel implements // Object c = featureColours.get(featureType); // if (c == null || c instanceof Color || (c instanceof GraduatedColor && // !((GraduatedColor)c).getMaxColor().equals(_col))) + if (col instanceof FeatureColourI) { - featureColours.put(featureType, col); + if (((FeatureColourI) col).isGraduatedColour()) + { + col = new GraduatedColor((FeatureColourI) col); + } + else + { + col = ((FeatureColourI) col).getColour(); + } } + featureColours.put(featureType, col); } public void setTransparency(float value) diff --git a/src/jalview/viewmodel/seqfeatures/FeaturesDisplayed.java b/src/jalview/viewmodel/seqfeatures/FeaturesDisplayed.java index 3f9e3d8..4c7e3c4 100644 --- a/src/jalview/viewmodel/seqfeatures/FeaturesDisplayed.java +++ b/src/jalview/viewmodel/seqfeatures/FeaturesDisplayed.java @@ -62,7 +62,7 @@ public class FeaturesDisplayed implements FeaturesDisplayedI } @Override - public boolean areVisible(Collection featureTypes) + public boolean areVisible(Collection featureTypes) { return featuresDisplayed.containsAll(featureTypes); } @@ -75,7 +75,7 @@ public class FeaturesDisplayed implements FeaturesDisplayedI } @Override - public void setAllVisible(Collection makeVisible) + public void setAllVisible(Collection makeVisible) { featuresDisplayed.addAll(makeVisible); featuresRegistered.addAll(makeVisible); @@ -107,7 +107,7 @@ public class FeaturesDisplayed implements FeaturesDisplayedI } @Override - public int getRegisterdFeaturesCount() + public int getRegisteredFeaturesCount() { return featuresRegistered.size(); } diff --git a/src/jalview/ws/SequenceFetcher.java b/src/jalview/ws/SequenceFetcher.java index 16bbfe6..007c85c 100644 --- a/src/jalview/ws/SequenceFetcher.java +++ b/src/jalview/ws/SequenceFetcher.java @@ -21,7 +21,6 @@ package jalview.ws; import jalview.ext.ensembl.EnsemblGene; -import jalview.ext.ensembl.EnsemblProtein; import jalview.ws.dbsources.EmblCdsSource; import jalview.ws.dbsources.EmblSource; import jalview.ws.dbsources.Pdb; @@ -59,7 +58,7 @@ public class SequenceFetcher extends ASequenceFetcher public SequenceFetcher(boolean addDas) { - addDBRefSourceImpl(EnsemblProtein.class); + // addDBRefSourceImpl(EnsemblProtein.class); // addDBRefSourceImpl(EnsemblCds.class); // addDBRefSourceImpl(EnsemblGenome.class); addDBRefSourceImpl(EnsemblGene.class); diff --git a/src/jalview/ws/seqfetcher/DbSourceProxy.java b/src/jalview/ws/seqfetcher/DbSourceProxy.java index fba9e83..2c6d582 100644 --- a/src/jalview/ws/seqfetcher/DbSourceProxy.java +++ b/src/jalview/ws/seqfetcher/DbSourceProxy.java @@ -20,18 +20,19 @@ */ package jalview.ws.seqfetcher; +import jalview.api.FeatureSettingsI; import jalview.datamodel.AlignmentI; import com.stevesoft.pat.Regex; /** * generic Reference Retrieval interface for a particular database - * source/version as cited in DBRefEntry. TODO: add/define property to describe - * max number of queries that this source can cope with at once. TODO: - * add/define mechanism for retrieval of Trees and distance matrices from a - * database (unify with io) + * source/version as cited in DBRefEntry. * - * @author JimP TODO: promote to API + * TODO: add/define mechanism for retrieval of Trees and distance matrices from + * a database (unify with io) + * + * @author JimP */ public interface DbSourceProxy { @@ -39,7 +40,7 @@ public interface DbSourceProxy * * @return source string constant used for this DB source */ - public String getDbSource(); + String getDbSource(); /** * Short meaningful name for this data source for display in menus or @@ -47,13 +48,13 @@ public interface DbSourceProxy * * @return String */ - public String getDbName(); + String getDbName(); /** * * @return version string for this database. */ - public String getDbVersion(); + String getDbVersion(); /** * Separator between individual accession queries for a database that allows @@ -63,7 +64,7 @@ public interface DbSourceProxy * @return string for separating concatenated queries (as individually * validated by the accession validator) */ - public String getAccessionSeparator(); + String getAccessionSeparator(); /** * Regular expression for checking form of query string understood by this @@ -73,14 +74,14 @@ public interface DbSourceProxy * * @return null or a validation regex */ - public Regex getAccessionValidator(); + Regex getAccessionValidator(); /** * * @return a test/example query that can be used to validate retrieval and * parsing mechanisms */ - public String getTestQuery(); + String getTestQuery(); /** * Required for sources supporting multiple query retrieval for use with the @@ -90,7 +91,7 @@ public interface DbSourceProxy * @param accession * @return */ - public boolean isValidReference(String accession); + boolean isValidReference(String accession); /** * make one or more queries to the database and attempt to parse the response @@ -106,27 +107,27 @@ public interface DbSourceProxy * exceptions are not raised if query not found in database) * */ - public AlignmentI getSequenceRecords(String queries) throws Exception; + AlignmentI getSequenceRecords(String queries) throws Exception; /** * * @return true if a query is currently being made */ - public boolean queryInProgress(); + boolean queryInProgress(); /** * get the raw reponse from the last set of queries * * @return one or more string buffers for each individual query */ - public StringBuffer getRawRecords(); + StringBuffer getRawRecords(); /** * Tier for this data source * * @return 0 - primary datasource, 1 - das primary source, 2 - secondary */ - public int getTier(); + int getTier(); /** * Extracts valid accession strings from a query string. If there is an @@ -144,7 +145,7 @@ public interface DbSourceProxy * * @return */ - public int getMaximumQueryCount(); + int getMaximumQueryCount(); /** * Returns true if the source may provide coding DNA i.e. sequences with @@ -152,7 +153,7 @@ public interface DbSourceProxy * * @return */ - public boolean isDnaCoding(); + boolean isDnaCoding(); /** * Answers true if the database is a source of alignments (for example, domain @@ -160,7 +161,7 @@ public interface DbSourceProxy * * @return */ - public boolean isAlignmentSource(); + boolean isAlignmentSource(); /** * Returns an (optional) description of the source, suitable for display as a @@ -168,5 +169,13 @@ public interface DbSourceProxy * * @return */ - public String getDescription(); + String getDescription(); + + /** + * Returns the preferred feature colour configuration if there is one, else + * null + * + * @return + */ + FeatureSettingsI getFeatureColourScheme(); } \ No newline at end of file diff --git a/src/jalview/ws/seqfetcher/DbSourceProxyImpl.java b/src/jalview/ws/seqfetcher/DbSourceProxyImpl.java index 84072c0..bdea000 100644 --- a/src/jalview/ws/seqfetcher/DbSourceProxyImpl.java +++ b/src/jalview/ws/seqfetcher/DbSourceProxyImpl.java @@ -20,6 +20,7 @@ */ package jalview.ws.seqfetcher; +import jalview.api.FeatureSettingsI; import jalview.datamodel.AlignmentI; import jalview.io.FormatAdapter; import jalview.io.IdentifyFile; @@ -148,4 +149,10 @@ public abstract class DbSourceProxyImpl implements DbSourceProxy { return null; } + + @Override + public FeatureSettingsI getFeatureColourScheme() + { + return null; + } } -- 1.7.10.2