From: Jim Procter Date: Thu, 29 Oct 2020 14:24:24 +0000 (+0000) Subject: Merge branch 'patch/JAL-3700_JAL-3748_JAL-3763_for_2_11_1_3' into releases/Release_2_... X-Git-Tag: Release_2_11_1_3~5 X-Git-Url: http://source.jalview.org/gitweb/?p=jalview.git;a=commitdiff_plain;h=39b4859e1a1b011af5d06058461db4d075acb578;hp=882ed2993331d2ce171a2bbdc7e8729f12ff603b Merge branch 'patch/JAL-3700_JAL-3748_JAL-3763_for_2_11_1_3' into releases/Release_2_11_1_Branch --- diff --git a/RELEASE b/RELEASE index 3600be2..b5ce6d5 100644 --- a/RELEASE +++ b/RELEASE @@ -1,2 +1,2 @@ jalview.release=releases/Release_2_11_1_Branch -jalview.version=2.11.1.1 +jalview.version=2.11.1.3 diff --git a/build.gradle b/build.gradle index 68d0c04..b2e9af1 100644 --- a/build.gradle +++ b/build.gradle @@ -94,7 +94,7 @@ ext { } //// // Set JALVIEW_VERSION if it is not already set - if (findProperty(JALVIEW_VERSION)==null || "".equals(JALVIEW_VERSION)) { + if (findProperty("JALVIEW_VERSION")==null || "".equals(JALVIEW_VERSION)) { JALVIEW_VERSION = releaseProps.get("jalview.version") } diff --git a/doc/building.html b/doc/building.html index cc5eb30..28206a6 100644 --- a/doc/building.html +++ b/doc/building.html @@ -1,47 +1,78 @@ - - + + - - + + Building Jalview from Source - + -
+
+

Building Jalview from Source

tl;dr

# download
@@ -744,7 +775,7 @@ git clone http://source.jalview.org/git/jalview.git
 cd jalview
 gradle shadowJar
 # run
-java -jar build/libs/jalview-all-11.jar
+java -jar build/libs/jalview-all-*-j11.jar
 
 # and/or create launcher
 gradle getdown
@@ -758,15 +789,15 @@ java -jar getdown-launcher.jar . jalview

The method here is described in terms of using a command line. You can easily do this on linux or in a Terminal window in macOS. You can do it in Windows.

-

The versions and installation methods here are just suggestions (which we have tested so are known to work). If you need or wish to use different implementations (particularly you might need a bespoke JDK if you are on an exotic architecture) then the general build instructions should work with any gradle 5+. You should be able to compile the bytecode with any JDK Java 11+. The resulting bytecode (in particular the shadow jar) should be runnable in any JRE Java 1.8+. Remember that because Jalview and the getdown launcher are Java bytecode you can build on one system where you might have gradle, and run on another where you don't (JRE 1.8+ required).

+

The versions and installation methods here are just suggestions (which we have tested so are known to work). If you need or wish to use different implementations (particularly you might need a bespoke JDK if you are on an exotic architecture) then the general build instructions should work with any gradle 5+. You should be able to compile the bytecode with any JDK Java 11+. The resulting bytecode (in particular the shadow jar) should be runnable in any JRE Java 1.8+. Remember that because Jalview and the getdown launcher are Java bytecode you can build on one system where you might have gradle, and run on another where you don’t (JRE 1.8+ required).

Java 11 compliant JDK

All platforms

-

We recommend obtaining an OpenJDK JDK 11 (since 11 is the long term support release) from AdoptOpenJDK: https://adoptopenjdk.net/?variant=openjdk11&jvmVariant=hotspot, either the Installer or .zip/.tar.gz variants whichever you prefer (if you're not sure, choose the Installer).

+

We recommend obtaining an OpenJDK JDK 11 (since 11 is the long term support release) from AdoptOpenJDK: https://adoptopenjdk.net/?variant=openjdk11&jvmVariant=hotspot, either the Installer or .zip/.tar.gz variants whichever you prefer (if you’re not sure, choose the Installer).

Alternative/CLI install of AdoptOpenJDK 11

You can also install adoptopenjdk11 using either brew (macOS), choco (Windows) (see the section on gradle and git for more informaiton on brew and choco) or yum or apt (Linux):

@@ -782,35 +813,35 @@ brew cask install adoptopenjdk11

You should be able to install the latest (or sufficiently recent) versions of gradle and git using your OS package manager.

MacOS

we recommend using brew, which can be installed following the instructions at https://brew.sh/. After installing brew, open a Terminal window and type in (using an Administrator privileged user):

-
brew install gradle git
+

or if you aready have them installed but need to upgrade the version:

-
brew upgrade gradle git
+

Windows

we suggest using the Chocolatey package manager. See install instructions at https://chocolatey.org/, and you will just need

-
choco install gradle
-choco install git
+

Alternatively, you could install a real bash shell and install both gradle and git through apt-get. See https://devblogs.microsoft.com/commandline/bash-on-ubuntu-on-windows-download-now-3/ for how to install the ubuntu bash shell in Windows 10.

Another alternative would be to install them separately. For gradle follow the instructions at https://gradle.org/install/, and for git here are a couple of suggestions: Git for Windows https://gitforwindows.org/. Getting the individual installs working together on the command line will be trickier so we recommend using Chocolatey or bash.

Linux

-

this will depend on which distribution you're using.

-
For Debian based distributions (e.g. Mint, Ubuntu, Debian)
+

this will depend on which distribution you’re using.

+
For Debian based distributions (e.g. Mint, Ubuntu, Debian)

run

-
 sudo apt-get install gradle git
-
for RPM-based distributions (e.g. Fedora, CentOS, RedHat)
+ +
for RPM-based distributions (e.g. Fedora, CentOS, RedHat)

run

-
sudo yum install gradle git
-

If you have some other version of linux you'll probably be able to work it out!

+ +

If you have some other version of linux you’ll probably be able to work it out!

Downloading the Jalview source tree

-

This can be done with git. On the command line, change directory to where you want to download Jalview's build-tree top level directory. Then run

-
git clone http://source.jalview.org/git/jalview.git
-

You'll get some progress output and after a minute or two you should have the full Jalview build-tree in the folder jalview.

-

What's in the source tree?

-

Jalview is a mature product with its codebase going back many years. As such it doesn't have a folder structure that most new gradle projects would have, so you might not find everything in the place you might expect. Here's a brief description of what you might find in the main folders under the jalview tree.

+

This can be done with git. On the command line, change directory to where you want to download Jalview’s build-tree top level directory. Then run

+ +

You’ll get some progress output and after a minute or two you should have the full Jalview build-tree in the folder jalview.

+

What’s in the source tree?

+

Jalview is a mature product with its codebase going back many years. As such it doesn’t have a folder structure that most new gradle projects would have, so you might not find everything in the place you might expect. Here’s a brief description of what you might find in the main folders under the jalview tree.

Within the jalview folder you will find (of possible interest):

--++ @@ -821,7 +852,7 @@ brew cask install adoptopenjdk11 - + @@ -849,7 +880,7 @@ brew cask install adoptopenjdk11 - + @@ -895,6 +926,10 @@ brew cask install adoptopenjdk11 + + + +
bin/used by eclipse for compiled classes -- no need to touch thisused by eclipse for compiled classes – no need to touch this
build/
getdown/website/the assembled "download" folder used by getdown for downloads/upgradesthe assembled “download” folder used by getdown for downloads/upgrades
getdown/files/ gradle.properties configurable properties for the build process
RELEASEpropertyfile configuring JALVIEW_VERSION (from jalview.version) and the release branch (from jalview.release). An alternative file can be specified via JALVIEW_RELEASE_FILE property

Note that you need a Java 11 JDK to compile Jalview whether your target build is Java 1.8 or Java 11.

@@ -907,33 +942,34 @@ brew cask install adoptopenjdk11

Minimal Jalview Build

To compile the necessary class files, just run

-
gradle compileJava
+
gradle compileJava

to compile the classes into the classes folder. You should now be able to run the Jalview application directly with

-
java -cp "classes:resources:help:j11lib/*" jalview.bin.Jalview
+
java -cp "classes:resources:help:j11lib/*" jalview.bin.Jalview

You can also run with an automatic large memory setting (which will set the maximum memory heap of the Jalview JVM to 90% of your local physical memory) and docked icon setting (if possible in your OS) with

-
java -cp "classes:resources:help:j11lib/*" jalview.bin.Launcher
+
java -cp "classes:resources:help:j11lib/*" jalview.bin.Launcher
-

You must use just "j11lib/*" and not "j11lib/*.jar" as this is a special Java classpath argument wildcard interpreted by java, not a shell expansion wildcard interpreted by the shell.

+

