From: gmungoc Date: Mon, 8 May 2017 16:45:01 +0000 (+0100) Subject: JAL-2505 set type,desc,begin,end,group,score in SequenceFeature X-Git-Tag: Release_2_10_3b1~293 X-Git-Url: http://source.jalview.org/gitweb/?a=commitdiff_plain;h=e28854ac11c339662d931324c32d89aca3313ed9;p=jalview.git JAL-2505 set type,desc,begin,end,group,score in SequenceFeature constructor --- diff --git a/src/jalview/io/JSONFile.java b/src/jalview/io/JSONFile.java index 20148b4..0d6e02f 100644 --- a/src/jalview/io/JSONFile.java +++ b/src/jalview/io/JSONFile.java @@ -692,12 +692,17 @@ public class JSONFile extends AlignFile implements ComplexAlignFile Long end = (Long) jsonFeature.get("xEnd"); String type = (String) jsonFeature.get("type"); String featureGrp = (String) jsonFeature.get("featureGroup"); - String descripiton = (String) jsonFeature.get("description"); + String description = (String) jsonFeature.get("description"); String seqRef = (String) jsonFeature.get("sequenceRef"); Float score = Float.valueOf(jsonFeature.get("score").toString()); Sequence seq = seqMap.get(seqRef); - SequenceFeature sequenceFeature = new SequenceFeature(); + int featureBegin = seq.findPosition(begin.intValue()); + int featureEnd = seq.findPosition(end.intValue()) - 1; + + SequenceFeature sequenceFeature = new SequenceFeature(type, + description, featureBegin, featureEnd, score, featureGrp); + JSONArray linksJsonArray = (JSONArray) jsonFeature.get("links"); if (linksJsonArray != null && linksJsonArray.size() > 0) { @@ -708,12 +713,7 @@ public class JSONFile extends AlignFile implements ComplexAlignFile sequenceFeature.addLink(link); } } - sequenceFeature.setFeatureGroup(featureGrp); - sequenceFeature.setScore(score); - sequenceFeature.setDescription(descripiton); - sequenceFeature.setType(type); - sequenceFeature.setBegin(seq.findPosition(begin.intValue())); - sequenceFeature.setEnd(seq.findPosition(end.intValue()) - 1); + seq.addSequenceFeature(sequenceFeature); displayedFeatures.setVisible(type); }