From 7e7c422421698d7a47a9bad846c5522556f066d6 Mon Sep 17 00:00:00 2001 From: Jim Procter Date: Mon, 15 May 2017 16:26:02 +0100 Subject: [PATCH] =?utf8?q?JAL-2535=20quick=20hack=20to=20implement=20posteri?= =?utf8?q?or=20probabilities=20parsing.=200-9=20parsed=20as=200..9,=20=E2=80?= =?utf8?q?=98*=E2=80=99=20or=20any=20other=20non-whitespace=20symbol=20parse?= =?utf8?q?d=20as=20=E2=80=9910=E2=80=99.?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- src/jalview/io/StockholmFile.java | 26 +++++++++++++++++++++++++- 1 file changed, 25 insertions(+), 1 deletion(-) 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; } -- 1.7.10.2