From 3900c35baa85360e632d91fa9a845d8eb9d727e3 Mon Sep 17 00:00:00 2001 From: Jim Procter Date: Wed, 21 Feb 2018 15:41:27 +0000 Subject: [PATCH] JAL-2914 process #gff-version as a valid GFF3 pragma and suppress unknown pragma warning for lines with only one # --- src/jalview/io/FeaturesFile.java | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/src/jalview/io/FeaturesFile.java b/src/jalview/io/FeaturesFile.java index d2282b1..d307a51 100755 --- a/src/jalview/io/FeaturesFile.java +++ b/src/jalview/io/FeaturesFile.java @@ -197,7 +197,8 @@ public class FeaturesFile extends AlignFile implements FeaturesSourceI // skip comments/process pragmas if (line.length() == 0 || line.startsWith("#")) { - if (line.toLowerCase().startsWith("##")) + if (line.toLowerCase().startsWith("##") + || line.indexOf("gff-version") > -1) { processGffPragma(line, gffProps, align, newseqs); } @@ -1093,8 +1094,8 @@ public class FeaturesFile extends AlignFile implements FeaturesSourceI // close off any open 'forward references' return; } - - String[] tokens = line.substring(2).split(" "); + int startpragma = (line.charAt(1) == '#') ? 2 : 1; // lax + String[] tokens = line.substring(startpragma).split(" "); String pragma = tokens[0]; String value = tokens.length == 1 ? null : tokens[1]; @@ -1141,7 +1142,11 @@ public class FeaturesFile extends AlignFile implements FeaturesSourceI } else { - System.err.println("Ignoring unknown pragma: " + line); + if (startpragma == 2) + { + // only complain if it was a genuine pragma line starting with ## + System.err.println("Ignoring unknown pragma: " + line); + } } } } -- 1.7.10.2