You must use just “j11lib/*” and not “j11lib/*.jar” as this is a special Java classpath argument wildcard interpreted by java, not a shell expansion wildcard interpreted by the shell.

-

Note that jalview.bin.Launcher is a simplified launcher class that re-launches jalview.bin.Jalview with the same JRE (not the same JVM instance), classpath and arguments, but with an automatically determined -Xmx... memory setting if one hasn't been provided.

+

Note that jalview.bin.Launcher is a simplified launcher class that re-launches jalview.bin.Jalview with the same JRE (not the same JVM instance), classpath and arguments, but with an automatically determined -Xmx... memory setting if one hasn’t been provided.

Jalview in a Jar File

To package the classes, resources, and help into one jar, you can run

-
gradle jar
+
gradle jar

which assembles the Jalview classes and resources into dist/jalview.jar

To run this, use

-
java -cp "dist/jalview.jar:j11lib/*" jalview.bin.Jalview
+
java -cp "dist/jalview.jar:j11lib/*" jalview.bin.Jalview

Distributed Jar Files

To simplify this, all required .jar files can be assembled into the dist folder using

-
gradle makeDist
+
gradle makeDist

which puts all required jar files into dist so you can run with

-
java -cp "dist/*" jalview.bin.Jalview
+
java -cp "dist/*" jalview.bin.Jalview

Single shadow Jar File

-

The shadow jar file is a single .jar that contains all required classes and resources from jalview.jar and all of the supporting libraries in j11lib/*.jar merged into one .jar archive file. A default launching class (MAIN-CLASS: jalview.bin.Launcher) is specified in the .jar manifest file (META/MANIFEST.MF) so a start class doesn't need to be specified.

-

Build the shadow jar file in build/lib/jalview-all-11.jar with

-
gradle shadowJar
-

and run it with

-
java -jar build/lib/jalview-all-11.jar
-

Because no arguments are required, most OSes will associate a .jar file with the java application (if this has been installed through the OS and not just a local unzip) as a -jar argument so you may find you can launch jalview-all-11.jar just by double-clicking on it)!

+

The shadow jar file is a single .jar that contains all required classes and resources from jalview.jar and all of the supporting libraries in j11lib/*.jar merged into one .jar archive file. A default launching class (MAIN-CLASS: jalview.bin.Launcher) is specified in the .jar manifest file (META/MANIFEST.MF) so a start class doesn’t need to be specified.

+

Build the shadow jar file in build/libs/jalview-all-VERSION-j11.jar with

+
gradle shadowJar
+

NB VERSION will be replaced with a version number or “DEVELOPMENT” depending on how the branch is set up.

+

Run it with

+
java -jar build/libs/jalview-all-VERSION-j11.jar
+

Because no arguments are required, most OSes will associate a .jar file with the java application (if this has been installed through the OS and not just a local unzip) as a -jar argument so you may find you can launch jalview-all-VERSION-j11.jar just by double-clicking on it)!

The shadowJar task is not a requirement for any other task, so to build the shadow jar file you must specify the shadowJar task.

@@ -943,38 +979,39 @@ brew cask install adoptopenjdk11

Building the getdown launcher

We have made significant customisations to the getdown launcher which you can find in getdown/src/getdown.

-

You don't need to build this afresh as the required gradle-core.jar and gradle-launcher.jar files are already distributed in j11lib and getdown/lib but if you want to, then you'll need a working Maven and also a Java 8 JDK. Ensure the Java 8 javac is forefront in your path and do

-
cd getdown/src/getdown
-mvn clean package -Dgetdown.host.whitelist="jalview.org,*.jalview.org"
-

and you will find the required .jar files in core/target/gradle-core-XXX.jar and launcher/target/gradle-launcher-XXX.jar. The gradle-core.jar should then be copied to all three of the j8lib, j11lib and getdown/lib folders, whilst the gradle-launcher.jar only needs to be copied to getdown/lib.

+

You don’t need to build this afresh as the required getdown-core.jar and getdown-launcher.jar files are already distributed in j11lib and getdown/lib but if you want to, then you’ll need a working Maven and also a Java 8 JDK. Ensure the Java 8 javac is forefront in your path and do

+ +

and you will find the required .jar files in core/target/getdown-core-XXX.jar and launcher/target/getdown-launcher-XXX.jar. The getdown-core.jar should then be copied to all three of the j8lib, j11lib and getdown/lib folders, whilst the getdown-launcher.jar only needs to be copied to getdown/lib.

The mvn command should ideally include the -Dgetdown.host.whitelist=*.jalview.org setting. This, and the necessary file copying commands, can be found in getdown/src/getdown/mvn_cmd.

To assemble Jalview with getdown use the following gradle task:

-
gradle getdown
-

This puts all the necessary files to launch Jalview with getdown into getdown/website/11/. This could be treated as the reference folder for getdown, which is where a getdown launcher will check to see if the Jalview application files it has are up to date, and download if they aren't or it simply doesn't have them.

+
gradle getdown
+

This puts all the necessary files to launch Jalview with getdown into getdown/website/11/. This could be treated as the reference folder for getdown, which is where a getdown launcher will check to see if the Jalview application files it has are up to date, and download if they aren’t or it simply doesn’t have them.

A minimal getdown-launcher can be found in getdown/files/11/ which checks its up-to-date status with (the absolute path to) getdown/website/11/.

This can be launched with

-
java -jar getdown/files/11/getdown-launcher.jar getdown/files/11/ jalview
+
java -jar getdown/files/11/getdown-launcher.jar getdown/files/11/ jalview
-

We've already met the -jar file.jar arguments. The next argument is the working folder for getdown, and the final argument, "jalview", is a getdown application id (only "jalview" is defined here).

+

We’ve already met the -jar file.jar arguments. The next argument is the working folder for getdown, and the final argument, “jalview”, is a getdown application id (only “jalview” is defined here).

+

The command line sequence for building and relocating the getdown artifacts can be executed as a script via getdown/src/getdown/mvn_cmd. Please make sure this script is kept up to date should the getdown build instructions change.

Running tests

There are substantial tests written for Jalview that use TestNG, which you can run with

-
gradle test
+
gradle test

These normally take around 5 - 10 minutes to complete and outputs its full results into the tests/ folder. A summary of results should appear in your console.

You can run different defined groups of tests with

-
gradle test -PtestngGroups=Network
+
gradle test -PtestngGroups=Network

Available groups include Functional (default), Network, External.

Excluding some tests

-

Some of Jalview's Functional tests don't pass reliably in all environments. We tag these tests with a group like 'Not-bamboo' to mark them for exclusion when we run tests as part of continuous integration.

+

Some of Jalview’s Functional tests don’t pass reliably in all environments. We tag these tests with a group like ‘Not-bamboo’ to mark them for exclusion when we run tests as part of continuous integration.

To exclude one or more groups of tests, add them as a comma separated list in testngExcludedGroups.

-
gradle test -PtestngExcludedGroups=Not-bamboo
+
gradle test -PtestngExcludedGroups=Not-bamboo

Installer packaging with install4j

Jalview is currently using install4j https://www.ej-technologies.com/products/install4j/overview.html as its installer packaging tool.

If you have a licensed installation of install4j you can build Jalview installers by running

-
gradle installers
+
gradle installers

though you may need to fiddle with the install4j and copyInstall4jTemplate tasks in build.gradle file to point to your installation of install4j and also to bundled JREs if you want to bundle those into the installers.

-

If you want more details, get in touch on our development mailing list jalview-dev@jalview.org. Sign up at http://www.compbio.dundee.ac.uk/mailman/listinfo/jalview-dev.

+

If you want more details, get in touch on our development mailing list . Sign up at http://www.compbio.dundee.ac.uk/mailman/listinfo/jalview-dev.

Gradle properties

There are a lot of properties configured in gradle.properties which we strongly recommend being left as they are unless you have a specific problem with the build process.

There are a few gradle properties you might want to set on the command line with the -P flag when building a version of Jalview with specific requirements:

@@ -982,19 +1019,19 @@ brew cask install adoptopenjdk11

This changes the target java bytecode version > NOTE that you will need to use a Java 11 (or greater) JDK Java compiler to build Jalview for any byte-code target version.

Valid values are 11 and 1.8.

e.g.

-
gradle shadowJar -PJAVA_VERSION=1.8
+
gradle shadowJar -PJAVA_VERSION=1.8

When using -PJAVA_VERSION=1.8 the libraries from j8lib (instead of j11lib) will be used in the compile
and runtime classpath and also used in the makeDist build step. Where a Java version of 11 is used in folder and file names, it will instead use 1.8. Also if you are building installer packages with install4j the package builder will look for JRE 1.8 bundles to package in the installers.

Note that continued development of Jalview will assume a Java 11+ runtime environment, the 2.11.0 release will run under a Java 1.8 JRE with a few minor features disabled.

CHANNEL

-

This changes the appbase setting in getdown.txt (appbase is where the getdown launcher looks to see if there's an updated file) to point to a particular Jalview channel or some other appropriate place to look for required files. If the selected channel type requires the getdown appbase to be a local directory on the filesystem (instead of a website URL) then a modified version of the getdown-launcher.jar will be used to allow this. The two versions of the getdown-launcher.jar can be found in getdown/lib. Some other variables used in the build process might also be set differently depending on the value of CHANNEL to allow smooth operation of getdown in the given context.

-

There are several values of CHANNEL that can be chosen, with a default of LOCAL. Here's what they're for and what they do:

+

This changes the appbase setting in getdown.txt (appbase is where the getdown launcher looks to see if there’s an updated file) to point to a particular Jalview channel or some other appropriate place to look for required files. If the selected channel type requires the getdown appbase to be a local directory on the filesystem (instead of a website URL) then a modified version of the getdown-launcher.jar will be used to allow this. The two versions of the getdown-launcher.jar can be found in getdown/lib. Some other variables used in the build process might also be set differently depending on the value of CHANNEL to allow smooth operation of getdown in the given context.

+

There are several values of CHANNEL that can be chosen, with a default of LOCAL. Here’s what they’re for and what they do:

-
  • DEVELOP: This is for creating a develop appbase channel on the main web server. This won't become live until the actual getdown artefact is synced to the web server. It will set +
  • DEVELOP: This is for creating a develop appbase channel on the main web server. This won’t become live until the actual getdown artefact is synced to the web server. It will set
  • -
  • SCRATCH-NAME: This is for creating a temporary scratch appbase channel on the main web server. This won't become live until the actual getdown artefact is synced to the web server. This is meant for testing an over-the-air update without interfering with the live release or develop channels. The value of NAME can be any "word-character" [A-Za-z0-9_] It will set +
  • SCRATCH-NAME: This is for creating a temporary scratch appbase channel on the main web server. This won’t become live until the actual getdown artefact is synced to the web server. This is meant for testing an over-the-air update without interfering with the live release or develop channels. The value of NAME can be any “word-character” [A-Za-z0-9_] It will set
  • -
  • TEST-LOCAL: Like SCRATCH but with a specific test-local channel name and a local filesystem appbase. This is meant for testing an over-the-air update on the local filesystem. An extra property LOCALDIR must be given (e.g. -PLOCALDIR=/home/user/tmp/test) It will set +
  • TEST-LOCAL: Like SCRATCH but with a specific test-local channel name and a local filesystem appbase. This is meant for testing an over-the-air update on the local filesystem. An extra property LOCALDIR must be given (e.g. -PLOCALDIR=/home/user/tmp/test) It will set
  • -
  • TEST-RELEASE: Like SCRATCH but with a specific test-release channel name. This won't become live until the actual getdown artefact is synced to the web server. This is meant for testing an over-the-air update without interfering with the live release or develop channels. It will set +
  • TEST-RELEASE: Like SCRATCH but with a specific test-release channel name. This won’t become live until the actual getdown artefact is synced to the web server. This is meant for testing an over-the-air update without interfering with the live release or develop channels. It will set
  • -
  • RELEASE: This is for an actual release build, and will use an appbase on the main web server with the main release channel name. This won't become live until the actual getdown artefact is synced to the web server. It will set +
  • RELEASE: This is for an actual release build, and will use an appbase on the main web server with the main release channel name. This won’t become live until the actual getdown artefact is synced to the web server. It will set
  • -
  • ARCHIVE: This is a helper to create a channel for a specific release version, and will use an appbase on the main web server with a specific archive/JALVIEW_VERSION channel name. This won't become live until the actual getdown artefact is synced to the web server. You must also specify an ARCHIVEDIR property that points to an earlier version of Jalview with a dist directory containing the required jar files. This should create a getdown structure and digest with the older jar files. It will set +
  • ARCHIVE: This is a helper to create a channel for a specific release version, and will use an appbase on the main web server with a specific archive/JALVIEW_VERSION channel name. This won’t become live until the actual getdown artefact is synced to the web server. You must also specify an ARCHIVEDIR property that points to an earlier version of Jalview with a dist directory containing the required jar files. This should create a getdown structure and digest with the older jar files. It will set
  • e.g.

    -
    gradle getdown -PCHANNEL=SCRATCH-my_test_version
    +
    gradle getdown -PCHANNEL=SCRATCH-my_test_version
    +

    JALVIEW_VERSION and the RELEASE file

    +

    Any Jalview build will include the value of JALVIEW_VERSION in various places, including the ‘About’ and Jalview Desktop window title, and in filenames for the stand-alone executable jar. You can specify a custom version for a build via the JALVIEW_VERSION property, but for most situations, JALVIEW_VERSION will be automatically configured according to the value of the CHANNEL property, using the jalview.version property specified in the RELEASE file: - CHANNEL=RELEASE will set version to jalview.version - CHANNEL=TEST or DEVELOP will append ‘-test’ or ‘-develop’ to jalview.version

    +

    It is also possible to specify a custom location for the RELEASE file via an optional JALVIEW_RELEASE_FILE property.

    install4jMediaTypes

    -

    If you are building install4j installers (requires install4j to be installed) then this property specifies a comma-separated list of media types (i.e. platform specific installers) install4j should actually build.

    +

    If you are building install4j installers (requires install4j to be installed) then this property specifies a comma-separated list of media types (i.e. platform specific installers) install4j should actually build.

    Currently the valid values are linuxDeb, linuxRPM, macosArchive, unixArchive, unixInstaller, windows

    The default value is all of them.

    e.g.

    -
    gradle installers -PJAVA_VERSION=1.8 -Pinstall4jMediaTypes=macosArchive
    +
    gradle installers -PJAVA_VERSION=1.8 -Pinstall4jMediaTypes=macosArchive

    To get an up-to-date list of possible values, you can run

    -
    perl -n -e 'm/^\s*<(\w+)[^>]*\bmediaFileName=/ && print "$1\n";' utils/install4j/install4j_template.install4j  | sort -u
    +
    perl -n -e 'm/^\s*<(\w+)[^>]*\bmediaFileName=/ && print "$1\n";' utils/install4j/install4j_template.install4j  | sort -u

    in the jalview root folder.

    Enabling Code Coverage with OpenClover

    -

    Bytecode instrumentation tasks are enabled by specifying 'true' (or just a non-whitespace non-numeric word) in the 'clover' property. This adds the 'openclover' plugin to the build script's classpath, making it possible to track code execution during test which can be viewed as an HTML report published at build/reports/clover/index.html.

    +

    Bytecode instrumentation tasks are enabled by specifying ‘true’ (or just a non-whitespace non-numeric word) in the ‘clover’ property. This adds the ‘openclover’ plugin to the build script’s classpath, making it possible to track code execution during test which can be viewed as an HTML report published at build/reports/clover/index.html.

    gradle -Pclover=true test cloverReport

    Troubleshooting report generation

    The build forks a new JVM process to run the clover report generation tools (both XML and HTML reports are generated by default). The following properties can be used to specify additional options or adjust JVM memory settings. Default values for these options are:

    @@ -1075,31 +1115,28 @@ and runtime classpath and also used in the makeDist build step. Whe

    Setting up in Eclipse IDE

    Installing Eclipse IDE

    We develop in Eclipse, and support settings to develop and save Jalview source code in our preferred style. We also support running the Jalview application, debugging and running tests with TestNG from within Eclipse.

    -

    To get Jalview set up as a project in Eclipse, we recommend using at least the 2019-12 version of Eclipse IDE for Java Developers which you can download from the Eclipse website: https://www.eclipse.org/downloads/. Since Eclipse 2020-03 you are encouraged to use the Eclipse Installer (see the Eclipse Downloads page). In the installer, when given a choice of packages for Eclipse you should choose the "Eclipse IDE for Enterprise Java Developers" package.

    -
    - - -
    +

    To get Jalview set up as a project in Eclipse, we recommend using at least the 2020-03 version of Eclipse IDE for Java Developers which you can download from the Eclipse website: https://www.eclipse.org/downloads/. Since Eclipse 2020-03 you are encouraged to use the Eclipse Installer (see the Eclipse Downloads page). In the installer, when given a choice of packages for Eclipse you should choose the “Eclipse IDE for Enterprise Java Developers” package.

    +

    Once Eclipse is installed, we also recommend installing several plugins from the Eclipse Marketplace.

    Some of these should already be installed with the Enterprise Java Developer package:

    -
      +
      1. Buildship Gradle Integration 3.0 (or greater)
      2. EclEmma Java Code Coverage
      3. Egit - Git Integration for Eclipse
      -

      To install the others, launch Eclipse, and go to Help->Eclipse Marketplace...

      +

      To install the others, launch Eclipse, and go to Help->Eclipse Marketplace…

      Search for and install:

      -
        +
        1. Groovy Development Tools 3.4.0 (or greater)
        2. Checkstyle Plug-in (optional)
        3. -
        4. TestNG for Eclipse (optional -- only needed if you want to run tests from Eclipse)
        5. +
        6. TestNG for Eclipse (optional – only needed if you want to run tests from Eclipse)
        -

        At time of writing, TestNG for Eclipse does not show up in the Eclipse Marketplace as the latest released version does not install in Eclipse 2019-03. However, you can install a working release of TestNG for Eclipse by going to

        -

        Help->Install New Software...

        +

        At time of writing, TestNG for Eclipse does not show up in the Eclipse Marketplace as the latest released version does not install in Eclipse 2020-03. However, you can install a working release of TestNG for Eclipse by going to

        +

        Help->Install New Software…

        and entering

        TestNG Release - https://dl.bintray.com/testng-team/testng-eclipse-release

        -

        into the Work with box and click on the Add... button.

        +

        into the Work with box and click on the Add… button.

        Eclipse might pause for a bit with the word Pending in the table below at this point, but it will eventually list TestNG with a selection box under the Name column.

        Select TestNG and carry on through the install process to install the TestNG plugin.

        @@ -1108,51 +1145,52 @@ and runtime classpath and also used in the makeDist build step. Whe

        Java -> Installed JREs

        If your Java 11 installation is not listed, click on

        Add -> Standard VM -> Next

        -

        and enter the JRE home. You can browse to where it is installed. Give it a name (like "AdoptOpenJDK 11"). Select this JDK as the default JRE and click on Apply and Close.

        +

        and enter the JRE home. You can browse to where it is installed. Give it a name (like “AdoptOpenJDK 11”). Select this JDK as the default JRE and click on Apply and Close.

        You can now import Jalview.

        Importing Jalview as an Eclipse project

        Importing an already downloaded git repo

        If you have already downloaded Jalview using git clone then you can import this folder into Eclipse directly.

        +

        Before importing the cloned git repo you must create the Eclipse project files. You can do this by either running

        +

        gradle eclipse

        +

        or

        +

        Unzipping the file utils/eclipse/eclipse_startup_files.zip in the base repo directory (jalview)

        It is important to import Jalview as a Gradle project (not as a Java project), so go to

        -

        File->Import...

        +

        File->Import…

        find and select

        Gradle->Existing Gradle Project

        and then click on the Next button.

        In the following options, it is the Project Root Directory you should set to be the jalview folder that git downloaded. Then you can click on the Finish button.

        Using Eclipse IDE to download the git repo

        -

        If you don't have git as a command line tool or would prefer to work entirely within Eclipse IDE then Eclipse's eGit plugin can set up a git repo of the jalview source. Go to

        -

        File->Import...

        +

        If you don’t have git as a command line tool or would prefer to work entirely within Eclipse IDE then Eclipse’s eGit plugin can set up a git repo of the jalview source. Go to

        +

        File->Import…

        Find and select

        Git->Projects from Git

        and then click on the Next button.

        Then select Clone URI and click on Next.

        In the next window (Source Git Repository) you should put the git clone URL in the text box labelled URI. If you have a Jalview developer account (with a username and password for the Jalview git repository) then you should enter https://source.jalview.org/git/jalview.git. If you do not have a Jalview developer account then you should enter http://source.jalview.org/git/jalview.git. You will not be able to push any of your changes back to the Jalview git repository. However you can still pull all branches of the Jalview source code to your computer and develop the code there. > You can sign up for a Jalview developer account at https://source.jalview.org/crucible/

        -

        If you have a Jalview developer account, enter the username and password and decide if you want to use Eclipse's secure storage. If you don't have an account you can leave the Authentication section blank.

        -
        -Eclipse eGit connection configuration -

        Eclipse eGit connection configuration

        -
        +

        If you have a Jalview developer account, enter the username and password and decide if you want to use Eclipse’s secure storage. If you don’t have an account you can leave the Authentication section blank.

        +
        +Eclipse eGit connection configuration
        Eclipse eGit connection configuration
        +

        Click on the Next button.

        The next window (Branch Selection) gives a list of the many Jalview branches, which by default will be all checked. You probably only want to download one branch (you can always download others at a later time). This is likely to be the develop branch so you can click on the Deselect All button, find the develop branch (the filter text helps), select that, and then click on the Next button.

        Choose a directory to your copy of the git repo in, and leave the other options as they are and click on the Next button. The next stage may take a minute or two as it checks out the selected branch(es) from the Jalview git repository.

        -

        When it has finished it is important to select Import as general project and then click on Next. > Ideally there would be an Import as gradle project here but there isn't -- we'll sort that out later.

        -
        -Eclipse eGit import choice -

        Eclipse eGit import choice

        -
        +

        When it has finished it is important to select Import as general project and then click on Next. > Ideally there would be an Import as gradle project here but there isn’t – we’ll sort that out later.

        +
        +Eclipse eGit import choice
        Eclipse eGit import choice
        +

        Click on the Next button.

        -

        You can change the project name here. By default it will show as jalview which is fine unless you have another instance of the a Jalview project also called jalview, in which case you could change this project's name now to avoid a conflict within Eclipse.

        +

        You can change the project name here. By default it will show as jalview which is fine unless you have another instance of the a Jalview project also called jalview, in which case you could change this project’s name now to avoid a conflict within Eclipse.

        Click on Finish!

        -

        However, we haven't finished...

        +

        However, we haven’t finished…

        You should now see, and be able to expand, the jalview project in the Project Explorer. We need to tell eclipse that this is a Gradle project, which will then allow the Eclipse Buildship plugin to automatically configure almost everything else!

        Right click on the project name (jalview) in the Project Explorer and find Configure towards the bottom of this long context menu, then choose Add Gradle Nature.

        -
        -Eclipse Add Gradle Nature -

        Eclipse Add Gradle Nature

        -
        +
        +Eclipse Add Gradle Nature
        Eclipse Add Gradle Nature
        +

        The project should now reconfigure itself using the build.gradle file to dynamically set various aspects of the project including classpath.

        Additional views

        -

        Some views that are automatically added when Importing a Gradle Project are not added when simply Adding a Gradle Nature, but we can add these manually by clicking on Window->Show View->Console and Window->Show View->Other... Filter with the word "gradle" and choose both Gradle Executions and Gradle Tasks and then click on the Open button.

        +

        Some views that are automatically added when Importing a Gradle Project are not added when simply Adding a Gradle Nature, but we can add these manually by clicking on Window->Show View->Console and Window->Show View->Other… Filter with the word “gradle” and choose both Gradle Executions and Gradle Tasks and then click on the Open button.

        Okay, ready to code! Use of Eclipse is beyond the scope of this document, but you can find more information about developing jalview and our developer workflow in the google doc https://docs.google.com/document/d/1lZo_pZRkazDBJGNachXr6qCVlw8ByuMYG6e9SZlPUlQ/edit?usp=sharing


        Jalview Development Team

        diff --git a/doc/building.md b/doc/building.md index 855f966..497e722 100644 --- a/doc/building.md +++ b/doc/building.md @@ -9,7 +9,7 @@ git clone http://source.jalview.org/git/jalview.git cd jalview gradle shadowJar # run -java -jar build/libs/jalview-all-11.jar +java -jar build/libs/jalview-all-*-j11.jar # and/or create launcher gradle getdown @@ -26,7 +26,7 @@ java -jar getdown-launcher.jar . jalview The method here is described in terms of using a command line. You can easily do this on linux or in a Terminal window in macOS. You can do it in Windows. * Java 11 compliant JDK -* gradle 5.2 or above +* gradle 5.2 or above *(NB gradle 6.6 and above currently produces NullPointerExceptions during the build. This is non-fatal and does not affect the build. Use gradle 6.5.1 to avoid this)* * git > The versions and installation methods here are just suggestions (which we have tested @@ -248,20 +248,23 @@ and all of the supporting libraries in `j11lib/*.jar` merged into one `.jar` arc file. A default launching class (`MAIN-CLASS: jalview.bin.Launcher`) is specified in the `.jar` manifest file (`META/MANIFEST.MF`) so a start class doesn't need to be specified. -Build the shadow jar file in `build/lib/jalview-all-11.jar` with +Build the shadow jar file in `build/libs/jalview-all-VERSION-j11.jar` with ```bash gradle shadowJar ``` -and run it with + +__NB__ `VERSION` will be replaced with a version number or "`DEVELOPMENT`" depending on how the branch is set up. + +Run it with ```bash -java -jar build/lib/jalview-all-11.jar +java -jar build/libs/jalview-all-VERSION-j11.jar ``` Because no arguments are required, most OSes will associate a `.jar` file with the `java` application (if this has been installed through the OS and not just a local -unzip) as a `-jar` argument so you may find you can launch `jalview-all-11.jar` +unzip) as a `-jar` argument so you may find you can launch `jalview-all-VERSION-j11.jar` just by double-clicking on it)! > The `shadowJar` task is not a requirement for any other task, so to build the shadow @@ -537,7 +540,7 @@ We develop in Eclipse, and support settings to develop and save Jalview source c in our preferred style. We also support running the Jalview application, debugging and running tests with TestNG from within Eclipse. -To get Jalview set up as a project in Eclipse, we recommend using at least the 2019-12 +To get Jalview set up as a project in Eclipse, we recommend using at least the 2020-03 version of Eclipse IDE for Java Developers which you can download from the Eclipse website: . Since Eclipse 2020-03 you are encouraged to use the Eclipse Installer (see the Eclipse Downloads page). In the installer, when given a choice of packages for Eclipse you should choose the "Eclipse IDE for Enterprise Java Developers" package. @@ -561,7 +564,7 @@ Search for and install: 1. TestNG for Eclipse (optional -- only needed if you want to run tests from Eclipse) > At time of writing, TestNG for Eclipse does not show up in the Eclipse Marketplace -as the latest released version does not install in Eclipse 2019-03. +as the latest released version does not install in Eclipse 2020-03. However, you can install a working release of TestNG for Eclipse by going to > Help->Install New Software... @@ -601,6 +604,14 @@ You can now import Jalview. If you have already downloaded Jalview using `git clone` then you can import this folder into Eclipse directly. +__Before importing the cloned git repo you must create the Eclipse project files.__ You can do this by either running + +`gradle eclipse` + +or + +Unzipping the file `utils/eclipse/eclipse_startup_files.zip` in the base repo directory (`jalview`) + It is important to import Jalview as a Gradle project (not as a Java project), so go to diff --git a/gradle.properties b/gradle.properties index 453572a..70a41ff 100644 --- a/gradle.properties +++ b/gradle.properties @@ -13,7 +13,8 @@ source_dir = src test_source_dir = test #test_source_dir = utils/jalviewjs/test/test -JALVIEW_VERSION = DEVELOPMENT +# JALVIEW_VERSION now being set by logic in build.gradle defaulting to looking at jalview.version property in RELEASE file +#JALVIEW_VERSION = DEVELOPMENT INSTALLATION = Source jalview_keystore = keys/.keystore jalview_keystore.pass = alignmentisfun diff --git a/help/help/html/features/commandline.html b/help/help/html/features/commandline.html index f0e04d5..0ef78f9 100644 --- a/help/help/html/features/commandline.html +++ b/help/help/html/features/commandline.html @@ -38,7 +38,7 @@
        • Standard installation on Linux/Unix:
          -       /PATH_TO_JALVIEW/Jalview -open http://www.jalview.org/examples/jpred_msa.fasta -annotations http://www.jalview.org/examples/jpred_msa.seq.concise -colour Clustal
          + /PATH_TO_JALVIEW/Jalview -open https://www.jalview.org/examples/jpred_msa.fasta -annotations https://www.jalview.org/examples/jpred_msa.seq.concise -colour Clustal
        • Standard installation on Windows:
                 \PATH_TO_JALVIEW\Jalview.exe -open %HOMEPATH%\myalignment.fa
          diff --git a/help/help/html/features/groovy.html b/help/help/html/features/groovy.html index ead4436..cc91154 100644 --- a/help/help/html/features/groovy.html +++ b/help/help/html/features/groovy.html @@ -39,7 +39,7 @@ installation of Groovy. Just select Tools→Groovy Console... from the Jalview Desktop's drop-down menu. After a short pause, you should then see the Groovy + href="https://groovy-lang.org/groovyconsole.html">Groovy Console appear. This allows you to interactively execute Groovy scripts whilst Jalview is running. We've also provided a Calculations→Execute Groovy Script button so you can execute the currently loaded @@ -101,7 +101,7 @@ print currentAlFrame.getTitle(); InstallAnywhere version of Jalview, you can find additional groovy scripts in the examples/groovy subfolder of the installation directory. The examples are also available at http://www.jalview.org/examples/groovy. + href="https://www.jalview.org/examples/groovy">https://www.jalview.org/examples/groovy.

          Using Groovy to add new Alignment Calculations
          We've @@ -115,8 +115,8 @@ print currentAlFrame.getTitle(); Creating custom colourschemes
          You can create your own alignment colourschemes with a groovy script. We've provided two examples:

          diff --git a/help/help/html/features/jvlfiles.html b/help/help/html/features/jvlfiles.html index 27742b3..e23af30 100644 --- a/help/help/html/features/jvlfiles.html +++ b/help/help/html/features/jvlfiles.html @@ -46,12 +46,12 @@
           # Jalview Launch File
           # Please install the Jalview Desktop from 
          -# http://www.jalview.org/getdown/release
          +# https://www.jalview.org/getdown/release
           # and then try to open this file again
           jalview.apparg=-open
          -jalview.apparg=http://www.jalview.org/examples/jpred_msa.fasta
          +jalview.apparg=https://www.jalview.org/examples/jpred_msa.fasta
           jalview.apparg=-annotations
          -jalview.apparg=http://www.jalview.org/examples/jpred_msa.seq.concise
          +jalview.apparg=https://www.jalview.org/examples/jpred_msa.seq.concise
           jalview.apparg=-colour
           jalview.apparg=Clustal
           
          @@ -62,7 +62,7 @@ jalview.apparg=Clustal # Please install the Jalview Desktop from # http://www.jalview.org/getdown/release # and then try to open this file again -appbase=http://www.jalview.org/getdown/archive/2_10_5/ +appbase=https://www.jalview.org/getdown/archive/2_10_5/ For security, the Jalview application will only allow appbase URLs from www.jalview.org. diff --git a/help/help/html/groovy/featuresCounter.html b/help/help/html/groovy/featuresCounter.html index 3b6705b..bd7144e 100644 --- a/help/help/html/groovy/featuresCounter.html +++ b/help/help/html/groovy/featuresCounter.html @@ -43,7 +43,7 @@
      Please note: The 2.10.2 feature counting interface is not compatible with earlier versions.

      http://www.jalview.org/examples/groovy/featuresCounter.groovy + href="https://www.jalview.org/examples/groovy/featuresCounter.groovy">https://www.jalview.org/examples/groovy/featuresCounter.groovy - rendered with hilite.me
      /*
        * Jalview - A Sequence Alignment Editor and Viewer ($$Version-Rel$$)
      diff --git a/help/help/html/index.html b/help/help/html/index.html
      index 8adbdb8..a6bb1b6 100755
      --- a/help/help/html/index.html
      +++ b/help/help/html/index.html
      @@ -45,7 +45,7 @@
         

      For more information, you might also want to take a look at the documentation section of the Jalview website (http://www.jalview.org/about/documentation). + href="https://www.jalview.org/about/documentation">https://www.jalview.org/about/documentation).

      If you are using the Jalview Desktop application and are looking for @@ -54,7 +54,7 @@ google the online version of these pages. If you don't find what you are looking for, or want to report a bug or make a feature request, then get in contact over at http://www.jalview.org/community + href="https://www.jalview.org/community">https://www.jalview.org/community

      Logging, troubleshooting and reporting bugs
      If diff --git a/help/help/html/memory.html b/help/help/html/memory.html index 0374dcb..7d6fb85 100755 --- a/help/help/html/memory.html +++ b/help/help/html/memory.html @@ -80,7 +80,7 @@ arguments, but you must put the jvl file first, e.g.

             /PATH_TO_JALVIEW/Jalview /path/to/file/mymemorysetting.jvl /path/to/alignments/myalignment.fa
      Alternatively, you can use the standard Jalview command line arguments with or without the jvl file (first), e.g.
      -       /PATH_TO_JALVIEW/Jalview /path/to/file/mymemorysetting.jvl -open http://www.jalview.org/examples/jpred_msa.fasta -annotations http://www.jalview.org/examples/jpred_msa.seq.concise -colour Clustal
      You can use command line arguments to control memory + /PATH_TO_JALVIEW/Jalview /path/to/file/mymemorysetting.jvl -open https://www.jalview.org/examples/jpred_msa.fasta -annotations https://www.jalview.org/examples/jpred_msa.seq.concise -colour Clustal
      You can use command line arguments to control memory settings in Windows and macOS too:
      In Windows you must use, e.g.
             \PATH_TO_JALVIEW\Jalview.exe %HOMEPATH%\mymemorysetting.jvl -open %HOMEPATH%\myalignment.fa
      In macOS you can use the macOS open command like this:
      diff --git a/help/help/html/releases.html b/help/help/html/releases.html
      index eea9de7..4bef1f6 100755
      --- a/help/help/html/releases.html
      +++ b/help/help/html/releases.html
      @@ -57,8 +57,48 @@ li:before {
           
           
             2.11.1.3
      + 27/10/2020
      + +
        + +
      + + +
        +
      • + Find doesn't always highlight all matching + positions in a sequence +
      • +
      • + Space character in Jalview install path on + Windows prevents install4j launching getdown +
      • +
      + + + + 2.11.1.2
      + 25/09/2020
      + +
        +
      + + +
        +
      • + Fresh install of Jalview 2.11.1.1 reports + "Encountered problems opening + https://www.jalview.org/examples/exampleFile_2_7.jvp" +
      • +
      + + + + 2.11.1.1
      - 15/09/2020
      + 17/09/2020
      • @@ -185,6 +225,14 @@ li:before { file again, and if that fails, delete the original file and save in place.)
      • +
      • + Cannot process alignments from HTTPS urls + via command line +
      • +
      • + References to http://www.jalview.org in + program and documentation +
      Launching Jalview
      • diff --git a/help/help/html/webServices/newsreader.html b/help/help/html/webServices/newsreader.html index c3c1d3f..2e8b69a 100644 --- a/help/help/html/webServices/newsreader.html +++ b/help/help/html/webServices/newsreader.html @@ -25,7 +25,7 @@

        The Jalview Desktop RSS News Reader
        The Jalview Desktop includes a built in news reader for the Jalview + href="https://www.jalview.org/feeds/desktop/rss">Jalview Desktop News Channel.

        @@ -48,9 +48,9 @@

        The Jalview news reader was introduced in Jalview + href="https://www.jalview.org/releaseHistory.html#Jalview2.7">Jalview version 2.7. Its implementation is based on JSwingReader. + href="https://jswingreader.sourceforge.net/">JSwingReader.


        If you need to prevent the news-reader opening, then add the diff --git a/help/help/html/whatsNew.html b/help/help/html/whatsNew.html index 2e18bae..a448aaa 100755 --- a/help/help/html/whatsNew.html +++ b/help/help/html/whatsNew.html @@ -24,12 +24,13 @@

        - Jalview 2.11.1.1 + Jalview 2.11.1.3

        -

        Jalview 2.11.1.1 is the first patch release for Jalview version - 2.11.1. In addition to fixes for some critical bugs, it also - contains a handful of new features suggested by the Jalview - community.

        +

        Jalview 2.11.1.3 is the third patch release, fixing a bug + introduced in last weeks Jalview 2.11.1.1 release affecting display + of Jalview's example project for some users. Together, these + releases include fixes for a number of critical bugs, and also contains a + handful of new features suggested by the Jalview community.

        • Shift+arrow keys navigate to next gap or residue in cursor mode (enable with F2)
        • diff --git a/src/jalview/analysis/Finder.java b/src/jalview/analysis/Finder.java index c545c7f..d52e42a 100644 --- a/src/jalview/analysis/Finder.java +++ b/src/jalview/analysis/Finder.java @@ -417,7 +417,7 @@ public class Finder implements FinderI * update residueIndex to next position after the start of the match * (findIndex returns a value base 1, columnIndex is held base 0) */ - residueIndex += offset + 1; + residueIndex = searchPattern.matchedFrom()+1; /* * return false if the match is entirely in a hidden region diff --git a/src/jalview/bin/Cache.java b/src/jalview/bin/Cache.java index 2ea7196..600d19c 100755 --- a/src/jalview/bin/Cache.java +++ b/src/jalview/bin/Cache.java @@ -174,8 +174,8 @@ import jalview.ws.sifts.SiftsSettings; * when shading by annotation *
        • ANNOTATIONCOLOUR_MAX (red) Shade used for maximum value of annotation * when shading by annotation
        • - *
        • www.jalview.org (http://www.jalview.org) a property enabling all HTTP - * requests to be redirected to a mirror of http://www.jalview.org
        • + *
        • www.jalview.org (https://www.jalview.org) a property enabling all HTTP + * requests to be redirected to a mirror of https://www.jalview.org
        • *
        • FIGURE_AUTOIDWIDTH (false) Expand the left hand column of an exported * alignment figure to accommodate even the longest sequence ID or annotation * label.
        • @@ -432,7 +432,7 @@ public class Cache DEFAULT_CACHE_THRESHOLD_IN_DAYS)); IdOrgSettings.setUrl(getDefault("ID_ORG_HOSTURL", - "http://www.jalview.org/services/identifiers")); + "https://www.jalview.org/services/identifiers")); IdOrgSettings.setDownloadLocation(ID_ORG_FILE); StructureImportSettings.setDefaultStructureFileFormat(jalview.bin.Cache diff --git a/src/jalview/bin/Jalview.java b/src/jalview/bin/Jalview.java index 341bcba..3a238bb 100755 --- a/src/jalview/bin/Jalview.java +++ b/src/jalview/bin/Jalview.java @@ -20,28 +20,6 @@ */ package jalview.bin; -import jalview.ext.so.SequenceOntology; -import jalview.gui.AlignFrame; -import jalview.gui.Desktop; -import jalview.gui.PromptUserConfig; -import jalview.io.AppletFormatAdapter; -import jalview.io.BioJsHTMLOutput; -import jalview.io.DataSourceType; -import jalview.io.FileFormat; -import jalview.io.FileFormatException; -import jalview.io.FileFormatI; -import jalview.io.FileFormats; -import jalview.io.FileLoader; -import jalview.io.HtmlSvgOutput; -import jalview.io.IdentifyFile; -import jalview.io.NewickFile; -import jalview.io.gff.SequenceOntologyFactory; -import jalview.schemes.ColourSchemeI; -import jalview.schemes.ColourSchemeProperty; -import jalview.util.MessageManager; -import jalview.util.Platform; -import jalview.ws.jws2.Jws2Discoverer; - import java.io.BufferedReader; import java.io.File; import java.io.FileOutputStream; @@ -79,6 +57,7 @@ import jalview.io.DataSourceType; import jalview.io.FileFormat; import jalview.io.FileFormatException; import jalview.io.FileFormatI; +import jalview.io.FileFormats; import jalview.io.FileLoader; import jalview.io.HtmlSvgOutput; import jalview.io.IdentifyFile; @@ -86,6 +65,7 @@ import jalview.io.NewickFile; import jalview.io.gff.SequenceOntologyFactory; import jalview.schemes.ColourSchemeI; import jalview.schemes.ColourSchemeProperty; +import jalview.util.HttpUtils; import jalview.util.MessageManager; import jalview.util.Platform; import jalview.ws.jws2.Jws2Discoverer; @@ -383,7 +363,7 @@ public class Jalview // String defurl = // "http://anaplog.compbio.dundee.ac.uk/cgi-bin/questionnaire.pl"; // // - String defurl = "http://www.jalview.org/cgi-bin/questionnaire.pl"; + String defurl = "https://www.jalview.org/cgi-bin/questionnaire.pl"; Cache.log.debug( "Starting questionnaire with default url: " + defurl); desktop.checkForQuestionnaire(defurl); @@ -451,7 +431,9 @@ public class Jalview } System.out.println("CMD [-open " + file + "] executed successfully!"); - if (!file.startsWith("http://")) + protocol = AppletFormatAdapter.checkProtocol(file); + + if (protocol == DataSourceType.FILE) { if (!(new File(file)).exists()) { @@ -463,8 +445,6 @@ public class Jalview } } - protocol = AppletFormatAdapter.checkProtocol(file); - try { format = new IdentifyFile().identify(file, protocol); @@ -648,11 +628,14 @@ public class Jalview af.createEPS(outputFile); continue; } - FileFormatI outFormat=null; - try { + FileFormatI outFormat = null; + try + { outFormat = FileFormats.getInstance().forName(outputFormat); - } catch (Exception formatP) { - System.out.println("Couldn't parse "+outFormat+" as a valid Jalview format string."); + } catch (Exception formatP) + { + System.out.println("Couldn't parse " + outFormat + + " as a valid Jalview format string."); } if (outFormat != null) { @@ -694,23 +677,21 @@ public class Jalview { file = jalview.bin.Cache.getDefault("STARTUP_FILE", jalview.bin.Cache.getDefault("www.jalview.org", - "http://www.jalview.org") - + "/examples/exampleFile_2_7.jar"); - if (file.equals( - "http://www.jalview.org/examples/exampleFile_2_3.jar")) + "https://www.jalview.org") + + "/examples/exampleFile_2_7.jvp"); + if (file.equals("http://www.jalview.org/examples/exampleFile_2_3.jar") + || file.equals( + "http://www.jalview.org/examples/exampleFile_2_7.jar")) { + file.replace("http:", "https:"); // hardwire upgrade of the startup file - file.replace("_2_3.jar", "_2_7.jar"); + file.replace("_2_3", "_2_7"); + file.replace("2_7.jar", "2_7.jvp"); // and remove the stale setting jalview.bin.Cache.removeProperty("STARTUP_FILE"); } - protocol = DataSourceType.FILE; - - if (file.indexOf("http:") > -1) - { - protocol = DataSourceType.URL; - } + protocol = AppletFormatAdapter.checkProtocol(file); if (file.endsWith(".jar")) { @@ -996,7 +977,7 @@ public class Jalview + "-groovy FILE\tExecute groovy script in FILE, after all other arguments have been processed (if FILE is the text 'STDIN' then the file will be read from STDIN)\n" + "-jvmmempc=PERCENT\tOnly available with standalone executable jar or jalview.bin.Launcher. Limit maximum heap size (memory) to PERCENT% of total physical memory detected. This defaults to 90 if total physical memory can be detected. See https://www.jalview.org/help/html/memory.html for more details.\n" + "-jvmmemmax=MAXMEMORY\tOnly available with standalone executable jar or jalview.bin.Launcher. Limit maximum heap size (memory) to MAXMEMORY. MAXMEMORY can be specified in bytes, kilobytes(k), megabytes(m), gigabytes(g) or if you're lucky enough, terabytes(t). This defaults to 32g if total physical memory can be detected, or to 8g if total physical memory cannot be detected. See https://www.jalview.org/help/html/memory.html for more details.\n" - + "\n~Read documentation in Application or visit http://www.jalview.org for description of Features and Annotations file~\n\n"); + + "\n~Read documentation in Application or visit https://www.jalview.org for description of Features and Annotations file~\n\n"); } private static void startUsageStats(final Desktop desktop) diff --git a/src/jalview/gui/AlignFrame.java b/src/jalview/gui/AlignFrame.java index 4be7d0e..b1efed6 100644 --- a/src/jalview/gui/AlignFrame.java +++ b/src/jalview/gui/AlignFrame.java @@ -138,6 +138,7 @@ import jalview.schemes.ColourSchemeI; import jalview.schemes.ColourSchemes; import jalview.schemes.ResidueColourScheme; import jalview.schemes.TCoffeeColourScheme; +import jalview.util.HttpUtils; import jalview.util.MessageManager; import jalview.util.Platform; import jalview.viewmodel.AlignmentViewport; @@ -1037,7 +1038,7 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener, Desktop.instance.closeAssociatedWindows(); FileLoader loader = new FileLoader(); - DataSourceType protocol = fileName.startsWith("http:") + DataSourceType protocol = HttpUtils.startsWithHttpOrHttps(fileName) ? DataSourceType.URL : DataSourceType.FILE; loader.LoadFile(viewport, fileName, protocol, currentFileFormat); @@ -1047,7 +1048,7 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener, Rectangle bounds = this.getBounds(); FileLoader loader = new FileLoader(); - DataSourceType protocol = fileName.startsWith("http:") + DataSourceType protocol = HttpUtils.startsWithHttpOrHttps(fileName) ? DataSourceType.URL : DataSourceType.FILE; AlignFrame newframe = loader.LoadFileWaitTillLoaded(fileName, @@ -1094,7 +1095,7 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener, public void save_actionPerformed(ActionEvent e) { if (fileName == null || (currentFileFormat == null) - || fileName.startsWith("http")) + || HttpUtils.startsWithHttpOrHttps(fileName)) { saveAs_actionPerformed(null); } @@ -1749,7 +1750,8 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener, } /** - * Calls AlignmentI.moveSelectedSequencesByOne with current sequence selection or the sequence under cursor in keyboard mode + * Calls AlignmentI.moveSelectedSequencesByOne with current sequence selection + * or the sequence under cursor in keyboard mode * * @param up * or down (if !up) @@ -1760,23 +1762,25 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener, if (sg == null) { - if (viewport.cursorMode) + if (viewport.cursorMode) { sg = new SequenceGroup(); - sg.addSequence(viewport.getAlignment() - .getSequenceAt(alignPanel.getSeqPanel().seqCanvas.cursorY),false); - } else { + sg.addSequence(viewport.getAlignment().getSequenceAt( + alignPanel.getSeqPanel().seqCanvas.cursorY), false); + } + else + { return; } } - + if (sg.getSize() < 1) { - return; + return; } - + // TODO: JAL-3733 - add an event to the undo buffer for this ! - + viewport.getAlignment().moveSelectedSequencesByOne(sg, viewport.getHiddenRepSequences(), up); alignPanel.paintAlignment(true, false); diff --git a/src/jalview/gui/BlogReader.java b/src/jalview/gui/BlogReader.java index 65c8b5a..c43c699 100644 --- a/src/jalview/gui/BlogReader.java +++ b/src/jalview/gui/BlogReader.java @@ -256,7 +256,7 @@ public class BlogReader extends JPanel chan.setURL( jalview.bin.Cache.getDefault("JALVIEW_NEWS_RSS", jalview.bin.Cache.getDefault("www.jalview.org", - "http://www.jalview.org") + "https://www.jalview.org") + "/feeds/desktop/rss")); loadLastM(); _channelModel.addChannel(chan); diff --git a/src/jalview/gui/Desktop.java b/src/jalview/gui/Desktop.java index 7564dda..0441e5e 100644 --- a/src/jalview/gui/Desktop.java +++ b/src/jalview/gui/Desktop.java @@ -927,7 +927,7 @@ public class Desktop extends jalview.jbgui.GDesktop } catch (java.lang.ClassCastException cex) { Cache.log.warn( - "Squashed a possible GUI implementation error. If you can recreate this, please look at http://issues.jalview.org/browse/JAL-869", + "Squashed a possible GUI implementation error. If you can recreate this, please look at https://issues.jalview.org/browse/JAL-869", cex); } } @@ -1135,7 +1135,7 @@ public class Desktop extends jalview.jbgui.GDesktop panel.add(history); history.setPreferredSize(new Dimension(400, 20)); history.setEditable(true); - history.addItem("http://www."); + history.addItem("https://www."); String historyItems = jalview.bin.Cache.getProperty("RECENT_URL"); @@ -1351,7 +1351,7 @@ public class Desktop extends jalview.jbgui.GDesktop "..Checking..") + " is available for download from " + jalview.bin.Cache.getDefault("www.jalview.org", - "http://www.jalview.org") + "https://www.jalview.org") + " !!"); if (red) { @@ -1362,7 +1362,7 @@ public class Desktop extends jalview.jbgui.GDesktop "AUTHORFNAMES", "The Jalview Authors (See AUTHORS file for current list)") + "

          Development managed by The Barton Group, University of Dundee, Scotland, UK.
          " - + "

          For help, see the FAQ at www.jalview.org/faq and/or join the jalview-discuss@jalview.org mailing list" + + "

          For help, see the FAQ at www.jalview.org/faq and/or join the jalview-discuss@jalview.org mailing list" + "

          If you use Jalview, please cite:" + "
          Waterhouse, A.M., Procter, J.B., Martin, D.M.A, Clamp, M. and Barton, G. J. (2009)" + "
          Jalview Version 2 - a multiple sequence alignment editor and analysis workbench" diff --git a/src/jalview/gui/Preferences.java b/src/jalview/gui/Preferences.java index 1f61bae..f51bfbf 100755 --- a/src/jalview/gui/Preferences.java +++ b/src/jalview/gui/Preferences.java @@ -289,8 +289,8 @@ public class Preferences extends GPreferences startupCheckbox .setSelected(Cache.getDefault("SHOW_STARTUP_FILE", true)); startupFileTextfield.setText(Cache.getDefault("STARTUP_FILE", - Cache.getDefault("www.jalview.org", "http://www.jalview.org") - + "/examples/exampleFile_2_3.jar")); + Cache.getDefault("www.jalview.org", "https://www.jalview.org") + + "/examples/exampleFile_2_7.jvp")); /* * Set Colours tab defaults diff --git a/src/jalview/io/JSONFile.java b/src/jalview/io/JSONFile.java index fda22dc..0e3cca7 100644 --- a/src/jalview/io/JSONFile.java +++ b/src/jalview/io/JSONFile.java @@ -71,7 +71,7 @@ public class JSONFile extends AlignFile implements ComplexAlignFile { private static String version = new BuildDetails().getVersion(); - private String webstartUrl = "http://www.jalview.org/services/launchApp"; + private String webstartUrl = "https://www.jalview.org/services/launchApp"; private String application = "Jalview"; diff --git a/src/jalview/project/Jalview2XML.java b/src/jalview/project/Jalview2XML.java index ca0423b..0e062ac 100644 --- a/src/jalview/project/Jalview2XML.java +++ b/src/jalview/project/Jalview2XML.java @@ -24,6 +24,54 @@ import static jalview.math.RotatableMatrix.Axis.X; import static jalview.math.RotatableMatrix.Axis.Y; import static jalview.math.RotatableMatrix.Axis.Z; +import java.awt.Color; +import java.awt.Font; +import java.awt.Rectangle; +import java.io.BufferedReader; +import java.io.DataInputStream; +import java.io.DataOutputStream; +import java.io.File; +import java.io.FileInputStream; +import java.io.FileOutputStream; +import java.io.IOException; +import java.io.InputStreamReader; +import java.io.OutputStreamWriter; +import java.io.PrintWriter; +import java.lang.reflect.InvocationTargetException; +import java.math.BigInteger; +import java.net.MalformedURLException; +import java.net.URL; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Collections; +import java.util.Enumeration; +import java.util.GregorianCalendar; +import java.util.HashMap; +import java.util.HashSet; +import java.util.Hashtable; +import java.util.IdentityHashMap; +import java.util.Iterator; +import java.util.LinkedHashMap; +import java.util.List; +import java.util.Map; +import java.util.Map.Entry; +import java.util.Set; +import java.util.Vector; +import java.util.jar.JarEntry; +import java.util.jar.JarInputStream; +import java.util.jar.JarOutputStream; + +import javax.swing.JInternalFrame; +import javax.swing.SwingUtilities; +import javax.xml.bind.JAXBContext; +import javax.xml.bind.JAXBElement; +import javax.xml.bind.Marshaller; +import javax.xml.datatype.DatatypeConfigurationException; +import javax.xml.datatype.DatatypeFactory; +import javax.xml.datatype.XMLGregorianCalendar; +import javax.xml.stream.XMLInputFactory; +import javax.xml.stream.XMLStreamReader; + import jalview.analysis.Conservation; import jalview.analysis.PCA; import jalview.analysis.scoremodels.ScoreModels; @@ -85,6 +133,7 @@ import jalview.schemes.UserColourScheme; import jalview.structure.StructureSelectionManager; import jalview.structures.models.AAStructureBindingModel; import jalview.util.Format; +import jalview.util.HttpUtils; import jalview.util.MessageManager; import jalview.util.Platform; import jalview.util.StringUtils; @@ -150,54 +199,6 @@ import jalview.xml.binding.jalview.SequenceSet.SequenceSetProperties; import jalview.xml.binding.jalview.ThresholdType; import jalview.xml.binding.jalview.VAMSAS; -import java.awt.Color; -import java.awt.Font; -import java.awt.Rectangle; -import java.io.BufferedReader; -import java.io.DataInputStream; -import java.io.DataOutputStream; -import java.io.File; -import java.io.FileInputStream; -import java.io.FileOutputStream; -import java.io.IOException; -import java.io.InputStreamReader; -import java.io.OutputStreamWriter; -import java.io.PrintWriter; -import java.lang.reflect.InvocationTargetException; -import java.math.BigInteger; -import java.net.MalformedURLException; -import java.net.URL; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.Collections; -import java.util.Enumeration; -import java.util.GregorianCalendar; -import java.util.HashMap; -import java.util.HashSet; -import java.util.Hashtable; -import java.util.IdentityHashMap; -import java.util.Iterator; -import java.util.LinkedHashMap; -import java.util.List; -import java.util.Map; -import java.util.Map.Entry; -import java.util.Set; -import java.util.Vector; -import java.util.jar.JarEntry; -import java.util.jar.JarInputStream; -import java.util.jar.JarOutputStream; - -import javax.swing.JInternalFrame; -import javax.swing.SwingUtilities; -import javax.xml.bind.JAXBContext; -import javax.xml.bind.JAXBElement; -import javax.xml.bind.Marshaller; -import javax.xml.datatype.DatatypeConfigurationException; -import javax.xml.datatype.DatatypeFactory; -import javax.xml.datatype.XMLGregorianCalendar; -import javax.xml.stream.XMLInputFactory; -import javax.xml.stream.XMLStreamReader; - /** * Write out the current jalview desktop state as a Jalview XML stream. * @@ -946,7 +947,7 @@ public class Jalview2XML else { vamsasSeq = createVamsasSequence(id, jds); -// vamsasSet.addSequence(vamsasSeq); + // vamsasSet.addSequence(vamsasSeq); vamsasSet.getSequence().add(vamsasSeq); vamsasSetIds.put(id, vamsasSeq); seqRefIds.put(id, jds); @@ -1339,9 +1340,8 @@ public class Jalview2XML if (colourScheme instanceof jalview.schemes.UserColourScheme) { - jGroup.setColour( - setUserColourScheme(colourScheme, userColours, - object)); + jGroup.setColour(setUserColourScheme(colourScheme, + userColours, object)); } else { @@ -1387,7 +1387,7 @@ public class Jalview2XML } } - //jms.setJGroup(groups); + // jms.setJGroup(groups); Object group; for (JGroup grp : groups) { @@ -1524,11 +1524,13 @@ public class Jalview2XML * save any filter for the feature type */ FeatureMatcherSetI filter = fr.getFeatureFilter(featureType); - if (filter != null) { - Iterator filters = filter.getMatchers().iterator(); + if (filter != null) + { + Iterator filters = filter.getMatchers() + .iterator(); FeatureMatcherI firstFilter = filters.next(); - setting.setMatcherSet(Jalview2XML.marshalFilter( - firstFilter, filters, filter.isAnded())); + setting.setMatcherSet(Jalview2XML.marshalFilter(firstFilter, + filters, filter.isAnded())); } /* @@ -1577,8 +1579,7 @@ public class Jalview2XML setting.setDisplay( av.getFeaturesDisplayed().isVisible(featureType)); - float rorder = fr - .getOrder(featureType); + float rorder = fr.getOrder(featureType); if (rorder > -1) { setting.setOrder(rorder); @@ -1602,7 +1603,7 @@ public class Jalview2XML Group g = new Group(); g.setName(grp); g.setDisplay(((Boolean) fr.checkGroupVisibility(grp, false)) - .booleanValue()); + .booleanValue()); // fs.addGroup(g); fs.getGroup().add(g); groupsAdded.addElement(grp); @@ -2368,7 +2369,8 @@ public class Jalview2XML { if (calcIdParam.getVersion().equals("1.0")) { - final String[] calcIds = calcIdParam.getServiceURL().toArray(new String[0]); + final String[] calcIds = calcIdParam.getServiceURL() + .toArray(new String[0]); Jws2Instance service = Jws2Discoverer.getDiscoverer() .getPreferredServiceFor(calcIds); if (service != null) @@ -2654,12 +2656,12 @@ public class Jalview2XML return id; } - jalview.schemes.UserColourScheme getUserColourScheme( - JalviewModel jm, String id) + jalview.schemes.UserColourScheme getUserColourScheme(JalviewModel jm, + String id) { List uc = jm.getUserColours(); UserColours colours = null; -/* + /* for (int i = 0; i < uc.length; i++) { if (uc[i].getId().equals(id)) @@ -2668,7 +2670,7 @@ public class Jalview2XML break; } } -*/ + */ for (UserColours c : uc) { if (c.getId().equals(id)) @@ -2696,10 +2698,9 @@ public class Jalview2XML newColours = new java.awt.Color[23]; for (int i = 0; i < 23; i++) { - newColours[i] = new java.awt.Color(Integer.parseInt( - colours.getUserColourScheme().getColour().get(i + 24) - .getRGB(), - 16)); + newColours[i] = new java.awt.Color( + Integer.parseInt(colours.getUserColourScheme().getColour() + .get(i + 24).getRGB(), 16)); } ucs.setLowerCaseColours(newColours); } @@ -2778,7 +2779,7 @@ public class Jalview2XML viewportsAdded.clear(); frefedSequence = null; - if (file.startsWith("http://")) + if (HttpUtils.startsWithHttpOrHttps(file)) { url = new URL(file); } @@ -2855,8 +2856,8 @@ public class Jalview2XML XMLStreamReader streamReader = XMLInputFactory.newInstance() .createXMLStreamReader(jin); javax.xml.bind.Unmarshaller um = jc.createUnmarshaller(); - JAXBElement jbe = um - .unmarshal(streamReader, JalviewModel.class); + JAXBElement jbe = um.unmarshal(streamReader, + JalviewModel.class); JalviewModel object = jbe.getValue(); /* @@ -3276,7 +3277,8 @@ public class Jalview2XML AlignFrame loadFromObject(JalviewModel jalviewModel, String file, boolean loadTreesAndStructures, jarInputStreamProvider jprovider) { - SequenceSet vamsasSet = jalviewModel.getVamsasModel().getSequenceSet().get(0); + SequenceSet vamsasSet = jalviewModel.getVamsasModel().getSequenceSet() + .get(0); List vamsasSeqs = vamsasSet.getSequence(); // JalviewModelSequence jms = object.getJalviewModelSequence(); @@ -3335,11 +3337,10 @@ public class Jalview2XML if (tmpSeq.getStart() != jseq.getStart() || tmpSeq.getEnd() != jseq.getEnd()) { - System.err.println( - String.format("Warning JAL-2154 regression: updating start/end for sequence %s from %d/%d to %d/%d", - tmpSeq.getName(), tmpSeq.getStart(), - tmpSeq.getEnd(), jseq.getStart(), - jseq.getEnd())); + System.err.println(String.format( + "Warning JAL-2154 regression: updating start/end for sequence %s from %d/%d to %d/%d", + tmpSeq.getName(), tmpSeq.getStart(), tmpSeq.getEnd(), + jseq.getStart(), jseq.getEnd())); } } else @@ -3622,8 +3623,8 @@ public class Jalview2XML else { // defer to later - frefedSequence.add( - newAlcodMapRef(map.getDnasq(), cf, mapping)); + frefedSequence + .add(newAlcodMapRef(map.getDnasq(), cf, mapping)); } } } @@ -3831,8 +3832,7 @@ public class Jalview2XML jaa.setCalcId(annotation.getCalcId()); if (annotation.getProperty().size() > 0) { - for (Annotation.Property prop : annotation - .getProperty()) + for (Annotation.Property prop : annotation.getProperty()) { jaa.setProperty(prop.getName(), prop.getValue()); } @@ -3913,9 +3913,9 @@ public class Jalview2XML sg.setShowNonconserved(safeBoolean(jGroup.isShowUnconserved())); sg.thresholdTextColour = safeInt(jGroup.getTextColThreshold()); // attributes with a default in the schema are never null - sg.setShowConsensusHistogram(jGroup.isShowConsensusHistogram()); - sg.setshowSequenceLogo(jGroup.isShowSequenceLogo()); - sg.setNormaliseSequenceLogo(jGroup.isNormaliseSequenceLogo()); + sg.setShowConsensusHistogram(jGroup.isShowConsensusHistogram()); + sg.setshowSequenceLogo(jGroup.isShowSequenceLogo()); + sg.setNormaliseSequenceLogo(jGroup.isNormaliseSequenceLogo()); sg.setIgnoreGapsConsensus(jGroup.isIgnoreGapsinConsensus()); if (jGroup.getConsThreshold() != null && jGroup.getConsThreshold().intValue() != 0) @@ -3959,8 +3959,9 @@ public class Jalview2XML if (addAnnotSchemeGroup) { // reconstruct the annotation colourscheme - sg.setColourScheme(constructAnnotationColour( - jGroup.getAnnotationColours(), null, al, jalviewModel, false)); + sg.setColourScheme( + constructAnnotationColour(jGroup.getAnnotationColours(), + null, al, jalviewModel, false)); } } } @@ -4166,8 +4167,8 @@ public class Jalview2XML * @param av * @param ap */ - protected void loadTrees(JalviewModel jm, Viewport view, - AlignFrame af, AlignViewport av, AlignmentPanel ap) + protected void loadTrees(JalviewModel jm, Viewport view, AlignFrame af, + AlignViewport av, AlignmentPanel ap) { // TODO result of automated refactoring - are all these parameters needed? try @@ -4275,8 +4276,8 @@ public class Jalview2XML for (int s = 0; s < structureStateCount; s++) { // check to see if we haven't already created this structure view - final StructureState structureState = pdbid - .getStructureState().get(s); + final StructureState structureState = pdbid.getStructureState() + .get(s); String sviewid = (structureState.getViewId() == null) ? null : structureState.getViewId() + uniqueSetSuffix; jalview.datamodel.PDBEntry jpdb = new jalview.datamodel.PDBEntry(); @@ -4339,8 +4340,8 @@ public class Jalview2XML colourByViewer &= structureState.isColourByJmol(); jmoldat.setColourByViewer(colourByViewer); - if (jmoldat.getStateData().length() < structureState - .getValue()/*Content()*/.length()) + if (jmoldat.getStateData().length() < structureState.getValue() + /*Content()*/.length()) { jmoldat.setStateData(structureState.getValue());// Content()); } @@ -4535,7 +4536,8 @@ public class Jalview2XML String reformatedOldFilename = oldfilenam.replaceAll("/", "\\\\"); filedat = oldFiles.get(new File(reformatedOldFilename)); } - newFileLoc.append(Platform.escapeBackslashes(filedat.getFilePath())); + newFileLoc + .append(Platform.escapeBackslashes(filedat.getFilePath())); pdbfilenames.add(filedat.getFilePath()); pdbids.add(filedat.getPdbId()); seqmaps.add(filedat.getSeqList().toArray(new SequenceI[0])); @@ -4848,9 +4850,9 @@ public class Jalview2XML } AlignFrame loadViewport(String file, List JSEQ, - List hiddenSeqs, AlignmentI al, - JalviewModel jm, Viewport view, String uniqueSeqSetId, - String viewId, List autoAlan) + List hiddenSeqs, AlignmentI al, JalviewModel jm, + Viewport view, String uniqueSeqSetId, String viewId, + List autoAlan) { AlignFrame af = null; af = new AlignFrame(al, safeInt(view.getWidth()), @@ -4931,9 +4933,8 @@ public class Jalview2XML viewport.setColourText(safeBoolean(view.isShowColourText())); - viewport - .setConservationSelected( - safeBoolean(view.isConservationSelected())); + viewport.setConservationSelected( + safeBoolean(view.isConservationSelected())); viewport.setIncrement(safeInt(view.getConsThreshold())); viewport.setShowJVSuffix(safeBoolean(view.isShowFullId())); viewport.setRightAlignIds(safeBoolean(view.isRightAlignIds())); @@ -5009,9 +5010,8 @@ public class Jalview2XML af.changeColour(cs); viewport.setColourAppliesToAllGroups(true); - viewport - .setShowSequenceFeatures( - safeBoolean(view.isShowSequenceFeatures())); + viewport.setShowSequenceFeatures( + safeBoolean(view.isShowSequenceFeatures())); viewport.setCentreColumnLabels(view.isCentreColumnLabels()); viewport.setIgnoreGapsConsensus(view.isIgnoreGapsinConsensus(), null); @@ -5035,13 +5035,13 @@ public class Jalview2XML .getFeatureRenderer(); FeaturesDisplayed fdi; viewport.setFeaturesDisplayed(fdi = new FeaturesDisplayed()); - String[] renderOrder = new String[jm.getFeatureSettings() - .getSetting().size()]; + String[] renderOrder = new String[jm.getFeatureSettings().getSetting() + .size()]; Map featureColours = new Hashtable<>(); Map featureOrder = new Hashtable<>(); - for (int fs = 0; fs < jm.getFeatureSettings() - .getSetting().size(); fs++) + for (int fs = 0; fs < jm.getFeatureSettings().getSetting() + .size(); fs++) { Setting setting = jm.getFeatureSettings().getSetting().get(fs); String featureType = setting.getType(); @@ -5053,8 +5053,8 @@ public class Jalview2XML .getMatcherSet(); if (filters != null) { - FeatureMatcherSetI filter = Jalview2XML - .parseFilter(featureType, filters); + FeatureMatcherSetI filter = Jalview2XML.parseFilter(featureType, + filters); if (!filter.isEmpty()) { fr.setFeatureFilter(featureType, filter); @@ -5086,8 +5086,7 @@ public class Jalview2XML float max = setting.getMax() == null ? 1f : setting.getMax().floatValue(); FeatureColourI gc = new FeatureColour(maxColour, minColour, - maxColour, - noValueColour, min, max); + maxColour, noValueColour, min, max); if (setting.getAttributeName().size() > 0) { gc.setAttributeName(setting.getAttributeName().toArray( @@ -5121,8 +5120,7 @@ public class Jalview2XML } else { - featureColours.put(featureType, - new FeatureColour(maxColour)); + featureColours.put(featureType, new FeatureColour(maxColour)); } renderOrder[fs] = featureType; if (setting.getOrder() != null) @@ -5595,6 +5593,7 @@ public class Jalview2XML } } } + /** * * @param vamsasSeq @@ -6341,8 +6340,8 @@ public class Jalview2XML * @param fcol * @return */ - public static Colour marshalColour( - String featureType, FeatureColourI fcol) + public static Colour marshalColour(String featureType, + FeatureColourI fcol) { Colour col = new Colour(); if (fcol.isSimpleColour()) @@ -6403,7 +6402,7 @@ public class Jalview2XML boolean and) { jalview.xml.binding.jalview.FeatureMatcherSet result = new jalview.xml.binding.jalview.FeatureMatcherSet(); - + if (filters.hasNext()) { /* @@ -6453,7 +6452,7 @@ public class Jalview2XML } result.setMatchCondition(matcherModel); } - + return result; } @@ -6464,8 +6463,7 @@ public class Jalview2XML * @param matcherSetModel * @return */ - public static FeatureMatcherSetI parseFilter( - String featureType, + public static FeatureMatcherSetI parseFilter(String featureType, jalview.xml.binding.jalview.FeatureMatcherSet matcherSetModel) { FeatureMatcherSetI result = new FeatureMatcherSet(); @@ -6480,7 +6478,7 @@ public class Jalview2XML featureType, e.getMessage())); // return as much as was parsed up to the error } - + return result; } @@ -6495,8 +6493,7 @@ public class Jalview2XML * @throws IllegalStateException * if AND and OR conditions are mixed */ - protected static void parseFilterConditions( - FeatureMatcherSetI matcherSet, + protected static void parseFilterConditions(FeatureMatcherSetI matcherSet, jalview.xml.binding.jalview.FeatureMatcherSet matcherSetModel, boolean and) { @@ -6518,7 +6515,7 @@ public class Jalview2XML else if (filterBy == FilterBy.BY_SCORE) { matchCondition = FeatureMatcher.byScore(cond, pattern); - + } else if (filterBy == FilterBy.BY_ATTRIBUTE) { @@ -6528,7 +6525,7 @@ public class Jalview2XML matchCondition = FeatureMatcher.byAttribute(cond, pattern, attNames); } - + /* * note this throws IllegalStateException if AND-ing to a * previously OR-ed compound condition, or vice versa @@ -6571,13 +6568,13 @@ public class Jalview2XML public static FeatureColourI parseColour(Colour colourModel) { FeatureColourI colour = null; - + if (colourModel.getMax() != null) { Color mincol = null; Color maxcol = null; Color noValueColour = null; - + try { mincol = new Color(Integer.parseInt(colourModel.getMinRGB(), 16)); @@ -6586,7 +6583,7 @@ public class Jalview2XML { Cache.log.warn("Couldn't parse out graduated feature color.", e); } - + NoValueColour noCol = colourModel.getNoValueColour(); if (noCol == NoValueColour.MIN) { @@ -6596,7 +6593,7 @@ public class Jalview2XML { noValueColour = maxcol; } - + colour = new FeatureColour(maxcol, mincol, maxcol, noValueColour, safeFloat(colourModel.getMin()), safeFloat(colourModel.getMax())); @@ -6635,7 +6632,7 @@ public class Jalview2XML Color color = new Color(Integer.parseInt(colourModel.getRGB(), 16)); colour = new FeatureColour(color); } - + return colour; } } diff --git a/src/jalview/util/Comparison.java b/src/jalview/util/Comparison.java index d4fc233..286bfb2 100644 --- a/src/jalview/util/Comparison.java +++ b/src/jalview/util/Comparison.java @@ -268,7 +268,38 @@ public class Comparison */ public static final boolean isNucleotide(SequenceI seq) { - return isNucleotide(new SequenceI[] { seq }); + if (seq==null) + { + return false; + } + long ntCount = 0; + long aaCount = 0; + + int len = seq.getLength(); + for (int i = 0; i < len; i++) + { + char c = seq.getCharAt(i); + if (isNucleotide(c)) + { + ntCount++; + } + else if (!isGap(c)) + { + aaCount++; + } + } + /* + * Check for nucleotide count > 85% of total count (in a form that evades + * int / float conversion or divide by zero). + */ + if (ntCount * 100 > EIGHTY_FIVE * (ntCount + aaCount)) + { + return true; + } + else + { + return false; + } } /** @@ -285,45 +316,23 @@ public class Comparison { return false; } - - int ntCount = 0; - int aaCount = 0; + // true if we have seen a nucleotide sequence + boolean na=false; for (SequenceI seq : seqs) { if (seq == null) { continue; } + na=true; // TODO could possibly make an informed guess just from the first sequence // to save a lengthy calculation - int len = seq.getLength(); - for (int i = 0; i < len; i++) - { - char c = seq.getCharAt(i); - if (isNucleotide(c)) - { - ntCount++; - } - else if (!isGap(c)) - { - aaCount++; - } + if (seq.isProtein()) { + // if even one looks like protein, the alignment is protein + return false; } } - - /* - * Check for nucleotide count > 85% of total count (in a form that evades - * int / float conversion or divide by zero). - */ - if (ntCount * 100 > EIGHTY_FIVE * (ntCount + aaCount)) - { - return true; - } - else - { - return false; - } - + return na; } /** diff --git a/src/jalview/util/HttpUtils.java b/src/jalview/util/HttpUtils.java index a5a9460..74f77a2 100644 --- a/src/jalview/util/HttpUtils.java +++ b/src/jalview/util/HttpUtils.java @@ -64,4 +64,9 @@ public class HttpUtils return false; } + public static boolean startsWithHttpOrHttps(String file) + { + return file.startsWith("http://") || file.startsWith("https://"); + } + } diff --git a/test/jalview/analysis/FinderTest.java b/test/jalview/analysis/FinderTest.java index 95e6c0d..1f45f70 100644 --- a/test/jalview/analysis/FinderTest.java +++ b/test/jalview/analysis/FinderTest.java @@ -123,6 +123,19 @@ public class FinderTest assertEquals(matches.get(1).getEnd(), 6); } + @Test(groups = "Functional") + public void testFind_findAll() + { + /* + * simple JAL-3765 test + * single symbol should find *all* matching symbols + */ + Finder f = new Finder(av); + f.findAll("M", false,false,false); + SearchResultsI sr = f.getSearchResults(); + assertEquals(sr.getCount(),5); + + } /** * Test for (undocumented) find residue by position */ diff --git a/test/jalview/util/ComparisonTest.java b/test/jalview/util/ComparisonTest.java index 6f6841d..2e646f5 100644 --- a/test/jalview/util/ComparisonTest.java +++ b/test/jalview/util/ComparisonTest.java @@ -85,15 +85,15 @@ public class ComparisonTest seq = new Sequence("DNA", "ACTugGCCAG"); SequenceI seq2 = new Sequence("Protein", "FLIMVSPTYW"); /* - * 90% DNA: + * 90% DNA but one protein sequence - expect false */ - assertTrue(Comparison.isNucleotide(new SequenceI[] { seq, seq, seq, + assertFalse(Comparison.isNucleotide(new SequenceI[] { seq, seq, seq, seq, seq, seq, seq, seq, seq, seq2 })); - assertTrue(Comparison.isNucleotide(new SequenceI[][] { + assertFalse(Comparison.isNucleotide(new SequenceI[][] { new SequenceI[] { seq }, new SequenceI[] { seq, seq, seq }, new SequenceI[] { seq, seq, seq, seq, seq, seq2 } })); /* - * 80% DNA: + * 80% DNA but one protein sequence - Expect false */ assertFalse(Comparison.isNucleotide(new SequenceI[] { seq, seq, seq, seq, seq, seq, seq, seq, seq2, seq2 })); diff --git a/utils/install4j/install4j8_template.install4j b/utils/install4j/install4j8_template.install4j index a02cd6d..d540935 100644 --- a/utils/install4j/install4j8_template.install4j +++ b/utils/install4j/install4j8_template.install4j @@ -127,7 +127,7 @@ - +