From: Jim Procter Date: Mon, 15 May 2017 15:26:02 +0000 (+0100) Subject: JAL-2535 quick hack to implement posterior probabilities parsing. 0-9 parsed as 0... X-Git-Tag: Release_2_10_2~3^2~88^2~4 X-Git-Url: http://source.jalview.org/gitweb/?a=commitdiff_plain;h=7e7c422421698d7a47a9bad846c5522556f066d6;p=jalview.git JAL-2535 quick hack to implement posterior probabilities parsing. 0-9 parsed as 0..9, ‘*’ or any other non-whitespace symbol parsed as ’10’. --- diff --git a/src/jalview/io/StockholmFile.java b/src/jalview/io/StockholmFile.java index e4d9f60..7f3f93b 100644 --- a/src/jalview/io/StockholmFile.java +++ b/src/jalview/io/StockholmFile.java @@ -33,6 +33,7 @@ import jalview.datamodel.Sequence; import jalview.datamodel.SequenceFeature; import jalview.datamodel.SequenceI; import jalview.schemes.ResidueProperties; +import jalview.util.Comparison; import jalview.util.Format; import jalview.util.MessageManager; @@ -817,12 +818,16 @@ public class StockholmFile extends AlignFile type = (label.indexOf("_cons") == label.length() - 5) ? label .substring(0, label.length() - 5) : label; } - boolean ss = false; + boolean ss = false, posterior = false; type = id2type(type); if (type.equals("secondary structure")) { ss = true; } + if (type.equalsIgnoreCase("posterior probability")) + { + posterior = true; + } // decide on secondary structure or not. Annotation[] els = new Annotation[annots.length()]; for (int i = 0; i < annots.length(); i++) @@ -857,6 +862,25 @@ public class StockholmFile extends AlignFile } } + if (posterior && !ann.isWhitespace() + && !Comparison.isGap(pos.charAt(0))) + { + float val = 0; + // symbol encodes values - 0..*==0..10 + if (pos.charAt(0) == '*') + { + val = 10; + } + else + { + val = pos.charAt(0) - '0'; + if (val > 9) + { + val = 10; + } + } + ann.value = val; + } els[i] = ann; }