X
- the class of the elements in the left input sequence.Y
- the class of the elements in the right input sequence.public class HTMLVisualizer<X,Y> extends Object implements Visualizer<X,Y>
Modifier and Type | Field and Description |
---|---|
static String[] |
META_COLUMN_IDS |
Constructor and Description |
---|
HTMLVisualizer() |
Modifier and Type | Method and Description |
---|---|
HTMLColumn<X,Y> |
addColumn(HTMLColumn<X,Y> col)
Adds a HTMLColumn to this HTMLVisualizer and overrides any HTMLColumn previously associated
with the same keyword.
|
int |
getColumn(String keyword)
Returns the index of the HTMLColumn belonging to the given keyword or -1 if no HTMLColumn
for that keyword exists.
|
List<HTMLColumn<X,Y>> |
getColumns()
Returns all HTMLColumns this HTMLVisualizer will visualize ordered according to their
keyword.
|
List<String> |
getKeywords()
Returns a list of all keywords for which HTMLColumns exist within this HTMLVisualizer.
|
static String |
getProperty(String key) |
static String |
getRGBColor(double score)
Returns an hexadecimal rgb color string for the given score.
|
static String |
getRoundedString(double num,
int decimalPlaces)
Returns the string representation of the given number to the given
precision.
|
void |
visualize(Alignment<X,Y> alignment,
OutputStream out)
Visualize the given Alignment and write the resulting data to the given OutputStream.
|
void |
visualizeMatrix(Alignment[][] alignments,
String[] names,
File outDir)
This takes a full or sparse matrix of Alignments and provides HTML
output for it.
|
void |
visualizeMatrix(Alignment[][] alignments,
String[] leftNames,
String[] rightNames,
File outDir)
This takes a full or sparse matrix of Alignments and provides HTML
output for it.
|
static void |
writeFromClassPath(Class start,
String path,
Writer wr)
Writes the data found at the given path in the class path to the
given writer.
|
static void |
writeFromClassPath(String path,
Writer wr)
Writes the data found at the given path in the class path to the
given writer.
|
public static final String[] META_COLUMN_IDS
public List<HTMLColumn<X,Y>> getColumns()
public int getColumn(@NonNull String keyword)
keyword
- a keyword.public HTMLColumn<X,Y> addColumn(@NonNull HTMLColumn<X,Y> col)
col
- a HTMLColumn.public List<String> getKeywords()
public void visualizeMatrix(@NonNull Alignment[][] alignments, @NonNull String[] names, @NonNull File outDir) throws IOException
alignments
- a quadratic matrix of AlignmentPaths.names
- some arbitrary names for the sequences of the underlying
data space.outDir
- a directory to write the finished HTML content to. The
content will consist of multiple files, which could not be prevented
due to efficiency reasons (a browser tends to crash when loading over
300 MB of content, even if most of said content is invisible). So the
visualization data for each single alignment is in a separate HTML file
and loaded only when required.IOException
- might be thrown due to failed IO operations.public void visualizeMatrix(@NonNull Alignment[][] alignments, @NonNull String[] leftNames, @NonNull String[] rightNames, @NonNull File outDir) throws IOException
alignments
- a matrix of AlignmentPaths. Note that we expect the
same
AlignmentSpecification for each of those Alignments. Furthermore we
expect that all AlignmentPaths in paths[i][*] for some fix i have the
same left Sequence and that all AlignmentPaths in paths[*][j] for some
fix j have the same right Sequence. This in effect means that we expect
the given matrix to be a distance matrix from an underlying dataspace
of sequences. This assumptions manifests in the expectation, that all
Sequences have to have the same NodeSpecification and all Paths have to
have the same AlignmentSpecification.leftNames
- some arbitrary names for the sequences in the rows of
the matrix (on the left side of the alignment).rightNames
- some arbitrary names for the sequences in the columns
of the matrix (on the right side of the alignment).outDir
- a directory to write the finished HTML content to. The
content will consist of multiple files, which could not be prevented
due to efficiency reasons (a browser tends to crash when loading over
300 MB of content, even if most of said content is invisible). So the
visualization data for each single alignment is in a separate HTML file
and loaded only when required.IOException
- might be thrown due to failed IO operations.public void visualize(@NonNull Alignment<X,Y> alignment, @NonNull OutputStream out) throws IOException
Visualizer
visualize
in interface Visualizer<X,Y>
alignment
- an Alignment to be visualized.out
- the OutputStream the visualization data shall be written to.IOException
- may be thrown during IO operations.public static String getRoundedString(double num, int decimalPlaces)
num
- a double number.decimalPlaces
- the number of decimal places that shall be kept
in the string representation.public static String getRGBColor(double score)
score
- a value between 0 and 1.public static void writeFromClassPath(String path, Writer wr) throws IOException
path
- a path to the resource (from HTMLVisualizer).wr
- a writer the resource shall be written to.IOException
- thrown if the writing fails.public static void writeFromClassPath(Class start, String path, Writer wr) throws IOException
start
- the start class, relative to which the path is located.path
- a path to the resource.wr
- a writer the resource shall be written to.IOException
- thrown if the writing fails.Copyright (C) 2016 Benjamin Paaßen, AG Theoretical Computer Science, Centre of Excellence Cognitive Interaction Technology (CITEC), University of Bielefeld, licensed under the AGPL v. 3: http://openresearch.cit-ec.de/projects/tcs . This documentation is licensed under the conditions of CC-BY-SA 4.0: https://creativecommons.org/licenses/by-sa/4.0/