Merge branch 'bug/JAL-3288splitFrameMenusJava11' into develop
authorgmungoc <g.m.carstairs@dundee.ac.uk>
Fri, 7 Jun 2019 14:31:59 +0000 (15:31 +0100)
committergmungoc <g.m.carstairs@dundee.ac.uk>
Fri, 7 Jun 2019 14:31:59 +0000 (15:31 +0100)
43 files changed:
build.gradle
schemas/jalview.xsd
schemas/vamsas.xsd
src/jalview/analysis/AlignmentUtils.java
src/jalview/datamodel/DBRefEntry.java
src/jalview/datamodel/GeneLociI.java
src/jalview/datamodel/GeneLocus.java [new file with mode: 0644]
src/jalview/datamodel/Sequence.java
src/jalview/ext/ensembl/EnsemblGene.java
src/jalview/ext/ensembl/EnsemblLookup.java
src/jalview/ext/ensembl/EnsemblMap.java
src/jalview/gui/CrossRefAction.java
src/jalview/io/SequenceAnnotationReport.java
src/jalview/io/vcf/VCFLoader.java
src/jalview/project/Jalview2XML.java
src/jalview/xml/binding/jalview/AlcodonFrame.java
src/jalview/xml/binding/jalview/Annotation.java
src/jalview/xml/binding/jalview/AnnotationColourScheme.java
src/jalview/xml/binding/jalview/AnnotationElement.java
src/jalview/xml/binding/jalview/DoubleMatrix.java
src/jalview/xml/binding/jalview/DoubleVector.java
src/jalview/xml/binding/jalview/Feature.java
src/jalview/xml/binding/jalview/FeatureMatcher.java
src/jalview/xml/binding/jalview/FeatureMatcherSet.java
src/jalview/xml/binding/jalview/FilterBy.java
src/jalview/xml/binding/jalview/JalviewModel.java
src/jalview/xml/binding/jalview/JalviewUserColours.java
src/jalview/xml/binding/jalview/MapListType.java
src/jalview/xml/binding/jalview/Mapping.java
src/jalview/xml/binding/jalview/NoValueColour.java
src/jalview/xml/binding/jalview/ObjectFactory.java
src/jalview/xml/binding/jalview/PcaDataType.java
src/jalview/xml/binding/jalview/Pdbentry.java
src/jalview/xml/binding/jalview/Sequence.java
src/jalview/xml/binding/jalview/SequenceSet.java
src/jalview/xml/binding/jalview/SequenceType.java
src/jalview/xml/binding/jalview/ThresholdType.java
src/jalview/xml/binding/jalview/VAMSAS.java
src/jalview/xml/binding/jalview/WebServiceParameterSet.java
src/jalview/xml/binding/jalview/package-info.java
test/jalview/analysis/AlignmentUtilsTests.java
test/jalview/project/Jalview2xmlTests.java
utils/HelpLinksChecker.java

index fb311a4..c2c4599 100644 (file)
@@ -1,6 +1,10 @@
 import org.apache.tools.ant.filters.ReplaceTokens
 //import org.apache.tools.ant.filters.ReplaceRegexp
 import org.gradle.internal.os.OperatingSystem
