sg.setEndRes(viewport.getAlignment().getWidth() - 1);
viewport.setSelectionGroup(sg);
viewport.sendSelection();
- alignPanel.paintAlignment(true);
+ // JAL-2034 - should delegate to
+ // alignPanel to decide if overview needs
+ // updating.
+ alignPanel.paintAlignment(false);
PaintRefresher.Refresh(alignPanel, viewport.getSequenceSetId());
}
viewport.setSelectionGroup(null);
alignPanel.getSeqPanel().seqCanvas.highlightSearchResults(null);
alignPanel.getIdPanel().getIdCanvas().searchResults = null;
- alignPanel.paintAlignment(true);
+ // JAL-2034 - should delegate to
+ // alignPanel to decide if overview needs
+ // updating.
+ alignPanel.paintAlignment(false);
PaintRefresher.Refresh(alignPanel, viewport.getSequenceSetId());
viewport.sendSelection();
}
{
sg.addOrRemove(viewport.getAlignment().getSequenceAt(i), false);
}
+ // JAL-2034 - should delegate to
+ // alignPanel to decide if overview needs
+ // updating.
alignPanel.paintAlignment(true);
PaintRefresher.Refresh(alignPanel, viewport.getSequenceSetId());
@Override
public void expandViews_actionPerformed(ActionEvent e)
{
- Desktop.instance.explodeViews(this);
+ Desktop.explodeViews(this);
}
/**
* @param source
* the database to show cross-references for
*/
- protected void showProductsFor(final SequenceI[] sel, final boolean _odna,
- final String source)
+ protected void showProductsFor(final SequenceI[] sel,
+ final boolean _odna, final String source)
{
Runnable foo = new Runnable()
{
AlignmentI dataset = alignment.getDataset() == null ? alignment
: alignment.getDataset();
boolean dna = alignment.isNucleotide();
- if (_odna!=dna)
+ if (_odna != dna)
{
System.err
.println("Conflict: showProducts for alignment originally "
+ " now searching for "
+ (dna ? "DNA" : "Protein") + " Context.");
}
- AlignmentI xrefs = new CrossRef(sel, dataset)
- .findXrefSequences(source, dna);
+ AlignmentI xrefs = new CrossRef(sel, dataset).findXrefSequences(
+ source, dna);
if (xrefs == null)
{
return;
AlignmentI xrefsAlignment = makeCrossReferencesAlignment(dataset,
xrefs);
-
- AlignFrame newFrame = new AlignFrame(xrefsAlignment, DEFAULT_WIDTH,
- DEFAULT_HEIGHT);
- if (Cache.getDefault("HIDE_INTRONS", true))
+ if (!dna)
{
- newFrame.hideFeatureColumns(SequenceOntologyI.EXON, false);
- }
- String newtitle = String.format("%s %s %s", MessageManager
- .getString(dna ? "label.proteins" : "label.nucleotides"),
- MessageManager.getString("label.for"), getTitle());
- newFrame.setTitle(newtitle);
-
- if (!Cache.getDefault(Preferences.ENABLE_SPLIT_FRAME, true))
- {
- /*
- * split frame display is turned off in preferences file
- */
- Desktop.addInternalFrame(newFrame, newtitle, DEFAULT_WIDTH,
- DEFAULT_HEIGHT);
- return; // via finally clause
+ xrefsAlignment = AlignmentUtils.makeCdsAlignment(
+ xrefsAlignment.getSequencesArray(), dataset, sel);
+ xrefsAlignment.alignAs(alignment);
}
/*
- * Make a copy of this alignment (sharing the same dataset
+ * If we are opening a splitframe, make a copy of this alignment (sharing the same dataset
* sequences). If we are DNA, drop introns and update mappings
*/
AlignmentI copyAlignment = null;
- final SequenceI[] sequenceSelection = AlignFrame.this.viewport
- .getSequenceSelection();
- boolean copyAlignmentIsAligned = false;
- if (dna)
+
+ if (Cache.getDefault(Preferences.ENABLE_SPLIT_FRAME, true))
{
- copyAlignment = AlignmentUtils.makeCdsAlignment(
- sequenceSelection, dataset, xrefsAlignment);
- if (copyAlignment.getHeight() == 0)
+ boolean copyAlignmentIsAligned = false;
+ if (dna)
{
- System.err.println("Failed to make CDS alignment");
- }
+ copyAlignment = AlignmentUtils.makeCdsAlignment(sel, dataset,
+ xrefsAlignment.getSequencesArray());
+ if (copyAlignment.getHeight() == 0)
+ {
+ System.err.println("Failed to make CDS alignment");
+ }
- /*
- * pending getting Embl transcripts to 'align',
- * we are only doing this for Ensembl
- */
- // TODO proper criteria for 'can align as cdna'
- if (DBRefSource.ENSEMBL.equalsIgnoreCase(source)
- || AlignmentUtils.looksLikeEnsembl(alignment))
+ /*
+ * pending getting Embl transcripts to 'align',
+ * we are only doing this for Ensembl
+ */
+ // TODO proper criteria for 'can align as cdna'
+ if (DBRefSource.ENSEMBL.equalsIgnoreCase(source)
+ || AlignmentUtils.looksLikeEnsembl(alignment))
+ {
+ copyAlignment.alignAs(alignment);
+ copyAlignmentIsAligned = true;
+ }
+ }
+ else
{
- copyAlignment.alignAs(alignment);
- copyAlignmentIsAligned = true;
+ copyAlignment = AlignmentUtils.makeCopyAlignment(sel,
+ xrefs.getSequencesArray(), dataset);
}
- }
- else
- {
- copyAlignment = AlignmentUtils.makeCopyAlignment(
- sequenceSelection, xrefs.getSequencesArray());
- }
- copyAlignment.setGapCharacter(AlignFrame.this.viewport
- .getGapCharacter());
+ copyAlignment.setGapCharacter(AlignFrame.this.viewport
+ .getGapCharacter());
- StructureSelectionManager ssm = StructureSelectionManager
- .getStructureSelectionManager(Desktop.instance);
+ StructureSelectionManager ssm = StructureSelectionManager
+ .getStructureSelectionManager(Desktop.instance);
- /*
- * register any new mappings for sequence mouseover etc
- * (will not duplicate any previously registered mappings)
- */
- ssm.registerMappings(dataset.getCodonFrames());
+ /*
+ * register any new mappings for sequence mouseover etc
+ * (will not duplicate any previously registered mappings)
+ */
+ ssm.registerMappings(dataset.getCodonFrames());
- if (copyAlignment.getHeight() <= 0)
- {
- System.err.println("No Sequences generated for xRef type "
- + source);
- return;
+ if (copyAlignment.getHeight() <= 0)
+ {
+ System.err.println("No Sequences generated for xRef type "
+ + source);
+ return;
+ }
+ /*
+ * align protein to dna
+ */
+ if (dna && copyAlignmentIsAligned)
+ {
+ xrefsAlignment.alignAs(copyAlignment);
+ }
+ else
+ {
+ /*
+ * align cdna to protein - currently only if
+ * fetching and aligning Ensembl transcripts!
+ */
+ // TODO: generalise for other sources of locus/transcript/cds data
+ if (dna && DBRefSource.ENSEMBL.equalsIgnoreCase(source))
+ {
+ copyAlignment.alignAs(xrefsAlignment);
+ }
+ }
}
/*
- * align protein to dna
+ * build AlignFrame(s) according to available alignment data
*/
- if (dna && copyAlignmentIsAligned)
+ AlignFrame newFrame = new AlignFrame(xrefsAlignment,
+ DEFAULT_WIDTH, DEFAULT_HEIGHT);
+ if (Cache.getDefault("HIDE_INTRONS", true))
{
- xrefsAlignment.alignAs(copyAlignment);
+ newFrame.hideFeatureColumns(SequenceOntologyI.EXON, false);
}
- else
+ String newtitle = String.format("%s %s %s", MessageManager
+ .getString(dna ? "label.proteins" : "label.nucleotides"),
+ MessageManager.getString("label.for"), getTitle());
+ newFrame.setTitle(newtitle);
+
+ if (copyAlignment == null)
{
/*
- * align cdna to protein - currently only if
- * fetching and aligning Ensembl transcripts!
+ * split frame display is turned off in preferences file
*/
- if (DBRefSource.ENSEMBL.equalsIgnoreCase(source))
- {
- copyAlignment.alignAs(xrefsAlignment);
- }
+ Desktop.addInternalFrame(newFrame, newtitle, DEFAULT_WIDTH,
+ DEFAULT_HEIGHT);
+ return; // via finally clause
}
-
AlignFrame copyThis = new AlignFrame(copyAlignment,
AlignFrame.DEFAULT_WIDTH, AlignFrame.DEFAULT_HEIGHT);
copyThis.setTitle(AlignFrame.this.getTitle());
* Makes an alignment containing the given sequences, and adds them to the
* given dataset, which is also set as the dataset for the new alignment
*
+ * TODO: refactor to DatasetI method
+ *
* @param dataset
* @param seqs
* @return