From: gmungoc Date: Wed, 6 Feb 2019 15:27:49 +0000 (+0000) Subject: JAL-2738 use GeneLocus extends DBRefEntry to hold chromosomal mappings X-Git-Tag: Release_2_11_1_0~52^2~3 X-Git-Url: http://source.jalview.org/gitweb/?a=commitdiff_plain;h=cbeb7ad59d51b468c54ca3db2a2a7693060a2509;p=jalview.git JAL-2738 use GeneLocus extends DBRefEntry to hold chromosomal mappings --- diff --git a/schemas/vamsas.xsd b/schemas/vamsas.xsd index 22b7aac..2ef0c15 100755 --- a/schemas/vamsas.xsd +++ b/schemas/vamsas.xsd @@ -161,6 +161,13 @@ + + + + true for gene locus mapping, source=species, version=assembly, accession=chromosome + + + diff --git a/src/jalview/analysis/AlignmentUtils.java b/src/jalview/analysis/AlignmentUtils.java index 0dfd383..0bc8180 100644 --- a/src/jalview/analysis/AlignmentUtils.java +++ b/src/jalview/analysis/AlignmentUtils.java @@ -1870,7 +1870,7 @@ public class AlignmentUtils return; } - MapList newMap = targetToFrom.traverse(fromLoci.getMap()); + MapList newMap = targetToFrom.traverse(fromLoci.getMapping()); if (newMap != null) { diff --git a/src/jalview/datamodel/DBRefEntry.java b/src/jalview/datamodel/DBRefEntry.java index 98868ce..bc8d0cf 100755 --- a/src/jalview/datamodel/DBRefEntry.java +++ b/src/jalview/datamodel/DBRefEntry.java @@ -27,15 +27,6 @@ import java.util.List; public class DBRefEntry implements DBRefEntryI { - /* - * the mapping to chromosome (genome) is held as an instance with - * source = speciesId - * version = assemblyId - * accessionId = "chromosome:" + chromosomeId - * map = mapping from sequence to reference assembly - */ - public static final String CHROMOSOME = "chromosome"; - String source = ""; String version = ""; @@ -344,14 +335,4 @@ public class DBRefEntry implements DBRefEntryI } return true; } - - /** - * Mappings to chromosome are held with accessionId as "chromosome:id" - * - * @return - */ - public boolean isChromosome() - { - return accessionId != null && accessionId.startsWith(CHROMOSOME + ":"); - } } diff --git a/src/jalview/datamodel/GeneLociI.java b/src/jalview/datamodel/GeneLociI.java index f8c7ec5..09db9d7 100644 --- a/src/jalview/datamodel/GeneLociI.java +++ b/src/jalview/datamodel/GeneLociI.java @@ -34,5 +34,5 @@ public interface GeneLociI * * @return */ - MapList getMap(); + MapList getMapping(); } diff --git a/src/jalview/datamodel/GeneLocus.java b/src/jalview/datamodel/GeneLocus.java new file mode 100644 index 0000000..f81348f --- /dev/null +++ b/src/jalview/datamodel/GeneLocus.java @@ -0,0 +1,91 @@ +package jalview.datamodel; + +import jalview.util.MapList; + +/** + * A specialisation of DBRefEntry used to hold the chromosomal coordinates for a + * (typically gene) sequence + *
    + *
  • field source is used to hold a species id e.g. human
  • + *
  • field version is used to hold assembly id e.g GRCh38
  • + *
  • field accession is used to hold the chromosome id
  • + *
  • field map is used to hold the mapping from sequence to + * chromosome coordinates
  • + *
