Search in sources :

Example 1 with DownloadableGenomeSet

use of uk.ac.babraham.SeqMonk.Network.DownloadableGenomes.DownloadableGenomeSet in project SeqMonk by s-andrews.

the class SeqMonkInformationPanel method run.

/* (non-Javadoc)
	 * @see java.lang.Runnable#run()
	 */
public void run() {
    // Check for an available update to the SeqMonk Program
    try {
        if (UpdateChecker.isUpdateAvailable()) {
            String latestVersion = UpdateChecker.getLatestVersionNumber();
            programUpdateLabel.setIcon(warningIcon);
            programUpdateLabelText.setText("A newer version of SeqMonk (v" + latestVersion + ") is available");
        } else {
            if (SeqMonkApplication.VERSION.contains("devel")) {
                programUpdateLabel.setIcon(warningIcon);
                programUpdateLabelText.setText("You are running a current development version of SeqMonk");
            } else {
                programUpdateLabel.setIcon(tickIcon);
                programUpdateLabelText.setText("You are running the latest version of SeqMonk");
            }
        }
    } catch (SeqMonkException e) {
        programUpdateLabel.setIcon(errorIcon);
        programUpdateLabelText.setText("Failed to check for SeqMonk updates");
        e.printStackTrace();
    }
    // Check for an available update to any of the installed genomes
    try {
        DownloadableGenomeSet availableGenomes = new DownloadableGenomeSet();
        updates = availableGenomes.findUpdateableGenomes();
        if (updates != null && updates.length > 0) {
            genomeUpdateLabel.setIcon(warningIcon);
            genomeUpdateLabelText.setText("There are updates available for " + updates.length + " of your installed genomes");
            updateGenomesButton.setVisible(true);
        } else {
            genomeUpdateLabel.setIcon(tickIcon);
            genomeUpdateLabelText.setText("All of your installed genomes are up to date");
        }
    } catch (Exception e) {
        genomeUpdateLabel.setIcon(errorIcon);
        genomeUpdateLabelText.setText("Failed to check for genome updates");
        e.printStackTrace();
    }
    try {
        String rVersion = RVersionTest.testRVersion(SeqMonkPreferences.getInstance().RLocation());
        if (rVersion.startsWith("2") || rVersion.startsWith("3.0")) {
            // They're going to have a problem, so let's not encourage this
            rLabel.setIcon(warningIcon);
            rLabelText.setText("Found R version " + rVersion + " but this is too old to use.  Please update to the latest R");
            setRLocationButton.setVisible(true);
            return;
        }
        if (!RVersionTest.hasRDependencies()) {
            rLabel.setIcon(warningIcon);
            rLabelText.setText("Found a valid R installation, but package dependencies were missing");
            installRDependenciesButton.setVisible(true);
        } else {
            rLabel.setIcon(tickIcon);
            rLabelText.setText("Found valid R version (" + rVersion + ") at '" + SeqMonkPreferences.getInstance().RLocation() + "'");
        }
    } catch (IOException ioe) {
        if (SeqMonkPreferences.getInstance().RLocation().equals("R")) {
            rLabel.setIcon(infoIcon);
            rLabelText.setText("Couldn't find a valid default R installation " + ioe.getMessage());
            setRLocationButton.setVisible(true);
        } else {
            rLabel.setIcon(errorIcon);
            rLabelText.setText("Couldn't find a valid R installation at " + SeqMonkPreferences.getInstance().RLocation() + " " + ioe.getMessage());
            setRLocationButton.setVisible(true);
        }
    }
}
Also used : SeqMonkException(uk.ac.babraham.SeqMonk.SeqMonkException) DownloadableGenomeSet(uk.ac.babraham.SeqMonk.Network.DownloadableGenomes.DownloadableGenomeSet) IOException(java.io.IOException) IOException(java.io.IOException) FileNotFoundException(java.io.FileNotFoundException) SeqMonkException(uk.ac.babraham.SeqMonk.SeqMonkException)

Aggregations

FileNotFoundException (java.io.FileNotFoundException)1 IOException (java.io.IOException)1 DownloadableGenomeSet (uk.ac.babraham.SeqMonk.Network.DownloadableGenomes.DownloadableGenomeSet)1 SeqMonkException (uk.ac.babraham.SeqMonk.SeqMonkException)1