From: Jim Procter Date: Tue, 25 Feb 2014 16:44:29 +0000 (+0000) Subject: JAL-1454 catch exceptions during calculation and report any warnings in the PCA ... X-Git-Tag: Jalview_2_9~203^2~1 X-Git-Url: http://source.jalview.org/gitweb/?a=commitdiff_plain;h=608bc7b65ff89fc814d05275fcaa87bdfa4cd9be;p=jalview.git JAL-1454 catch exceptions during calculation and report any warnings in the PCA 'Output values...' dump. --- diff --git a/src/jalview/analysis/PCA.java b/src/jalview/analysis/PCA.java index 7a506cc..89c6353 100755 --- a/src/jalview/analysis/PCA.java +++ b/src/jalview/analysis/PCA.java @@ -237,6 +237,20 @@ public class PCA implements Runnable */ public void run() { + PrintStream ps = new PrintStream(System.out) + { + public void print(String x) + { + details.append(x); + } + + public void println() + { + details.append("\n"); + } + }; + + try { details.append("PCA Calculation Mode is " + (jvCalcMode ? "Jalview variant" : "Original SeqSpace") + "\n"); Matrix mt = m.transpose(); @@ -251,19 +265,6 @@ public class PCA implements Runnable eigenvector = mt.preMultiply(m2); // jalview variation on seqsmace method } - PrintStream ps = new PrintStream(System.out) - { - public void print(String x) - { - details.append(x); - } - - public void println() - { - details.append("\n"); - } - }; - eigenvector.print(ps); symm = eigenvector.copy(); @@ -280,6 +281,12 @@ public class PCA implements Runnable // Now produce the diagonalization matrix eigenvector.tqli(); + } catch (Exception q) + { + q.printStackTrace(); + details.append("\n*** Unexpected exception when performing PCA ***\n"+q.getLocalizedMessage()); + details.append("*** Matrices below may not be fully diagonalised. ***\n"); + } details.append(" --- New diagonalization matrix ---\n"); eigenvector.print(ps);