public class HTMLVisualizer extends AbstractVisualizer
Modifier and Type | Field and Description |
---|---|
static String[] |
META_COLUMN_IDS |
Constructor and Description |
---|
HTMLVisualizer() |
Modifier and Type | Method and Description |
---|---|
ArrayList<HTMLColumn> |
getAdditionalColumns()
Optionally you may manipulate this list to add or remove additional
columns for the HTML table.
|
int |
getDecimalPlaces()
This specifies how many decimal places (after comma) should be
visualized.
|
Set<String> |
getKeywords()
Optionally you may manipulate this set to restrict the keywords for which
the HTMLVisualizer will print columns in the html table.
|
static String |
getProperty(String key) |
ProgressReporter |
getReporter()
Returns the ProgressReporter that is used to report progress.
|
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.
|
boolean |
isRestrictKeywords()
If this flag is set to "true" the HTMLVisualizer will only print out
table columns for the keywords specified in "keywords".
|
void |
setDecimalPlaces(int decimalPlaces)
This specifies how many decimal places (after comma) should be
visualized.
|
void |
setReporter(ProgressReporter reporter)
Sets the ProgressReporter that is used to report progress.
|
void |
setRestrictKeywords(boolean restrictKeywords)
If this flag is set to "true" the HTMLVisualizer will only print out
table columns for the keywords specified in "keywords".
|
void |
visualize(AlignmentPath path,
OutputStream out)
A visualization in this sense is some arbitrary data that can be written
to an output stream and is created from an AlignmentPath.
|
void |
visualizeMatrix(AlignmentPath[][] paths,
String[] names,
File outDir)
This takes a full or sparse matrix of AlignmentPaths and provides HTML
output for it.
|
void |
visualizeMatrix(AlignmentPath[][] paths,
String[] leftNames,
String[] rightNames,
File outDir)
This takes a full or sparse matrix of AlignmentPaths 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.
|
getVisualizationData, visualize, visualize
public static final String[] META_COLUMN_IDS
public boolean isRestrictKeywords()
public void setRestrictKeywords(boolean restrictKeywords)
restrictKeywords
- true or false.public Set<String> getKeywords()
public ProgressReporter getReporter()
public void setReporter(ProgressReporter reporter)
reporter
- the ProgressReporter that is used to report progress.
This is a CommandLineProgressReporter per default. If it is set to null,
the progress is not reported.public ArrayList<HTMLColumn> getAdditionalColumns()
public void setDecimalPlaces(int decimalPlaces)
decimalPlaces
- the number of decimal places that are visualized.public int getDecimalPlaces()
public void visualizeMatrix(AlignmentPath[][] paths, String[] names, File outDir) throws IOException
paths
- 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(AlignmentPath[][] paths, String[] leftNames, String[] rightNames, File outDir) throws IOException
paths
- 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(AlignmentPath path, OutputStream out) throws IOException
path
- an AlignmentPath 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
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
Copyright (C) 2013-2015 Benjamin Paaßen, Georg Zentgraf, 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/