+import org.gradle.plugins.ide.eclipse.model.*
+
+
+import groovy.transform.ExternalizeMethods
 
 buildscript {
   dependencies {
@@ -48,20 +52,18 @@ def compile_target_compatibility
 
 ext {
   // where the getdown channel will be built.
-  // TODO: consider allowing this expression to  be overrriden by -P arg
-  getdownWebsiteDir = jalviewDir + '/' + getdown_website_dir + '/' + JAVA_VERSION + '/'
+  // TODO: consider allowing this expression to  be overridden by -P arg
+  getdownWebsiteDir = jalviewDir + '/' + getdown_website_dir + '/' + JAVA_VERSION
   getdownAppDir = getdownWebsiteDir + '/' + getdown_app_dir
   getdownJ11libDir = getdownWebsiteDir + '/' + getdown_j11lib_dir
   getdownResourceDir = getdownWebsiteDir + '/' + getdown_resource_dir
   getdownLauncher = jalviewDir + '/' + getdown_launcher
   getdownFilesDir = jalviewDir + '/' + getdown_files_dir + '/' + JAVA_VERSION + '/'
-  def getdownChannel = getdown_channel_name
-  if (getdown_channel_name.equals("COMMIT")) {
-    getdownChannel = getGitHash()
-  }
-  getdown_app_base = getdown_channel_base+"/"+getdownChannel+"/"+JAVA_VERSION+"/"
+  getdown_app_base = getdown_channel_base+"/"+getdown_channel_name+"/"+JAVA_VERSION+"/"
   modules_compileClasspath = fileTree(dir: "$jalviewDir/$j11modDir", include: ["*.jar"])
   modules_runtimeClasspath = modules_compileClasspath
+  gitHash = ""
+  gitBranch = ""
 }
 
 def JAVA_INTEGER_VERSION
@@ -149,8 +151,8 @@ sourceSets {
     } else {
       compileClasspath += files(sourceSets.main.java.outputDir)
     }
-    compileClasspath += sourceSets.main.compileClasspath
-    compileClasspath += files( sourceSets.main.resources.srcDirs)
+    //compileClasspath += sourceSets.main.compileClasspath
+    //compileClasspath += files( sourceSets.main.resources.srcDirs)
     compileClasspath += fileTree(dir: "$jalviewDir/$utilsDir", include: ["**/*.jar"])
     compileClasspath += fileTree(dir: "$jalviewDir/$libDir", include: ["*.jar"])
 
@@ -190,7 +192,6 @@ eclipse {
         removeThese += it
       }
     }
-    containers 'org.eclipse.buildship.core.gradleclasspathcontainer'
 
     minusConfigurations += removeThese
     plusConfigurations = [ ]
@@ -209,31 +210,11 @@ eclipse {
           }
         }
         cp.entries.removeAll(removeTheseToo)
-      }
-
-      withXml {
-        def node = it.asNode()
-        def srcTestAttributes
-        node.children().each{ cpe ->
-          def attributes = cpe.attributes()
-          if (attributes.get("kind") == "src" && attributes.get("path") == "test") {
-            srcTestAttributes = cpe.find { a -> a.name() == "attributes" }
-            return
-          }
-        }
-        def addTestAttribute = true
-        srcTestAttributes.each{a ->
-          if (a.name() == "attribute" && a.attributes().getAt("name") == "test") {
-            addTestAttribute = false
-          }
-        }
-        if (addTestAttribute) {
-          srcTestAttributes.append(new Node(null, "attribute", [name:"test", value:"true"]))
-        }
-
-        node.appendNode('classpathentry', [kind:"output", path:"bin/main"])
-        node.appendNode('classpathentry', [kind:"lib", path:helpParentDir])
-        node.appendNode('classpathentry', [kind:"lib", path:resourceDir])
+        
+        cp.entries += new Output("bin/main")
+        cp.entries += new Library(fileReference(helpParentDir))
+        cp.entries += new Library(fileReference(resourceDir))
+        
         HashMap<String, Boolean> addedLibPath = new HashMap<>();
         def allPaths = sourceSets.test.compileClasspath + sourceSets.main.compileClasspath
         sourceSets.main.compileClasspath.each{
@@ -241,7 +222,6 @@ eclipse {
           //no longer want to add outputDir as eclipse is using its own output dir in bin/main
           if (it.isDirectory() || ! it.exists()) {
             // don't add dirs to classpath
-            //println("Not adding directory "+it)
             return
           }
           def itPath = it.toString()
@@ -252,36 +232,69 @@ eclipse {
             //println("Not adding duplicate entry "+itPath)
           } else {
             //println("Adding entry "+itPath)
-            node.appendNode('classpathentry', [kind:"lib", path:itPath])
+            cp.entries += new Library(fileReference(itPath))
             addedLibPath.put(itPath, true)
           }
         }
+
         sourceSets.test.compileClasspath.each{
           //if ((it.isDirectory() || ! it.exists()) && ! (it.equals(sourceSets.main.java.outputDir))) {
           //no longer want to add outputDir as eclipse is using its own output dir in bin/main
           if (it.isDirectory() || ! it.exists()) {
             // don't add dirs to classpath
-            //println("Not adding directory "+it)
-            return
+            return false // groovy "break" in .each loop
           }
           def itPath = it.toString()
           if (itPath.startsWith(jalviewDirAbsolutePath+"/")) {
             itPath = itPath.substring(jalviewDirAbsolutePath.length()+1)
           }
           if (addedLibPath.get(itPath)) {
-            //println("Not adding duplicate entry "+itPath)
+            // don't duplicate
           } else {
-            //println("Adding entry "+itPath)
-            node.appendNode('classpathentry', [kind:"lib", path:itPath])
-            .appendNode('attributes')
-            .appendNode('attribute', [name:"test", value:"true"])
+            def lib = new Library(fileReference(itPath))
+            // this doesn't work... yet.  Adding test=true attribute using withXml below
+            //def attrs = new Node(null, 'attributes', ["test":"true"])
+            //lib.appendNode(attrs) //
+            cp.entries += lib
             addedLibPath.put(itPath, true)
           }
         }
-      }
+      }  
 
