/*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.9.0b2)
- * Copyright (C) 2015 The Jalview Authors
+ * Jalview - A Sequence Alignment Editor and Viewer ($$Version-Rel$$)
+ * Copyright (C) $$Year-Rel$$ The Jalview Authors
*
* This file is part of Jalview.
*
import jalview.datamodel.Alignment;
import jalview.datamodel.AlignmentI;
import jalview.datamodel.ColumnSelection;
-import jalview.datamodel.SearchResults;
-import jalview.datamodel.SearchResults.Match;
+import jalview.datamodel.SearchResultMatchI;
+import jalview.datamodel.SearchResultsI;
import jalview.datamodel.Sequence;
import jalview.datamodel.SequenceGroup;
import jalview.datamodel.SequenceI;
import jalview.gui.AlignViewport;
-import jalview.io.AppletFormatAdapter;
+import jalview.gui.JvOptionPane;
+import jalview.io.DataSourceType;
+import jalview.io.FileFormat;
+import jalview.io.FileFormatI;
import jalview.io.FormatAdapter;
import java.awt.Color;
import java.util.Arrays;
import java.util.List;
+import org.testng.annotations.BeforeClass;
import org.testng.annotations.Test;
public class MappingUtilsTest
{
+
+ @BeforeClass(alwaysRun = true)
+ public void setUpJvOptionPane()
+ {
+ JvOptionPane.setInteractiveMode(false);
+ JvOptionPane.setMockResponse(JvOptionPane.CANCEL_OPTION);
+ }
+
private AlignViewportI dnaView;
private AlignViewportI proteinView;
/*
* Check protein residue 12 maps to codon 5-7, 13 to codon 8-10
*/
- SearchResults sr = MappingUtils.buildSearchResults(aseq1, 12, acfList);
+ SearchResultsI sr = MappingUtils.buildSearchResults(aseq1, 12, acfList);
assertEquals(1, sr.getResults().size());
- Match m = sr.getResults().get(0);
+ SearchResultMatchI m = sr.getResults().get(0);
assertEquals(seq1.getDatasetSequence(), m.getSequence());
assertEquals(5, m.getStart());
assertEquals(7, m.getEnd());
/*
* Check protein residue 8 maps to [6, 8, 9]
*/
- SearchResults sr = MappingUtils.buildSearchResults(aseq1, 8, acfList);
+ SearchResultsI sr = MappingUtils.buildSearchResults(aseq1, 8, acfList);
assertEquals(2, sr.getResults().size());
- Match m = sr.getResults().get(0);
+ SearchResultMatchI m = sr.getResults().get(0);
assertEquals(seq1.getDatasetSequence(), m.getSequence());
assertEquals(6, m.getStart());
assertEquals(6, m.getEnd());
* viewport).
*/
AlignmentI cdna = loadAlignment(">Seq1\nACG\n>Seq2\nTGA\n>Seq3\nTAC\n",
- "FASTA");
+ FileFormat.Fasta);
cdna.setDataset(null);
AlignmentI protein = loadAlignment(">Seq1\nK\n>Seq2\nL\n>Seq3\nQ\n",
- "FASTA");
+ FileFormat.Fasta);
protein.setDataset(null);
AlignedCodonFrame acf = new AlignedCodonFrame();
MapList map = new MapList(new int[] { 1, 3 }, new int[] { 1, 1 }, 3, 1);
* @return
* @throws IOException
*/
- protected AlignmentI loadAlignment(final String data, String format)
+ protected AlignmentI loadAlignment(final String data, FileFormatI format)
throws IOException
{
AlignmentI a = new FormatAdapter().readFile(data,
- AppletFormatAdapter.PASTE, format);
+ DataSourceType.PASTE, format);
a.setDataset(null);
return a;
}
*/
AlignmentI cdna = loadAlignment(">Seq1/10-18\nAC-GctGtC-T\n"
+ ">Seq2/20-27\nTc-GA-G-T-Tc\n" + ">Seq3/30-38\nTtTT-AaCGg-\n",
- "FASTA");
+ FileFormat.Fasta);
cdna.setDataset(null);
AlignmentI protein = loadAlignment(
">Seq1/40-41\n-K-P\n>Seq2/50-51\nL--Q\n>Seq3/60-61\nG--S\n",
- "FASTA");
+ FileFormat.Fasta);
protein.setDataset(null);
// map first dna to first protein seq
* viewport).
*/
AlignmentI cdna = loadAlignment(
- ">Seq1\nACGGCA\n>Seq2\nTGACAG\n>Seq3\nTACGTA\n", "FASTA");
+ ">Seq1\nACGGCA\n>Seq2\nTGACAG\n>Seq3\nTACGTA\n",
+ FileFormat.Fasta);
cdna.setDataset(null);
AlignmentI protein = loadAlignment(">Seq1\nKA\n>Seq2\nLQ\n>Seq3\nQV\n",
- "FASTA");
+ FileFormat.Fasta);
protein.setDataset(null);
AlignedCodonFrame acf = new AlignedCodonFrame();
MapList map = new MapList(new int[] { 1, 6 }, new int[] { 1, 2 }, 3, 1);
*/
AlignmentI cdna = loadAlignment(
">Seq1\nA-CG-GC--AT-CA\n>Seq2\n-TG-AC-AG-T-AT\n>Seq3\n-T--ACG-TAAT-G\n",
- "FASTA");
+ FileFormat.Fasta);
cdna.setDataset(null);
AlignmentI protein = loadAlignment(
- ">Seq1\n-KA-S\n>Seq2\n--L-QY\n>Seq3\nQ-V-M\n", "FASTA");
+ ">Seq1\n-KA-S\n>Seq2\n--L-QY\n>Seq3\nQ-V-M\n", FileFormat.Fasta);
protein.setDataset(null);
AlignedCodonFrame acf = new AlignedCodonFrame();
MapList map = new MapList(new int[] { 1, 9 }, new int[] { 1, 3 }, 3, 1);