package jalview.gui;
import jalview.analysis.AlignmentUtils;
-import jalview.analysis.AlignmentUtils.MappingResult;
import jalview.analysis.AnnotationSorter.SequenceAnnotationOrder;
import jalview.analysis.NJTree;
import jalview.api.AlignViewportI;
* If one alignment is protein and one nucleotide, with at least one
* sequence name in common, offer to open a linked alignment.
*/
- if (getAlignment().isNucleotide() != al.isNucleotide())
+ if (AlignmentUtils.isMappable(al, getAlignment()))
{
- // TODO: JAL-845 try a bit harder to link up imported sequences
- final Set<String> sequenceNames = getAlignment().getSequenceNames();
- sequenceNames.retainAll(al.getSequenceNames());
- if (!sequenceNames.isEmpty()) // at least one sequence name in both
+ if (openLinkedAlignment(al, title))
{
- if (openLinkedAlignment(al, title))
- {
- return;
- }
+ return;
}
}
// TODO: JAL-407 regardless of above - identical sequences (based on ID and
}
/*
- * Try to find mappings for at least one sequence. Any mappings made will be
- * added to the protein alignment.
+ * Map sequences. At least one should get mapped as we have already passed
+ * the test for 'mappability'. Any mappings made will be added to the
+ * protein alignment.
*/
- MappingResult mapped = AlignmentUtils.mapProteinToCdna(protein, cdna);
- if (mapped != MappingResult.Mapped)
- {
- /*
- * No mapping possible - warn the user, but leave window open.
- */
- final String msg = JvSwingUtils.wrapTooltip(true,
- MessageManager.getString("label.mapping_failed"));
- JOptionPane.showInternalMessageDialog(Desktop.desktop, msg,
- MessageManager.getString("label.no_mappings"),
- JOptionPane.WARNING_MESSAGE);
- }
+ AlignmentUtils.mapProteinToCdna(protein, cdna);
try
{
: copyMe;
AlignmentI protein = proteinFrame.viewport.getAlignment();
protein.setCodonFrames(mappings);
+ proteinFrame.viewport.initComplementConsensus();
cdnaFrame.setVisible(true);
proteinFrame.setVisible(true);