+ * + * @author gmcarstairs + * + */ +public class GeneLocus extends DBRefEntry implements GeneLociI +{ + /** + * Constructor adapts species, assembly, chromosome to DBRefEntry source, + * version, accession, respectively, and saves the mapping of sequence to + * chromosomal coordinates + * + * @param speciesId + * @param assemblyId + * @param chromosomeId + * @param mapping + */ + public GeneLocus(String speciesId, String assemblyId, String chromosomeId, + Mapping mapping) + { + super(speciesId, assemblyId, chromosomeId, mapping); + } + + /** + * Constructor + * + * @param speciesId + * @param assemblyId + * @param chromosomeId + */ + public GeneLocus(String speciesId, String assemblyId, String chromosomeId) + { + this(speciesId, assemblyId, chromosomeId, null); + } + + @Override + public boolean equals(Object o) + { + return o instanceof GeneLocus && super.equals(o); + } + + @Override + public MapList getMapping() + { + return map == null ? null : map.getMap(); + } + + /** + * Answers the species identifier e.g. "human", stored as field source of + * DBRefEntry + */ + @Override + public String getSpeciesId() + { + return getSource(); + } + + /** + * Answers the genome assembly id e.g. "GRCh38", stored as field + * version of DBRefEntry + */ + @Override + public String getAssemblyId() + { + return getVersion(); + } + + /** + * Answers the chromosome identifier e.g. "X", stored as field + * accession of DBRefEntry + */ + @Override + public String getChromosomeId() + { + return getAccessionId(); + } + +} diff --git a/src/jalview/datamodel/Sequence.java b/src/jalview/datamodel/Sequence.java index 80310c0..6f5c18a 100755 --- a/src/jalview/datamodel/Sequence.java +++ b/src/jalview/datamodel/Sequence.java @@ -670,8 +670,8 @@ public class Sequence extends ASequence implements SequenceI public void setGeneLoci(String speciesId, String assemblyId, String chromosomeId, MapList map) { - addDBRef(new DBRefEntry(speciesId, assemblyId, DBRefEntry.CHROMOSOME - + ":" + chromosomeId, new Mapping(map))); + addDBRef(new GeneLocus(speciesId, assemblyId, chromosomeId, + new Mapping(map))); } /** @@ -687,36 +687,9 @@ public class Sequence extends ASequence implements SequenceI { for (final DBRefEntry ref : refs) { - if (ref.isChromosome()) + if (ref instanceof GeneLociI) { - return new GeneLociI() - { - @Override - public String getSpeciesId() - { - return ref.getSource(); - } - - @Override - public String getAssemblyId() - { - return ref.getVersion(); - } - - @Override - public String getChromosomeId() - { - // strip off "chromosome:" prefix to chrId - return ref.getAccessionId().substring( - DBRefEntry.CHROMOSOME.length() + 1); - } - - @Override - public MapList getMap() - { - return ref.getMap().getMap(); - } - }; + return (GeneLociI) ref; } } } diff --git a/src/jalview/ext/ensembl/EnsemblGene.java b/src/jalview/ext/ensembl/EnsemblGene.java index 7648536..9c7ce63 100644 --- a/src/jalview/ext/ensembl/EnsemblGene.java +++ b/src/jalview/ext/ensembl/EnsemblGene.java @@ -23,7 +23,6 @@ package jalview.ext.ensembl; import jalview.api.FeatureColourI; import jalview.api.FeatureSettingsModelI; import jalview.datamodel.AlignmentI; -import jalview.datamodel.DBRefEntry; import jalview.datamodel.GeneLociI; import jalview.datamodel.Sequence; import jalview.datamodel.SequenceFeature; @@ -62,6 +61,8 @@ public class EnsemblGene extends EnsemblSeqProxy EnsemblFeatureType.exon, EnsemblFeatureType.cds, EnsemblFeatureType.variation }; + private static final String CHROMOSOME = "chromosome"; + /** * Default constructor (to use rest.ensembl.org) */ @@ -187,7 +188,7 @@ public class EnsemblGene extends EnsemblSeqProxy if (geneLoci != null) { seq.setGeneLoci(geneLoci.getSpeciesId(), geneLoci.getAssemblyId(), - geneLoci.getChromosomeId(), geneLoci.getMap()); + geneLoci.getChromosomeId(), geneLoci.getMapping()); } else { @@ -209,7 +210,7 @@ public class EnsemblGene extends EnsemblSeqProxy return false; } String[] tokens = description.split(":"); - if (tokens.length == 6 && tokens[0].startsWith(DBRefEntry.CHROMOSOME)) + if (tokens.length == 6 && tokens[0].startsWith(CHROMOSOME)) { String ref = tokens[1]; String chrom = tokens[2]; @@ -460,7 +461,7 @@ public class EnsemblGene extends EnsemblSeqProxy return; } - MapList geneMapping = loci.getMap(); + MapList geneMapping = loci.getMapping(); List exons = mapping.getFromRanges(); List transcriptLoci = new ArrayList<>(); diff --git a/src/jalview/ext/ensembl/EnsemblLookup.java b/src/jalview/ext/ensembl/EnsemblLookup.java index c6b794a..b412849 100644 --- a/src/jalview/ext/ensembl/EnsemblLookup.java +++ b/src/jalview/ext/ensembl/EnsemblLookup.java @@ -23,6 +23,8 @@ package jalview.ext.ensembl; import jalview.bin.Cache; import jalview.datamodel.AlignmentI; import jalview.datamodel.GeneLociI; +import jalview.datamodel.GeneLocus; +import jalview.datamodel.Mapping; import jalview.util.MapList; import java.io.BufferedReader; @@ -287,34 +289,10 @@ public class EnsemblLookup extends EnsemblRestClient fromEnd }); List toRange = Collections.singletonList(new int[] { toStart, toEnd }); - final MapList map = new MapList(fromRange, toRange, 1, 1); - return new GeneLociI() - { - - @Override - public String getSpeciesId() - { - return species == null ? "" : species; - } - - @Override - public String getAssemblyId() - { - return assembly; - } - - @Override - public String getChromosomeId() - { - return chromosome; - } - - @Override - public MapList getMap() - { - return map; - } - }; + final Mapping map = new Mapping( + new MapList(fromRange, toRange, 1, 1)); + return new GeneLocus(species == null ? "" : species, assembly, + chromosome, map); } catch (NullPointerException | NumberFormatException e) { Cache.log.error("Error looking up gene loci: " + e.getMessage()); diff --git a/src/jalview/ext/ensembl/EnsemblMap.java b/src/jalview/ext/ensembl/EnsemblMap.java index b1c9d86..c688a6f 100644 --- a/src/jalview/ext/ensembl/EnsemblMap.java +++ b/src/jalview/ext/ensembl/EnsemblMap.java @@ -3,6 +3,8 @@ package jalview.ext.ensembl; import jalview.datamodel.AlignmentI; import jalview.datamodel.DBRefSource; import jalview.datamodel.GeneLociI; +import jalview.datamodel.GeneLocus; +import jalview.datamodel.Mapping; import jalview.util.MapList; import java.io.BufferedReader; @@ -386,34 +388,9 @@ public class EnsemblMap extends EnsemblRestClient final String chr = chromosome; List fromRange = Collections.singletonList(new int[] { 1, fromEnd }); - final MapList map = new MapList(fromRange, regions, 1, 1); - return new GeneLociI() - { - - @Override - public String getSpeciesId() - { - return species == null ? "" : species; - } - - @Override - public String getAssemblyId() - { - return as; - } - - @Override - public String getChromosomeId() - { - return chr; - } - - @Override - public MapList getMap() - { - return map; - } - }; + Mapping mapping = new Mapping(new MapList(fromRange, regions, 1, 1)); + return new GeneLocus(species == null ? "" : species, as, chr, + mapping); } catch (IOException | ParseException | NumberFormatException e) { // ignore diff --git a/src/jalview/gui/CrossRefAction.java b/src/jalview/gui/CrossRefAction.java index 85f2498..51ac2ee 100644 --- a/src/jalview/gui/CrossRefAction.java +++ b/src/jalview/gui/CrossRefAction.java @@ -356,12 +356,12 @@ public class CrossRefAction implements Runnable seq.getLength()); if (geneLoci != null) { - MapList map = geneLoci.getMap(); + MapList map = geneLoci.getMapping(); int mappedFromLength = MappingUtils.getLength(map.getFromRanges()); if (mappedFromLength == seq.getLength()) { seq.setGeneLoci(geneLoci.getSpeciesId(), geneLoci.getAssemblyId(), - geneLoci.getChromosomeId(), geneLoci.getMap()); + geneLoci.getChromosomeId(), map); retrievedLoci.put(dbref, geneLoci); return true; } @@ -374,12 +374,12 @@ public class CrossRefAction implements Runnable seq.getLength()); if (geneLoci != null) { - MapList map = geneLoci.getMap(); + MapList map = geneLoci.getMapping(); int mappedFromLength = MappingUtils.getLength(map.getFromRanges()); if (mappedFromLength == seq.getLength()) { seq.setGeneLoci(geneLoci.getSpeciesId(), geneLoci.getAssemblyId(), - geneLoci.getChromosomeId(), geneLoci.getMap()); + geneLoci.getChromosomeId(), map); retrievedLoci.put(dbref, geneLoci); return true; } diff --git a/src/jalview/io/SequenceAnnotationReport.java b/src/jalview/io/SequenceAnnotationReport.java index 6b82671..dd09d03 100644 --- a/src/jalview/io/SequenceAnnotationReport.java +++ b/src/jalview/io/SequenceAnnotationReport.java @@ -23,6 +23,7 @@ package jalview.io; import jalview.api.FeatureColourI; import jalview.datamodel.DBRefEntry; import jalview.datamodel.DBRefSource; +import jalview.datamodel.GeneLociI; import jalview.datamodel.SequenceFeature; import jalview.datamodel.SequenceI; import jalview.util.MessageManager; @@ -68,11 +69,11 @@ public class SequenceAnnotationReport @Override public int compare(DBRefEntry ref1, DBRefEntry ref2) { - if (ref1.isChromosome()) + if (ref1 instanceof GeneLociI) { return -1; } - if (ref2.isChromosome()) + if (ref2 instanceof GeneLociI) { return 1; } diff --git a/src/jalview/io/vcf/VCFLoader.java b/src/jalview/io/vcf/VCFLoader.java index 622da73..7bf7791 100644 --- a/src/jalview/io/vcf/VCFLoader.java +++ b/src/jalview/io/vcf/VCFLoader.java @@ -737,7 +737,7 @@ public class VCFLoader String species = seqCoords.getSpeciesId(); String chromosome = seqCoords.getChromosomeId(); String seqRef = seqCoords.getAssemblyId(); - MapList map = seqCoords.getMap(); + MapList map = seqCoords.getMapping(); // note this requires the configured species to match that // returned with the Ensembl sequence; todo: support aliases? diff --git a/src/jalview/project/Jalview2XML.java b/src/jalview/project/Jalview2XML.java index 0d2ec68..0e17779 100644 --- a/src/jalview/project/Jalview2XML.java +++ b/src/jalview/project/Jalview2XML.java @@ -38,6 +38,8 @@ import jalview.datamodel.AlignedCodonFrame; import jalview.datamodel.Alignment; import jalview.datamodel.AlignmentAnnotation; import jalview.datamodel.AlignmentI; +import jalview.datamodel.DBRefEntry; +import jalview.datamodel.GeneLocus; import jalview.datamodel.GraphLine; import jalview.datamodel.PDBEntry; import jalview.datamodel.Point; @@ -2505,21 +2507,29 @@ public class Jalview2XML parentseq = jds; } } + + /* + * save any dbrefs; special subclass GeneLocus is flagged as 'locus' + */ if (dbrefs != null) { for (int d = 0; d < dbrefs.length; d++) { DBRef dbref = new DBRef(); - dbref.setSource(dbrefs[d].getSource()); - dbref.setVersion(dbrefs[d].getVersion()); - dbref.setAccessionId(dbrefs[d].getAccessionId()); - if (dbrefs[d].hasMap()) + DBRefEntry dbRefEntry = dbrefs[d]; + dbref.setSource(dbRefEntry.getSource()); + dbref.setVersion(dbRefEntry.getVersion()); + dbref.setAccessionId(dbRefEntry.getAccessionId()); + if (dbRefEntry instanceof GeneLocus) { - Mapping mp = createVamsasMapping(dbrefs[d].getMap(), parentseq, + dbref.setLocus(true); + } + if (dbRefEntry.hasMap()) + { + Mapping mp = createVamsasMapping(dbRefEntry.getMap(), parentseq, jds, recurse); dbref.setMapping(mp); } - // vamsasSeq.addDBRef(dbref); vamsasSeq.getDBRef().add(dbref); } } @@ -5798,13 +5808,29 @@ public class Jalview2XML return datasetId; } + /** + * Add any saved DBRefEntry's to the sequence. An entry flagged as 'locus' is + * constructed as a special subclass GeneLocus. + * + * @param datasetSequence + * @param sequence + */ private void addDBRefs(SequenceI datasetSequence, Sequence sequence) { for (int d = 0; d < sequence.getDBRef().size(); d++) { DBRef dr = sequence.getDBRef().get(d); - jalview.datamodel.DBRefEntry entry = new jalview.datamodel.DBRefEntry( - dr.getSource(), dr.getVersion(), dr.getAccessionId()); + DBRefEntry entry; + if (dr.isLocus()) + { + entry = new GeneLocus(dr.getSource(), dr.getVersion(), + dr.getAccessionId()); + } + else + { + entry = new DBRefEntry(dr.getSource(), dr.getVersion(), + dr.getAccessionId()); + } if (dr.getMapping() != null) { entry.setMap(addMapping(dr.getMapping())); diff --git a/src/jalview/xml/binding/jalview/Sequence.java b/src/jalview/xml/binding/jalview/Sequence.java index abb40c9..4442017 100644 --- a/src/jalview/xml/binding/jalview/Sequence.java +++ b/src/jalview/xml/binding/jalview/Sequence.java @@ -2,7 +2,7 @@ // This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, v2.2.8-b130911.1802 // See http://java.sun.com/xml/jaxb // Any modifications to this file will be lost upon recompilation of the source schema. -// Generated on: 2018.12.20 at 11:47:26 AM GMT +// Generated on: 2019.02.06 at 10:59:19 AM GMT // @@ -38,6 +38,7 @@ import javax.xml.bind.annotation.XmlType; * <attribute name="source" type="{http://www.w3.org/2001/XMLSchema}string" /> * <attribute name="version" type="{http://www.w3.org/2001/XMLSchema}string" /> * <attribute name="accessionId" type="{http://www.w3.org/2001/XMLSchema}string" /> + * <attribute name="locus" type="{http://www.w3.org/2001/XMLSchema}boolean" default="false" /> * </restriction> * </complexContent> * </complexType> @@ -134,6 +135,7 @@ public class Sequence * <attribute name="source" type="{http://www.w3.org/2001/XMLSchema}string" /> * <attribute name="version" type="{http://www.w3.org/2001/XMLSchema}string" /> * <attribute name="accessionId" type="{http://www.w3.org/2001/XMLSchema}string" /> + * <attribute name="locus" type="{http://www.w3.org/2001/XMLSchema}boolean" default="false" /> * </restriction> * </complexContent> * </complexType> @@ -155,6 +157,8 @@ public class Sequence protected String version; @XmlAttribute(name = "accessionId") protected String accessionId; + @XmlAttribute(name = "locus") + protected Boolean locus; /** * Gets the value of the mapping property. @@ -252,6 +256,34 @@ public class Sequence this.accessionId = value; } + /** + * Gets the value of the locus property. + * + * @return + * possible object is + * {@link Boolean } + * + */ + public boolean isLocus() { + if (locus == null) { + return false; + } else { + return locus; + } + } + + /** + * Sets the value of the locus property. + * + * @param value + * allowed object is + * {@link Boolean } + * + */ + public void setLocus(Boolean value) { + this.locus = value; + } + } } diff --git a/test/jalview/analysis/AlignmentUtilsTests.java b/test/jalview/analysis/AlignmentUtilsTests.java index 70ae6a0..14559dd 100644 --- a/test/jalview/analysis/AlignmentUtilsTests.java +++ b/test/jalview/analysis/AlignmentUtilsTests.java @@ -2684,7 +2684,7 @@ public class AlignmentUtilsTests * transcript 'CDS' is 10-16, 17-21 * which is 'gene' 158-164, 210-214 */ - MapList toMap = toLoci.getMap(); + MapList toMap = toLoci.getMapping(); assertEquals(1, toMap.getFromRanges().size()); assertEquals(2, toMap.getFromRanges().get(0).length); assertEquals(1, toMap.getFromRanges().get(0)[0]); @@ -2707,7 +2707,7 @@ public class AlignmentUtilsTests AlignmentUtils.transferGeneLoci(from, map, to); assertEquals("GRCh38", toLoci.getAssemblyId()); assertEquals("7", toLoci.getChromosomeId()); - toMap = toLoci.getMap(); + toMap = toLoci.getMapping(); assertEquals("[ [1, 12] ] 1:1 to [ [158, 164] [210, 214] ]", toMap.toString()); } diff --git a/test/jalview/project/Jalview2xmlTests.java b/test/jalview/project/Jalview2xmlTests.java index d902fa2..5f1256c 100644 --- a/test/jalview/project/Jalview2xmlTests.java +++ b/test/jalview/project/Jalview2xmlTests.java @@ -34,7 +34,10 @@ import jalview.api.FeatureColourI; import jalview.api.ViewStyleI; import jalview.datamodel.AlignmentAnnotation; import jalview.datamodel.AlignmentI; +import jalview.datamodel.DBRefEntry; +import jalview.datamodel.GeneLocus; import jalview.datamodel.HiddenSequences; +import jalview.datamodel.Mapping; import jalview.datamodel.PDBEntry; import jalview.datamodel.PDBEntry.Type; import jalview.datamodel.SequenceCollectionI; @@ -68,6 +71,7 @@ import jalview.schemes.RNAHelicesColour; import jalview.schemes.StrandColourScheme; import jalview.schemes.TCoffeeColourScheme; import jalview.structure.StructureImportSettings; +import jalview.util.MapList; import jalview.util.matcher.Condition; import jalview.viewmodel.AlignmentViewport; @@ -1179,4 +1183,83 @@ public class Jalview2xmlTests extends Jalview2xmlBase .getAlignViewport(), "Didn't restore correct view association for the PCA view"); } + + /** + * Test save and reload of DBRefEntry including GeneLocus in project + * + * @throws Exception + */ + @Test(groups = { "Functional" }) + public void testStoreAndRecoverGeneLocus() throws Exception + { + Desktop.instance.closeAll_actionPerformed(null); + String seqData = ">P30419\nACDE\n>X1235\nGCCTGTGACGAA"; + AlignFrame af = new FileLoader().LoadFileWaitTillLoaded(seqData, + DataSourceType.PASTE); + assertNotNull(af, "Didn't read in the example file correctly."); + + AlignmentViewPanel ap = Desktop.getAlignmentPanels(null)[0]; + SequenceI pep = ap.getAlignment().getSequenceAt(0); + SequenceI cds = ap.getAlignment().getSequenceAt(1); + + /* + * give 'protein' a dbref to self, a dbref with map to CDS, + * and a dbref with map to gene 'locus' + */ + DBRefEntry dbref1 = new DBRefEntry("Uniprot", "1", "P30419", null); + pep.addDBRef(dbref1); + Mapping cdsmap = new Mapping(cds, + new MapList(new int[] + { 1, 4 }, new int[] { 1, 12 }, 1, 3)); + DBRefEntry dbref2 = new DBRefEntry("EMBLCDS", "2", "X1235", cdsmap); + pep.addDBRef(dbref2); + Mapping locusmap = new Mapping(null, + new MapList(new int[] + { 1, 4 }, new int[] { 2674123, 2674135 }, 1, 3)); + DBRefEntry dbref3 = new GeneLocus("human", "GRCh38", "5", locusmap); + pep.addDBRef(dbref3); + + File tfile = File.createTempFile("testStoreAndRecoverGeneLocus", + ".jvp"); + try + { + new Jalview2XML(false).saveState(tfile); + } catch (Throwable e) + { + Assert.fail("Didn't save the state", e); + } + Desktop.instance.closeAll_actionPerformed(null); + + new FileLoader().LoadFileWaitTillLoaded(tfile.getAbsolutePath(), + DataSourceType.FILE); + AlignmentViewPanel rap = Desktop.getAlignmentPanels(null)[0]; + SequenceI rpep = rap.getAlignment().getSequenceAt(0); + assertEquals(rpep.getName(), "P30419"); + DBRefEntry[] dbrefs = rpep.getDBRefs(); + assertEquals(dbrefs.length, 3); + DBRefEntry dbRef = dbrefs[0]; + assertFalse(dbRef instanceof GeneLocus); + assertNull(dbRef.getMap()); + assertEquals(dbRef, dbref1); + + /* + * restored dbrefs with mapping have a different 'map to' + * sequence but otherwise match the original dbrefs + */ + dbRef = dbrefs[1]; + assertFalse(dbRef instanceof GeneLocus); + assertTrue(dbRef.equalRef(dbref2)); + assertNotNull(dbRef.getMap()); + SequenceI rcds = rap.getAlignment().getSequenceAt(1); + assertSame(dbRef.getMap().getTo(), rcds); + // compare MapList but not map.to + assertEquals(dbRef.getMap().getMap(), dbref2.getMap().getMap()); + + /* + * GeneLocus map.to is null so can compare Mapping objects + */ + dbRef = dbrefs[2]; + assertTrue(dbRef instanceof GeneLocus); + assertEquals(dbRef, dbref3); + } }