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 java.io.IOException;
25 import java.io.StringReader;
27 import org.jsoup.Jsoup;
28 import org.jsoup.nodes.Document;
29 import org.jsoup.nodes.Element;
31 import jalview.api.ComplexAlignFile;
32 import jalview.datamodel.ColumnSelection;
33 import jalview.datamodel.SequenceI;
34 import jalview.schemes.ColourSchemeI;
36 public class HtmlFile extends AlignFile implements ComplexAlignFile
38 public static final String FILE_EXT = "html";
40 public static final String FILE_DESC = "HTML";
42 private ColourSchemeI colourScheme;
44 private boolean showSeqFeatures;
46 private ColumnSelection columnSelection;
48 private SequenceI[] hiddenSequences;
55 public HtmlFile(FileParse source) throws IOException
60 public HtmlFile(String inFile, String type) throws IOException
66 public void parse() throws IOException
70 StringBuilder htmlData = new StringBuilder();
72 while ((currentLine = nextLine()) != null)
74 htmlData.append(currentLine);
77 Document doc = Jsoup.parse(htmlData.toString());
78 Element content = doc.getElementById("seqData");
79 JSONFile jsonFile = new JSONFile().parse(new StringReader(content.val()));
80 this.seqs = jsonFile.getSeqs();
81 this.seqGroups = jsonFile.getSeqGroups();
82 this.annotations = jsonFile.getAnnotations();
83 this.showSeqFeatures = jsonFile.isShowSeqFeatures();
84 this.colourScheme = jsonFile.getColourScheme();
85 this.hiddenSequences = jsonFile.getHiddenSequences();
86 this.columnSelection = jsonFile.getColumnSelection();
97 throw new UnsupportedOperationException(
98 "Print method of HtmlFile is not supported!");
101 public boolean isShowSeqFeatures()
103 return showSeqFeatures;
106 public void setShowSeqFeatures(boolean showSeqFeatures)
108 this.showSeqFeatures = showSeqFeatures;
111 public ColourSchemeI getColourScheme()
116 public void setColourScheme(ColourSchemeI colourScheme)
118 this.colourScheme = colourScheme;
121 public ColumnSelection getColumnSelection()
123 return columnSelection;
126 public void setColumnSelection(ColumnSelection columnSelection)
128 this.columnSelection = columnSelection;
131 public SequenceI[] getHiddenSequences()
133 return hiddenSequences;
136 public void setHiddenSequences(SequenceI[] hiddenSequences)
138 this.hiddenSequences = hiddenSequences;