X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;f=src%2Fjalview%2Fio%2FJSONFile.java;h=0d6e02f853f2d1df0c41825e8ae54d04f966b97b;hb=e28854ac11c339662d931324c32d89aca3313ed9;hp=20148b49cb96aab17b922bf062b183965ecf4b0d;hpb=7ff2320a439fdf69396aff086bbfeb81411595db;p=jalview.git 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); }