X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;ds=sidebyside;f=src%2Fjalview%2Fdatamodel%2FSequenceFeature.java;h=ba7412c7f132045e9c01c20687d37e58d69c45be;hb=6ec47c00025dbeb48dba5f5db77754ec50b7a6b5;hp=045bbbdbc9dcf3e5ccc189e59c59d1e59f638899;hpb=b9d3d1f71c6a8aee09cd23e1303b062cbe43a239;p=jalview.git diff --git a/src/jalview/datamodel/SequenceFeature.java b/src/jalview/datamodel/SequenceFeature.java index 045bbbd..ba7412c 100755 --- a/src/jalview/datamodel/SequenceFeature.java +++ b/src/jalview/datamodel/SequenceFeature.java @@ -58,9 +58,9 @@ public class SequenceFeature implements FeatureLocationI private static final String ATTRIBUTES = "ATTRIBUTES"; /* - * type, begin, end, featureGroup are final to ensure that - * the integrity of SequenceFeatures data store can't be - * broken by direct update of these fields + * type, begin, end, featureGroup, score and contactFeature are final + * to ensure that the integrity of SequenceFeatures data store + * can't be broken by direct update of these fields */ public final String type; @@ -72,6 +72,8 @@ public class SequenceFeature implements FeatureLocationI public final float score; + private final boolean contactFeature; + public String description; /* @@ -107,12 +109,7 @@ public class SequenceFeature implements FeatureLocationI public SequenceFeature(String theType, String theDesc, int theBegin, int theEnd, String group) { - this.type = theType; - this.description = theDesc; - this.begin = theBegin; - this.end = theEnd; - this.featureGroup = group; - this.score = NO_SCORE; + this(theType, theDesc, theBegin, theEnd, NO_SCORE, group); } /** @@ -134,21 +131,28 @@ public class SequenceFeature implements FeatureLocationI this.end = theEnd; this.featureGroup = group; this.score = theScore; + + /* + * for now, only "Disulfide/disulphide bond" is treated as a contact feature + */ + this.contactFeature = "disulfide bond".equalsIgnoreCase(type) + || "disulphide bond".equalsIgnoreCase(type); } /** * A copy constructor that allows the value of final fields to be 'modified' * * @param sf + * @param newType * @param newBegin * @param newEnd * @param newGroup * @param newScore */ - public SequenceFeature(SequenceFeature sf, int newBegin, int newEnd, - String newGroup, float newScore) + public SequenceFeature(SequenceFeature sf, String newType, int newBegin, + int newEnd, String newGroup, float newScore) { - this(sf.getType(), sf.getDescription(), newBegin, newEnd, newScore, + this(newType, sf.getDescription(), newBegin, newEnd, newScore, newGroup); if (sf.otherDetails != null) @@ -170,6 +174,21 @@ public class SequenceFeature implements FeatureLocationI } /** + * A copy constructor that allows the value of final fields to be 'modified' + * + * @param sf + * @param newBegin + * @param newEnd + * @param newGroup + * @param newScore + */ + public SequenceFeature(SequenceFeature sf, int newBegin, int newEnd, + String newGroup, float newScore) + { + this(sf, sf.getType(), newBegin, newEnd, newGroup, newScore); + } + + /** * Two features are considered equal if they have the same type, group, * description, start, end, phase, strand, and (if present) 'Name', ID' and * 'Parent' attributes. @@ -504,13 +523,7 @@ public class SequenceFeature implements FeatureLocationI @Override public boolean isContactFeature() { - // TODO abstract one day to a FeatureType class - if ("disulfide bond".equalsIgnoreCase(type) - || "disulphide bond".equalsIgnoreCase(type)) - { - return true; - } - return false; + return contactFeature; } /**