Skip to main content

Scale Matrix

scale-matrix

Apply a user-specified scaling factor to tab-delimited matrix data

AsA=s(a1,1a1,nam,1am,n)=(sa1,1sa1,nsam,1sam,n)A \rightarrow sA = s * \begin{pmatrix} a_{1,1} & \cdots & a_{1,n}\\ \vdots & \ddots & \vdots \\ a_{m,1} & \cdots & a_{m,n} \\ \end{pmatrix} = \begin{pmatrix} s*a_{1,1} & \cdots & s*a_{1,n}\\ \vdots & \ddots & \vdots \\ s*a_{m,1} & \cdots & s*a_{m,n} \\ \end{pmatrix}

This tool typically applies a scaling factor (ss) calculated from ScriptManager's Scaling Factor tool to a CDT/TAB file (AA), usually from Tag Pileup.

File inputs (CDT/TAB)

This script processes matrix files (CDT/TAB) but there is no extension restriction so be make sure your input files include tab-delimited numerical data.

Scaling Factor

File-specific Scaling

If you have multiple files that need to be scaled by different scaling factors (e.g. TagPileup outputs derived from different BAM files), the File-specific scaling method is more convenient to use.

tip

Copy-pasting inputs

You can use the copy and paste features to handle bulk processing of the file-specific scaling. You may consider using Microsoft Excel/Google sheets to organize filenames and scaling factors (you can copy scaling factors output by the Scaling Factor GUI) and paste them into ScriptManager's Scale Matrix GUI using Ctrl-V.

For MacOS users: Make sure you are using the "Control" key and not the Apple "Command" keys.

note

The input files must be loaded with the file selection tool. The input file column does not support pasting or but can be copied into another application.

Uniform Scaling

If you have multiple files that all need to be scaled by the same value (e.g. TagPileup outputs derived from the same BAM file), the Uniform scaling methood is more convenient to use. When this option is selected, the "Uniform scaling factor" option can be selected while the "Scaling Factor" column is disregarded in the execution of the script.

Start Row/Column

These integers indicate the last header columns or row labels. By default they are set to follow CDT format specifications but can be adjusted if you have some other tab-delimited file format with different header starts.

Output

Each scaled matrix file is written with the _SCALE.cdt suffix appended. For example, SomeMatrixFile.cdt would be scaled and written to SomeMatrixFile_SCALE.cdt.

Command Line Interface

Usage:

java -jar ScriptManager.jar read-analysis scale-matrix [-hV] [-l=<startCOL>]
[-o=<output>] [-r=<startROW>] [-s=<scale>] <matrix>

Positional Input

This tool takes a single matrix file for input.

Output Options

OptionDescription
-o, --output=<output>specify output filename
-z, --gzipgzip output (default=false)

Scale Options

OptionDescription
-s, --scaling-factorscaling factor (default=1)

Coord Start Options

OptionDescription
-r, --start-rowrow to start scaling the matrix (zero indexed)
-l, --start-colcolumn to start scaling the matrix (zero indexed)