*/
package jalview.datamodel;
-import jalview.analysis.AlignSeq;
-import jalview.datamodel.features.SequenceFeatures;
-import jalview.datamodel.features.SequenceFeaturesI;
-import jalview.util.Comparison;
-import jalview.util.DBRefUtils;
-import jalview.util.MapList;
-import jalview.util.StringUtils;
-
import java.util.ArrayList;
import java.util.Arrays;
import java.util.BitSet;
+import java.util.Collection;
import java.util.Collections;
import java.util.Enumeration;
import java.util.Iterator;
import java.util.Vector;
import fr.orsay.lri.varna.models.rna.RNA;
+import jalview.analysis.AlignSeq;
+import jalview.datamodel.features.SequenceFeatures;
+import jalview.datamodel.features.SequenceFeaturesI;
+import jalview.util.Comparison;
+import jalview.util.DBRefUtils;
+import jalview.util.MapList;
+import jalview.util.StringUtils;
/**
*
}
/**
- * DOCUMENT ME!
+ * Answers the sequence name, with '/start-end' appended if jvsuffix is true
*
- * @return DOCUMENT ME!
+ * @return
*/
@Override
public String getDisplayId(boolean jvsuffix)
{
- StringBuffer result = new StringBuffer(name);
- if (jvsuffix)
+ if (!jvsuffix)
{
- result.append("/" + start + "-" + end);
+ return name;
}
+ StringBuilder result = new StringBuilder(name);
+ result.append("/").append(start).append("-").append(end);
return result.toString();
}
public void setStart(int start)
{
this.start = start;
+ sequenceChanged();
}
/**
@Override
public void addDBRef(DBRefEntry entry)
{
+ // TODO JAL-3980 maintain as sorted list
if (datasetSequence != null)
{
datasetSequence.addDBRef(entry);
{
dbrefs = new DBModList<>();
}
+ // TODO JAL-3979 LOOK UP RATHER THAN SWEEP FOR EFFICIENCY
for (int ib = 0, nb = dbrefs.size(); ib < nb; ib++)
{
_aa.adjustForAlignment(); // uses annotation's own record of
// sequence-column mapping
datasetSequence.addAlignmentAnnotation(_aa);
+
+ // transfer contact matrices
+ ContactMatrixI cm = getContactMatrixFor(aa);
+ if (cm != null)
+ {
+ datasetSequence.addContactListFor(_aa, cm);
+ }
}
}
}
public List<AlignmentAnnotation> getAlignmentAnnotations(String calcId,
String label)
{
+ return getAlignmentAnnotations(calcId, label, null, true);
+ }
+
+ @Override
+ public List<AlignmentAnnotation> getAlignmentAnnotations(String calcId,
+ String label, String description)
+ {
+ return getAlignmentAnnotations(calcId, label, description, false);
+ }
+
+ private List<AlignmentAnnotation> getAlignmentAnnotations(String calcId,
+ String label, String description, boolean ignoreDescription)
+ {
List<AlignmentAnnotation> result = new ArrayList<>();
if (this.annotation != null)
{
for (AlignmentAnnotation ann : annotation)
{
- if (ann.calcId != null && ann.calcId.equals(calcId)
- && ann.label != null && ann.label.equals(label))
+ if ((ann.calcId != null && ann.calcId.equals(calcId))
+ && (ann.label != null && ann.label.equals(label))
+ && ((ignoreDescription && description == null)
+ || (ann.description != null
+ && ann.description.equals(description))))
+
{
result.add(ann);
}
List<SequenceFeature> result = getFeatures().findFeatures(startPos,
endPos, types);
- if (datasetSequence != null)
- {
- result = datasetSequence.getFeatures().findFeatures(startPos, endPos,
- types);
- }
- else
- {
- result = sequenceFeatureStore.findFeatures(startPos, endPos, types);
- }
/*
* if end column is gapped, endPos may be to the right,
// otherwise, sequence was completely hidden
return 0;
}
+
+ ////
+ //// Contact Matrix Holder Boilerplate
+ ////
+ ContactMapHolderI cmholder = new ContactMapHolder();
+
+ @Override
+ public Collection<ContactMatrixI> getContactMaps()
+ {
+ return cmholder.getContactMaps();
+ }
+
+ @Override
+ public ContactMatrixI getContactMatrixFor(AlignmentAnnotation ann)
+ {
+ return cmholder.getContactMatrixFor(ann);
+ }
+
+ @Override
+ public ContactListI getContactListFor(AlignmentAnnotation _aa, int column)
+ {
+ return cmholder.getContactListFor(_aa, column);
+ }
+
+ @Override
+ public AlignmentAnnotation addContactList(ContactMatrixI cm)
+ {
+ AlignmentAnnotation aa = cmholder.addContactList(cm);
+
+ Annotation _aa[] = new Annotation[getLength()];
+ Annotation dummy = new Annotation(0.0f);
+ for (int i = 0; i < _aa.length; _aa[i++] = dummy)
+ {
+ ;
+ }
+ aa.annotations = _aa;
+ aa.setSequenceRef(this);
+ aa.createSequenceMapping(this, getStart(), false);
+ addAlignmentAnnotation(aa);
+ return aa;
+ }
+
+ @Override
+ public void addContactListFor(AlignmentAnnotation annotation,
+ ContactMatrixI cm)
+ {
+ cmholder.addContactListFor(annotation, cm);
+ }
}