-    }
-  }
+      // withXml changes ignored by buildship, these add the "test=true" attribute
+      withXml {
+        def node = it.asNode()
+        
+        def srcTestAttributes
+        node.children().each{ cpe ->
+          def attributes = cpe.attributes()
+          if (attributes.get("kind") == "src" && attributes.get("path") == "test") {
+            srcTestAttributes = cpe.find { a -> a.name() == "attributes" }
+            return
+          }
+        }
+        def addTestAttribute = true
+        srcTestAttributes.each{a ->
+          if (a.name() == "attribute" && a.attributes().getAt("name") == "test") {
+            addTestAttribute = false
+          }
+        }
+        if (addTestAttribute) {
+          srcTestAttributes.append(new Node(null, "attribute", [name:"test", value:"true"]))
+        }
+
+        node.children().each{ cpe ->
+          def attributes = cpe.attributes()
+          if (attributes.get("kind") == "lib" && attributes.get("path").startsWith("utils/")) {
+            cpe.appendNode('attributes')
+                .appendNode('attribute', [name:"test", value:"true"])
+          }
+        }
+      } // withXML
+    } // file
+
+    containers 'org.eclipse.buildship.core.gradleclasspathcontainer'
+  } // classpath
 
   jdt {
     // for the IDE, use java 11 compatibility
@@ -292,7 +305,7 @@ eclipse {
     file {
       withProperties { props ->
         def jalview_prefs = new Properties()
-        def ins = new FileInputStream(eclipse_extra_jdt_prefs_file)
+        def ins = new FileInputStream(jalviewDirAbsolutePath+"/"+eclipse_extra_jdt_prefs_file)
         jalview_prefs.load(ins)
         ins.close()
         jalview_prefs.forEach { t, v ->
@@ -303,8 +316,10 @@ eclipse {
       }
     }
   }
-
-}
+  
+  //synchronizationTasks eclipseClasspath
+  //autoBuildTasks eclipseClasspath
+} 
 
 task cloverInstr() {
   // only instrument source, we build test classes as normal
@@ -323,7 +338,7 @@ task cloverInstr() {
     com.atlassian.clover.CloverInstr.mainImpl(args)
   }
 }
-
+  
 
 task cloverReport {
   group = "Verification"
@@ -402,36 +417,40 @@ def getDate(format) {
   return date.format(format)
 }
 
-def getGitHash() {
-  def stdout = new ByteArrayOutputStream()
-  exec {
-    commandLine "git", "rev-parse", "--short", "HEAD"
-    standardOutput = stdout
-    workingDir = jalviewDir
+task setGitHash(type: Exec) {
+  workingDir = jalviewDir
+  commandLine "git", "rev-parse", "--short", "HEAD"
+  standardOutput = new ByteArrayOutputStream()
+  project.ext.gitHash = {
+    return standardOutput.toString().trim()
   }
-  return stdout.toString().trim()
 }
 
-def getGitBranch() {
-  def stdout = new ByteArrayOutputStream()
-  exec {
-    commandLine "git", "rev-parse", "--abbrev-ref", "HEAD"
-    standardOutput = stdout
-    workingDir = jalviewDir
+task setGitBranch(type: Exec) {
+  workingDir = jalviewDir
+  commandLine "git", "rev-parse", "--abbrev-ref", "HEAD"
+  standardOutput = new ByteArrayOutputStream()
+  project.ext.gitBranch = {
+    return standardOutput.toString().trim()
   }
-  return stdout.toString().trim()
+}
+
+task setGitVals {
+  dependsOn setGitHash
+  dependsOn setGitBranch
 }
 
 task createBuildProperties(type: WriteProperties) {
+  dependsOn setGitVals
   inputs.dir("$jalviewDir/$sourceDir")
   inputs.dir("$jalviewDir/$resourceDir")
   outputFile "$classes/$buildPropertiesFile"
-  /* taking time/date specific comment out to allow better incremental builds */
+  // taking time specific comment out to allow better incremental builds
   //comment "--Jalview Build Details--\n"+getDate("yyyy-MM-dd HH:mm:ss")
   comment "--Jalview Build Details--\n"+getDate("yyyy-MM-dd")
   property "BUILD_DATE", getDate("dd MMMM yyyy")
   property "VERSION", JALVIEW_VERSION
-  property "INSTALLATION", INSTALLATION+" git-commit:"+getGitHash()+" ["+getGitBranch()+"]"
+  property "INSTALLATION", INSTALLATION+" git-commit:"+project.ext.gitHash+" ["+project.ext.gitBranch+"]"
   outputs.file(outputFile)
   outputs.dir("$classes")
 }
@@ -538,6 +557,8 @@ task compileLinkCheck(type: JavaCompile) {
   destinationDir = file("$jalviewDir/$utilsDir")
   source = fileTree(dir: "$jalviewDir/$utilsDir", include: ["HelpLinksChecker.java", "BufferedLineReader.java"])
 
+  inputs.file("$jalviewDir/$utilsDir/HelpLinksChecker.java")
+  inputs.file("$jalviewDir/$utilsDir/HelpLinksChecker.java")
   outputs.file("$jalviewDir/$utilsDir/HelpLinksChecker.class")
   outputs.file("$jalviewDir/$utilsDir/BufferedLineReader.class")
 }
@@ -550,7 +571,6 @@ task linkCheck(type: JavaExec) {
   workingDir = jalviewDir
   def help = "$classes/$helpDir"
   args = [ "$classes/$helpDir", "-nointernet" ]
-  //args = [ "$classesDir/$helpDir", "-nointernet" ]
 
   doFirst {
     helplinkscheckeroutputfile.createNewFile()
@@ -648,7 +668,7 @@ task getdownWebsite() {
     props.put("getdown_txt_multi_java_location", getdown_alt_multi_java_location)
 
     if (getdown_local == "true") {
-      getdown_app_base = "file://"+file(getdownWebsiteDir).getAbsolutePath()
+      getdown_app_base = file(getdownWebsiteDir).toURI().toString()
     }
     props.put("getdown_txt_appbase", getdown_app_base)
     props.each{ prop, val ->
index 07dee98..1d2235e 100755 (executable)
                                                                </xs:documentation>
                                                        </xs:annotation>
                                                </xs:attribute>
+                                               <xs:attribute name="showComplementFeatures" type="xs:boolean" use="optional" default="false" />
+                                               <xs:attribute name="showComplementFeaturesOnTop" type="xs:boolean" use="optional" default="false" />
                                        </xs:complexType>
                                </xs:element>
                                <xs:element name="UserColours" minOccurs="0" maxOccurs="unbounded">
index 22b7aac..20c19dd 100755 (executable)
                                                        </xs:element>
                                                </xs:choice>
                                        </xs:sequence>
+                                       <xs:attribute name="mappingType" type="xs:string" use="optional">
+                                               <xs:annotation>
+                                                       <xs:documentation>Biotype of the mapping e.g. CdsToPeptide</xs:documentation>
+                                               </xs:annotation>
+                                       </xs:attribute>
                                </xs:extension>
                        </xs:complexContent>    
                </xs:complexType>
                                                                <xs:attribute name="source" type="xs:string"/>
                                                                <xs:attribute name="version" type="xs:string"/>
                                                                <xs:attribute name="accessionId" type="xs:string"/>
+                                                               <xs:attribute name="locus" type="xs:boolean" default="false">
+                                                                       <xs:annotation>
+                                                                               <xs:documentation>
+                                                                                       true for gene locus mapping, source=species, version=assembly, accession=chromosome
+                                                                               </xs:documentation>
+                                                                       </xs:annotation>
+                                                               </xs:attribute>
                                                        </xs:complexType>
                                                </xs:element>
                                        </xs:sequence>
                                                        </xs:documentation>
                                                </xs:annotation>
                                        </xs:attribute>
+                                       <xs:attribute name="biotype" type="xs:string" use="optional">
+                                               <xs:annotation>
+                                                       <xs:documentation>
+                                                               Biotype of the sequence (if known)
+                                                       </xs:documentation>
+                                               </xs:annotation>
+                                       </xs:attribute>
                                </xs:extension>
                        </xs:complexContent>
                </xs:complexType>
index 0dfd383..0bc8180 100644 (file)
@@ -1870,7 +1870,7 @@ public class AlignmentUtils
       return;
     }
 
-    MapList newMap = targetToFrom.traverse(fromLoci.getMap());
+    MapList newMap = targetToFrom.traverse(fromLoci.getMapping());
 
     if (newMap != null)
     {
index 98868ce..bc8d0cf 100755 (executable)
@@ -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 + ":");
-  }
 }
index f8c7ec5..09db9d7 100644 (file)
@@ -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 (file)
index 0000000..f81348f
--- /dev/null
@@ -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
+ * <ul>
+ * <li>field <code>source</code> is used to hold a species id e.g. human</li>
+ * <li>field <code>version</code> is used to hold assembly id e.g GRCh38</li>
+ * <li>field <code>accession</code> is used to hold the chromosome id</li>
+ * <li>field <code>map</code> is used to hold the mapping from sequence to
+ * chromosome coordinates</li>
+ * </ul>
+ * 
+ * @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 <code>source</code> of
+   * DBRefEntry
+   */
+  @Override
+  public String getSpeciesId()
+  {
+    return getSource();
+  }
+
+  /**
+   * Answers the genome assembly id e.g. "GRCh38", stored as field
+   * <code>version</code> of DBRefEntry
+   */
+  @Override
+  public String getAssemblyId()
+  {
+    return getVersion();
+  }
+
+  /**
+   * Answers the chromosome identifier e.g. "X", stored as field
+   * <code>accession</code> of DBRefEntry
+   */
+  @Override
+  public String getChromosomeId()
+  {
+    return getAccessionId();
+  }
+
+}
index 80310c0..6f5c18a 100755 (executable)
@@ -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;
         }
       }
     }
index 7648536..9c7ce63 100644 (file)
@@ -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<int[]> exons = mapping.getFromRanges();
     List<int[]> transcriptLoci = new ArrayList<>();
index c6b794a..b412849 100644 (file)
@@ -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<int[]> 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());
index b1c9d86..c688a6f 100644 (file)
@@ -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<int[]> 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
index 85f2498..51ac2ee 100644 (file)
@@ -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;
       }
index 6b82671..dd09d03 100644 (file)
@@ -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;
       }
