+/*
+ * Jalview - A Sequence Alignment Editor and Viewer ($$Version-Rel$$)
+ * Copyright (C) $$Year-Rel$$ The Jalview Authors
+ *
+ * This file is part of Jalview.
+ *
+ * Jalview is free software: you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation, either version 3
+ * of the License, or (at your option) any later version.
+ *
+ * Jalview is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty
+ * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ * PURPOSE. See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
+ */
package jalview.io;
import static org.testng.Assert.assertEquals;
import org.testng.annotations.BeforeClass;
import org.testng.annotations.Test;
-import jalview.bin.Cache;
+import jalview.bin.Console;
import jalview.datamodel.DBRefEntry;
import jalview.datamodel.Mapping;
import jalview.datamodel.Sequence.DBModList;
@BeforeClass(alwaysRun = true)
public void setUp()
{
- Cache.initLogger();
+ Console.initLogger();
}
/**
{
assertEquals((ranges = map.getFromRanges()).size(), 1);
assertEquals(ranges.get(0)[0], 1579);
- assertEquals(ranges.get(0)[1], 2934);
+ assertEquals(ranges.get(0)[1], 2931); // excludes stop 2934
assertEquals((ranges = map.getToRanges()).size(), 1);
assertEquals(ranges.get(0)[0], 1);
assertEquals(ranges.get(0)[1], 451);
{
assertEquals((ranges = map.getFromRanges()).size(), 1);
assertEquals(ranges.get(0)[0], 2928);
- assertEquals(ranges.get(0)[1], 3992);
+ assertEquals(ranges.get(0)[1], 3989); // excludes stop 3992
assertEquals((ranges = map.getToRanges()).size(), 1);
assertEquals(ranges.get(0)[0], 1);
assertEquals(ranges.get(0)[1], 354);
{
assertEquals((ranges = map.getFromRanges()).size(), 1);
assertEquals(ranges.get(0)[0], 4054);
- assertEquals(ranges.get(0)[1], 4848);
+ assertEquals(ranges.get(0)[1], 4845); // excludes stop 4848
assertEquals((ranges = map.getToRanges()).size(), 1);
assertEquals(ranges.get(0)[0], 1);
assertEquals(ranges.get(0)[1], 264);
assertEquals(ranges.get(0)[0], 7022);
assertEquals(ranges.get(0)[1], 7502);
assertEquals(ranges.get(1)[0], 1);
- assertEquals(ranges.get(1)[1], 437);
+ assertEquals(ranges.get(1)[1], 434); // excludes stop at 437
assertEquals((ranges = map.getToRanges()).size(), 1);
assertEquals(ranges.get(0)[0], 1);
assertEquals(ranges.get(0)[1], 305);
// complement(488..1480)
assertEquals((ranges = map.getFromRanges()).size(), 1);
assertEquals(ranges.get(0)[0], 1480);
- assertEquals(ranges.get(0)[1], 488);
+ assertEquals(ranges.get(0)[1], 491); // // excludes stop at 488
assertEquals((ranges = map.getToRanges()).size(), 1);
assertEquals(ranges.get(0)[0], 1);
assertEquals(ranges.get(0)[1], 330);
}
assertEquals(uniprotCount, 8);
}
+
/**
* A fairly tough test, using J03321 (circular DNA), which has 8 CDS features,
* one of them reverse strand
FileParse fp = new FileParse(dataFile, DataSourceType.FILE);
EmblFlatFile parser = new EmblFlatFile(fp, "EmblTest");
List<SequenceI> seqs = parser.getSeqs();
- assertTrue(seqs.get(0).getSequenceAsString().indexOf("u")>-1);
+ assertTrue(seqs.get(0).getSequenceAsString().indexOf("u") > -1);
}
@Test(groups = "Functional")
* dna should have dbref to itself, and to inferred EMBLCDSPROTEIN:QHD43415.1
*/
assertEquals(dbrefs.size(), 2);
-
+
// dbref to self
DBRefEntry dbref = dbrefs.get(0);
assertEquals(dbref.getSource(), "EMBLTEST");
assertEquals(map.getToHighest(), 40);
assertEquals(map.getFromRatio(), 1);
assertEquals(map.getToRatio(), 1);
-
+
// dbref to inferred EMBLCDSPROTEIN:
dbref = dbrefs.get(1);
assertEquals(dbref.getSource(), "EMBLCDSPROTEIN");
assertSame(exons, EmblFlatFile.adjustForProteinLength(6, exons));
// patch from JAL-3725 in EmblXmlSource propagated to Flatfile
- // match if we assume exons include stop codon not in protein:
+ // match if we assume exons include stop codon not in protein:
int[] truncated = EmblFlatFile.adjustForProteinLength(5, exons);
assertEquals(Arrays.toString(truncated), "[11, 15, 21, 25, 31, 35]");
-
+
// truncate last exon by 6bp
truncated = EmblFlatFile.adjustForProteinLength(4, exons);
- assertEquals(Arrays.toString(truncated),"[11, 15, 21, 25, 31, 32]");
+ assertEquals(Arrays.toString(truncated), "[11, 15, 21, 25, 31, 32]");
// remove last exon and truncate preceding by 1bp (so 3bp in total)
truncated = EmblFlatFile.adjustForProteinLength(3, exons);
- assertEquals(Arrays.toString(truncated),"[11, 15, 21, 24]");
+ assertEquals(Arrays.toString(truncated), "[11, 15, 21, 24]");
// exact removal of exon case:
exons = new int[] { 11, 15, 21, 27, 33, 38 }; // 18 bp
public void testRemoveQuotes()
{
assertNull(EmblFlatFile.removeQuotes(null));
- assertEquals(EmblFlatFile.removeQuotes("No quotes here"), "No quotes here");
- assertEquals(EmblFlatFile.removeQuotes("\"Enclosing quotes\""), "Enclosing quotes");
- assertEquals(EmblFlatFile.removeQuotes("\"Escaped \"\"quotes\"\" example\""), "Escaped \"quotes\" example");
+ assertEquals(EmblFlatFile.removeQuotes("No quotes here"),
+ "No quotes here");
+ assertEquals(EmblFlatFile.removeQuotes("\"Enclosing quotes\""),
+ "Enclosing quotes");
+ assertEquals(
+ EmblFlatFile.removeQuotes("\"Escaped \"\"quotes\"\" example\""),
+ "Escaped \"quotes\" example");
}
}