package versusSNP.util;
import java.io.IOException;
import java.io.StringReader;
import javax.swing.text.BadLocationException;
import javax.swing.text.Document;
import javax.swing.text.html.HTMLDocument;
import javax.swing.text.html.HTMLEditorKit;
import versusSNP.blast.util.AlignmentStore;
import versusSNP.genome.Sequence;
public final class HTMLSequenceFormatter {
public static final int LINE_CHARS = 60;
public static final int SEGMENT_CHARS = 10;
public static Document format(Sequence sequence) throws IOException, BadLocationException {
HTMLEditorKit editorKit = new HTMLEditorKit();
HTMLDocument doc = (HTMLDocument)editorKit.createDefaultDocument();
editorKit.read(new StringReader(HTMLUtils.renderSequence(sequence.getSequence(), true)), doc, 0);
return doc;
}
public static Document format(AlignmentStore alignmentStore) throws IOException, BadLocationException {
HTMLEditorKit editorKit = new HTMLEditorKit();
HTMLDocument doc = (HTMLDocument)editorKit.createDefaultDocument();
editorKit.read(new StringReader(alignmentStore.getHTMLAlignment()), doc, 0);
return doc;
}
}