From: jprocter <Jim Procter> Date: Wed, 17 May 2006 16:51:29 +0000 (+0000) Subject: refactored code for creating JNet annotations X-Git-Tag: Release_2_1~400 X-Git-Url: http://source.jalview.org/gitweb/?a=commitdiff_plain;h=7aa11cfcb114407bb2929306eeefebc44565a43c;p=jalview.git refactored code for creating JNet annotations --- diff --git a/src/jalview/ws/JPredClient.java b/src/jalview/ws/JPredClient.java index 2d49ac6..08d7271 100755 --- a/src/jalview/ws/JPredClient.java +++ b/src/jalview/ws/JPredClient.java @@ -27,6 +27,7 @@ import jalview.analysis.*; import jalview.datamodel.*; import jalview.gui.*; import jalview.io.FormatAdapter; +import jalview.io.*; public class JPredClient extends WSClient @@ -127,6 +128,8 @@ public class JPredClient { this.server = loc.getjpred(new java.net.URL(WsURL)); // JBPNote will be set from properties ( (JpredSoapBindingStub)this.server).setTimeout(60000); // one minute stub + //((JpredSoapBindingStub)this.server)._setProperty(org.apache.axis.encoding.C, Boolean.TRUE); + } catch (Exception ex) { @@ -238,6 +241,7 @@ public class JPredClient catch (Exception ex) { allowedServerExceptions--; + wsInfo.appendProgressText("\nJPredWS Server exception!\n" + ex.getMessage()); @@ -441,110 +445,13 @@ public class JPredClient al.setDataset(null); - AlignmentAnnotation annot; - Annotation[] annotations = null; - int i = 0; - int width = preds[0].getSequence().length(); - - int[] gapmap = al.getSequenceAt(FirstSeq).gapMap(); - - if (gapmap.length != width) - { - throw (new Exception( - "Jnet Client Error\nNumber of residues in supposed query sequence :\n" + - al.getSequenceAt(FirstSeq).getName() + "\n" + - al.getSequenceAt(FirstSeq).getSequence() + - "\nDiffer from number of prediction sites in \n" + - result.getPredfile() + "\n")); + try { + jalview.io.JnetAnnotationMaker.add_annotation(prediction, al, FirstSeq, + noMsa); } - - // JBPNote Should also rename the query sequence sometime... - i = 0; - - SequenceI seqRef = al.getSequenceAt(FirstSeq); - - while (i < preds.length) - { - String id = preds[i].getName().toUpperCase(); - - if (id.startsWith("LUPAS") || id.startsWith("JNET") || - id.startsWith("JPRED")) - { - annotations = new Annotation[al.getWidth()]; - - if (id.equals("JNETPRED") || id.equals("JNETPSSM") || - id.equals("JNETFREQ") || id.equals("JNETHMM") || - id.equals("JNETALIGN") || id.equals("JPRED")) - { - for (int j = 0; j < width; j++) - { - annotations[gapmap[j]] = new Annotation("", "", - preds[i].getCharAt(j), 0); - } - } - else if (id.equals("JNETCONF")) - { - for (int j = 0; j < width; j++) - { - float value = Float.parseFloat(preds[i].getCharAt( - j) + ""); - annotations[gapmap[j]] = new Annotation(preds[i].getCharAt( - j) + "", "", preds[i].getCharAt(j), - value); - } - } - else - { - for (int j = 0; j < width; j++) - { - annotations[gapmap[j]] = new Annotation(preds[i].getCharAt( - j) + "", "", ' ', 0); - } - } - - if (id.equals("JNETCONF")) - { - annot = new AlignmentAnnotation(preds[i].getName(), - "JNet Output", annotations, 0f, - 10f, - AlignmentAnnotation.BAR_GRAPH); - } - else - { - annot = new AlignmentAnnotation(preds[i].getName(), - "JNet Output", annotations); - } - - if (seqRef != null) - { - annot.createSequenceMapping(seqRef, 0); - seqRef.addAlignmentAnnotation(annot); - } - - al.addAnnotation(annot); - - - if (noMsa) - { - al.deleteSequence(preds[i]); - } - } - - i++; + catch (Exception e) { + jalview.bin.Cache.log.error("JNet Client: JPred Annotation Parse Error", e); } - - //Hashtable scores = prediction.getScores(); - - /* addFloatAnnotations(al, gapmap, (Vector)scores.get("JNETPROPH"), - "JnetpropH", "Jnet Helix Propensity", 0f,1f,1); - - addFloatAnnotations(al, gapmap, (Vector)scores.get("JNETPROPB"), - "JnetpropB", "Jnet Beta Sheet Propensity", 0f,1f,1); - - addFloatAnnotations(al, gapmap, (Vector)scores.get("JNETPROPC"), - "JnetpropC", "Jnet Coil Propensity", 0f,1f,1); - */ - wsInfo.setProgressText(OutputHeader); jalview.bin.Cache.log.debug("Finished parsing output."); AlignFrame af = new AlignFrame(al);