From af933523a5b24cd18b6a54fa2808c8734b9b9ecc Mon Sep 17 00:00:00 2001 From: Sascha Steinbiss <ss34@sanger.ac.uk> Date: Thu, 6 Feb 2014 11:10:51 +0000 Subject: [PATCH] concatenate 'comment' and 'curation' attributes with blank --- uk/ac/sanger/artemis/io/GFFStreamFeature.java | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/uk/ac/sanger/artemis/io/GFFStreamFeature.java b/uk/ac/sanger/artemis/io/GFFStreamFeature.java index bfec1da89..f4a0a9b44 100644 --- a/uk/ac/sanger/artemis/io/GFFStreamFeature.java +++ b/uk/ac/sanger/artemis/io/GFFStreamFeature.java @@ -892,12 +892,29 @@ public class GFFStreamFeature extends SimpleDocumentFeature implements } }; + GFF3AttributeAggregator curcomProc = new GFF3AttributeAggregator() { + @Override + public String process(StringVector values) { + StringBuilder buffer = new StringBuilder(); + if (values != null && values.size() > 0) { + for (int value_index = 0; value_index < values.size(); ++value_index) { + buffer.append(GFF3Encoder.encode(values.elementAt(value_index))); + if (value_index < (values.size()) - 1) + buffer.append(" "); + } + } + return buffer.toString(); + } + }; + // map GO -> full_GO abuf.setMapping("GO", "full_GO"); abuf.setGlue("full_GO", ","); // merge curation and comment abuf.setMapping("curation", "comment"); + abuf.setGlue("comment", " "); + abuf.setAggregator("comment", curcomProc); // also put GOs in Ontology_term abuf.setClone("full_GO", "Ontology_term"); -- GitLab