import fr.orsay.lri.varna.models.rna.RNA;
import jalview.analysis.AlignSeq;
+import jalview.analysis.AlignmentUtils;
+import jalview.analysis.SeqsetUtils;
import jalview.datamodel.features.SequenceFeatures;
import jalview.datamodel.features.SequenceFeaturesI;
import jalview.util.Comparison;
{
// only copy the given annotation
AlignmentAnnotation newann = new AlignmentAnnotation(sqann[i]);
+ ContactMatrixI cm = seq.getContactMatrixFor(sqann[i]);
+ if (cm!=null)
+ {
+ addContactListFor(newann, cm);
+ }
addAlignmentAnnotation(newann);
}
}
// sequence-column mapping
datasetSequence.addAlignmentAnnotation(_aa);
- // transfer contact matrices
- ContactMatrixI cm = getContactMatrixFor(aa);
- if (cm != null)
- {
- datasetSequence.addContactListFor(_aa, cm);
+ if (_cmholder != null)
+ { // transfer contact matrices
+ ContactMatrixI cm = _cmholder.getContactMatrixFor(aa);
+ if (cm != null)
+ {
+ datasetSequence.addContactListFor(_aa, cm);
+ datasetSequence.addContactListFor(aa, cm);
+ }
}
}
}
+ // all matrices should have been transferred. so we clear the local holder
+ _cmholder=null;
}
return datasetSequence;
}
////
//// Contact Matrix Holder Boilerplate
////
- ContactMapHolderI cmholder = new ContactMapHolder();
+ ContactMapHolderI _cmholder = null;
+ private ContactMapHolderI getContactMapHolder()
+ {
+ if (datasetSequence!=null) {
+ return ((Sequence)datasetSequence).getContactMapHolder();
+ }
+ if (_cmholder==null)
+ {
+ _cmholder=new ContactMapHolder();
+ }
+ return _cmholder;
+ }
@Override
public Collection<ContactMatrixI> getContactMaps()
{
- return cmholder.getContactMaps();
+ return getContactMapHolder().getContactMaps();
}
@Override
public ContactMatrixI getContactMatrixFor(AlignmentAnnotation ann)
{
- return cmholder.getContactMatrixFor(ann);
+ return getContactMapHolder().getContactMatrixFor(ann);
}
@Override
public ContactListI getContactListFor(AlignmentAnnotation _aa, int column)
{
- return cmholder.getContactListFor(_aa, column);
+ return getContactMapHolder().getContactListFor(_aa, column);
}
@Override
public AlignmentAnnotation addContactList(ContactMatrixI cm)
{
- AlignmentAnnotation aa = cmholder.addContactList(cm);
+ AlignmentAnnotation aa;
+
+ if (datasetSequence != null)
+ {
+ aa = datasetSequence.addContactList(cm);
+ // clone the annotation for the local sequence
+ aa = new AlignmentAnnotation(aa);
+ aa.restrict(start, end);
+ aa.adjustForAlignment();
+ getContactMapHolder().addContactListFor(aa,cm);
+ addAlignmentAnnotation(aa);
+ return aa;
+ }
+
+ // construct new annotation for matrix on dataset sequence
+ aa = getContactMapHolder().addContactList(cm);
Annotation _aa[] = new Annotation[getLength()];
public void addContactListFor(AlignmentAnnotation annotation,
ContactMatrixI cm)
{
- cmholder.addContactListFor(annotation, cm);
+ getContactMapHolder().addContactListFor(annotation, cm);
}
}