From d6ab080a4e9181800bbecb6525e6329c10246aab Mon Sep 17 00:00:00 2001 From: jprocter Date: Mon, 15 Dec 2008 10:35:09 +0000 Subject: [PATCH] added (and enabled) switch to store gff source string as sequencefeature.group rather than add it to description --- src/jalview/io/FeaturesFile.java | 28 +++++++++++++++++++++++++--- 1 file changed, 25 insertions(+), 3 deletions(-) diff --git a/src/jalview/io/FeaturesFile.java b/src/jalview/io/FeaturesFile.java index 5058e5f..17ff88f 100755 --- a/src/jalview/io/FeaturesFile.java +++ b/src/jalview/io/FeaturesFile.java @@ -36,6 +36,11 @@ import jalview.schemes.*; public class FeaturesFile extends AlignFile { /** + * work around for GFF interpretation bug where source string becomes description rather than a group + */ + private boolean doGffSource = true; + + /** * Creates a new FeaturesFile object. */ public FeaturesFile() @@ -161,17 +166,34 @@ public class FeaturesFile extends AlignFile if (seq != null) { desc = st.nextToken(); + String group=null; + if (doGffSource && desc.indexOf(' ')==-1) { + // could also be a source term rather than description line + group = new String(desc); + } type = st.nextToken(); try { - start = Integer.parseInt(st.nextToken()); + String stt = st.nextToken(); + if (stt.length()==0 || stt.equals("-")) + { + start = 0; + } else { + start = Integer.parseInt(stt); + } } catch (NumberFormatException ex) { start = 0; } try { - end = Integer.parseInt(st.nextToken()); + String stt = st.nextToken(); + if (stt.length()==0 || stt.equals("-")) + { + end = -1; + } else { + end = Integer.parseInt(stt); + } } catch (NumberFormatException ex) { end = -1; @@ -184,7 +206,7 @@ public class FeaturesFile extends AlignFile score = 0; } - sf = new SequenceFeature(type, desc, start, end, score, null); + sf = new SequenceFeature(type, desc, start, end, score, group); try { -- 1.7.10.2