index 622da73..7bf7791 100644 (file)
@@ -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?
index 0d2ec68..0e17779 100644 (file)
@@ -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()));
index 83f1ee2..cb90984 100644 (file)
@@ -2,7 +2,7 @@
 // This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, v2.2.8-b130911.1802 
 // See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a> 
 // 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.06.07 at 02:21:15 PM BST 
 //
 
 
index 0dbcad0..35f78f3 100644 (file)
@@ -2,7 +2,7 @@
 // This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, v2.2.8-b130911.1802 
 // See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a> 
 // 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.06.07 at 02:21:15 PM BST 
 //
 
 
index 44affa2..6f5ef65 100644 (file)
@@ -2,7 +2,7 @@
 // This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, v2.2.8-b130911.1802 
 // See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a> 
 // 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.06.07 at 02:21:15 PM BST 
 //
 
 
index de408d2..6780323 100644 (file)
@@ -2,7 +2,7 @@
 // This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, v2.2.8-b130911.1802 
 // See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a> 
 // 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.06.07 at 02:21:15 PM BST 
 //
 
 
index b4c07bc..5edb2e8 100644 (file)
@@ -2,7 +2,7 @@
 // This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, v2.2.8-b130911.1802 
 // See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a> 
 // 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.06.07 at 02:21:15 PM BST 
 //
 
 
