-jalview.release=releases/Release_2_11_1_Branch
-jalview.version=2.11.1.0
+jalview.release=releases/Release_2_11_2_Branch
+jalview.version=2.11.2.0
if (eclipseHome == null || ! IN_ECLIPSE) {
throw new StopExecutionException("Cannot find running Eclipse home from System.properties['eclipse.home.location']. Skipping J2S Plugin Check.")
}
- def eclipseJ2sPlugin = "${eclipseHome}/dropins/${j2sPluginFile.getName()}"
- def eclipseJ2sPluginFile = file(eclipseJ2sPlugin)
- if (!eclipseJ2sPluginFile.exists()) {
- def msg = "Eclipse J2S Plugin is not installed (could not find '${eclipseJ2sPlugin}')\nTry running task jalviewjsIDE_copyJ2sPlugin"
+ def eclipseJ2sPluginDirs = [ "${eclipseHome}/dropins" ]
+ def altPluginsDir = System.properties["org.eclipse.equinox.p2.reconciler.dropins.directory"]
+ if (altPluginsDir != null && file(altPluginsDir).exists()) {
+ eclipseJ2sPluginDirs += altPluginsDir
+ }
+ def foundPlugin = false
+ def j2sPluginFileName = j2sPluginFile.getName()
+ def eclipseJ2sPlugin
+ def eclipseJ2sPluginFile
+ eclipseJ2sPluginDirs.any { dir ->
+ eclipseJ2sPlugin = "${dir}/${j2sPluginFileName}"
+ eclipseJ2sPluginFile = file(eclipseJ2sPlugin)
+ if (eclipseJ2sPluginFile.exists()) {
+ foundPlugin = true
+ return true
+ }
+ }
+ if (!foundPlugin) {
+ def msg = "Eclipse J2S Plugin is not installed (could not find '${j2sPluginFileName}' in\n"+eclipseJ2sPluginDirs.join("\n")+"\n)\nTry running task jalviewjsIDE_copyJ2sPlugin"
System.err.println(msg)
throw new StopExecutionException(msg)
}
System.err.println(msg)
throw new StopExecutionException(msg)
} else {
- def msg = "Eclipse J2S Plugin is the same as '${j2sPlugin}' (this is good)"
+ def msg = "Eclipse J2S Plugin '${eclipseJ2sPlugin}' is the same as '${j2sPlugin}' (this is good)"
println(msg)
}
}
-1.8.3-1.2.4_FJVL
+1.8.3-1.2.8_FJVL
-1.8.3-1.2.4_JVL
+1.8.3-1.2.8_JVL
<parent>
<groupId>com.threerings.getdown</groupId>
<artifactId>getdown</artifactId>
- <version>1.8.3-1.2.4_FJVL</version>
+ <version>1.8.3-1.2.8_FJVL</version>
</parent>
<artifactId>getdown-ant</artifactId>
<parent>
<groupId>com.threerings.getdown</groupId>
<artifactId>getdown</artifactId>
- <version>1.8.3-1.2.4_FJVL</version>
+ <version>1.8.3-1.2.8_FJVL</version>
</parent>
<artifactId>getdown-core</artifactId>
import java.util.regex.Pattern;
import java.util.zip.GZIPInputStream;
+import jalview.bin.HiDPISetting;
import jalview.bin.MemorySetting;
//import com.install4j.api.launcher.Variables;
args.add("-Dinstaller_template_version=" + System.getProperty("installer_template_version"));
args.add("-Dlauncher_version=" + Build.version());
+ // set HiDPI property if wanted
+ String scalePropertyArg = HiDPISetting.getScalePropertyArg();
+ if (scalePropertyArg != null)
+ {
+ args.add(scalePropertyArg);
+ }
+
// set the native library path if we have native resources
// @TODO optional getdown.txt parameter to set addCurrentLibraryPath to true or false?
ClassPath javaLibPath = PathBuilder.buildLibsPath(this, true);
clearValidationMarkers();
// if the new copy validates, reinitialize ourselves; otherwise report baffling hoseage
if (_digest.validateResource(crsrc, null)) {
+ // unset _initialisedConfig so new file is initialised
+ _initialisedConfig = null;
init(true);
} else {
log.warning(CONFIG_FILE + " failed to validate even after redownloading. " +
--- /dev/null
+package jalview.bin;
+
+import java.awt.Toolkit;
+
+public class HiDPISetting
+{
+ public static final int dpi;
+
+ public static final int scale;
+
+ private static final int hidpi = 110;
+
+ private static final String scaleProperty = "sun.java2d.uiScale";
+
+ private static final boolean isAMac = System.getProperty("os.name")
+ .indexOf("Mac") > -1;
+
+ private static final boolean isLinux = System.getProperty("os.name")
+ .toLowerCase().indexOf("linux") > -1;
+
+ private static final boolean isWindows = System.getProperty("os.name")
+ .toLowerCase().indexOf("windows") > -1;
+
+ static
+ {
+ dpi = Toolkit.getDefaultToolkit().getScreenResolution();
+ scale = dpi / hidpi + 1;
+ if (scale > 1 && isLinux)
+ {
+ System.out.println("DPI detected as " + dpi
+ + ". Scaling factor set to " + scale + ".");
+ }
+ }
+
+ public static String getScalePropertyArg()
+ {
+ // HiDPI setting. Just looking at Linux to start with. Test with Windows.
+ if (!isLinux)
+ {
+ return null;
+ }
+ if (scale > 1)
+ {
+ return "-D" + scaleProperty + "=" + scale;
+ }
+ return null;
+ }
+}
<parent>
<groupId>com.threerings.getdown</groupId>
<artifactId>getdown</artifactId>
- <version>1.8.3-1.2.4_FJVL</version>
+ <version>1.8.3-1.2.8_FJVL</version>
</parent>
<artifactId>getdown-launcher</artifactId>
if [ x$JVLVERSION != x ]; then
export VERSION=$JVLVERSION
else
- export VERSION=1.8.3-1.2.4_JVL
+ export VERSION=1.8.3-1.2.8_JVL
fi
if [ x${VERSION%_JVL} = x$VERSION ]; then
<groupId>com.threerings.getdown</groupId>
<artifactId>getdown</artifactId>
<packaging>pom</packaging>
- <version>1.8.3-1.2.4_FJVL</version>
+ <version>1.8.3-1.2.8_FJVL</version>
<name>getdown</name>
<description>An application installer and updater.</description>
<td>Redo the last sequence edit undone.</td>
</tr>
<tr>
- <td><strong>Up Arrow</strong></td>
- <td>Normal</td>
- <td>Moves selected sequence(s) up the alignment</td>
- </tr>
- <tr>
- <td><strong>Down Arrow</strong></td>
- <td>Normal</td>
- <td>Moves selected sequence(s) down the alignment.</td>
- </tr>
- <tr>
- <td><strong>Left Arrow</strong></td>
- <td>Normal</td>
- <td>Slides selected sequence(s) left. Press Alt key to slide
- in cursor mode</td>
- </tr>
- <tr>
- <td><strong>Right Arrow</strong></td>
- <td>Normal</td>
- <td>Slides selected sequence(s) right. Press Alt key to slide
- in cursor mode</td>
- </tr>
- <tr>
<td><strong>Cursor Keys<br> (Arrow Keys)
</strong></td>
<td>Cursor</td>
<td>Move cursor around alignment</td>
</tr>
<tr>
+ <td><strong>Cursor Keys<br> (Arrow Keys)
+ </strong></td>
+ <td>Normal<br />
+ <em>(+Alt in Cursor)</em></td>
+ <td>Moves selected sequence(s) up, down, left, or right
+ according to the direction pressed.<br>
+ <br>
+ <em>Alt+Arrow key to move selection or sequence under cursor
+ in cursor mode.</em>
+ </td>
+ </tr>
+ <tr>
<td><strong>Page Up</strong></td>
<td>Both</td>
<td>Scroll up the alignment view</td>
--- /dev/null
+package jalview.bin;
+
+import java.awt.Toolkit;
+
+public class HiDPISetting
+{
+ public static final int dpi;
+
+ public static final int scale;
+
+ private static final int hidpi = 110;
+
+ private static final String scaleProperty = "sun.java2d.uiScale";
+
+ private static final boolean isAMac = System.getProperty("os.name")
+ .indexOf("Mac") > -1;
+
+ private static final boolean isLinux = System.getProperty("os.name")
+ .toLowerCase().indexOf("linux") > -1;
+
+ private static final boolean isWindows = System.getProperty("os.name")
+ .toLowerCase().indexOf("windows") > -1;
+
+ static
+ {
+ dpi = Toolkit.getDefaultToolkit().getScreenResolution();
+ scale = dpi / hidpi + 1;
+ if (scale > 1 && isLinux)
+ {
+ System.out.println("DPI detected as " + dpi
+ + ". Scaling factor set to " + scale + ".");
+ }
+ }
+
+ public static String getScalePropertyArg()
+ {
+ // HiDPI setting. Just looking at Linux to start with. Test with Windows.
+ if (!isLinux)
+ {
+ return null;
+ }
+ if (scale > 1)
+ {
+ return "-D" + scaleProperty + "=" + scale;
+ }
+ return null;
+ }
+}
if (!headless)
{
+
desktop = new Desktop();
desktop.setInBatchMode(true); // indicate we are starting up
/**
* main method for jalview.bin.Launcher. This restarts the same JRE's JVM with
- * the same arguments but with memory adjusted based on extracted -jvmmempc and
- * -jvmmemmax application arguments. If on a Mac then extra dock:icon and
+ * the same arguments but with memory adjusted based on extracted -jvmmempc
+ * and -jvmmemmax application arguments. If on a Mac then extra dock:icon and
* dock:name arguments are also set.
*
* @param args
if (!memSet)
{
long maxMemLong = MemorySetting.getMemorySetting(jvmmemmax, jvmmempc);
-
+
if (maxMemLong > 0)
{
memSetting = "-Xmx" + Long.toString(maxMemLong);
}
}
+ String scalePropertyArg = HiDPISetting.getScalePropertyArg();
+ if (scalePropertyArg != null)
+ {
+ command.add(scalePropertyArg);
+ }
+
command.add(startClass);
command.addAll(arguments);
if (e.getMessage().toLowerCase().contains("memory"))
{
System.out.println("Caught a memory exception: " + e.getMessage());
- // Probably the "Cannot allocate memory" error, try without the memory setting
+ // Probably the "Cannot allocate memory" error, try without the memory
+ // setting
ArrayList<String> commandNoMem = new ArrayList<>();
for (int i = 0; i < command.size(); i++)
{
* @see https://github.com/Ensembl/ensembl-rest/wiki/Change-log
* @see http://rest.ensembl.org/info/rest?content-type=application/json
*/
- private static final String LATEST_ENSEMBLGENOMES_REST_VERSION = "10.0";
+ private static final String LATEST_ENSEMBLGENOMES_REST_VERSION = "13.0";
- private static final String LATEST_ENSEMBL_REST_VERSION = "10.0";
+ private static final String LATEST_ENSEMBL_REST_VERSION = "13.0";
private static final String REST_CHANGE_LOG = "https://github.com/Ensembl/ensembl-rest/wiki/Change-log";
return new StructureCommand("open " + file);
}
- /**
- * Overrides the default method to concatenate colour commands into one
- */
- @Override
- public List<StructureCommandI> colourBySequence(
- Map<Object, AtomSpecModel> colourMap)
- {
- List<StructureCommandI> commands = new ArrayList<>();
- StringBuilder sb = new StringBuilder(colourMap.size() * 20);
- boolean first = true;
- for (Object key : colourMap.keySet())
- {
- Color colour = (Color) key;
- final AtomSpecModel colourData = colourMap.get(colour);
- StructureCommandI command = getColourCommand(colourData, colour);
- if (!first)
- {
- sb.append(getCommandSeparator());
- }
- first = false;
- sb.append(command.getCommand());
- }
-
- commands.add(new StructureCommand(sb.toString()));
- return commands;
- }
-
@Override
public StructureCommandI openSession(String filepath)
{
*/
package jalview.ext.so;
-import jalview.io.gff.SequenceOntologyI;
-
import java.io.BufferedInputStream;
import java.io.BufferedReader;
import java.io.IOException;
import org.biojava.nbio.ontology.io.OboParser;
import org.biojava.nbio.ontology.utils.Annotation;
+import jalview.bin.Cache;
+import jalview.io.gff.SequenceOntologyI;
+
/**
* A wrapper class that parses the Sequence Ontology and exposes useful access
* methods. This version uses the BioJava parser.
}
}
long elapsed = System.currentTimeMillis() - now;
- System.out.println("Loaded Sequence Ontology from " + zipFile + " ("
+ Cache.log.info("Loaded Sequence Ontology from " + zipFile + " ("
+ elapsed + "ms)");
} catch (Exception e)
{
boolean oldTermIsObsolete = isObsolete(replaced);
if (newTermIsObsolete && !oldTermIsObsolete)
{
- System.err.println("Ignoring " + term.getName()
+ Cache.log.debug("Ignoring " + term.getName()
+ " as obsolete and duplicated by "
+ replaced.getName());
term = replaced;
}
else if (!newTermIsObsolete && oldTermIsObsolete)
{
- System.err.println("Ignoring " + replaced.getName()
+ Cache.log.debug("Ignoring " + replaced.getName()
+ " as obsolete and duplicated by " + term.getName());
}
else
{
- System.err.println("Warning: " + term.getName()
+ Cache.log.debug("Warning: " + term.getName()
+ " has replaced " + replaced.getName()
+ " for lookup of '" + description + "'");
}
{
if (!termsNotFound.contains(term))
{
- System.err.println("SO term " + term + " invalid");
+ Cache.log.error("SO term " + term + " invalid");
termsNotFound.add(term);
}
}
}
/**
- * DOCUMENT ME!
+ * Calls AlignmentI.moveSelectedSequencesByOne with current sequence selection or the sequence under cursor in keyboard mode
*
* @param up
- * DOCUMENT ME!
+ * or down (if !up)
*/
public void moveSelectedSequences(boolean up)
{
if (sg == null)
{
- return;
+ if (viewport.cursorMode)
+ {
+ sg = new SequenceGroup();
+ sg.addSequence(viewport.getAlignment()
+ .getSequenceAt(alignPanel.getSeqPanel().seqCanvas.cursorY),false);
+ } else {
+ return;
+ }
+ }
+
+ if (sg.getSize() < 1)
+ {
+ return;
}
+
+ // TODO: JAL-3733 - add an event to the undo buffer for this !
+
viewport.getAlignment().moveSelectedSequencesByOne(sg,
viewport.getHiddenRepSequences(), up);
alignPanel.paintAlignment(true, false);
mouseDragLastX = -1;
mouseDragLastY = -1;
mouseDragging = false;
+ if (dragMode == DragMode.Resize)
+ {
+ ap.adjustAnnotationHeight();
+ }
dragMode = DragMode.Undefined;
ap.getScalePanel().mouseReleased(evt);
}
/**
- * DOCUMENT ME!
+ * Action on starting or continuing a mouse drag. There are two possible
+ * actions:
+ * <ul>
+ * <li>drag up or down on a graphed annotation increases or decreases the
+ * height of the graph</li>
+ * <li>dragging left or right selects the columns dragged across</li>
+ * </ul>
+ * A drag on a graph annotation is treated as column selection if it starts
+ * with more horizontal than vertical movement, and as resize if it starts
+ * with more vertical than horizontal movement. Once started, the drag does
+ * not change mode.
*
* @param evt
- * DOCUMENT ME!
*/
@Override
public void mouseDragged(MouseEvent evt)
{
/*
- * todo: if dragMode is Undefined:
+ * if dragMode is Undefined:
* - set to Select if dx > dy
* - set to Resize if dy > dx
* - do nothing if dx == dy
*/
package jalview.io;
-import jalview.api.AlignExportSettingsI;
-import jalview.api.AlignViewportI;
-import jalview.api.AlignmentViewPanel;
-import jalview.api.FeatureSettingsModelI;
-import jalview.util.MessageManager;
-
import java.io.BufferedInputStream;
import java.io.BufferedReader;
import java.io.ByteArrayInputStream;
import java.net.URLConnection;
import java.util.zip.GZIPInputStream;
+import jalview.api.AlignExportSettingsI;
+import jalview.api.AlignViewportI;
+import jalview.api.AlignmentViewPanel;
+import jalview.api.FeatureSettingsModelI;
+import jalview.bin.Cache;
+import jalview.util.MessageManager;
import jalview.util.Platform;
/**
}
return error;
}
-
+
/**
* Recognise the 2-byte magic header for gzip streams
*
* https://recalll.co/ask/v/topic/java-How-to-check-if-InputStream-is-Gzipped/555aadd62bd27354438b90f6
*
- * @param bytes - at least two bytes
- * @return
+ * @param bytes
+ * - at least two bytes
+ * @return
+ * @throws IOException
*/
- private static boolean isGzipStream(byte[] bytes) {
- int head = ((int) bytes[0] & 0xff) | ((bytes[1] << 8) & 0xff00);
- return (GZIPInputStream.GZIP_MAGIC == head);
+ public static boolean isGzipStream(InputStream input) throws IOException
+ {
+ if (!input.markSupported())
+ {
+ Cache.log.error(
+ "FileParse.izGzipStream: input stream must support mark/reset");
+ return false;
+ }
+ input.mark(4);
+
+ // get first 2 bytes or return false
+ byte[] bytes = new byte[2];
+ int read = input.read(bytes);
+ input.reset();
+ if (read != bytes.length)
+ {
+ return false;
+ }
+
+ int header = (bytes[0] & 0xff) | ((bytes[1] << 8) & 0xff00);
+ return (GZIPInputStream.GZIP_MAGIC == header);
}
/**
* @param input
* @return
*/
- private BufferedReader checkForGzipStream(InputStream input) throws Exception {
-
- // NB: stackoverflow https://stackoverflow.com/questions/4818468/how-to-check-if-inputstream-is-gzipped
+ private BufferedReader checkForGzipStream(InputStream input)
+ throws Exception
+ {
+ // NB: stackoverflow
+ // https://stackoverflow.com/questions/4818468/how-to-check-if-inputstream-is-gzipped
// could use a PushBackInputStream rather than a BufferedInputStream
-
- BufferedInputStream bufinput;
- if (!input.markSupported()) {
- bufinput= new BufferedInputStream(input,16);
- input = bufinput;
+ if (!input.markSupported())
+ {
+ input = new BufferedInputStream(input, 16);
}
- input.mark(4);
- byte[] bytes=input.readNBytes(2);
- input.reset();
- if (bytes.length==2 && isGzipStream(bytes)) {
+ if (isGzipStream(input))
+ {
return getGzipReader(input);
}
// return a buffered reader for the stream.
- InputStreamReader isReader= new InputStreamReader(input);
- BufferedReader toReadFrom=new BufferedReader(isReader);
+ InputStreamReader isReader = new InputStreamReader(input);
+ BufferedReader toReadFrom = new BufferedReader(isReader);
return toReadFrom;
}
+
/**
* Returns a {@code BufferedReader} which wraps the input stream with a
* GZIPInputStream. Throws a {@code ZipException} if a GZIP format error
throw new IOException(
"Response status from " + urlStr + " was " + rc);
}
- } else {
- try {
- dataIn = checkForGzipStream(_conn.getInputStream());
- dataName=urlStr;
+ }
+ else
+ {
+ try
+ {
+ dataIn = checkForGzipStream(_conn.getInputStream());
+ dataName = urlStr;
} catch (IOException ex)
{
- throw new IOException("Failed to handle non-HTTP URI stream",ex);
+ throw new IOException("Failed to handle non-HTTP URI stream", ex);
} catch (Exception ex)
{
- throw new IOException("Failed to determine type of input stream for given URI",ex);
+ throw new IOException(
+ "Failed to determine type of input stream for given URI",
+ ex);
}
return;
}
*/
package jalview.io;
+import java.io.IOException;
+import java.util.StringTokenizer;
+
import jalview.analysis.scoremodels.ScoreMatrix;
import jalview.analysis.scoremodels.ScoreModels;
import jalview.datamodel.SequenceI;
-import java.io.IOException;
-import java.util.StringTokenizer;
-
/**
* A class that can parse a file containing a substitution matrix and register
* it for use in Jalview
{
continue;
}
- if (data.toUpperCase().startsWith(SCOREMATRIX))
+ // equivalent to data.startsWithIgnoreCase(SCOREMATRIX)
+ if (data.regionMatches(true, 0, SCOREMATRIX, 0, SCOREMATRIX.length()))
{
/*
* Parse name from ScoreMatrix <name>
*
* @return
*/
- protected static String getCommandSeparator()
+ protected String getCommandSeparator()
{
return CMD_SEPARATOR;
}
*/
package jalview.io;
-import jalview.gui.JvOptionPane;
+import static org.testng.Assert.assertFalse;
+import static org.testng.Assert.assertTrue;
+import java.io.BufferedInputStream;
+import java.io.ByteArrayInputStream;
import java.io.File;
+import java.io.FileInputStream;
import java.io.IOException;
+import java.io.InputStream;
+import java.io.StringBufferInputStream;
import org.testng.AssertJUnit;
import org.testng.annotations.AfterClass;
import org.testng.annotations.BeforeClass;
import org.testng.annotations.Test;
+import jalview.bin.Cache;
+import jalview.gui.JvOptionPane;
+
/**
* @author jimp
*
@BeforeClass(alwaysRun = true)
public static void setUpBeforeClass() throws Exception
{
+ Cache.initLogger();
}
/**
public void testStarsInFasta1() throws IOException
{
String uri;
- FileParse fp = new FileParse(uri = STARS_FA_FILE1.getAbsoluteFile()
- .toString(), DataSourceType.FILE);
+ FileParse fp = new FileParse(
+ uri = STARS_FA_FILE1.getAbsoluteFile().toString(),
+ DataSourceType.FILE);
assertValidFormat(FileFormat.Fasta, uri, fp);
}
public void testStarsInFasta2() throws IOException
{
String uri;
- FileParse fp = new FileParse(uri = STARS_FA_FILE2.getAbsoluteFile()
- .toString(), DataSourceType.FILE);
+ FileParse fp = new FileParse(
+ uri = STARS_FA_FILE2.getAbsoluteFile().toString(),
+ DataSourceType.FILE);
assertValidFormat(FileFormat.Fasta, uri, fp);
}
public void testGzipIo() throws IOException
{
String uri;
- FileParse fp = new FileParse(uri = ALIGN_FILE.getAbsoluteFile().toURI()
- .toString(), DataSourceType.URL);
+ FileParse fp = new FileParse(
+ uri = ALIGN_FILE.getAbsoluteFile().toURI().toString(),
+ DataSourceType.URL);
assertValidFormat(FileFormat.Fasta, uri, fp);
}
public void testGziplocalFileIO() throws IOException
{
String filepath;
- FileParse fp = new FileParse(filepath = ALIGN_FILE.getAbsoluteFile()
- .toString(), DataSourceType.FILE);
+ FileParse fp = new FileParse(
+ filepath = ALIGN_FILE.getAbsoluteFile().toString(),
+ DataSourceType.FILE);
assertValidFormat(FileFormat.Fasta, filepath, fp);
}
@Test(groups = { "Functional" })
+ public void testIsGzipInputStream() throws IOException
+ {
+ InputStream is = new FileInputStream(ALIGN_FILE);
+
+ /*
+ * first try fails - FileInputStream does not support mark/reset
+ */
+ assertFalse(FileParse.isGzipStream(is));
+
+ /*
+ * wrap in a BufferedInputStream and try again
+ */
+ is = new BufferedInputStream(is, 16);
+ assertTrue(FileParse.isGzipStream(is));
+
+ /*
+ * check recognition of non-gzipped input
+ */
+ assertFalse(FileParse.isGzipStream(new BufferedInputStream(
+ new ByteArrayInputStream("NOT A GZIP".getBytes()))));
+ }
+
+ @Test(groups = { "Functional" })
public void testNonGzipURLIO() throws IOException
{
String uri;
- FileParse fp = new FileParse(uri = NOTGZALIGN_FILE.getAbsoluteFile()
- .toURI().toString(), DataSourceType.URL);
+ FileParse fp = new FileParse(
+ uri = NOTGZALIGN_FILE.getAbsoluteFile().toURI().toString(),
+ DataSourceType.URL);
assertValidFormat(FileFormat.Fasta, uri, fp);
}
public void testNonGziplocalFileIO() throws IOException
{
String filepath;
- FileParse fp = new FileParse(filepath = NOTGZALIGN_FILE
- .getAbsoluteFile().toString(), DataSourceType.FILE);
+ FileParse fp = new FileParse(
+ filepath = NOTGZALIGN_FILE.getAbsoluteFile().toString(),
+ DataSourceType.FILE);
assertValidFormat(FileFormat.Fasta, filepath, fp);
}
}