Difference between revisions of "Matrix2png"

From Christoph's Personal Wiki
Jump to: navigation, search
(External links)
 
(4 intermediate revisions by the same user not shown)
Line 2: Line 2:
 
'''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.
 
'''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.0.6''' (April 2006).
+
The current version of matrix2png is '''1.2.2''' (February 2012).
  
 
==Usage==
 
==Usage==
 +
see: [http://www.chibi.ubc.ca/matrix2png/matrix2image.html here] for detailed usage and examples.
 +
 
;<code>-data <file></code> : (required)
 
;<code>-data <file></code> : (required)
 
;<code>-desctext <file></code> : (optional)
 
;<code>-desctext <file></code> : (optional)
Line 46: Line 48:
 
You can convert this to a PNG like so:
 
You can convert this to a PNG like so:
 
  {{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
 +
 +
===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==
 
==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:
 
;<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
 
::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>.)
+
::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==
 
==Reference==
Line 58: Line 65:
 
*[http://bioinformatics.ubc.ca/matrix2png/ Official site]
 
*[http://bioinformatics.ubc.ca/matrix2png/ Official site]
 
*[http://bioinformatics.ubc.ca/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