index e2592ab..68ebf9b 100644 (file)
@@ -2,7 +2,7 @@
 // This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, v2.2.8-b130911.1802 
 // See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a> 
 // 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.06.07 at 02:21:15 PM BST 
 //
 
 
index 9001ee2..39fc0c3 100644 (file)
@@ -2,7 +2,7 @@
 // This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, v2.2.8-b130911.1802 
 // See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a> 
 // 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.06.07 at 02:21:15 PM BST 
 //
 
 
index 0daf56a..c92f72c 100644 (file)
@@ -2,7 +2,7 @@
 // This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, v2.2.8-b130911.1802 
 // See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a> 
 // 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.06.07 at 02:21:15 PM BST 
 //
 
 
index bf69d5b..0c21215 100644 (file)
@@ -2,7 +2,7 @@
 // This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, v2.2.8-b130911.1802 
 // See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a> 
 // 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.06.07 at 02:21:15 PM BST 
 //
 
 
index 5684acf..36b454f 100644 (file)
@@ -2,7 +2,7 @@
 // This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, v2.2.8-b130911.1802 
 // See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a> 
 // 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.06.07 at 02:21:15 PM BST 
 //
 
 
index ed57edc..0ea2491 100644 (file)
@@ -2,7 +2,7 @@
 // This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, v2.2.8-b130911.1802 
 // See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a> 
 // 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.06.07 at 02:21:15 PM BST 
 //
 
 
