import jalview.api.AlignViewportI;
import jalview.api.AlignmentViewPanel;
import jalview.api.FeatureSettingsControllerI;
-import jalview.api.FeatureSettingsI;
+import jalview.api.FeatureSettingsModelI;
import jalview.api.SplitContainerI;
import jalview.api.ViewStyleI;
import jalview.api.analysis.ScoreModelI;
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;
if (xrefs != null)
{
/*
- * figure out colour scheme if any to apply to features
+ * get display scheme (if any) to apply to features
*/
- ASequenceFetcher sftch = new SequenceFetcher();
- List<DbSourceProxy> proxies = sftch.getSourceProxy(source);
- FeatureSettingsI featureColourScheme = null;
- for (DbSourceProxy proxy : proxies)
- {
- FeatureSettingsI preferredColours = proxy
- .getFeatureColourScheme();
- if (preferredColours != null)
- {
- featureColourScheme = preferredColours;
- break;
- }
- }
- Alignment al = makeCrossReferencesAlignment(
+ FeatureSettingsModelI featureColourScheme = new SequenceFetcher()
+ .getFeatureColourScheme(source);
+
+ AlignmentI al = makeCrossReferencesAlignment(
alignment.getDataset(), xrefs);
AlignFrame newFrame = new AlignFrame(al, DEFAULT_WIDTH,
}
/**
- * Makes an alignment containing the given sequences; the sequences are
- * added to the given alignment dataset, and the dataset is set on (shared
- * by) the new alignment
+ * Makes an alignment containing the given sequences. If this is of the
+ * same type as the given dataset (nucleotide/protein), then the new
+ * alignment shares the same dataset, and its dataset sequences are added
+ * to it. Otherwise a new dataset sequence is created for the
+ * cross-references.
*
* @param dataset
* @param seqs
* @return
*/
- protected Alignment makeCrossReferencesAlignment(Alignment dataset,
- Alignment seqs)
+ protected AlignmentI makeCrossReferencesAlignment(AlignmentI dataset,
+ AlignmentI seqs)
{
+ boolean sameType = dataset.isNucleotide() == seqs.isNucleotide();
+
SequenceI[] sprods = new SequenceI[seqs.getHeight()];
for (int s = 0; s < sprods.length; s++)
{
sprods[s] = (seqs.getSequenceAt(s)).deriveSequence();
- if (dataset.getSequences() == null
- || !dataset.getSequences().contains(
- sprods[s].getDatasetSequence()))
+ if (sameType)
{
- dataset.addSequence(sprods[s].getDatasetSequence());
+ if (dataset.getSequences() == null
+ || !dataset.getSequences().contains(
+ sprods[s].getDatasetSequence()))
+ {
+ dataset.addSequence(sprods[s].getDatasetSequence());
+ }
}
sprods[s].updatePDBIds();
}
Alignment al = new Alignment(sprods);
- al.setDataset(dataset);
+ if (sameType)
+ {
+ al.setDataset((Alignment) dataset);
+ }
+ else
+ {
+ al.createDatasetAlignment();
+ }
return al;
}