Difference between revisions of "Matrix2png"

From Christoph's Personal Wiki
Jump to: navigation, search
(Example)
(External links)
 
(6 intermediate revisions by the same user not shown)
Line 1: Line 1:
 
{{lowercase|title=matrix2png}}
 
{{lowercase|title=matrix2png}}
'''matrix2png''' is a simple but powerful program for making visualizations of microarray data and many other data types. It generates [http://www.libpng.org/pub/png/ PNG] formatted images from text files of data. It is fast, easy to use, and reasonably flexible. It can be used to generate publication-quality images, or to act as a image generator for web applications. It is useful for imaging all kinds of matrix-based data, not just microarray data. Matrix2png is open source.
+
'''matrix2png''' is a simple but powerful programme for making visualizations of microarray data and many other data types. It generates [http://www.libpng.org/pub/png/ PNG] formatted images from text files of data. It is fast, easy to use, and reasonably flexible. It can be used to generate publication-quality images, or to act as a image generator for web applications. It is useful for imaging all kinds of matrix-based data, not just microarray data. Matrix2png is open source.
 +
 
 +
The current version of matrix2png is '''1.2.2''' (February 2012).
  
 
==Usage==
 
==Usage==
  -data <file> (required)
+
  see: [http://www.chibi.ubc.ca/matrix2png/matrix2image.html here] for detailed usage and examples.
-desctext <file>
+
 
-range : values assigned to mincolor and maxcolor as min:max (default is data range)
+
;<code>-data <file></code> : (required)
-con : contrast (default = 1.0; applies only when not using -range option)
+
;<code>-desctext <file></code> : (optional)
-size : pixel dimensions per value as x:y (default = 2:2)
+
;<code>-range</code> : values assigned to mincolor and maxcolor as min:max (default is data range)
-numcolors : number of colors (default = 64)
+
;<code>-con</code> : contrast (default = 1.0; applies only when not using -range option)
-minsize : minimum image size as x:y pixels
+
;<code>-size</code> : pixel dimensions per value as x:y (default = 2:2)
-mincolor : color used at lowest value (name or r:g:b triplet) (default = blue)
+
;<code>-numcolors</code> : number of colours (default = 64)
-maxcolor : color used at highest value (name or r:g:b triplet) (default = red)
+
;<code>-minsize</code> : minimum image size as x:y pixels
-bkgcolor : color used as background (name or r:g:b triplet) (default = white)
+
;<code>-mincolor</code> : colour used at lowest value (name or r:g:b triplet) (default = blue)
-missingcolor : color used for missing values (name or r:g:b triplet) (default = grey)
+
;<code>-maxcolor</code> : colour used at highest value (name or r:g:b triplet) (default = red)
-map : color choices from preset maps: overrides min/max colors and -b (default = 0 (none) )
+
;<code>-bkgcolor</code> : colour used as background (name or r:g:b triplet) (default = white)
-discrete: Use discretized mapping of values to colors; use -dmap to assign a mapping file
+
;<code>-missingcolor</code> : colour used for missing values (name or r:g:b triplet) (default = grey)
-dmap <mapping file> : Discrete color mapping file to use for discrete mapping (default = preset)
+
;<code>-map</code> : colour choices from preset maps: overrides min/max colours and -b (default = 0 (none))
-numr : Number of rows to process starting from the top of the matrix by default
+
;<code>-discrete</code> : Use discretized mapping of values to colors; use -dmap to assign a mapping file
-numc : Number of columns to process starting from the left edge of the matrix by default
+
;<code>-dmap <mapping file></code> : Discrete colour mapping file to use for discrete mapping (default = preset)
-startrow : Index of the first row to be processed; can combine with numr (default=1)
+
;<code>-numr</code> : Number of rows to process starting from the top of the matrix by default
-startcol : Index of the first column to be processed; can combine with numc (default=1)
+
;<code>-numc</code> : Number of columns to process starting from the left edge of the matrix by default
-trim : Trim this percent of data extremes when determining data range (only without the -range option)
+
;<code>-startrow</code> : Index of the first row to be processed; can combine with numr (default=1)
-verbose : Verbosity of the output 1|2|3|4|5 (default=2)
+
;<code>-startcol</code> : Index of the first column to be processed; can combine with numc (default=1)
-title <title>: Add a title
+
;<code>-trim</code> : Trim this percent of data extremes when determining data range (only without the -range option)
-z : Row-normalize the data to mean 0 and variance 1
+
;<code>-verbose</code> : Verbosity of the output <code>1|2|3|4|5</code> (default=2)
-b : Middle of color range is black
+
;<code>-title <title></code> : Add a title
-d : Add cell dividers
+
;<code>-z</code> : Row-normalize the data to mean 0 and variance 1
-s : Add scale bar
+
;<code>-b</code> : Middle of colour range is black
-r : Add row names
+
;<code>-d</code> : Add cell dividers
-c : Add column names
+
;<code>-s</code> : Add scale bar
-f : Data file has a format line
+
;<code>-r</code> : Add row names
-e : Draw ellipses instead of rectangles
+
;<code>-c</code> : Add column names
-l : Log transform the data (base 2)
+
;<code>-f</code> : Data file has a format line
 +
;<code>-e</code> : Draw ellipses instead of rectangles
 +
;<code>-l</code> : Log transform the data (base 2)
  
 
===Example===
 
===Example===
Line 45: Line 49:
 
  {{prg_name|matrix2png}} -data foo.mat -size 18:18 -mincolor darkred -maxcolor white -c -r -s -con 1.0 >foo.png
 
  {{prg_name|matrix2png}} -data foo.mat -size 18:18 -mincolor darkred -maxcolor white -c -r -s -con 1.0 >foo.png
  
== Reference ==
+
===Example with Gnuplot===
* Pavlidis P, Noble WS (2003). Matrix2png: A Utility for Visualizing Matrix Data. ''Bioinformatics, 19:295-296''.
+
''Note: There should be no field names in the rows or columns.''
 +
set palette rgbformula 7,-2,7
 +
p 'foo.mat' matrix u 1:(-$2):3 w image
 +
 
 +
==Documentation==
 +
;<code>-mincolor <value></code> : (ignored if using "<code>-map</code>"), <code>-maxcolor</code> (ignored if using "<code>-map</code>"), <code>-bkgcolor</code>: The colors which are used for the image scale. The smallest value in the image (or values less than or equal to the <code>minvalue</code>) are represented by <code>mincolor</code>, same idea for <code>maxcolor</code>. The background color is used for areas of the image not covered by the matrix data - which means that you may not see the background color at all. Colors can be selected by name or by <code>red:green:blue</code> triplets (values ranging from 0 to 255). Thus pure red is indicated by <code>255:0:0</code> while medium grey would be <code>128:128:128</code>. Colors which can be selected by name are:
 +
::red, darkred, blue, darkblue, green, darkgreen, yellow, magenta, cyan, black, white, grey (or gray), orange, violet
 +
::Other colors are generated by interpolating between the min and max colors; by using color maps (below), you can use preset mappings that are more complex. (Defaults: <code>mincolor=blue; maxcolor=red; bkgcolor=white</code>.)
 +
 
 +
==Reference==
 +
*Pavlidis P, Noble WS (2003). "Matrix2png: A Utility for Visualizing Matrix Data". ''Bioinformatics'' '''19''':295-296.
  
== External links ==
+
==External links==
* [http://microarray.cpmc.columbia.edu/matrix2png/ Official site]
+
*[http://bioinformatics.ubc.ca/matrix2png/ Official site]
* [http://microarray.cpmc.columbia.edu/pavlidis/lab/cgi-bin/matrix2png.cgi Web interface to matrix2png]
+
*[http://bioinformatics.ubc.ca/pavlidis/lab/cgi-bin/matrix2png.cgi Web interface to matrix2png]
* [http://www.personal.psu.edu/cab38/ColorBrewer/ColorBrewer.html ColorBrewer] &mdash; colour schemes used in matrix2png
+
*[http://colorbrewer2.org/ ColorBrewer] &mdash; colour schemes used in matrix2png
  
 
[[Category:Bioinformatics]]
 
[[Category:Bioinformatics]]
 
[[Category:Graphics software]]
 
[[Category:Graphics software]]

Latest revision as of 20:19, 11 July 2012

The correct title of this article is matrix2png. The initial letter is capitalized due to technical restrictions.

matrix2png is a simple but powerful programme for making visualizations of microarray data and many other data types. It generates PNG formatted images from text files of data. It is fast, easy to use, and reasonably flexible. It can be used to generate publication-quality images, or to act as a image generator for web applications. It is useful for imaging all kinds of matrix-based data, not just microarray data. Matrix2png is open source.

The current version of matrix2png is 1.2.2 (February 2012).

Usage

see: here for detailed usage and examples.
-data <file> 
(required)
-desctext <file> 
(optional)
-range 
values assigned to mincolor and maxcolor as min:max (default is data range)
-con 
contrast (default = 1.0; applies only when not using -range option)
-size 
pixel dimensions per value as x:y (default = 2:2)
-numcolors 
number of colours (default = 64)
-minsize 
minimum image size as x:y pixels
-mincolor 
colour used at lowest value (name or r:g:b triplet) (default = blue)
-maxcolor 
colour used at highest value (name or r:g:b triplet) (default = red)
-bkgcolor 
colour used as background (name or r:g:b triplet) (default = white)
-missingcolor 
colour used for missing values (name or r:g:b triplet) (default = grey)
-map 
colour choices from preset maps: overrides min/max colours and -b (default = 0 (none))
-discrete 
Use discretized mapping of values to colors; use -dmap to assign a mapping file
-dmap <mapping file> 
Discrete colour mapping file to use for discrete mapping (default = preset)
-numr 
Number of rows to process starting from the top of the matrix by default
-numc 
Number of columns to process starting from the left edge of the matrix by default
-startrow 
Index of the first row to be processed; can combine with numr (default=1)
-startcol 
Index of the first column to be processed; can combine with numc (default=1)
-trim 
Trim this percent of data extremes when determining data range (only without the -range option)
-verbose 
Verbosity of the output 1|2|3|4|5 (default=2)
-title <title> 
Add a title
-z 
Row-normalize the data to mean 0 and variance 1
-b 
Middle of colour range is black
-d 
Add cell dividers
-s 
Add scale bar
-r 
Add row names
-c 
Add column names
-f 
Data file has a format line
-e 
Draw ellipses instead of rectangles
-l 
Log transform the data (base 2)

Example

If, for an example, you have a matrix file ('foo.mat') that has something like the following matrix:

foo A1 A2 A3
B1   4  3  9
B2   3  2  1
B3   7  5  8

Note: All entries must be tab delimited.

You can convert this to a PNG like so:

matrix2png -data foo.mat -size 18:18 -mincolor darkred -maxcolor white -c -r -s -con 1.0 >foo.png

Example with Gnuplot

Note: There should be no field names in the rows or columns.

set palette rgbformula 7,-2,7
p 'foo.mat' matrix u 1:(-$2):3 w image

Documentation

-mincolor <value> 
(ignored if using "-map"), -maxcolor (ignored if using "-map"), -bkgcolor: The colors which are used for the image scale. The smallest value in the image (or values less than or equal to the minvalue) are represented by mincolor, same idea for maxcolor. The background color is used for areas of the image not covered by the matrix data - which means that you may not see the background color at all. Colors can be selected by name or by red:green:blue triplets (values ranging from 0 to 255). Thus pure red is indicated by 255:0:0 while medium grey would be 128:128:128. Colors which can be selected by name are:
red, darkred, blue, darkblue, green, darkgreen, yellow, magenta, cyan, black, white, grey (or gray), orange, violet
Other colors are generated by interpolating between the min and max colors; by using color maps (below), you can use preset mappings that are more complex. (Defaults: mincolor=blue; maxcolor=red; bkgcolor=white.)

Reference

  • Pavlidis P, Noble WS (2003). "Matrix2png: A Utility for Visualizing Matrix Data". Bioinformatics 19:295-296.

External links