@@ -208,6 +208,8 @@ import javax.xml.datatype.XMLGregorianCalendar;
  *                   &lt;attribute name="textColThreshold" type="{http://www.w3.org/2001/XMLSchema}int" />
  *                   &lt;attribute name="id" type="{http://www.w3.org/2001/XMLSchema}ID" />
  *                   &lt;attribute name="complementId" type="{http://www.w3.org/2001/XMLSchema}string" />
+ *                   &lt;attribute name="showComplementFeatures" type="{http://www.w3.org/2001/XMLSchema}boolean" default="false" />
+ *                   &lt;attribute name="showComplementFeaturesOnTop" type="{http://www.w3.org/2001/XMLSchema}boolean" default="false" />
  *                 &lt;/restriction>
  *               &lt;/complexContent>
  *             &lt;/complexType>
@@ -4808,6 +4810,8 @@ public class JalviewModel {
      *       &lt;attribute name="textColThreshold" type="{http://www.w3.org/2001/XMLSchema}int" />
      *       &lt;attribute name="id" type="{http://www.w3.org/2001/XMLSchema}ID" />
      *       &lt;attribute name="complementId" type="{http://www.w3.org/2001/XMLSchema}string" />
+     *       &lt;attribute name="showComplementFeatures" type="{http://www.w3.org/2001/XMLSchema}boolean" default="false" />
+     *       &lt;attribute name="showComplementFeaturesOnTop" type="{http://www.w3.org/2001/XMLSchema}boolean" default="false" />
      *     &lt;/restriction>
      *   &lt;/complexContent>
      * &lt;/complexType>
@@ -4914,6 +4918,10 @@ public class JalviewModel {
         protected String id;
         @XmlAttribute(name = "complementId")
         protected String complementId;
+        @XmlAttribute(name = "showComplementFeatures")
+        protected Boolean showComplementFeatures;
+        @XmlAttribute(name = "showComplementFeaturesOnTop")
+        protected Boolean showComplementFeaturesOnTop;
         @XmlAttribute(name = "width")
         protected Integer width;
         @XmlAttribute(name = "height")
@@ -6034,6 +6042,62 @@ public class JalviewModel {
         }
 
         /**
+         * Gets the value of the showComplementFeatures property.
+         * 
+         * @return
+         *     possible object is
+         *     {@link Boolean }
+         *     
+         */
+        public boolean isShowComplementFeatures() {
+            if (showComplementFeatures == null) {
+                return false;
+            } else {
+                return showComplementFeatures;
+            }
+        }
+
+        /**
+         * Sets the value of the showComplementFeatures property.
+         * 
+         * @param value
+         *     allowed object is
+         *     {@link Boolean }
+         *     
+         */
+        public void setShowComplementFeatures(Boolean value) {
+            this.showComplementFeatures = value;
+        }
+
+        /**
+         * Gets the value of the showComplementFeaturesOnTop property.
+         * 
+         * @return
+         *     possible object is
+         *     {@link Boolean }
+         *     
+         */
+        public boolean isShowComplementFeaturesOnTop() {
+            if (showComplementFeaturesOnTop == null) {
+                return false;
+            } else {
+                return showComplementFeaturesOnTop;
+            }
+        }
+
+        /**
+         * Sets the value of the showComplementFeaturesOnTop property.
+         * 
+         * @param value
+         *     allowed object is
+         *     {@link Boolean }
+         *     
+         */
+        public void setShowComplementFeaturesOnTop(Boolean value) {
+            this.showComplementFeaturesOnTop = value;
+        }
+
+        /**
          * Gets the value of the width property.
          * 
          * @return
index 701647c..c43e04c 100644 (file)
@@ -2,7 +2,7 @@
 // This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, v2.2.8-b130911.1802 
 // See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a> 
 // 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.06.07 at 02:21:15 PM BST 
 //
 
 
index 3d7b5eb..1a31d82 100644 (file)
@@ -2,7 +2,7 @@
 // This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, v2.2.8-b130911.1802 
 // See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a> 
 // 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.06.07 at 02:21:15 PM BST 
 //
 
 
index 3cbebc0..5ebeb7e 100644 (file)
@@ -2,7 +2,7 @@
 // This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, v2.2.8-b130911.1802 
 // See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a> 
 // 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.06.07 at 02:21:15 PM BST 
 //
 
 
@@ -10,6 +10,7 @@ package jalview.xml.binding.jalview;
 
 import javax.xml.bind.annotation.XmlAccessType;
 import javax.xml.bind.annotation.XmlAccessorType;
+import javax.xml.bind.annotation.XmlAttribute;
 import javax.xml.bind.annotation.XmlElement;
 import javax.xml.bind.annotation.XmlRootElement;
 import javax.xml.bind.annotation.XmlType;
@@ -41,6 +42,7 @@ import javax.xml.bind.annotation.XmlType;
  *           &lt;/element>
  *         &lt;/choice>
  *       &lt;/sequence>
+ *       &lt;attribute name="mappingType" type="{http://www.w3.org/2001/XMLSchema}string" />
  *     &lt;/extension>
  *   &lt;/complexContent>
  * &lt;/complexType>
@@ -61,6 +63,8 @@ public class Mapping
     @XmlElement(name = "Sequence")
     protected Sequence sequence;
     protected String dseqFor;
+    @XmlAttribute(name = "mappingType")
+    protected String mappingType;
 
     /**
      * Gets the value of the sequence property.
@@ -110,4 +114,28 @@ public class Mapping
         this.dseqFor = value;
     }
 
+    /**
+     * Gets the value of the mappingType property.
+     * 
+     * @return
+     *     possible object is
+     *     {@link String }
+     *     
+     */
+    public String getMappingType() {
+        return mappingType;
+    }
+
+    /**
+     * Sets the value of the mappingType property.
+     * 
+     * @param value
+     *     allowed object is
+     *     {@link String }
+     *     
+     */
+    public void setMappingType(String value) {
+        this.mappingType = value;
+    }
+
 }
index 15fc45d..9db4ea3 100644 (file)
@@ -2,7 +2,7 @@
 // This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, v2.2.8-b130911.1802 
 // See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a> 
 // 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.06.07 at 02:21:15 PM BST 
 //
 
 
index 6858f07..e0b2127 100644 (file)
@@ -2,7 +2,7 @@
 // This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, v2.2.8-b130911.1802 
 // See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a> 
 // 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.06.07 at 02:21:15 PM BST 
 //
 
 
index e8c7cf2..6234f32 100644 (file)
@@ -2,7 +2,7 @@
 // This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, v2.2.8-b130911.1802 
 // See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a> 
 // 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.06.07 at 02:21:15 PM BST 
 //
 
 
index 843ea6c..d5132ab 100644 (file)
@@ -2,7 +2,7 @@
 // This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, v2.2.8-b130911.1802 
 // See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a> 
 // 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.06.07 at 02:21:15 PM BST 
 //
 
 
index abb40c9..b842947 100644 (file)
@@ -2,7 +2,7 @@
 // This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, v2.2.8-b130911.1802 
 // See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a> 
 // 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.06.07 at 02:21:15 PM BST 
 //
 
 
@@ -38,12 +38,14 @@ import javax.xml.bind.annotation.XmlType;
  *                 &lt;attribute name="source" type="{http://www.w3.org/2001/XMLSchema}string" />
  *                 &lt;attribute name="version" type="{http://www.w3.org/2001/XMLSchema}string" />
  *                 &lt;attribute name="accessionId" type="{http://www.w3.org/2001/XMLSchema}string" />
+ *                 &lt;attribute name="locus" type="{http://www.w3.org/2001/XMLSchema}boolean" default="false" />
  *               &lt;/restriction>
  *             &lt;/complexContent>
  *           &lt;/complexType>
  *         &lt;/element>
  *       &lt;/sequence>
  *       &lt;attribute name="dsseqid" type="{http://www.w3.org/2001/XMLSchema}string" />
+ *       &lt;attribute name="biotype" type="{http://www.w3.org/2001/XMLSchema}string" />
  *     &lt;/extension>
  *   &lt;/complexContent>
  * &lt;/complexType>
@@ -64,6 +66,8 @@ public class Sequence
     protected List<Sequence.DBRef> dbRef;
     @XmlAttribute(name = "dsseqid")
     protected String dsseqid;
+    @XmlAttribute(name = "biotype")
+    protected String biotype;
 
     /**
      * Gets the value of the dbRef property.
@@ -118,6 +122,30 @@ public class Sequence
         this.dsseqid = value;
     }
 
+    /**
+     * Gets the value of the biotype property.
+     * 
+     * @return
+     *     possible object is
+     *     {@link String }
+     *     
+     */
+    public String getBiotype() {
+        return biotype;
+    }
+
+    /**
+     * Sets the value of the biotype property.
+     * 
+     * @param value
+     *     allowed object is
+     *     {@link String }
+     *     
+     */
+    public void setBiotype(String value) {
+        this.biotype = value;
+    }
+
 
     /**
      * <p>Java class for anonymous complex type.
@@ -134,6 +162,7 @@ public class Sequence
      *       &lt;attribute name="source" type="{http://www.w3.org/2001/XMLSchema}string" />
      *       &lt;attribute name="version" type="{http://www.w3.org/2001/XMLSchema}string" />
      *       &lt;attribute name="accessionId" type="{http://www.w3.org/2001/XMLSchema}string" />
+     *       &lt;attribute name="locus" type="{http://www.w3.org/2001/XMLSchema}boolean" default="false" />
      *     &lt;/restriction>
      *   &lt;/complexContent>
      * &lt;/complexType>
@@ -155,6 +184,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 +283,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;
+        }
+
     }
 
 }
index 0fc7771..6aee6ac 100644 (file)
@@ -2,7 +2,7 @@
 // This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, v2.2.8-b130911.1802 
 // See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a> 
 // 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.06.07 at 02:21:15 PM BST 
 //
 
 
index 07b8c24..aef7543 100644 (file)
@@ -2,7 +2,7 @@
 // This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, v2.2.8-b130911.1802 
 // See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a> 
 // 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.06.07 at 02:21:15 PM BST 
 //
 
 
index e8b7e28..1b3d6d4 100644 (file)
@@ -2,7 +2,7 @@
 // This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, v2.2.8-b130911.1802 
 // See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a> 
 // 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.06.07 at 02:21:15 PM BST 
 //
 
 
index 1f68de9..5d341c3 100644 (file)
@@ -2,7 +2,7 @@
 // This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, v2.2.8-b130911.1802 
 // See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a> 
 // 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.06.07 at 02:21:15 PM BST 
 //
 
 
index c884556..659eab9 100644 (file)
@@ -2,7 +2,7 @@
 // This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, v2.2.8-b130911.1802 
 // See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a> 
 // 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.06.07 at 02:21:15 PM BST 
 //
 
 
index bd6dc77..3ed532d 100644 (file)
@@ -2,7 +2,7 @@
 // This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, v2.2.8-b130911.1802 
 // See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a> 
 // 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.06.07 at 02:21:15 PM BST 
 //
 
 @javax.xml.bind.annotation.XmlSchema(namespace = "www.vamsas.ac.uk/jalview/version2", elementFormDefault = javax.xml.bind.annotation.XmlNsForm.QUALIFIED)
index 70ae6a0..14559dd 100644 (file)
@@ -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());
   }
index d902fa2..5f1256c 100644 (file)
@@ -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);
+  }
 }
index 1279b31..dee5322 100644 (file)
@@ -282,9 +282,10 @@ public class HelpLinksChecker implements BufferedLineReader.LineCleaner
         else
         {
           internalHrefCount++;
+          String relFile = System.getProperty("os.name").indexOf("Win") > -1 ? href.replace("/", File.separator) : href;
           File hrefFile = href.equals("") ? htmlFile : new File(htmlFolder,
                   href);
-          if (hrefFile != htmlFile && !fileExists(hrefFile, href))
+          if (hrefFile != htmlFile && !fileExists(hrefFile, relFile))
           {
             badLink = true;
             invalidInternalHrefCount++;