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 {
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
} 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"])
removeThese += it
}
}
- containers 'org.eclipse.buildship.core.gradleclasspathcontainer'
minusConfigurations += removeThese
plusConfigurations = [ ]
}
}
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{
//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()
//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
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 ->
}
}
}
-
-}
+
+ //synchronizationTasks eclipseClasspath
+ //autoBuildTasks eclipseClasspath
+}
task cloverInstr() {
// only instrument source, we build test classes as normal
com.atlassian.clover.CloverInstr.mainImpl(args)
}
}
-
+
task cloverReport {
group = "Verification"
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")
}
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")
}
workingDir = jalviewDir
def help = "$classes/$helpDir"
args = [ "$classes/$helpDir", "-nointernet" ]
- //args = [ "$classesDir/$helpDir", "-nointernet" ]
doFirst {
helplinkscheckeroutputfile.createNewFile()
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 ->
</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">
</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>
return;
}
- MapList newMap = targetToFrom.traverse(fromLoci.getMap());
+ MapList newMap = targetToFrom.traverse(fromLoci.getMapping());
if (newMap != null)
{
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 = "";
}
return true;
}
-
- /**
- * Mappings to chromosome are held with accessionId as "chromosome:id"
- *
- * @return
- */
- public boolean isChromosome()
- {
- return accessionId != null && accessionId.startsWith(CHROMOSOME + ":");
- }
}
*
* @return
*/
- MapList getMap();
+ MapList getMapping();
}
--- /dev/null
+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();
+ }
+
+}
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)));
}
/**
{
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;
}
}
}
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;
EnsemblFeatureType.exon, EnsemblFeatureType.cds,
EnsemblFeatureType.variation };
+ private static final String CHROMOSOME = "chromosome";
+
/**
* Default constructor (to use rest.ensembl.org)
*/
if (geneLoci != null)
{
seq.setGeneLoci(geneLoci.getSpeciesId(), geneLoci.getAssemblyId(),
- geneLoci.getChromosomeId(), geneLoci.getMap());
+ geneLoci.getChromosomeId(), geneLoci.getMapping());
}
else
{
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];
return;
}
- MapList geneMapping = loci.getMap();
+ MapList geneMapping = loci.getMapping();
List<int[]> exons = mapping.getFromRanges();
List<int[]> transcriptLoci = new ArrayList<>();
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;
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());
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;
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
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;
}
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;
}
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;
@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;
}
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?
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;
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);
}
}
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()));
// 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
//
// 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
//
// 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
//
// 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
//
// 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
//
// 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
//
// 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
//
// 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
//
// 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
//
// 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
//
// 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
//
* <attribute name="textColThreshold" type="{http://www.w3.org/2001/XMLSchema}int" />
* <attribute name="id" type="{http://www.w3.org/2001/XMLSchema}ID" />
* <attribute name="complementId" type="{http://www.w3.org/2001/XMLSchema}string" />
+ * <attribute name="showComplementFeatures" type="{http://www.w3.org/2001/XMLSchema}boolean" default="false" />
+ * <attribute name="showComplementFeaturesOnTop" type="{http://www.w3.org/2001/XMLSchema}boolean" default="false" />
* </restriction>
* </complexContent>
* </complexType>
* <attribute name="textColThreshold" type="{http://www.w3.org/2001/XMLSchema}int" />
* <attribute name="id" type="{http://www.w3.org/2001/XMLSchema}ID" />
* <attribute name="complementId" type="{http://www.w3.org/2001/XMLSchema}string" />
+ * <attribute name="showComplementFeatures" type="{http://www.w3.org/2001/XMLSchema}boolean" default="false" />
+ * <attribute name="showComplementFeaturesOnTop" type="{http://www.w3.org/2001/XMLSchema}boolean" default="false" />
* </restriction>
* </complexContent>
* </complexType>
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")
}
/**
+ * 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
// 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
//
// 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
//
// 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
//
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;
* </element>
* </choice>
* </sequence>
+ * <attribute name="mappingType" type="{http://www.w3.org/2001/XMLSchema}string" />
* </extension>
* </complexContent>
* </complexType>
@XmlElement(name = "Sequence")
protected Sequence sequence;
protected String dseqFor;
+ @XmlAttribute(name = "mappingType")
+ protected String mappingType;
/**
* Gets the value of the sequence property.
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;
+ }
+
}
// 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
//
// 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
//
// 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
//
// 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
//
// 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
//
* <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>
* </element>
* </sequence>
* <attribute name="dsseqid" type="{http://www.w3.org/2001/XMLSchema}string" />
+ * <attribute name="biotype" type="{http://www.w3.org/2001/XMLSchema}string" />
* </extension>
* </complexContent>
* </complexType>
protected List<Sequence.DBRef> dbRef;
@XmlAttribute(name = "dsseqid")
protected String dsseqid;
+ @XmlAttribute(name = "biotype")
+ protected String biotype;
/**
* Gets the value of the dbRef property.
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.
* <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>
protected String version;
@XmlAttribute(name = "accessionId")
protected String accessionId;
+ @XmlAttribute(name = "locus")
+ protected Boolean locus;
/**
* Gets the value of the mapping property.
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;
+ }
+
}
}
// 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
//
// 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
//
// 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
//
// 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
//
// 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
//
// 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)
* 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]);
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());
}
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;
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;
.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);
+ }
}
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++;