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.datamodel.AlignmentOrder;
import jalview.datamodel.AlignmentView;
import jalview.datamodel.ColumnSelection;
+import jalview.datamodel.DBRefSource;
import jalview.datamodel.HiddenSequences;
import jalview.datamodel.PDBEntry;
import jalview.datamodel.SeqCigar;
*/
ASequenceFetcher sftch = new SequenceFetcher();
List<DbSourceProxy> proxies = sftch.getSourceProxy(source);
- FeatureSettingsI featureColourScheme = null;
+ FeatureSettingsModelI featureColourScheme = null;
for (DbSourceProxy proxy : proxies)
{
- FeatureSettingsI preferredColours = proxy
+ FeatureSettingsModelI preferredColours = proxy
.getFeatureColourScheme();
if (preferredColours != null)
{
Alignment al = makeCrossReferencesAlignment(
alignment.getDataset(), xrefs);
- /*
- * Copy dna-to-protein mappings to new alignment
- */
- // TODO 1: no mappings are set up for EMBL product
- // TODO 2: if they were, should add them to protein alignment, not
- // dna
- // List<AlignedCodonFrame> cf = xrefs.getCodonFrames();
- // for (AlignedCodonFrame acf : cf)
- // {
- // al.addCodonFrame(acf);
- // }
AlignFrame newFrame = new AlignFrame(al, DEFAULT_WIDTH,
DEFAULT_HEIGHT);
String newtitle = String.format("%s %s %s",
if (dna)
{
copyAlignment = AlignmentUtils.makeCdsAlignment(
- sequenceSelection, cf);
+ sequenceSelection, cf, alignment);
+ if (copyAlignment.getHeight() == 0)
+ {
+ System.err.println("Failed to make CDS alignment");
+ }
al.getCodonFrames().clear();
al.getCodonFrames().addAll(cf);
}
sequenceSelection));
copyAlignment.getCodonFrames().addAll(cf);
}
+ copyAlignment.setGapCharacter(AlignFrame.this.viewport
+ .getGapCharacter());
StructureSelectionManager ssm = StructureSelectionManager
.getStructureSelectionManager(Desktop.instance);
ssm.registerMappings(cf);
copyAlignment.addSequence(peer);
}
- /*
- * align protein to dna
- */
- // TODO needs debugging
- // if (dna)
- // {
- // al.alignAs(copyAlignment);
- // }
- // else
- // {
- // copyAlignment.alignAs(al);
- // }
-
- AlignFrame copyThis = new AlignFrame(copyAlignment,
- AlignFrame.DEFAULT_WIDTH, AlignFrame.DEFAULT_HEIGHT);
- copyThis.setTitle(AlignFrame.this.getTitle());
-
- boolean showSequenceFeatures = viewport
- .isShowSequenceFeatures();
- newFrame.setShowSeqFeatures(showSequenceFeatures);
- copyThis.setShowSeqFeatures(showSequenceFeatures);
- FeatureRenderer myFeatureStyling = alignPanel.getSeqPanel().seqCanvas
- .getFeatureRenderer();
-
- /*
- * copy feature rendering settings to split frame
- */
- newFrame.alignPanel.getSeqPanel().seqCanvas
- .getFeatureRenderer().transferSettings(
- myFeatureStyling);
- copyThis.alignPanel.getSeqPanel().seqCanvas
- .getFeatureRenderer().transferSettings(
- myFeatureStyling);
+ if (copyAlignment.getHeight() > 0)
+ {
+ /*
+ * align protein to dna
+ */
+ // FIXME what if the dna is not aligned :-O
+ if (dna)
+ {
+ al.alignAs(copyAlignment);
+ }
+ else
+ {
+ /*
+ * align cdna to protein - currently only if
+ * fetching and aligning Ensembl transcripts!
+ */
+ if (DBRefSource.ENSEMBL.equalsIgnoreCase(source))
+ {
+ copyAlignment.alignAs(al);
+ }
+ }
- /*
- * apply 'database source' feature configuration
- * if any was found
- */
- newFrame.getViewport()
- .applyFeaturesStyle(featureColourScheme);
- copyThis.getViewport()
- .applyFeaturesStyle(featureColourScheme);
-
- SplitFrame sf = new SplitFrame(dna ? copyThis : newFrame,
- dna ? newFrame : copyThis);
- newFrame.setVisible(true);
- copyThis.setVisible(true);
- String linkedTitle = MessageManager
- .getString("label.linked_view_title");
- Desktop.addInternalFrame(sf, linkedTitle, -1, -1);
- sf.adjustDivider();
+ AlignFrame copyThis = new AlignFrame(copyAlignment,
+ AlignFrame.DEFAULT_WIDTH, AlignFrame.DEFAULT_HEIGHT);
+ copyThis.setTitle(AlignFrame.this.getTitle());
+
+ boolean showSequenceFeatures = viewport
+ .isShowSequenceFeatures();
+ newFrame.setShowSeqFeatures(showSequenceFeatures);
+ copyThis.setShowSeqFeatures(showSequenceFeatures);
+ FeatureRenderer myFeatureStyling = alignPanel.getSeqPanel().seqCanvas
+ .getFeatureRenderer();
+
+ /*
+ * copy feature rendering settings to split frame
+ */
+ newFrame.alignPanel.getSeqPanel().seqCanvas
+ .getFeatureRenderer().transferSettings(
+ myFeatureStyling);
+ copyThis.alignPanel.getSeqPanel().seqCanvas
+ .getFeatureRenderer().transferSettings(
+ myFeatureStyling);
+
+ /*
+ * apply 'database source' feature configuration
+ * if any was found
+ */
+ // TODO is this the feature colouring for the original
+ // alignment or the fetched xrefs? either could be Ensembl
+ newFrame.getViewport().applyFeaturesStyle(
+ featureColourScheme);
+ copyThis.getViewport().applyFeaturesStyle(
+ featureColourScheme);
+
+ SplitFrame sf = new SplitFrame(dna ? copyThis : newFrame,
+ dna ? newFrame : copyThis);
+ newFrame.setVisible(true);
+ copyThis.setVisible(true);
+ String linkedTitle = MessageManager
+ .getString("label.linked_view_title");
+ Desktop.addInternalFrame(sf, linkedTitle, -1, -1);
+ sf.adjustDivider();
+ }
}
else
{
}
/**
- * @param alignment
- * @param prods
+ * 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
+ *
+ * @param dataset
+ * @param seqs
* @return
*/
protected Alignment makeCrossReferencesAlignment(Alignment dataset,
- Alignment prods)
+ Alignment seqs)
{
- SequenceI[] sprods = new SequenceI[prods.getHeight()];
+ SequenceI[] sprods = new SequenceI[seqs.getHeight()];
for (int s = 0; s < sprods.length; s++)
{
- sprods[s] = (prods.getSequenceAt(s)).deriveSequence();
+ sprods[s] = (seqs.getSequenceAt(s)).deriveSequence();
if (dataset.getSequences() == null
|| !dataset.getSequences().contains(
sprods[s].getDatasetSequence()))