From 43699f9bc6ba2f390d3652f69b6db8975ff727c0 Mon Sep 17 00:00:00 2001 From: hansonr Date: Tue, 29 Jan 2019 12:52:02 -0600 Subject: [PATCH] test package fix for List DBrefs (untested) --- test/jalview/analysis/AlignmentUtilsTests.java | 36 +++--- test/jalview/analysis/CrossRefTest.java | 64 +++++----- test/jalview/datamodel/AlignmentTest.java | 16 +-- test/jalview/datamodel/SequenceTest.java | 72 ++++++----- test/jalview/ext/ensembl/EnsemblXrefTest.java | 17 +-- test/jalview/gui/StructureChooserTest.java | 8 +- test/jalview/io/vcf/VCFLoaderTest.java | 6 +- .../structure/StructureSelectionManagerTest.java | 2 +- test/jalview/util/DBRefUtilsTest.java | 61 +++++----- test/jalview/util/JSONUtilsTest.java | 8 +- test/jalview/ws/dbsources/EmblSourceTest.java | 126 ++++++++++---------- test/jalview/ws/dbsources/RemoteFormatTest.java | 2 +- test/jalview/ws/dbsources/UniprotTest.java | 2 +- test/jalview/ws/seqfetcher/DbRefFetcherTest.java | 14 +-- 14 files changed, 233 insertions(+), 201 deletions(-) diff --git a/test/jalview/analysis/AlignmentUtilsTests.java b/test/jalview/analysis/AlignmentUtilsTests.java index a7a7d34..713d7a7 100644 --- a/test/jalview/analysis/AlignmentUtilsTests.java +++ b/test/jalview/analysis/AlignmentUtilsTests.java @@ -51,6 +51,7 @@ import jalview.io.FormatAdapter; import jalview.io.gff.SequenceOntologyI; import jalview.util.MapList; import jalview.util.MappingUtils; +import jalview.ws.params.InvalidArgumentException; import java.io.IOException; import java.util.ArrayList; @@ -974,7 +975,12 @@ public class AlignmentUtilsTests assertTrue(AlignmentUtils.haveCrossRef(seq2, seq1)); // now the other way round - seq1.setDBRefs(null); + try { + seq1.setDBRefs(null); + } catch (InvalidArgumentException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } seq2.addDBRef(new DBRefEntry("EMBL", "1", "A12345")); assertTrue(AlignmentUtils.haveCrossRef(seq1, seq2)); assertTrue(AlignmentUtils.haveCrossRef(seq2, seq1)); @@ -1052,11 +1058,11 @@ public class AlignmentUtilsTests DBRefEntry dna1xref = new DBRefEntry("UNIPROT", "ENSEMBL", "pep1", new Mapping(mapfordna1)); dna1.addDBRef(dna1xref); - assertEquals(2, dna1.getDBRefs().length); // to self and to pep1 + assertEquals(2, dna1.getDBRefs().size()); // to self and to pep1 DBRefEntry dna2xref = new DBRefEntry("UNIPROT", "ENSEMBL", "pep2", new Mapping(mapfordna2)); dna2.addDBRef(dna2xref); - assertEquals(2, dna2.getDBRefs().length); // to self and to pep2 + assertEquals(2, dna2.getDBRefs().size()); // to self and to pep2 /* * execute method under test: @@ -1084,8 +1090,8 @@ public class AlignmentUtilsTests * verify CDS has a dbref with mapping to peptide */ assertNotNull(cds1Dss.getDBRefs()); - assertEquals(2, cds1Dss.getDBRefs().length); - dbref = cds1Dss.getDBRefs()[0]; + assertEquals(2, cds1Dss.getDBRefs().size()); + dbref = cds1Dss.getDBRefs().get(0); assertEquals(dna1xref.getSource(), dbref.getSource()); // version is via ensembl's primary ref assertEquals(dna1xref.getVersion(), dbref.getVersion()); @@ -1101,8 +1107,8 @@ public class AlignmentUtilsTests */ assertNotNull(pep1.getDBRefs()); // FIXME pep1.getDBRefs() is 1 - is that the correct behaviour ? - assertEquals(2, pep1.getDBRefs().length); - dbref = pep1.getDBRefs()[1]; + assertEquals(2, pep1.getDBRefs().size()); + dbref = pep1.getDBRefs().get(1); assertEquals("ENSEMBL", dbref.getSource()); assertEquals("0", dbref.getVersion()); assertEquals("CDS|dna1", dbref.getAccessionId()); @@ -1113,14 +1119,14 @@ public class AlignmentUtilsTests /* * verify cDNA has added a dbref with mapping to CDS */ - assertEquals(3, dna1.getDBRefs().length); - DBRefEntry dbRefEntry = dna1.getDBRefs()[2]; + assertEquals(3, dna1.getDBRefs().size()); + DBRefEntry dbRefEntry = dna1.getDBRefs().get(2); assertSame(cds1Dss, dbRefEntry.getMap().getTo()); MapList dnaToCdsMapping = new MapList(new int[] { 4, 6, 10, 12 }, new int[] { 1, 6 }, 1, 1); assertEquals(dnaToCdsMapping, dbRefEntry.getMap().getMap()); - assertEquals(3, dna2.getDBRefs().length); - dbRefEntry = dna2.getDBRefs()[2]; + assertEquals(3, dna2.getDBRefs().size()); + dbRefEntry = dna2.getDBRefs().get(2); assertSame(cds2Dss, dbRefEntry.getMap().getTo()); dnaToCdsMapping = new MapList(new int[] { 1, 3, 7, 9, 13, 15 }, new int[] { 1, 9 }, 1, 1); @@ -1129,14 +1135,14 @@ public class AlignmentUtilsTests /* * verify CDS has added a dbref with mapping to cDNA */ - assertEquals(2, cds1Dss.getDBRefs().length); - dbRefEntry = cds1Dss.getDBRefs()[1]; + assertEquals(2, cds1Dss.getDBRefs().size()); + dbRefEntry = cds1Dss.getDBRefs().get(1); assertSame(dna1.getDatasetSequence(), dbRefEntry.getMap().getTo()); MapList cdsToDnaMapping = new MapList(new int[] { 1, 6 }, new int[] { 4, 6, 10, 12 }, 1, 1); assertEquals(cdsToDnaMapping, dbRefEntry.getMap().getMap()); - assertEquals(2, cds2Dss.getDBRefs().length); - dbRefEntry = cds2Dss.getDBRefs()[1]; + assertEquals(2, cds2Dss.getDBRefs().size()); + dbRefEntry = cds2Dss.getDBRefs().get(1); assertSame(dna2.getDatasetSequence(), dbRefEntry.getMap().getTo()); cdsToDnaMapping = new MapList(new int[] { 1, 9 }, new int[] { 1, 3, 7, 9, 13, 15 }, 1, 1); diff --git a/test/jalview/analysis/CrossRefTest.java b/test/jalview/analysis/CrossRefTest.java index b3c78be..a398cc9 100644 --- a/test/jalview/analysis/CrossRefTest.java +++ b/test/jalview/analysis/CrossRefTest.java @@ -42,8 +42,10 @@ import jalview.util.DBRefUtils; import jalview.util.MapList; import jalview.ws.SequenceFetcher; import jalview.ws.SequenceFetcherFactory; +import jalview.ws.params.InvalidArgumentException; import java.util.ArrayList; +import java.util.Arrays; import java.util.List; import org.testng.annotations.AfterClass; @@ -73,28 +75,28 @@ public class CrossRefTest DBRefEntry ref8 = new DBRefEntry("PFAM", "1", "A123"); // ENSEMBL is a source of either dna or protein sequence data DBRefEntry ref9 = new DBRefEntry("ENSEMBL", "1", "A123"); - DBRefEntry[] refs = new DBRefEntry[] { ref1, ref2, ref3, ref4, ref5, - ref6, ref7, ref8, ref9 }; + List refs = Arrays.asList(new DBRefEntry[] { ref1, ref2, ref3, ref4, ref5, + ref6, ref7, ref8, ref9 }); /* * Just the DNA refs: */ - DBRefEntry[] found = DBRefUtils.selectDbRefs(true, refs); - assertEquals(4, found.length); - assertSame(ref5, found[0]); - assertSame(ref6, found[1]); - assertSame(ref7, found[2]); - assertSame(ref9, found[3]); + List found = DBRefUtils.selectDbRefs(true, refs); + assertEquals(4, found.size()); + assertSame(ref5, found.get(0)); + assertSame(ref6, found.get(1)); + assertSame(ref7, found.get(2)); + assertSame(ref9, found.get(3)); /* * Just the protein refs: */ found = DBRefUtils.selectDbRefs(false, refs); - assertEquals(4, found.length); - assertSame(ref1, found[0]); - assertSame(ref2, found[1]); - assertSame(ref4, found[2]); - assertSame(ref9, found[3]); + assertEquals(4, found.size()); + assertSame(ref1, found.get(0)); + assertSame(ref2, found.get(1)); + assertSame(ref4, found.get(2)); + assertSame(ref9, found.get(3)); } /** @@ -141,7 +143,12 @@ public class CrossRefTest * and others to dna coding databases */ sources.clear(); - seq.setDBRefs(null); + try { + seq.setDBRefs(null); + } catch (InvalidArgumentException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } seq.addDBRef(new DBRefEntry("UNIPROT", "0", "A1234")); seq.addDBRef(new DBRefEntry("EMBLCDS", "0", "E2347")); SequenceI seq2 = new Sequence("Seq2", "MGKYQARLSS"); @@ -280,7 +287,7 @@ public class CrossRefTest CrossRef testee = new CrossRef(al.getSequencesArray(), al); AlignedCodonFrame acf = new AlignedCodonFrame(); boolean found = testee.searchDataset(true, dna1, dbref, result, acf, - true); + true, DBRefUtils.SEARCH_MODE_FULL); assertFalse(found); assertTrue(result.isEmpty()); assertTrue(acf.isEmpty()); @@ -291,7 +298,7 @@ public class CrossRefTest acf = new AlignedCodonFrame(); dbref = new DBRefEntry("UNIPROT", "0", "Q9ZTS2"); found = testee.searchDataset(!dna1.isProtein(), dna1, dbref, result, - acf, false); // search dataset with a protein xref from a dna + acf, false, DBRefUtils.SEARCH_MODE_FULL); // search dataset with a protein xref from a dna // sequence to locate the protein product assertTrue(found); assertEquals(1, result.size()); @@ -305,7 +312,7 @@ public class CrossRefTest acf = new AlignedCodonFrame(); dbref = new DBRefEntry("UNIPROT", "0", "Q9ZTS2"); found = testee.searchDataset(!pep1.isProtein(), pep1, dbref, result, - acf, false); // search dataset with a protein's direct dbref to + acf, false, DBRefUtils.SEARCH_MODE_FULL); // search dataset with a protein's direct dbref to // locate dna sequences with matching xref assertTrue(found); assertEquals(1, result.size()); @@ -707,30 +714,31 @@ public class CrossRefTest /* * verify mappings added to Uniprot-to-EMBL dbrefs */ - Mapping mapping = p0ce19.getDBRefs()[0].getMap(); + Mapping mapping = p0ce19.getDBRefs().get(0).getMap(); assertSame(j03321, mapping.getTo()); - mapping = p0ce19.getDBRefs()[1].getMap(); + mapping = p0ce19.getDBRefs().get(1).getMap(); assertSame(x06707, mapping.getTo()); - mapping = p0ce20.getDBRefs()[0].getMap(); + mapping = p0ce20.getDBRefs().get(0).getMap(); assertSame(j03321, mapping.getTo()); - mapping = p0ce20.getDBRefs()[1].getMap(); + mapping = p0ce20.getDBRefs().get(1).getMap(); assertSame(x06707, mapping.getTo()); /* * verify dbrefs on EMBL are mapped to alignment seqs */ - assertSame(p0ce19, j03321.getDBRefs()[0].getMap().getTo()); - assertSame(p0ce20, j03321.getDBRefs()[1].getMap().getTo()); - assertSame(p0ce19, x06707.getDBRefs()[0].getMap().getTo()); - assertSame(p0ce20, x06707.getDBRefs()[1].getMap().getTo()); + + assertSame(p0ce19, j03321.getDBRefs().get(0).getMap().getTo()); + assertSame(p0ce20, j03321.getDBRefs().get(1).getMap().getTo()); + assertSame(p0ce19, x06707.getDBRefs().get(0).getMap().getTo()); + assertSame(p0ce20, x06707.getDBRefs().get(1).getMap().getTo()); /* * verify new dbref on EMBL dbref mapping is copied to the * original Uniprot sequence */ - assertEquals(4, p0ce19.getDBRefs().length); - assertEquals("PIR", p0ce19.getDBRefs()[3].getSource()); - assertEquals("S01875", p0ce19.getDBRefs()[3].getAccessionId()); + assertEquals(4, p0ce19.getDBRefs().size()); + assertEquals("PIR", p0ce19.getDBRefs().get(3).getSource()); + assertEquals("S01875", p0ce19.getDBRefs().get(3).getAccessionId()); } @Test(groups = "Functional") diff --git a/test/jalview/datamodel/AlignmentTest.java b/test/jalview/datamodel/AlignmentTest.java index 1d1ebd6..96af53e 100644 --- a/test/jalview/datamodel/AlignmentTest.java +++ b/test/jalview/datamodel/AlignmentTest.java @@ -1173,14 +1173,14 @@ public class AlignmentTest /* * verify peptide.cdsdbref.peptidedbref is now mapped to peptide dataset */ - DBRefEntry[] dbRefs = pep.getDBRefs(); - assertEquals(2, dbRefs.length); - assertSame(dna, dbRefs[0].map.to); - assertSame(cds, dbRefs[1].map.to); - assertEquals(1, dna.getDBRefs().length); - assertSame(pep.getDatasetSequence(), dna.getDBRefs()[0].map.to); - assertEquals(1, cds.getDBRefs().length); - assertSame(pep.getDatasetSequence(), cds.getDBRefs()[0].map.to); + List dbRefs = pep.getDBRefs(); + assertEquals(2, dbRefs.size()); + assertSame(dna, dbRefs.get(0).map.to); + assertSame(cds, dbRefs.get(1).map.to); + assertEquals(1, dna.getDBRefs().size()); + assertSame(pep.getDatasetSequence(), dna.getDBRefs().get(0).map.to); + assertEquals(1, cds.getDBRefs().size()); + assertSame(pep.getDatasetSequence(), cds.getDBRefs().get(0).map.to); } @Test(groups = { "Functional" }) diff --git a/test/jalview/datamodel/SequenceTest.java b/test/jalview/datamodel/SequenceTest.java index 9629b6f..bf6d403 100644 --- a/test/jalview/datamodel/SequenceTest.java +++ b/test/jalview/datamodel/SequenceTest.java @@ -34,6 +34,7 @@ import jalview.commands.EditCommand.Action; import jalview.datamodel.PDBEntry.Type; import jalview.gui.JvOptionPane; import jalview.util.MapList; +import jalview.ws.params.InvalidArgumentException; import java.io.File; import java.util.ArrayList; @@ -615,9 +616,9 @@ public class SequenceTest assertNotNull(newDs); assertNotSame(ds, newDs); assertNotNull(sq.getDBRefs()); - assertEquals(1, sq.getDBRefs().length); - assertNotSame(dbr1, sq.getDBRefs()[0]); - assertEquals(dbr1, sq.getDBRefs()[0]); + assertEquals(1, sq.getDBRefs().size()); + assertNotSame(dbr1, sq.getDBRefs().get(0)); + assertEquals(dbr1, sq.getDBRefs().get(0)); /* * internal delete with sequence features @@ -678,8 +679,8 @@ public class SequenceTest assertEquals(4, sq.getEnd()); assertSame(ds, PA.getValue(sq, "datasetSequence")); assertNotNull(sq.getDBRefs()); - assertEquals(1, sq.getDBRefs().length); - assertSame(dbr1, sq.getDBRefs()[0]); + assertEquals(1, sq.getDBRefs().size()); + assertSame(dbr1, sq.getDBRefs().get(0)); } @Test(groups = { "Functional" }) @@ -913,12 +914,12 @@ public class SequenceTest new AlignmentAnnotation("Test annot", "Test annot description", annots)); Assert.assertEquals(sq.getDescription(), "Test sequence description.."); - Assert.assertEquals(sq.getDBRefs().length, 5); // DBRefs are on dataset + Assert.assertEquals(sq.getDBRefs().size(), 5); // DBRefs are on dataset // sequence Assert.assertEquals(sq.getAllPDBEntries().size(), 4); Assert.assertNotNull(sq.getAnnotation()); Assert.assertEquals(sq.getAnnotation()[0].annotations.length, 2); - Assert.assertEquals(sq.getDatasetSequence().getDBRefs().length, 5); // same + Assert.assertEquals(sq.getDatasetSequence().getDBRefs().size(), 5); // same // as // sq.getDBRefs() Assert.assertEquals(sq.getDatasetSequence().getAllPDBEntries().size(), @@ -929,11 +930,11 @@ public class SequenceTest Assert.assertEquals(derived.getDescription(), "Test sequence description.."); - Assert.assertEquals(derived.getDBRefs().length, 5); // come from dataset + Assert.assertEquals(derived.getDBRefs().size(), 5); // come from dataset Assert.assertEquals(derived.getAllPDBEntries().size(), 4); Assert.assertNotNull(derived.getAnnotation()); Assert.assertEquals(derived.getAnnotation()[0].annotations.length, 2); - Assert.assertEquals(derived.getDatasetSequence().getDBRefs().length, 5); + Assert.assertEquals(derived.getDatasetSequence().getDBRefs().size(), 5); Assert.assertEquals(derived.getDatasetSequence().getAllPDBEntries() .size(), 4); Assert.assertNotNull(derived.getDatasetSequence().getAnnotation()); @@ -1012,10 +1013,10 @@ public class SequenceTest // but that doesn't distinguish it from an aligned sequence // which has not yet generated a dataset sequence // NB getDBRef looks inside dataset sequence if not null - DBRefEntry[] dbrefs = copy.getDBRefs(); - assertEquals(1, dbrefs.length); - assertFalse(dbrefs[0] == seq1.getDBRefs()[0]); - assertTrue(dbrefs[0].equals(seq1.getDBRefs()[0])); + List dbrefs = copy.getDBRefs(); + assertEquals(1, dbrefs.size()); + assertFalse(dbrefs.get(0) == seq1.getDBRefs().get(0)); + assertTrue(dbrefs.get(0).equals(seq1.getDBRefs().get(0))); } @Test(groups = { "Functional" }) @@ -1044,9 +1045,9 @@ public class SequenceTest // getDBRef looks inside dataset sequence and this is shared, // so holds the same dbref objects - DBRefEntry[] dbrefs = copy.getDBRefs(); - assertEquals(1, dbrefs.length); - assertSame(dbrefs[0], seq1.getDBRefs()[0]); + List dbrefs = copy.getDBRefs(); + assertEquals(1, dbrefs.size()); + assertSame(dbrefs.get(0), seq1.getDBRefs().get(0)); } /** @@ -1145,39 +1146,39 @@ public class SequenceTest assertNull(sq.getDBRefs()); DBRefEntry dbref = new DBRefEntry("Uniprot", "1", "P00340"); sq.addDBRef(dbref); - assertEquals(1, sq.getDBRefs().length); - assertSame(dbref, sq.getDBRefs()[0]); + assertEquals(1, sq.getDBRefs().size()); + assertSame(dbref, sq.getDBRefs().get(0)); /* * change of version - new entry */ DBRefEntry dbref2 = new DBRefEntry("Uniprot", "2", "P00340"); sq.addDBRef(dbref2); - assertEquals(2, sq.getDBRefs().length); - assertSame(dbref, sq.getDBRefs()[0]); - assertSame(dbref2, sq.getDBRefs()[1]); + assertEquals(2, sq.getDBRefs().size()); + assertSame(dbref, sq.getDBRefs().get(0)); + assertSame(dbref2, sq.getDBRefs().get(1)); /* * matches existing entry - not added */ sq.addDBRef(new DBRefEntry("UNIPROT", "1", "p00340")); - assertEquals(2, sq.getDBRefs().length); + assertEquals(2, sq.getDBRefs().size()); /* * different source = new entry */ DBRefEntry dbref3 = new DBRefEntry("UniRef", "1", "p00340"); sq.addDBRef(dbref3); - assertEquals(3, sq.getDBRefs().length); - assertSame(dbref3, sq.getDBRefs()[2]); + assertEquals(3, sq.getDBRefs().size()); + assertSame(dbref3, sq.getDBRefs().get(2)); /* * different ref = new entry */ DBRefEntry dbref4 = new DBRefEntry("UniRef", "1", "p00341"); sq.addDBRef(dbref4); - assertEquals(4, sq.getDBRefs().length); - assertSame(dbref4, sq.getDBRefs()[3]); + assertEquals(4, sq.getDBRefs().size()); + assertSame(dbref4, sq.getDBRefs().get(3)); /* * matching ref with a mapping - map updated @@ -1187,8 +1188,8 @@ public class SequenceTest 1, 1 }, 3, 1)); dbref5.setMap(map); sq.addDBRef(dbref5); - assertEquals(4, sq.getDBRefs().length); - assertSame(dbref4, sq.getDBRefs()[3]); + assertEquals(4, sq.getDBRefs().size()); + assertSame(dbref4, sq.getDBRefs().get(3)); assertSame(map, dbref4.getMap()); /* @@ -1198,8 +1199,8 @@ public class SequenceTest DBRefEntry dbref6 = new DBRefEntry(dbref2.getSource(), "3", dbref2.getAccessionId()); sq.addDBRef(dbref6); - assertEquals(4, sq.getDBRefs().length); - assertSame(dbref2, sq.getDBRefs()[1]); + assertEquals(4, sq.getDBRefs().size()); + assertSame(dbref2, sq.getDBRefs().get(1)); assertEquals("3", dbref2.getVersion()); /* @@ -1209,8 +1210,8 @@ public class SequenceTest DBRefEntry dbref7 = new DBRefEntry(dbref3.getSource(), "3", dbref3.getAccessionId()); sq.addDBRef(dbref7); - assertEquals(4, sq.getDBRefs().length); - assertSame(dbref3, sq.getDBRefs()[2]); + assertEquals(4, sq.getDBRefs().size()); + assertSame(dbref3, sq.getDBRefs().get(2)); assertEquals("3", dbref2.getVersion()); } @@ -1224,7 +1225,12 @@ public class SequenceTest assertTrue(primaryDBRefs.isEmpty()); // empty dbrefs - sq.setDBRefs(new DBRefEntry[] {}); + try { + sq.setDBRefs(new ArrayList()); + } catch (InvalidArgumentException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } primaryDBRefs = sq.getPrimaryDBRefs(); assertTrue(primaryDBRefs.isEmpty()); diff --git a/test/jalview/ext/ensembl/EnsemblXrefTest.java b/test/jalview/ext/ensembl/EnsemblXrefTest.java index 9cc6627..07f8892 100644 --- a/test/jalview/ext/ensembl/EnsemblXrefTest.java +++ b/test/jalview/ext/ensembl/EnsemblXrefTest.java @@ -25,13 +25,13 @@ import static org.testng.AssertJUnit.assertFalse; import jalview.datamodel.DBRefEntry; import jalview.gui.JvOptionPane; +import jalview.util.JSONUtils; -import java.io.BufferedReader; import java.io.IOException; -import java.io.StringReader; import java.net.URL; import java.util.List; +import org.json.simple.parser.ParseException; import org.testng.annotations.BeforeClass; import org.testng.annotations.Test; @@ -61,12 +61,13 @@ public class EnsemblXrefTest EnsemblXref testee = new EnsemblXref("http://rest.ensembl.org", dbName, dbVers) { - @Override - protected BufferedReader getHttpResponse(URL url, List ids) - throws IOException - { - return new BufferedReader(new StringReader(JSON)); - } + @SuppressWarnings("unchecked") + @Override + protected Object getJSON(URL url, List ids, int msDelay, int mode, String mapKey) throws IOException, ParseException + { + return ((List)JSONUtils.parse(JSON)).iterator(); + } + }; // synonyms and GO terms are not returned diff --git a/test/jalview/gui/StructureChooserTest.java b/test/jalview/gui/StructureChooserTest.java index f69e6b5..3f7a3f8 100644 --- a/test/jalview/gui/StructureChooserTest.java +++ b/test/jalview/gui/StructureChooserTest.java @@ -31,6 +31,7 @@ import jalview.datamodel.Sequence; import jalview.datamodel.SequenceI; import jalview.fts.api.FTSData; import jalview.jbgui.GStructureChooser.FilterOption; +import jalview.ws.params.InvalidArgumentException; import java.util.Collection; import java.util.Vector; @@ -93,7 +94,12 @@ public class StructureChooserTest assertEquals( "text:XYZ_1 OR text:XYZ_2 OR text:XYZ_3 OR text:XYZ_4 OR text:4kqy", query); - seq.setDBRefs(null); + try { + seq.setDBRefs(null); + } catch (InvalidArgumentException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } query = StructureChooser.buildQuery(seq); assertEquals("text:4kqy", query); diff --git a/test/jalview/io/vcf/VCFLoaderTest.java b/test/jalview/io/vcf/VCFLoaderTest.java index 7e3c0b4..859b21b 100644 --- a/test/jalview/io/vcf/VCFLoaderTest.java +++ b/test/jalview/io/vcf/VCFLoaderTest.java @@ -155,7 +155,7 @@ public class VCFLoaderTest * verify SNP variant feature(s) computed and added to protein * first codon AGC varies to ACC giving S/T */ - DBRefEntry[] dbRefs = al.getSequenceAt(1).getDBRefs(); + List dbRefs = al.getSequenceAt(1).getDBRefs(); SequenceI peptide = null; for (DBRefEntry dbref : dbRefs) { @@ -410,7 +410,7 @@ public class VCFLoaderTest * verify variant feature(s) computed and added to protein * last codon GCT varies to GGT giving A/G in the last peptide position */ - DBRefEntry[] dbRefs = al.getSequenceAt(3).getDBRefs(); + List dbRefs = al.getSequenceAt(3).getDBRefs(); SequenceI peptide = null; for (DBRefEntry dbref : dbRefs) { @@ -560,7 +560,7 @@ public class VCFLoaderTest * and GAG/GGG which is E/G in position 4 * the insertion variant is not transferred to the peptide */ - DBRefEntry[] dbRefs = al.findName("transcript3").getDBRefs(); + List dbRefs = al.findName("transcript3").getDBRefs(); SequenceI peptide = null; for (DBRefEntry dbref : dbRefs) { diff --git a/test/jalview/structure/StructureSelectionManagerTest.java b/test/jalview/structure/StructureSelectionManagerTest.java index 286be1b..e59648f 100644 --- a/test/jalview/structure/StructureSelectionManagerTest.java +++ b/test/jalview/structure/StructureSelectionManagerTest.java @@ -418,7 +418,7 @@ public class StructureSelectionManagerTest extends Jalview2xmlBase PDBID); AlignmentAnnotation subseq_tf=null; - assertTrue(seq.getDBRefs() != null && seq.getDBRefs().length > 0); + assertTrue(seq.getDBRefs() != null && seq.getDBRefs().size() > 0); if (!al.findAnnotations(seq, null, TEMP_FACTOR_AA).iterator().hasNext()) { diff --git a/test/jalview/util/DBRefUtilsTest.java b/test/jalview/util/DBRefUtilsTest.java index 0ef3c25..963ca7c 100644 --- a/test/jalview/util/DBRefUtilsTest.java +++ b/test/jalview/util/DBRefUtilsTest.java @@ -34,6 +34,7 @@ import jalview.datamodel.Sequence; import jalview.datamodel.SequenceI; import jalview.gui.JvOptionPane; +import java.util.Arrays; import java.util.List; import org.testng.annotations.BeforeClass; @@ -63,25 +64,25 @@ public class DBRefUtilsTest DBRefEntry ref2 = new DBRefEntry("UNIPROT", "1.2", "A12346"); // Source is converted to upper-case by this constructor! DBRefEntry ref3 = new DBRefEntry("Uniprot", "1.2", "A12347"); - DBRefEntry[] dbrefs = new DBRefEntry[] { ref1, ref2, ref3 }; + List dbrefs = Arrays.asList(new DBRefEntry[] { ref1, ref2, ref3 }); String[] sources = new String[] { "EMBL", "UNIPROT" }; - DBRefEntry[] selected = DBRefUtils.selectRefs(dbrefs, sources); - assertEquals(3, selected.length); - assertSame(ref1, selected[0]); - assertSame(ref2, selected[1]); - assertSame(ref3, selected[2]); + List selected = DBRefUtils.selectRefs(dbrefs, sources); + assertEquals(3, selected.size()); + assertSame(ref1, selected.get(0)); + assertSame(ref2, selected.get(1)); + assertSame(ref3, selected.get(2)); sources = new String[] { "EMBL" }; selected = DBRefUtils.selectRefs(dbrefs, sources); - assertEquals(1, selected.length); - assertSame(ref1, selected[0]); + assertEquals(1, selected.size()); + assertSame(ref1, selected.get(0)); sources = new String[] { "UNIPROT" }; selected = DBRefUtils.selectRefs(dbrefs, sources); - assertEquals(2, selected.length); - assertSame(ref2, selected[0]); - assertSame(ref3, selected[1]); + assertEquals(2, selected.size()); + assertSame(ref2, selected.get(0)); + assertSame(ref3, selected.get(1)); sources = new String[] { "EMBLCDS" }; selected = DBRefUtils.selectRefs(dbrefs, sources); @@ -89,10 +90,10 @@ public class DBRefUtilsTest sources = new String[] { "embl", "uniprot" }; selected = DBRefUtils.selectRefs(dbrefs, sources); - assertEquals(3, selected.length); - assertSame(ref1, selected[0]); - assertSame(ref2, selected[1]); - assertSame(ref3, selected[2]); + assertEquals(3, selected.size()); + assertSame(ref1, selected.get(0)); + assertSame(ref2, selected.get(1)); + assertSame(ref3, selected.get(2)); } /** @@ -161,9 +162,9 @@ public class DBRefUtilsTest { SequenceI seq = new Sequence("Seq1", "ABCD"); DBRefEntry ref = DBRefUtils.parseToDbRef(seq, "EMBL", "1.2", "a7890"); - DBRefEntry[] refs = seq.getDBRefs(); - assertEquals(1, refs.length); - assertSame(ref, refs[0]); + List refs = seq.getDBRefs(); + assertEquals(1, refs.size()); + assertSame(ref, refs.get(0)); assertEquals("EMBL", ref.getSource()); assertEquals("1.2", ref.getVersion()); assertEquals("a7890", ref.getAccessionId()); @@ -182,9 +183,9 @@ public class DBRefUtilsTest // TODO: correct PDBEntry and PDB DBRef accessions need to be generated for // PDB ref in Stockholm - DBRefEntry[] refs = seq.getDBRefs(); - assertEquals(1, refs.length); - assertSame(ref, refs[0]); + List refs = seq.getDBRefs(); + assertEquals(1, refs.size()); + assertSame(ref, refs.get(0)); assertEquals("PDB", ref.getSource()); assertEquals("1.2", ref.getVersion()); // DBRef id is pdbId + chain code @@ -217,8 +218,9 @@ public class DBRefUtilsTest ref5.setMap(new Mapping(new MapList(new int[] { 1, 1 }, new int[] { 1, 1 }, 1, 1))); - List matches = DBRefUtils.searchRefs(new DBRefEntry[] { - ref1, ref2, ref3, ref4, ref5 }, target); + List matches = DBRefUtils.searchRefs( + Arrays.asList(new DBRefEntry[] { + ref1, ref2, ref3, ref4, ref5 }), target, DBRefUtils.SEARCH_MODE_FULL); assertEquals(3, matches.size()); assertSame(ref1, matches.get(0)); assertSame(ref2, matches.get(1)); @@ -250,8 +252,9 @@ public class DBRefUtilsTest new int[] { 1, 1 }, 2, 2)); ref3.setMap(map3); - List matches = DBRefUtils.searchRefs(new DBRefEntry[] { - ref1, ref2, ref3 }, target); + List matches = DBRefUtils.searchRefs( + Arrays.asList(new DBRefEntry[] { + ref1, ref2, ref3 }), target, DBRefUtils.SEARCH_MODE_FULL); assertEquals(2, matches.size()); assertSame(ref1, matches.get(0)); assertSame(ref2, matches.get(1)); @@ -275,7 +278,8 @@ public class DBRefUtilsTest ref5.setMap(new Mapping(new MapList(new int[] { 1, 1 }, new int[] { 1, 1 }, 1, 1))); - DBRefEntry[] dbrefs = new DBRefEntry[] { ref1, ref2, ref3, ref4, ref5 }; + List dbrefs = Arrays.asList(new DBRefEntry[] { + ref1, ref2, ref3, ref4, ref5 }); List matches = DBRefUtils.searchRefs(dbrefs, "A1234"); assertEquals(3, matches.size()); assertSame(ref1, matches.get(0)); @@ -303,8 +307,9 @@ public class DBRefUtilsTest ref5.setMap(new Mapping(new MapList(new int[] { 1, 1 }, new int[] { 1, 1 }, 1, 1))); - List matches = DBRefUtils.searchRefs(new DBRefEntry[] { - ref1, ref2, ref3, ref4, ref5 }, target); + List matches = DBRefUtils.searchRefs( + Arrays.asList(new DBRefEntry[] { + ref1, ref2, ref3, ref4, ref5 }), target, DBRefUtils.SEARCH_MODE_FULL); assertEquals(4, matches.size()); assertSame(ref1, matches.get(0)); assertSame(ref2, matches.get(1)); diff --git a/test/jalview/util/JSONUtilsTest.java b/test/jalview/util/JSONUtilsTest.java index 45f1c48..d898a88 100644 --- a/test/jalview/util/JSONUtilsTest.java +++ b/test/jalview/util/JSONUtilsTest.java @@ -12,15 +12,15 @@ public class JSONUtilsTest @Test(groups = "Functional") public void testArrayToList() throws JSONException { - assertNull(JSONUtils.arrayToList(null)); + assertNull(JSONUtils.arrayToStringList(null)); JSONArray ja = new JSONArray(); - assertNull(JSONUtils.arrayToList(null)); + assertNull(JSONUtils.arrayToStringList(null)); ja.add("hello"); - assertEquals(JSONUtils.arrayToList(ja), "hello"); + assertEquals(JSONUtils.arrayToStringList(ja), "hello"); ja.add("world"); - assertEquals(JSONUtils.arrayToList(ja), "hello,world"); + assertEquals(JSONUtils.arrayToStringList(ja), "hello,world"); } } diff --git a/test/jalview/ws/dbsources/EmblSourceTest.java b/test/jalview/ws/dbsources/EmblSourceTest.java index d450495..5bf215c 100644 --- a/test/jalview/ws/dbsources/EmblSourceTest.java +++ b/test/jalview/ws/dbsources/EmblSourceTest.java @@ -168,10 +168,10 @@ public class EmblSourceTest MapList cds3Map = new MapList(new int[] { 4, 6, 10, 15 }, new int[] { 1, 3 }, 3, 1); - DBRefEntry[] dbrefs = dna.getDBRefs(); - assertEquals(7, dbrefs.length); + List dbrefs = dna.getDBRefs(); + assertEquals(7, dbrefs.size()); - DBRefEntry dbRefEntry = dbrefs[0]; + DBRefEntry dbRefEntry = dbrefs.get(0); assertEquals("EMBL", dbRefEntry.getSource()); assertEquals("X07547", dbRefEntry.getAccessionId()); assertEquals("1", dbRefEntry.getVersion()); @@ -179,38 +179,38 @@ public class EmblSourceTest assertNull(dbRefEntry.getMap().getTo()); assertEquals(mapToSelf, dbRefEntry.getMap().getMap()); - dbRefEntry = dbrefs[1]; + dbRefEntry = dbrefs.get(1); // DBRefEntry constructor puts dbSource in upper case assertEquals("EUROPEPMC", dbRefEntry.getSource()); assertEquals("PMC107176", dbRefEntry.getAccessionId()); assertEquals("9573186", dbRefEntry.getVersion()); assertNull(dbRefEntry.getMap()); - dbRefEntry = dbrefs[2]; + dbRefEntry = dbrefs.get(2); assertEquals("MD5", dbRefEntry.getSource()); assertEquals("ac73317", dbRefEntry.getAccessionId()); assertEquals("0", dbRefEntry.getVersion()); assertNull(dbRefEntry.getMap()); - dbRefEntry = dbrefs[3]; + dbRefEntry = dbrefs.get(3); assertEquals("UNIPROT", dbRefEntry.getSource()); assertEquals("B0BCM4", dbRefEntry.getAccessionId()); assertSame(peptides.get(1), dbRefEntry.getMap().getTo()); assertEquals(cds1Map, dbRefEntry.getMap().getMap()); - dbRefEntry = dbrefs[4]; + dbRefEntry = dbrefs.get(4); assertEquals("UNIPROT", dbRefEntry.getSource()); assertEquals("P0CE20", dbRefEntry.getAccessionId()); assertSame(peptides.get(2), dbRefEntry.getMap().getTo()); assertEquals(cds1Map, dbRefEntry.getMap().getMap()); - dbRefEntry = dbrefs[5]; + dbRefEntry = dbrefs.get(5); assertEquals("UNIPROT", dbRefEntry.getSource()); assertEquals("B0BCM3", dbRefEntry.getAccessionId()); assertSame(peptides.get(4), dbRefEntry.getMap().getTo()); assertEquals(cds2Map, dbRefEntry.getMap().getMap()); - dbRefEntry = dbrefs[6]; + dbRefEntry = dbrefs.get(6); assertEquals("EMBLCDSPROTEIN", dbRefEntry.getSource()); assertEquals("CAA12345.6", dbRefEntry.getAccessionId()); assertSame(peptides.get(5), dbRefEntry.getMap().getTo()); @@ -229,82 +229,82 @@ public class EmblSourceTest // dbrefs for first CDS EMBL product CAA30420.1 dbrefs = peptides.get(0).getDBRefs(); - assertEquals(5, dbrefs.length); - assertEquals(DBRefSource.EMBL, dbrefs[0].getSource()); - assertEquals("CAA30420.1", dbrefs[0].getAccessionId()); + assertEquals(5, dbrefs.size()); + assertEquals(DBRefSource.EMBL, dbrefs.get(0).getSource()); + assertEquals("CAA30420.1", dbrefs.get(0).getAccessionId()); // TODO: verify getPrimaryDBRefs() for peptide products - assertEquals(cds1Map.getInverse(), dbrefs[0].getMap().getMap()); - assertEquals(DBRefSource.EMBLCDS, dbrefs[1].getSource()); - assertEquals("CAA30420.1", dbrefs[1].getAccessionId()); - assertEquals(proteinToCdsMap1, dbrefs[1].getMap().getMap()); - assertEquals(DBRefSource.EMBLCDSProduct, dbrefs[2].getSource()); - assertEquals("CAA30420.1", dbrefs[2].getAccessionId()); - assertNull(dbrefs[2].getMap()); + assertEquals(cds1Map.getInverse(), dbrefs.get(0).getMap().getMap()); + assertEquals(DBRefSource.EMBLCDS, dbrefs.get(1).getSource()); + assertEquals("CAA30420.1", dbrefs.get(1).getAccessionId()); + assertEquals(proteinToCdsMap1, dbrefs.get(1).getMap().getMap()); + assertEquals(DBRefSource.EMBLCDSProduct, dbrefs.get(2).getSource()); + assertEquals("CAA30420.1", dbrefs.get(2).getAccessionId()); + assertNull(dbrefs.get(2).getMap()); assertEquals(new DBRefEntry(DBRefSource.UNIPROT, "2.1", "B0BCM4"), - dbrefs[3]); - assertNull(dbrefs[3].getMap()); + dbrefs.get(3)); + assertNull(dbrefs.get(3).getMap()); assertEquals(new DBRefEntry(DBRefSource.UNIPROT, "0", "P0CE20"), - dbrefs[4]); - assertNull(dbrefs[4].getMap()); + dbrefs.get(4)); + assertNull(dbrefs.get(4).getMap()); // dbrefs for first CDS first Uniprot xref dbrefs = peptides.get(1).getDBRefs(); - assertEquals(2, dbrefs.length); + assertEquals(2, dbrefs.size()); assertEquals(new DBRefEntry(DBRefSource.UNIPROT, "2.1", "B0BCM4"), - dbrefs[0]); - assertNull(dbrefs[0].getMap()); - assertEquals(DBRefSource.EMBL, dbrefs[1].getSource()); - assertEquals("X07547", dbrefs[1].getAccessionId()); - assertEquals(cds1Map.getInverse(), dbrefs[1].getMap().getMap()); + dbrefs.get(0)); + assertNull(dbrefs.get(0).getMap()); + assertEquals(DBRefSource.EMBL, dbrefs.get(1).getSource()); + assertEquals("X07547", dbrefs.get(1).getAccessionId()); + assertEquals(cds1Map.getInverse(), dbrefs.get(1).getMap().getMap()); // dbrefs for first CDS second Uniprot xref dbrefs = peptides.get(2).getDBRefs(); - assertEquals(2, dbrefs.length); + assertEquals(2, dbrefs.size()); assertEquals(new DBRefEntry(DBRefSource.UNIPROT, "0", "P0CE20"), - dbrefs[0]); - assertNull(dbrefs[0].getMap()); - assertEquals(DBRefSource.EMBL, dbrefs[1].getSource()); - assertEquals("X07547", dbrefs[1].getAccessionId()); - assertEquals(cds1Map.getInverse(), dbrefs[1].getMap().getMap()); + dbrefs.get(0)); + assertNull(dbrefs.get(0).getMap()); + assertEquals(DBRefSource.EMBL, dbrefs.get(1).getSource()); + assertEquals("X07547", dbrefs.get(1).getAccessionId()); + assertEquals(cds1Map.getInverse(), dbrefs.get(1).getMap().getMap()); // dbrefs for second CDS EMBL product CAA30421.1 dbrefs = peptides.get(3).getDBRefs(); - assertEquals(4, dbrefs.length); - assertEquals(DBRefSource.EMBL, dbrefs[0].getSource()); - assertEquals("CAA30421.1", dbrefs[0].getAccessionId()); - assertEquals(cds2Map.getInverse(), dbrefs[0].getMap().getMap()); - assertEquals(DBRefSource.EMBLCDS, dbrefs[1].getSource()); - assertEquals("CAA30421.1", dbrefs[1].getAccessionId()); - assertEquals(proteinToCdsMap1, dbrefs[1].getMap().getMap()); - assertEquals(DBRefSource.EMBLCDSProduct, dbrefs[2].getSource()); - assertEquals("CAA30421.1", dbrefs[2].getAccessionId()); - assertNull(dbrefs[2].getMap()); + assertEquals(4, dbrefs.size()); + assertEquals(DBRefSource.EMBL, dbrefs.get(0).getSource()); + assertEquals("CAA30421.1", dbrefs.get(0).getAccessionId()); + assertEquals(cds2Map.getInverse(), dbrefs.get(0).getMap().getMap()); + assertEquals(DBRefSource.EMBLCDS, dbrefs.get(1).getSource()); + assertEquals("CAA30421.1", dbrefs.get(1).getAccessionId()); + assertEquals(proteinToCdsMap1, dbrefs.get(1).getMap().getMap()); + assertEquals(DBRefSource.EMBLCDSProduct, dbrefs.get(2).getSource()); + assertEquals("CAA30421.1", dbrefs.get(2).getAccessionId()); + assertNull(dbrefs.get(2).getMap()); assertEquals(new DBRefEntry(DBRefSource.UNIPROT, "0", "B0BCM3"), - dbrefs[3]); - assertNull(dbrefs[3].getMap()); + dbrefs.get(3)); + assertNull(dbrefs.get(3).getMap()); // dbrefs for second CDS second Uniprot xref dbrefs = peptides.get(4).getDBRefs(); - assertEquals(2, dbrefs.length); + assertEquals(2, dbrefs.size()); assertEquals(new DBRefEntry(DBRefSource.UNIPROT, "0", "B0BCM3"), - dbrefs[0]); - assertNull(dbrefs[0].getMap()); - assertEquals(DBRefSource.EMBL, dbrefs[1].getSource()); - assertEquals("X07547", dbrefs[1].getAccessionId()); - assertEquals(cds2Map.getInverse(), dbrefs[1].getMap().getMap()); + dbrefs.get(0)); + assertNull(dbrefs.get(0).getMap()); + assertEquals(DBRefSource.EMBL, dbrefs.get(1).getSource()); + assertEquals("X07547", dbrefs.get(1).getAccessionId()); + assertEquals(cds2Map.getInverse(), dbrefs.get(1).getMap().getMap()); // dbrefs for third CDS inferred EMBL product CAA12345.6 dbrefs = peptides.get(5).getDBRefs(); - assertEquals(3, dbrefs.length); - assertEquals(DBRefSource.EMBL, dbrefs[0].getSource()); - assertEquals("CAA12345.6", dbrefs[0].getAccessionId()); - assertEquals(cds3Map.getInverse(), dbrefs[0].getMap().getMap()); - assertEquals(DBRefSource.EMBLCDS, dbrefs[1].getSource()); - assertEquals("CAA12345.6", dbrefs[1].getAccessionId()); - assertEquals(proteinToCdsMap2, dbrefs[1].getMap().getMap()); - assertEquals(DBRefSource.EMBLCDSProduct, dbrefs[2].getSource()); - assertEquals("CAA12345.6", dbrefs[2].getAccessionId()); - assertNull(dbrefs[2].getMap()); + assertEquals(3, dbrefs.size()); + assertEquals(DBRefSource.EMBL, dbrefs.get(0).getSource()); + assertEquals("CAA12345.6", dbrefs.get(0).getAccessionId()); + assertEquals(cds3Map.getInverse(), dbrefs.get(0).getMap().getMap()); + assertEquals(DBRefSource.EMBLCDS, dbrefs.get(1).getSource()); + assertEquals("CAA12345.6", dbrefs.get(1).getAccessionId()); + assertEquals(proteinToCdsMap2, dbrefs.get(1).getMap().getMap()); + assertEquals(DBRefSource.EMBLCDSProduct, dbrefs.get(2).getSource()); + assertEquals("CAA12345.6", dbrefs.get(2).getAccessionId()); + assertNull(dbrefs.get(2).getMap()); } @Test(groups = "Functional") diff --git a/test/jalview/ws/dbsources/RemoteFormatTest.java b/test/jalview/ws/dbsources/RemoteFormatTest.java index e04d195..629bd8a 100644 --- a/test/jalview/ws/dbsources/RemoteFormatTest.java +++ b/test/jalview/ws/dbsources/RemoteFormatTest.java @@ -80,7 +80,7 @@ public class RemoteFormatTest SequenceI sq = al.getSequenceAt(0); // suppress this check as only Uniprot and PDB acquire PDB refs // assertTrue(sq.getAllPDBEntries().size() > 0, "No PDBEntry on sequence."); - assertTrue(sq.getDBRefs().length > 0, "No DBRef on sequence."); + assertTrue(sq.getDBRefs().size() > 0, "No DBRef on sequence."); // suppress this test as only certain databases provide 'primary' dbrefs // assertFalse(sq.getPrimaryDBRefs().isEmpty()); int length = AlignSeq.extractGaps("-. ", sq.getSequenceAsString()) diff --git a/test/jalview/ws/dbsources/UniprotTest.java b/test/jalview/ws/dbsources/UniprotTest.java index e835724..e6b465b 100644 --- a/test/jalview/ws/dbsources/UniprotTest.java +++ b/test/jalview/ws/dbsources/UniprotTest.java @@ -215,7 +215,7 @@ public class UniprotTest is).get(0); SequenceI seq = new Uniprot().uniprotEntryToSequence(entry); assertNotNull(seq); - assertEquals(6, seq.getDBRefs().length); // 2*Uniprot, PDB, PDBsum, 2*EMBL + assertEquals(6, seq.getDBRefs().size()); // 2*Uniprot, PDB, PDBsum, 2*EMBL } diff --git a/test/jalview/ws/seqfetcher/DbRefFetcherTest.java b/test/jalview/ws/seqfetcher/DbRefFetcherTest.java index de91af3..a7e5806 100644 --- a/test/jalview/ws/seqfetcher/DbRefFetcherTest.java +++ b/test/jalview/ws/seqfetcher/DbRefFetcherTest.java @@ -181,25 +181,25 @@ public class DbRefFetcherTest FeatureProperties.isCodingFeature(embl.getDbSource(), sfs.get(0).getType())); assertEquals(embl.getDbSource(), sfs.get(0).getFeatureGroup()); - DBRefEntry[] dr = DBRefUtils.selectRefs(seq.getDBRefs(), + List dr = DBRefUtils.selectRefs(seq.getDBRefs(), new String[] { DBRefSource.UNIPROT }); assertNotNull(dr); - assertEquals("Expected a single Uniprot cross reference", 1, dr.length); - assertEquals("Expected cross reference map to be one amino acid", dr[0] + assertEquals("Expected a single Uniprot cross reference", 1, dr.size()); + assertEquals("Expected cross reference map to be one amino acid", dr.get(0) .getMap().getMappedWidth(), 1); - assertEquals("Expected local reference map to be 3 nucleotides", dr[0] + assertEquals("Expected local reference map to be 3 nucleotides", dr.get(0) .getMap().getWidth(), 3); AlignmentI sprods = new CrossRef(alsq.getSequencesArray(), alsq) - .findXrefSequences(dr[0].getSource(), true); + .findXrefSequences(dr.get(0).getSource(), true); assertNotNull( "Couldn't recover cross reference sequence from dataset. Was it ever added ?", sprods); assertEquals("Didn't xref right number of records", 1, sprods.getHeight()); SequenceI proteinSeq = sprods.getSequenceAt(0); - assertEquals(proteinSeq.getSequenceAsString(), dr[0].getMap().getTo() + assertEquals(proteinSeq.getSequenceAsString(), dr.get(0).getMap().getTo() .getSequenceAsString()); - assertEquals(dr[0].getSource() + "|" + dr[0].getAccessionId(), + assertEquals(dr.get(0).getSource() + "|" + dr.get(0).getAccessionId(), proteinSeq.getName()); } } -- 1.7.10.2