--- /dev/null
+package jalview.io.gff;
+
+import jalview.datamodel.AlignmentI;
+import jalview.datamodel.SequenceFeature;
+import jalview.datamodel.SequenceI;
+
+import java.io.IOException;
+import java.util.List;
+import java.util.Map;
+
+public class Gff2Helper extends GffHelperBase
+{
+ /**
+ * GFF2 uses space character to delimit name/value pairs on column 9
+ *
+ * @param text
+ * @return
+ */
+ public static Map<String, List<String>> parseNameValuePairs(String text)
+ {
+ // TODO: can a value include a comma? if so it will be broken by this
+ return parseNameValuePairs(text, ";", ' ', ",");
+ }
+
+ /**
+ * Return ' ' as the name-value separator used in column 9 attributes.
+ */
+ @Override
+ protected char getNameValueSeparator()
+ {
+ return ' ';
+ }
+
+ /**
+ * Default processing if not overridden is just to construct a sequence
+ * feature
+ */
+ @Override
+ public SequenceFeature processGff(SequenceI seq, String[] gff,
+ AlignmentI align, List<SequenceI> newseqs,
+ boolean relaxedIdMatching) throws IOException
+ {
+ Map<String, List<String>> attributes = null;
+ if (gff.length > ATTRIBUTES_COL)
+ {
+ attributes = parseNameValuePairs(gff[ATTRIBUTES_COL]);
+ }
+ return buildSequenceFeature(gff, attributes);
+ }
+
+}