2 * Jalview - A Sequence Alignment Editor and Viewer ($$Version-Rel$$)
3 * Copyright (C) $$Year-Rel$$ The Jalview Authors
5 * This file is part of Jalview.
7 * Jalview is free software: you can redistribute it and/or
8 * modify it under the terms of the GNU General Public License
9 * as published by the Free Software Foundation, either version 3
10 * of the License, or (at your option) any later version.
12 * Jalview is distributed in the hope that it will be useful, but
13 * WITHOUT ANY WARRANTY; without even the implied warranty
14 * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
15 * PURPOSE. See the GNU General Public License for more details.
17 * You should have received a copy of the GNU General Public License
18 * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
19 * The Jalview Authors are detailed in the 'AUTHORS' file.
24 import jalview.api.AlignExportSettingsI;
25 import jalview.api.AlignViewportI;
26 import jalview.api.AlignmentViewPanel;
27 import jalview.api.ComplexAlignFile;
28 import jalview.api.FeatureRenderer;
29 import jalview.api.FeatureSettingsModelI;
30 import jalview.api.FeaturesDisplayedI;
31 import jalview.bin.BuildDetails;
32 import jalview.datamodel.AlignExportSettingsAdapter;
33 import jalview.datamodel.AlignmentAnnotation;
34 import jalview.datamodel.AlignmentI;
35 import jalview.datamodel.Annotation;
36 import jalview.datamodel.HiddenColumns;
37 import jalview.datamodel.HiddenSequences;
38 import jalview.datamodel.Sequence;
39 import jalview.datamodel.SequenceFeature;
40 import jalview.datamodel.SequenceGroup;
41 import jalview.datamodel.SequenceI;
42 import jalview.json.binding.biojson.v1.AlignmentAnnotationPojo;
43 import jalview.json.binding.biojson.v1.AlignmentPojo;
44 import jalview.json.binding.biojson.v1.AnnotationDisplaySettingPojo;
45 import jalview.json.binding.biojson.v1.AnnotationPojo;
46 import jalview.json.binding.biojson.v1.ColourSchemeMapper;
47 import jalview.json.binding.biojson.v1.SequenceFeaturesPojo;
48 import jalview.json.binding.biojson.v1.SequenceGrpPojo;
49 import jalview.json.binding.biojson.v1.SequencePojo;
50 import jalview.renderer.seqfeatures.FeatureColourFinder;
51 import jalview.schemes.ColourSchemeProperty;
52 import jalview.schemes.JalviewColourScheme;
53 import jalview.schemes.ResidueColourScheme;
54 import jalview.util.ColorUtils;
55 import jalview.util.Format;
56 import jalview.util.JSONUtils;
57 import jalview.viewmodel.seqfeatures.FeaturesDisplayed;
59 import java.awt.Color;
60 import java.io.IOException;
61 import java.io.Reader;
62 import java.util.ArrayList;
63 import java.util.Hashtable;
64 import java.util.Iterator;
65 import java.util.List;
67 import java.util.Vector;
69 public class JSONFile extends AlignFile implements ComplexAlignFile
71 private static String version = new BuildDetails().getVersion();
73 private String webstartUrl = "https://www.jalview.org/services/launchApp";
75 private String application = "Jalview";
77 private String globalColourScheme;
79 private boolean showSeqFeatures;
81 private Hashtable<String, Sequence> seqMap;
83 private FeaturesDisplayedI displayedFeatures;
85 private FeatureRenderer fr;
87 private HiddenColumns hiddenColumns;
89 private List<String> hiddenSeqRefs;
91 private ArrayList<SequenceI> hiddenSequences;
93 private final static String TCOFFEE_SCORE = "TCoffeeScore";
100 public JSONFile(FileParse source) throws IOException
105 public JSONFile(String inFile, DataSourceType sourceType)
108 super(inFile, sourceType);
112 public void parse() throws IOException
119 public String print(SequenceI[] sqs, boolean jvsuffix)
121 String jsonOutput = null;
124 AlignmentPojo jsonAlignmentPojo = new AlignmentPojo();
125 AlignExportSettingsI exportSettings = getExportSettings();
128 * if no export settings were supplied, provide an 'export all' setting
130 if (exportSettings == null)
132 exportSettings = new AlignExportSettingsAdapter(true);
136 for (SequenceI seq : sqs)
138 StringBuilder name = new StringBuilder();
139 name.append(seq.getName()).append("/").append(seq.getStart())
140 .append("-").append(seq.getEnd());
141 SequencePojo jsonSeqPojo = new SequencePojo();
142 jsonSeqPojo.setId(String.valueOf(seq.hashCode()));
143 jsonSeqPojo.setOrder(++count);
144 jsonSeqPojo.setEnd(seq.getEnd());
145 jsonSeqPojo.setStart(seq.getStart());
146 jsonSeqPojo.setName(name.toString());
147 jsonSeqPojo.setSeq(seq.getSequenceAsString());
148 jsonAlignmentPojo.getSeqs().add(jsonSeqPojo);
150 jsonAlignmentPojo.setGlobalColorScheme(globalColourScheme);
151 jsonAlignmentPojo.getAppSettings().put("application", application);
152 jsonAlignmentPojo.getAppSettings().put("version", version);
153 jsonAlignmentPojo.getAppSettings().put("webStartUrl", webstartUrl);
154 jsonAlignmentPojo.getAppSettings().put("showSeqFeatures",
155 String.valueOf(showSeqFeatures));
157 String[] hiddenSections = getHiddenSections();
158 if (hiddenSections != null)
160 if (hiddenSections[0] != null
161 && exportSettings.isExportHiddenColumns())
163 jsonAlignmentPojo.getAppSettings().put("hiddenCols",
164 String.valueOf(hiddenSections[0]));
166 if (hiddenSections[1] != null
167 && exportSettings.isExportHiddenSequences())
169 jsonAlignmentPojo.getAppSettings().put("hiddenSeqs",
170 String.valueOf(hiddenSections[1]));
174 if (exportSettings.isExportAnnotations())
177 .setAlignAnnotation(annotationToJsonPojo(annotations));
181 // These color schemes require annotation, disable them if annotations
183 if (globalColourScheme
184 .equalsIgnoreCase(JalviewColourScheme.RNAHelices.toString())
185 || globalColourScheme.equalsIgnoreCase(
186 JalviewColourScheme.TCoffee.toString()))
188 jsonAlignmentPojo.setGlobalColorScheme(ResidueColourScheme.NONE);
192 if (exportSettings.isExportFeatures())
194 jsonAlignmentPojo.setSeqFeatures(sequenceFeatureToJsonPojo(sqs));
197 if (exportSettings.isExportGroups() && seqGroups != null
198 && seqGroups.size() > 0)
200 for (SequenceGroup seqGrp : seqGroups)
202 SequenceGrpPojo seqGrpPojo = new SequenceGrpPojo();
203 seqGrpPojo.setGroupName(seqGrp.getName());
204 seqGrpPojo.setColourScheme(ColourSchemeProperty
205 .getColourName(seqGrp.getColourScheme()));
206 seqGrpPojo.setColourText(seqGrp.getColourText());
207 seqGrpPojo.setDescription(seqGrp.getDescription());
208 seqGrpPojo.setDisplayBoxes(seqGrp.getDisplayBoxes());
209 seqGrpPojo.setDisplayText(seqGrp.getDisplayText());
210 seqGrpPojo.setEndRes(seqGrp.getEndRes());
211 seqGrpPojo.setStartRes(seqGrp.getStartRes());
212 seqGrpPojo.setShowNonconserved(seqGrp.getShowNonconserved());
213 for (SequenceI seq : seqGrp.getSequences())
215 seqGrpPojo.getSequenceRefs()
216 .add(String.valueOf(seq.hashCode()));
218 jsonAlignmentPojo.getSeqGroups().add(seqGrpPojo);
222 jsonOutput = JSONUtils.stringify(jsonAlignmentPojo);
223 return jsonOutput.replaceAll("xstart", "xStart").replaceAll("xend",
225 } catch (Exception e)
232 public String[] getHiddenSections()
234 String[] hiddenSections = new String[2];
235 if (getViewport() == null)
240 // hidden column business
241 if (getViewport().hasHiddenColumns())
243 hiddenSections[0] = getViewport().getAlignment().getHiddenColumns()
244 .regionsToString(";", "-");
247 // hidden rows/seqs business
248 HiddenSequences hiddenSeqsObj = getViewport().getAlignment()
249 .getHiddenSequences();
250 if (hiddenSeqsObj == null || hiddenSeqsObj.hiddenSequences == null)
252 return hiddenSections;
255 SequenceI[] hiddenSeqs = hiddenSeqsObj.hiddenSequences;
256 StringBuilder hiddenSeqsBuilder = new StringBuilder();
257 for (SequenceI hiddenSeq : hiddenSeqs)
259 if (hiddenSeq != null)
261 hiddenSeqsBuilder.append(";").append(hiddenSeq.hashCode());
264 if (hiddenSeqsBuilder.length() > 0)
266 hiddenSeqsBuilder.deleteCharAt(0);
268 hiddenSections[1] = hiddenSeqsBuilder.toString();
270 return hiddenSections;
273 protected List<SequenceFeaturesPojo> sequenceFeatureToJsonPojo(
276 displayedFeatures = (fr == null) ? null : fr.getFeaturesDisplayed();
277 List<SequenceFeaturesPojo> sequenceFeaturesPojo = new ArrayList<>();
280 return sequenceFeaturesPojo;
283 FeatureColourFinder finder = new FeatureColourFinder(fr);
285 String[] visibleFeatureTypes = displayedFeatures == null ? null
286 : displayedFeatures.getVisibleFeatures().toArray(
287 new String[displayedFeatures.getVisibleFeatureCount()]);
289 for (SequenceI seq : sqs)
292 * get all features currently visible (and any non-positional features)
294 List<SequenceFeature> seqFeatures = seq.getFeatures().getAllFeatures(
295 visibleFeatureTypes);
296 for (SequenceFeature sf : seqFeatures)
298 SequenceFeaturesPojo jsonFeature = new SequenceFeaturesPojo(
299 String.valueOf(seq.hashCode()));
301 String featureColour = (fr == null) ? null : Format
302 .getHexString(finder.findFeatureColour(Color.white, seq,
303 seq.findIndex(sf.getBegin())));
304 int xStart = sf.getBegin() == 0 ? 0
305 : seq.findIndex(sf.getBegin()) - 1;
306 int xEnd = sf.getEnd() == 0 ? 0 : seq.findIndex(sf.getEnd());
307 jsonFeature.setXstart(xStart);
308 jsonFeature.setXend(xEnd);
309 jsonFeature.setType(sf.getType());
310 jsonFeature.setDescription(sf.getDescription());
311 jsonFeature.setLinks(sf.links);
312 jsonFeature.setOtherDetails(sf.otherDetails);
313 jsonFeature.setScore(sf.getScore());
314 jsonFeature.setFillColor(featureColour);
315 jsonFeature.setFeatureGroup(sf.getFeatureGroup());
316 sequenceFeaturesPojo.add(jsonFeature);
319 return sequenceFeaturesPojo;
322 public static List<AlignmentAnnotationPojo> annotationToJsonPojo(
323 Vector<AlignmentAnnotation> annotations)
325 List<AlignmentAnnotationPojo> jsonAnnotations = new ArrayList<>();
326 if (annotations == null)
328 return jsonAnnotations;
330 for (AlignmentAnnotation annot : annotations)
332 AlignmentAnnotationPojo alignAnnotPojo = new AlignmentAnnotationPojo();
333 alignAnnotPojo.setDescription(annot.description);
334 alignAnnotPojo.setLabel(annot.label);
335 if (!Double.isNaN(annot.score))
337 alignAnnotPojo.setScore(annot.score);
339 alignAnnotPojo.setCalcId(annot.getCalcId());
340 alignAnnotPojo.setGraphType(annot.graph);
342 AnnotationDisplaySettingPojo annotSetting = new AnnotationDisplaySettingPojo();
343 annotSetting.setBelowAlignment(annot.belowAlignment);
344 annotSetting.setCentreColLabels(annot.centreColLabels);
345 annotSetting.setScaleColLabel(annot.scaleColLabel);
346 annotSetting.setShowAllColLabels(annot.showAllColLabels);
347 annotSetting.setVisible(annot.visible);
348 annotSetting.setHasIcon(annot.hasIcons);
349 alignAnnotPojo.setAnnotationSettings(annotSetting);
350 SequenceI refSeq = annot.sequenceRef;
353 alignAnnotPojo.setSequenceRef(String.valueOf(refSeq.hashCode()));
355 for (Annotation annotation : annot.annotations)
357 AnnotationPojo annotationPojo = new AnnotationPojo();
358 if (annotation != null)
360 annotationPojo.setDescription(annotation.description);
361 annotationPojo.setValue(annotation.value);
363 .setSecondaryStructure(annotation.secondaryStructure);
364 String displayChar = annotation.displayCharacter == null ? null
365 : annotation.displayCharacter;
366 // System.out.println("--------------------->[" + displayChar + "]");
367 annotationPojo.setDisplayCharacter(displayChar);
368 if (annotation.colour != null)
370 annotationPojo.setColour(
371 jalview.util.Format.getHexString(annotation.colour));
373 alignAnnotPojo.getAnnotations().add(annotationPojo);
377 if (annot.getCalcId() != null
378 && annot.getCalcId().equalsIgnoreCase(TCOFFEE_SCORE))
384 alignAnnotPojo.getAnnotations().add(annotationPojo);
388 jsonAnnotations.add(alignAnnotPojo);
390 return jsonAnnotations;
393 @SuppressWarnings("unchecked")
394 public JSONFile parse(Reader jsonAlignmentString)
398 Map<String, Object> alignmentJsonObj = (Map<String, Object>) JSONUtils.parse(jsonAlignmentString);
399 List<Object> seqJsonArray = (List<Object>) alignmentJsonObj.get("seqs");
400 List<Object> alAnnotJsonArray = (List<Object>) alignmentJsonObj
401 .get("alignAnnotation");
402 List<Object> jsonSeqArray = (List<Object>) alignmentJsonObj
404 List<Object> seqGrpJsonArray = (List<Object>) alignmentJsonObj
406 Map<String, Object> jvSettingsJsonObj = (Map<String, Object>) alignmentJsonObj
409 if (jvSettingsJsonObj != null)
411 globalColourScheme = (String) jvSettingsJsonObj
412 .get("globalColorScheme");
413 Boolean showFeatures = Boolean.valueOf(
414 jvSettingsJsonObj.get("showSeqFeatures").toString());
415 setShowSeqFeatures(showFeatures);
416 parseHiddenSeqRefsAsList(jvSettingsJsonObj);
417 parseHiddenCols(jvSettingsJsonObj);
420 hiddenSequences = new ArrayList<>();
421 seqMap = new Hashtable<>();
422 for (Iterator<Object> sequenceIter = seqJsonArray.iterator(); sequenceIter.hasNext();)
424 Map<String, Object> sequence = (Map<String, Object>) sequenceIter.next();
425 String sequcenceString = sequence.get("seq").toString();
426 String sequenceName = sequence.get("name").toString();
427 String seqUniqueId = sequence.get("id").toString();
428 int start = Integer.valueOf(sequence.get("start").toString());
429 int end = Integer.valueOf(sequence.get("end").toString());
430 Sequence seq = new Sequence(sequenceName, sequcenceString, start,
432 if (hiddenSeqRefs != null && hiddenSeqRefs.contains(seqUniqueId))
434 hiddenSequences.add(seq);
437 seqMap.put(seqUniqueId, seq);
440 parseFeatures(jsonSeqArray);
442 for (Iterator<Object> seqGrpIter = seqGrpJsonArray.iterator(); seqGrpIter.hasNext();)
444 Map<String, Object> seqGrpObj = (Map<String, Object>)seqGrpIter.next();
445 String grpName = seqGrpObj.get("groupName").toString();
446 String colourScheme = seqGrpObj.get("colourScheme").toString();
447 String description = (seqGrpObj.get("description") == null) ? null
448 : seqGrpObj.get("description").toString();
449 boolean displayBoxes = Boolean
450 .valueOf(seqGrpObj.get("displayBoxes").toString());
451 boolean displayText = Boolean
452 .valueOf(seqGrpObj.get("displayText").toString());
453 boolean colourText = Boolean
454 .valueOf(seqGrpObj.get("colourText").toString());
455 boolean showNonconserved = Boolean
456 .valueOf(seqGrpObj.get("showNonconserved").toString());
457 int startRes = Integer
458 .valueOf(seqGrpObj.get("startRes").toString());
459 int endRes = Integer.valueOf(seqGrpObj.get("endRes").toString());
460 List<Object> sequenceRefs = (List<Object>) seqGrpObj.get("sequenceRefs");
462 ArrayList<SequenceI> grpSeqs = new ArrayList<>();
463 if (sequenceRefs.size() > 0)
465 Iterator<Object> seqHashIter = sequenceRefs.iterator();
466 while (seqHashIter.hasNext())
468 Sequence sequence = seqMap.get(seqHashIter.next());
469 if (sequence != null)
471 grpSeqs.add(sequence);
475 SequenceGroup seqGrp = new SequenceGroup(grpSeqs, grpName, null,
476 displayBoxes, displayText, colourText, startRes, endRes);
477 seqGrp.setColourScheme(ColourSchemeMapper
478 .getJalviewColourScheme(colourScheme, seqGrp));
479 seqGrp.setShowNonconserved(showNonconserved);
480 seqGrp.setDescription(description);
481 this.seqGroups.add(seqGrp);
485 for (Iterator<Object> alAnnotIter = alAnnotJsonArray.iterator(); alAnnotIter.hasNext();)
487 Map<String, Object> alAnnot = (Map<String, Object>) alAnnotIter.next();
488 List<Object> annotJsonArray = (List<Object>) alAnnot.get("annotations");
489 Annotation[] annotations = new Annotation[annotJsonArray.size()];
491 for (Iterator<Object> annotIter = annotJsonArray.iterator(); annotIter.hasNext();)
493 Map<String, Object> annot = (Map<String, Object>) annotIter.next();
496 annotations[count] = null;
500 float val = annot.get("value") == null ? null
501 : Float.valueOf(annot.get("value").toString());
502 String desc = annot.get("description") == null ? null
503 : annot.get("description").toString();
504 char ss = annot.get("secondaryStructure") == null
505 || annot.get("secondaryStructure").toString()
506 .equalsIgnoreCase("u0000") ? ' '
507 : annot.get("secondaryStructure")
508 .toString().charAt(0);
509 String displayChar = annot.get("displayCharacter") == null ? ""
510 : annot.get("displayCharacter").toString();
512 annotations[count] = new Annotation(displayChar, desc, ss, val);
513 if (annot.get("colour") != null)
515 Color color = ColorUtils
516 .parseColourString(annot.get("colour").toString());
517 annotations[count].colour = color;
523 AlignmentAnnotation alignAnnot = new AlignmentAnnotation(
524 alAnnot.get("label").toString(),
525 alAnnot.get("description").toString(), annotations);
526 alignAnnot.graph = (alAnnot.get("graphType") == null) ? 0
527 : Integer.valueOf(alAnnot.get("graphType").toString());
529 Map<String, Object> diplaySettings = (Map<String, Object>) alAnnot
530 .get("annotationSettings");
531 if (diplaySettings != null)
534 alignAnnot.scaleColLabel = (diplaySettings
535 .get("scaleColLabel") == null) ? false
536 : Boolean.valueOf(diplaySettings
537 .get("scaleColLabel").toString());
538 alignAnnot.showAllColLabels = (diplaySettings
539 .get("showAllColLabels") == null) ? true
540 : Boolean.valueOf(diplaySettings
541 .get("showAllColLabels").toString());
542 alignAnnot.centreColLabels = (diplaySettings
543 .get("centreColLabels") == null) ? true
544 : Boolean.valueOf(diplaySettings
545 .get("centreColLabels").toString());
546 alignAnnot.belowAlignment = (diplaySettings
547 .get("belowAlignment") == null) ? false
548 : Boolean.valueOf(diplaySettings
549 .get("belowAlignment").toString());
550 alignAnnot.visible = (diplaySettings.get("visible") == null)
553 diplaySettings.get("visible").toString());
554 alignAnnot.hasIcons = (diplaySettings.get("hasIcon") == null)
557 diplaySettings.get("hasIcon").toString());
560 if (alAnnot.get("score") != null)
562 alignAnnot.score = Double
563 .valueOf(alAnnot.get("score").toString());
566 String calcId = (alAnnot.get("calcId") == null) ? ""
567 : alAnnot.get("calcId").toString();
568 alignAnnot.setCalcId(calcId);
569 String seqHash = (alAnnot.get("sequenceRef") != null)
570 ? alAnnot.get("sequenceRef").toString()
573 Sequence sequence = (seqHash != null) ? seqMap.get(seqHash) : null;
574 if (sequence != null)
576 alignAnnot.sequenceRef = sequence;
577 sequence.addAlignmentAnnotation(alignAnnot);
578 if (alignAnnot.label.equalsIgnoreCase("T-COFFEE"))
580 alignAnnot.createSequenceMapping(sequence, sequence.getStart(),
582 sequence.addAlignmentAnnotation(alignAnnot);
583 alignAnnot.adjustForAlignment();
586 alignAnnot.validateRangeAndDisplay();
587 this.annotations.add(alignAnnot);
590 } catch (Exception e)
597 public void parseHiddenSeqRefsAsList(Map<String, Object> jvSettingsJson)
599 hiddenSeqRefs = new ArrayList<>();
600 String hiddenSeqs = (String) jvSettingsJson.get("hiddenSeqs");
601 if (hiddenSeqs != null && !hiddenSeqs.isEmpty())
603 String[] seqRefs = hiddenSeqs.split(";");
604 for (int i = 0, n = seqRefs.length; i < n; i++)
606 hiddenSeqRefs.add(seqRefs[i]);
611 public void parseHiddenCols(Map<String, Object> jvSettingsJson)
613 String hiddenCols = (String) jvSettingsJson.get("hiddenCols");
614 if (hiddenCols != null && !hiddenCols.isEmpty())
616 hiddenColumns = new HiddenColumns();
617 String[] rangeStrings = hiddenCols.split(";");
618 for (int i = 0, n = rangeStrings.length; i < n; i++)
620 String[] range = rangeStrings[i].split("-");
621 hiddenColumns.hideColumns(Integer.valueOf(range[0]),
622 Integer.valueOf(range[1]));
627 @SuppressWarnings("unchecked")
628 private void parseFeatures(List<Object> jsonSeqFeatures)
630 if (jsonSeqFeatures != null)
632 displayedFeatures = new FeaturesDisplayed();
633 for (Object o : jsonSeqFeatures)
635 Map<String, Object> jsonFeature = (Map<String, Object>) o;
636 Long begin = (Long) jsonFeature.get("xStart");
637 Long end = (Long) jsonFeature.get("xEnd");
638 String type = (String) jsonFeature.get("type");
639 String featureGrp = (String) jsonFeature.get("featureGroup");
640 String description = (String) jsonFeature.get("description");
641 String seqRef = (String) jsonFeature.get("sequenceRef");
642 Float score = Float.valueOf(jsonFeature.get("score").toString());
644 Sequence seq = seqMap.get(seqRef);
647 * begin/end of 0 is for a non-positional feature
649 int featureBegin = begin.intValue() == 0 ? 0 : seq
650 .findPosition(begin.intValue());
651 int featureEnd = end.intValue() == 0 ? 0 : seq.findPosition(end
654 SequenceFeature sequenceFeature = new SequenceFeature(type,
655 description, featureBegin, featureEnd, score, featureGrp);
657 List<Object> linksJsonArray = (List<Object>) jsonFeature.get("links");
658 if (linksJsonArray != null && linksJsonArray.size() > 0)
660 Iterator<Object> linkList = linksJsonArray.iterator();
661 while (linkList.hasNext())
663 sequenceFeature.addLink((String) linkList.next());
667 seq.addSequenceFeature(sequenceFeature);
668 displayedFeatures.setVisible(type);
674 public String getGlobalColourScheme()
676 return globalColourScheme;
679 public void setGlobalColorScheme(String globalColourScheme)
681 this.globalColourScheme = globalColourScheme;
685 public FeaturesDisplayedI getDisplayedFeatures()
687 return displayedFeatures;
690 public void setDisplayedFeatures(FeaturesDisplayedI displayedFeatures)
692 this.displayedFeatures = displayedFeatures;
696 public void configureForView(AlignmentViewPanel avpanel)
702 super.configureForView(avpanel);
703 AlignViewportI viewport = avpanel.getAlignViewport();
704 AlignmentI alignment = viewport.getAlignment();
705 AlignmentAnnotation[] annots = alignment.getAlignmentAnnotation();
707 seqGroups = alignment.getGroups();
708 fr = avpanel.cloneFeatureRenderer();
710 // Add non auto calculated annotation to AlignFile
713 for (AlignmentAnnotation annot : annots)
715 if (annot != null && !annot.autoCalculated)
717 annotations.add(annot);
721 globalColourScheme = ColourSchemeProperty
722 .getColourName(viewport.getGlobalColourScheme());
723 setDisplayedFeatures(viewport.getFeaturesDisplayed());
724 showSeqFeatures = viewport.isShowSequenceFeatures();
729 public boolean isShowSeqFeatures()
731 return showSeqFeatures;
734 public void setShowSeqFeatures(boolean showSeqFeatures)
736 this.showSeqFeatures = showSeqFeatures;
739 public Vector<AlignmentAnnotation> getAnnotations()
745 public HiddenColumns getHiddenColumns()
747 return hiddenColumns;
750 public void setHiddenColumns(HiddenColumns hidden)
752 this.hiddenColumns = hidden;
756 public SequenceI[] getHiddenSequences()
758 if (hiddenSequences == null || hiddenSequences.isEmpty())
760 return new SequenceI[] {};
762 synchronized (hiddenSequences)
764 return hiddenSequences.toArray(new SequenceI[hiddenSequences.size()]);
768 public void setHiddenSequences(ArrayList<SequenceI> hiddenSequences)
770 this.hiddenSequences = hiddenSequences;
773 public class JSONExportSettings
775 private boolean exportSequence;
777 private boolean exportSequenceFeatures;
779 private boolean exportAnnotations;
781 private boolean exportGroups;
783 private boolean exportJalviewSettings;
785 public boolean isExportSequence()
787 return exportSequence;
790 public void setExportSequence(boolean exportSequence)
792 this.exportSequence = exportSequence;
795 public boolean isExportSequenceFeatures()
797 return exportSequenceFeatures;
800 public void setExportSequenceFeatures(boolean exportSequenceFeatures)
802 this.exportSequenceFeatures = exportSequenceFeatures;
805 public boolean isExportAnnotations()
807 return exportAnnotations;
810 public void setExportAnnotations(boolean exportAnnotations)
812 this.exportAnnotations = exportAnnotations;
815 public boolean isExportGroups()
820 public void setExportGroups(boolean exportGroups)
822 this.exportGroups = exportGroups;
825 public boolean isExportJalviewSettings()
827 return exportJalviewSettings;
830 public void setExportJalviewSettings(boolean exportJalviewSettings)
832 this.exportJalviewSettings = exportJalviewSettings;
837 * Returns a descriptor for suitable feature display settings with
839 * <li>ResNums or insertions features visible</li>
840 * <li>insertions features coloured red</li>
841 * <li>ResNum features coloured by label</li>
842 * <li>Insertions displayed above (on top of) ResNums</li>
846 public FeatureSettingsModelI getFeatureColourScheme()
848 return new PDBFeatureSettings();