git://source.jalview.org
/
jalview.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
JAL-3878 update branch from 2.12 merge from 2.11.2
[jalview.git]
/
src
/
jalview
/
viewmodel
/
seqfeatures
/
FeatureRendererModel.java
diff --git
a/src/jalview/viewmodel/seqfeatures/FeatureRendererModel.java
b/src/jalview/viewmodel/seqfeatures/FeatureRendererModel.java
index
3608626
..
e812ed5
100644
(file)
--- a/
src/jalview/viewmodel/seqfeatures/FeatureRendererModel.java
+++ b/
src/jalview/viewmodel/seqfeatures/FeatureRendererModel.java
@@
-39,9
+39,9
@@
import jalview.api.AlignViewportI;
import jalview.api.FeatureColourI;
import jalview.api.FeaturesDisplayedI;
import jalview.datamodel.AlignedCodonFrame;
import jalview.api.FeatureColourI;
import jalview.api.FeaturesDisplayedI;
import jalview.datamodel.AlignedCodonFrame;
+import jalview.datamodel.AlignedCodonFrame.SequenceToSequenceMapping;
import jalview.datamodel.AlignmentI;
import jalview.datamodel.MappedFeatures;
import jalview.datamodel.AlignmentI;
import jalview.datamodel.MappedFeatures;
-import jalview.datamodel.Mapping;
import jalview.datamodel.SearchResultMatchI;
import jalview.datamodel.SearchResults;
import jalview.datamodel.SearchResultsI;
import jalview.datamodel.SearchResultMatchI;
import jalview.datamodel.SearchResults;
import jalview.datamodel.SearchResultsI;
@@
-104,11
+104,11
@@
public abstract class FeatureRendererModel
Map<String, Float> featureOrder = null;
Map<String, Float> featureOrder = null;
- protected PropertyChangeSupport changeSupport = new PropertyChangeSupport(
- this);
-
protected AlignViewportI av;
protected AlignViewportI av;
+ private PropertyChangeSupport changeSupport = new PropertyChangeSupport(
+ this);
+
@Override
public AlignViewportI getViewport()
{
@Override
public AlignViewportI getViewport()
{
@@
-301,14
+301,21
@@
public abstract class FeatureRendererModel
{
firing = Boolean.TRUE;
findAllFeatures(true); // add all new features as visible
{
firing = Boolean.TRUE;
findAllFeatures(true); // add all new features as visible
- changeSupport.firePropertyChange("changeSupport", null, null);
+ notifyFeaturesChanged();
firing = Boolean.FALSE;
}
}
}
@Override
firing = Boolean.FALSE;
}
}
}
@Override
- public List<SequenceFeature> findFeaturesAtColumn(SequenceI sequence, int column)
+ public void notifyFeaturesChanged()
+ {
+ changeSupport.firePropertyChange("changeSupport", null, null);
+ }
+
+ @Override
+ public List<SequenceFeature> findFeaturesAtColumn(SequenceI sequence,
+ int column)
{
/*
* include features at the position provided their feature type is
{
/*
* include features at the position provided their feature type is
@@
-402,8
+409,8
@@
public abstract class FeatureRendererModel
}
if (groupDisplayed)
{
}
if (groupDisplayed)
{
- Set<String> types = asq.getFeatures().getFeatureTypesForGroups(
- true, group);
+ Set<String> types = asq.getFeatures()
+ .getFeatureTypesForGroups(true, group);
for (String type : types)
{
if (!allfeatures.contains(type)) // or use HashSet and no test?
for (String type : types)
{
if (!allfeatures.contains(type)) // or use HashSet and no test?
@@
-482,6
+489,7
@@
public abstract class FeatureRendererModel
}
}
}
}
}
}
+
protected Boolean firing = Boolean.FALSE;
/**
protected Boolean firing = Boolean.FALSE;
/**
@@
-622,8
+630,9
@@
public abstract class FeatureRendererModel
*/
public boolean showFeatureOfType(String type)
{
*/
public boolean showFeatureOfType(String type)
{
- return type == null ? false : (av.getFeaturesDisplayed() == null ? true
- : av.getFeaturesDisplayed().isVisible(type));
+ return type == null ? false
+ : (av.getFeaturesDisplayed() == null ? true
+ : av.getFeaturesDisplayed().isVisible(type));
}
@Override
}
@Override
@@
-701,15
+710,15
@@
public abstract class FeatureRendererModel
}
/**
}
/**
- * Sets the priority order for features, with the highest priority (displayed on
- * top) at the start of the data array
+ * Sets the priority order for features, with the highest priority (displayed
+ * on top) at the start of the data array
*
* @param data
* an array of { Type, Colour, Filter, Boolean }
* @param visibleNew
* when true current featureDisplay list will be cleared
*
* @param data
* an array of { Type, Colour, Filter, Boolean }
* @param visibleNew
* when true current featureDisplay list will be cleared
- * @return true if any visible features have been reordered or recoloured, else
- * false (i.e. no need to repaint)
+ * @return true if any visible features have been reordered or recoloured,
+ * else false (i.e. no need to repaint)
*/
public boolean setFeaturePriority(FeatureSettingsBean[] data,
boolean visibleNew)
*/
public boolean setFeaturePriority(FeatureSettingsBean[] data,
boolean visibleNew)
@@
-993,8
+1002,7
@@
public abstract class FeatureRendererModel
*/
public boolean featureGroupNotShown(final SequenceFeature sequenceFeature)
{
*/
public boolean featureGroupNotShown(final SequenceFeature sequenceFeature)
{
- return featureGroups != null
- && sequenceFeature.featureGroup != null
+ return featureGroups != null && sequenceFeature.featureGroup != null
&& sequenceFeature.featureGroup.length() != 0
&& featureGroups.containsKey(sequenceFeature.featureGroup)
&& !featureGroups.get(sequenceFeature.featureGroup)
&& sequenceFeature.featureGroup.length() != 0
&& featureGroups.containsKey(sequenceFeature.featureGroup)
&& !featureGroups.get(sequenceFeature.featureGroup)
@@
-1022,9
+1030,9
@@
public abstract class FeatureRendererModel
List<String> visibleFeatures = getDisplayedFeatureTypes();
String[] visibleTypes = visibleFeatures
.toArray(new String[visibleFeatures.size()]);
List<String> visibleFeatures = getDisplayedFeatureTypes();
String[] visibleTypes = visibleFeatures
.toArray(new String[visibleFeatures.size()]);
- List<SequenceFeature> features = sequence.getFeatures().findFeatures(
- fromResNo, toResNo, visibleTypes);
-
+ List<SequenceFeature> features = sequence.getFeatures()
+ .findFeatures(fromResNo, toResNo, visibleTypes);
+
for (SequenceFeature sf : features)
{
if (!featureGroupNotShown(sf) && getColour(sf) != null)
for (SequenceFeature sf : features)
{
if (!featureGroupNotShown(sf) && getColour(sf) != null)
@@
-1084,8
+1092,7
@@
public abstract class FeatureRendererModel
* (checking type and isContactFeature as a fail-safe here, although
* currently they are guaranteed to match in this context)
*/
* (checking type and isContactFeature as a fail-safe here, although
* currently they are guaranteed to match in this context)
*/
- if (lastFeature != null
- && sf.getBegin() == lastFeature.getBegin()
+ if (lastFeature != null && sf.getBegin() == lastFeature.getBegin()
&& sf.getEnd() == lastFeature.getEnd()
&& sf.isContactFeature() == lastFeature.isContactFeature()
&& sf.getType().equals(lastFeature.getType()))
&& sf.getEnd() == lastFeature.getEnd()
&& sf.isContactFeature() == lastFeature.isContactFeature()
&& sf.getType().equals(lastFeature.getType()))
@@
-1115,7
+1122,8
@@
public abstract class FeatureRendererModel
}
@Override
}
@Override
- public void setFeatureFilter(String featureType, FeatureMatcherSetI filter)
+ public void setFeatureFilter(String featureType,
+ FeatureMatcherSetI filter)
{
if (filter == null || filter.isEmpty())
{
{
if (filter == null || filter.isEmpty())
{
@@
-1153,7
+1161,7
@@
public abstract class FeatureRendererModel
{
return null;
}
{
return null;
}
-
+
return fc.getColor(sf);
}
return fc.getColor(sf);
}
@@
-1227,25
+1235,25
@@
public abstract class FeatureRendererModel
* todo: direct lookup of CDS for peptide and vice-versa; for now,
* have to search through an unordered list of mappings for a candidate
*/
* todo: direct lookup of CDS for peptide and vice-versa; for now,
* have to search through an unordered list of mappings for a candidate
*/
- Mapping mapping = null;
+ SequenceToSequenceMapping mapping = null;
SequenceI mapFrom = null;
for (AlignedCodonFrame acf : mappings)
{
SequenceI mapFrom = null;
for (AlignedCodonFrame acf : mappings)
{
- mapping = acf.getMappingForSequence(sequence);
- if (mapping == null || !mapping.getMap().isTripletMap())
+ mapping = acf.getCoveringCodonMapping(ds);
+ if (mapping == null)
{
{
- continue; // we are only looking for 3:1 or 1:3 mappings
+ continue;
}
SearchResultsI sr = new SearchResults();
}
SearchResultsI sr = new SearchResults();
- acf.markMappedRegion(ds, pos, sr);
+ mapping.markMappedRegion(ds, pos, sr);
for (SearchResultMatchI match : sr.getResults())
{
int fromRes = match.getStart();
int toRes = match.getEnd();
mapFrom = match.getSequence();
for (SearchResultMatchI match : sr.getResults())
{
int fromRes = match.getStart();
int toRes = match.getEnd();
mapFrom = match.getSequence();
- List<SequenceFeature> fs = findFeaturesAtResidue(
- mapFrom, fromRes, toRes);
+ List<SequenceFeature> fs = findFeaturesAtResidue(mapFrom, fromRes,
+ toRes);
for (SequenceFeature sf : fs)
{
if (!found.contains(sf))
for (SequenceFeature sf : fs)
{
if (!found.contains(sf))
@@
-1290,8
+1298,9
@@
public abstract class FeatureRendererModel
}
}
}
}
}
}
-
- return new MappedFeatures(mapping, mapFrom, pos, residue, result);
+
+ return new MappedFeatures(mapping.getMapping(), mapFrom, pos, residue,
+ result);
}
@Override
}
@Override