|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES All Classes | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectde.jstacs.utils.SeqLogoPlotter
public class SeqLogoPlotter
Class with static methods for plotting sequence logos of DNA motifs, i.e., position weight matrices defined over a DNAAlphabet.
In general, sequence logos can be plotted to any Graphics2D object, e.g., for on-screen printing using the plotLogo methods.
For convenience, the method plotLogoToPNG(String, int, double[][]) can be used to directly plot a sequence logo
to a PNG file with a given height and automatically chosen aspect ratio.
| Constructor Summary | |
|---|---|
SeqLogoPlotter()
|
|
| Method Summary | |
|---|---|
protected static Pair<BufferedImage,Graphics2D> |
getBufferedImageAndGraphics(int height,
double[][] ps)
Creates a new BufferedImage with given height and width chosen automatically according to the number of rows
of ps, and returns this BufferedImage and its Graphics2D object. |
static int |
getHeight(int width,
double[][] ps)
Returns the automatically chosen height for a given width and position weight matrix. |
static int |
getWidth(int height,
double[][] ps)
Returns the automatically chosen width for a given height and position weight matrix. |
static void |
plotLogo(Graphics2D g,
int h,
double[][] ps)
Plots the sequence logo for the position weight matrix given in ps. |
static void |
plotLogo(Graphics2D g,
int height,
double[][] ps,
String[] labels,
String labX,
String labY)
Plots the sequence logo for the position weight matrix given in ps. |
static void |
plotLogo(Graphics2D g,
int w,
int h,
double[][] ps,
String[] labels,
String labX,
String labY)
Plots the sequence logo for the position weight matrix given in ps. |
static void |
plotLogo(Graphics2D g,
int x,
int y,
int w,
int h,
double[][] ps,
String[] labels,
String labX,
String labY)
Plots the sequence logo for the position weight matrix given in ps. |
static BufferedImage |
plotLogoToBufferedImage(int height,
double[][] ps)
Plots the sequence logo for the position weight matrix given in ps. |
static void |
plotLogoToPNG(String path,
int height,
double[][] ps)
Plots the sequence logo for the position weight matrix given in ps. |
static void |
plotTALgetterLogo(Graphics2D g,
int x,
int y,
int w,
int h,
double[][] ps,
double[] imp,
String[] labels,
String labX,
String labY,
String labY2)
Plots the TALgetter logo for the binding specificities given in ps. |
static BufferedImage |
plotTALgetterLogoToBufferedImage(int height,
double[][] ps,
double[] imp,
String[] lab)
Plots the TALgetter logo for the binding specificities given in ps. |
static void |
plotTALgetterLogoToPNG(String path,
int height,
double[][] ps,
double[] imp,
String[] lab)
Plots the TALgetter logo for the binding specificities given in ps. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public SeqLogoPlotter()
| Method Detail |
|---|
public static void plotLogoToPNG(String path,
int height,
double[][] ps)
throws IOException
ps.
The rows of ps correspond to positions in the sequence logo. Each row must be normalized.
For a given height (in pixels), the width is chosen automatically depending on the number of rows
in ps.
The positions of the sequence logo are numbered contiguously from 1 to ps.length. The label of the
x-axis is set to "Position", and the label of the y-axis is set to "bits".
The sequence logo is written to the PNG file given in path.
path - the path to the PNG file writtenheight - the height of the PNG image (in pixels)ps - the position weight matrix
IOException - if the file could not be writtenpublic static BufferedImage plotLogoToBufferedImage(int height,
double[][] ps)
ps.
The rows of ps correspond to positions in the sequence logo. Each row must be normalized.
For a given height (in pixels), the width is chosen automatically depending on the number of rows
in ps.
The positions of the sequence logo are numbered contiguously from 1 to ps.length. The label of the
x-axis is set to "Position", and the label of the y-axis is set to "bits".
The sequence logo is return as a BufferedImage.
height - the height of the PNG image (in pixels)ps - the position weight matrix
protected static Pair<BufferedImage,Graphics2D> getBufferedImageAndGraphics(int height,
double[][] ps)
BufferedImage with given height and width chosen automatically according to the number of rows
of ps, and returns this BufferedImage and its Graphics2D object.
height - the height (in pixels)ps - the position weight matrix
BufferedImage and its Graphics2D objectpublic static void plotLogo(Graphics2D g,
int h,
double[][] ps)
ps.
The rows of ps correspond to positions in the sequence logo. Each row must be normalized.
For a given height (in pixels), the width is chosen automatically depending on the number of rows
in ps.
The positions of the sequence logo are numbered contiguously from 1 to ps.length. The label of the
x-axis is set to "Position", and the label of the y-axis is set to "bits".
The sequence logo is written to the Graphics2D object given in g.
g - the Graphics2D objecth - the height of the sequence logops - the position weight matrixpublic static void plotLogo(Graphics2D g,
int height,
double[][] ps,
String[] labels,
String labX,
String labY)
ps.
The rows of ps correspond to positions in the sequence logo. Each row must be normalized.
For a given height (in pixels), the width is chosen automatically depending on the number of rows
in ps.
The sequence logo is written to the Graphics2D object given in g.
g - the Graphics2D objectheight - the height of the sequence logops - the position weight matrixlabels - the labels of the positions of the sequence logo, if null the positions are numbered contiguously from 1 to ps.lengthlabX - the label of the x-axislabY - the label of the y-axispublic static int getWidth(int height,
double[][] ps)
height - the heightps - the position weight matrix
public static int getHeight(int width,
double[][] ps)
width - the widthps - the position weight matrix
public static void plotLogo(Graphics2D g,
int w,
int h,
double[][] ps,
String[] labels,
String labX,
String labY)
ps.
The rows of ps correspond to positions in the sequence logo. Each row must be normalized.
The sequence logo is written to the Graphics2D object given in g.
g - the Graphics2D objectw - the width of the sequence logoh - the height of the sequence logops - the position weight matrixlabels - the labels of the positions of the sequence logo, if null the positions are numbered contiguously from 1 to ps.lengthlabX - the label of the x-axislabY - the label of the y-axispublic static void plotLogo(Graphics2D g,
int x,
int y,
int w,
int h,
double[][] ps,
String[] labels,
String labX,
String labY)
ps.
The rows of ps correspond to positions in the sequence logo. Each row must be normalized.
The sequence logo is written to the Graphics2D object given in g.
g - the Graphics2D objectx - the x-coordinate of the bottom left corner of the sequence logoy - the y-coordinate of the bottom left corner of the sequence logo (-h results in a sequence logo spanning from 0 to h)w - the width of the sequence logoh - the height of the sequence logops - the position weight matrixlabels - the labels of the positions of the sequence logo, if null the positions are numbered contiguously from 1 to ps.lengthlabX - the label of the x-axislabY - the label of the y-axispublic static void plotTALgetterLogoToPNG(String path,
int height,
double[][] ps,
double[] imp,
String[] lab)
throws IOException
ps.
The rows of ps correspond to specificities of the RVDs. Each row must be normalized.
For a given height (in pixels), the width is chosen automatically depending on the number of rows
in ps. In addition, the importance of RVDs is plotted as given in imp.
The labels of the RVDs are given in lab. The label of the
x-axis is set to "RVD", and the label of the y-axes are set to "bits" and "Importance", respectively.
The TALgetter logo is written to the PNG file given in path.
path - the path to the PNG file writtenheight - the height of the PNG image (in pixels)ps - the binding specificities of RVDsimp - the importance of RVDslab - the amino acids of the RVDs in one-letter code
IOException - if the file could not be writtenpublic static BufferedImage plotTALgetterLogoToBufferedImage(int height,
double[][] ps,
double[] imp,
String[] lab)
ps.
The rows of ps correspond to specificities of the RVDs. Each row must be normalized.
For a given height (in pixels), the width is chosen automatically depending on the number of rows
in ps. In addition, the importance of RVDs is plotted as given in imp.
The labels of the RVDs are given in lab. The label of the
x-axis is set to "RVD", and the label of the y-axes are set to "bits" and "Importance", respectively.
The TALgetter logo is returned as BufferedImage.
height - the height of the PNG image (in pixels)ps - the binding specificities of RVDsimp - the importance of RVDslab - the amino acids of the RVDs in one-letter code
public static void plotTALgetterLogo(Graphics2D g,
int x,
int y,
int w,
int h,
double[][] ps,
double[] imp,
String[] labels,
String labX,
String labY,
String labY2)
ps.
The rows of ps correspond to specificities of the RVDs. Each row must be normalized.
For a given height (in pixels), the width is chosen automatically depending on the number of rows
in ps. In addition, the importance of RVDs is plotted as given in imp.
The labels of the RVDs are given in lab. The label of the
x-axis is set to "RVD", and the label of the y-axes are set to "bits" and "Importance", respectively.
The TALgetter logo is returned as BufferedImage.
g - the Graphics2D objectx - the x-coordinate of the bottom left corner of the TALgetter logoy - the y-coordinate of the bottom left corner of the TALgetter logo (-h results in a logo spanning from 0 to h)w - the width of the TALgetter logoh - the height of the TALgetter logops - the binding specificities of RVDsimp - the importance of RVDslabels - the amino acids of the RVDs in one-letter codelabX - the label of the x-axislabY - the label of the y-axislabY2 - the label of the second (importance) y-axis
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES All Classes | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||