3 Oct 2003 mcxsubs 1.003, 03-276

1. |  | NAME
2. |  | SYNOPSIS
3. |  | DESCRIPTION
4. |  | OPTIONS
5. |  | SUBMATRIX SPECIFICATIONS
6. |  | AUTHOR
7. |  | SEE ALSO

## NAME

mcxsubs - extract submatrices (subgraphs) of a matrix (graph).

This can be used to inspect local cluster structure in a graph, for example by looking at the subgraph induced by a single cluster or a couple of clusterings, or the edge set where all tail nodes are from a set of domains and all head nodes are from the complement of this set, and many other variants and refinements.

Additionally, mcxsubs allows for remapping the indices of the result, selecting matrix entries based on value, transposing the result, and making the result characteristic (set all nonzero values to 1.0).

## SYNOPSIS

mcxsubs -mtx <fname> [options] <specs>+

mcxsubs -mtx <fname> (input matrix) [-dom <fname> (domain matrix)] [-stem str (for output files)] [-digits k (set precision)] [--tag (tag nodes)] <specs>+

## DESCRIPTION

mcxsubs lets you extract submatrices/subgraphs corresponding with index sets and (possibly) sets of domains from a given domain matrix (e.g. a matrix representing a clustering). Columns and rows of the target submatrix can be specified both independently and simultaneously, and can be specified as unions of simple index and domain ranges and complements of these.

Because a submatrix or subgraph specification is composed of type, location, column, row, index, and set specifications, the word specification is abbreviated as spec. Multiple submatrices can be specified simultaneously. A submatrix is created for each submatrix spec. Everything encountered after the mcxsubs options are exhausted should be a spec. The syntax of specs is described in the SUBMATRIX SPECIFICATIONS section.

## OPTIONS

-mtx <fname> (input matrix)
|  | Submatrices will all be selected from the matrix in file `<fname>`. This option is obligatory.
-dom <fname> (domain matrix)
|  | Submatrices are specified in terms of sets (or domains) of indices. These sets are specified by (the label of) the vectors from the matrix given by this options.
-stem str (for output files)
|  | Each generated submatrix is written to a file which is named after its spec or a tag appended to the spec (see the SUBMATRIX SPECIFICATIONS section). In both cases, the identifying string (spec or tag) is prefixed with a fixed string which is by default "out.sub-". This prefix can be changed using this option.
-digits k (set precision)
|  | Matrices are currently output in ascii format, with a precision of three digits. This option changes the precision. Setting -digits -1 disables the output of values altogether - only the node indices are written.
--tag (tag nodes)
|  | Each node in the column (tail node) listing of the matrix (graph) spec is tagged with the domain it is in. This requires the use of the -dom option. This output mode, called tagged matrix, is currently not recognized by any of the mcl/mcx input routines. It is present to facilitate easier visual inspection of clustering results.

## SUBMATRIX SPECIFICATIONS

A submatrix or subgraph spec may contain a number of spec parts. Each part consists of a key-value pair for which key and value are separated by a colon. Different key-value pairs can be separated by an underscore, but this is not necessary. The key part usually consists of a single letter. It can be one of 'r' (or 'R'), 'c' (or 'C'), 'v', or 'f', which respectively denote the row, column, value, and finish keys. The row and column keys can be combined into a single key sharing the same value. Both of them come in two flavours, so 'rc', 'Rc', 'rC' et cetera are all valid keys.

Row and column keys accept the same type of values, called location values. The syntax of location values is more complicated than that of values accepted by other keys. It is described first.

A shared column/row key can occur in two cases: i) the spec of a principal submatrix or equivalently a subgraph, and ii) the spec of all edges between a set of nodes to the complement of that set. Examples of these are:

`cr:i0-6,10,11-14`
|  | Principal submatrix on indices 0-6, 10, and 11-14 - all column and row indices are from this set. Equivalently, this encodes the subgraph on nodes 0-6, 10, 11-14. The 'c' stands for column, the 'r' for row, and the 'i' for index. After the colon it is also allowed to specify a 'd' part (standing for domain), this is shown further below. The c/r/C/R part is the type part of a column/row spec, indicating whether it pertains to columns, rows, or both. The i/d/I/D part is the location part.
`c:i0-6,10,11-14r:i1-6,10,11-14`
|  | Equivalent (but less clear) spec of the above.
`cR:i0-6,10,11-14`
|  | Matrix with column indices in 0-6, 10, 11-14, and row indices in the complement of this set. Corresponds with all edges going out from the set 0-6, 10, 11-14. Complements are triggered by the use of a capital; see the next examples.
`c:i0-6,10,11-14R:i1-6,10,11-14`
`c:i0-6,10,11-14r:I1-6,10,11-14`
|  | Both these examples are equivalent to the previous one. In the last example, the capital 'I' indicates that the complement should be taken. In this example, 'r' combined with 'I' has the same effect as 'R' combined with 'i'. This is no longer true if the location spec uses set specs as well: see the next examples.
`c:d3,5-9r:d8-14i10-30`
|  | Column indices are taken from the domains 3, 5-9 (from the domain matrix specified by -dom), row indices are taken from domains 8-14 plus the indices 10-30.
`cR:d0-2`
|  | Column indices are all indices from domains 0-2, row indices are all other indices. This gives all edges going out from domains 0-2. The use of 'D' is analogous to that of 'C', 'R', and 'I'. Thus, `D0-3,8,21-30` specifies all indices which are in the complement of the set formed by taking the union of domains 0-3,8,21-30. There are two special domains - use `-1` to obtain the row domain of the domain matrix, use `-2` to obtain its column domain.

As seen above, indices (either representing themselves or domains) are entered as comma-separated lists of single indices or ranges of indices (ranges may overlap). The union of the corresponding elements is taken and passed along. Before anything else, the result set is replaced by its complement if 'I' is specified (for simple indices) or 'D' is specified (for domains). If there is both an index and a set spec string, the union of the results of both is taken and passed along. If the latter result is passed to either 'C' or 'R', it is replaced by its complement.

If a column or row spec is missing, it is implicitly understood that all nodes should be taken for the missing type. A totally empty type spec (which is the case if the first character in the spec is the colon) indicates that the subgraph on all nodes must be taken, which is identical to the original graph. As an aside, this empty type spec renders any location spec useless, as it is ignored. This behaviour may still be useful in conjunction with the --tag option.

The value key is always introduced as 'v:'. It is followed by a comma separated list of value specifications. A value specification is a string followed by a numer. The string can be one of 'gq', 'gt', 'lq', 'lt', respectively denoting greater than or equal to, greater than, less than or equal to, and less than.

The finish key is always introduced as 'f:'. It is followed by a comma separated list of directives which take the form of simple strings. Such a string can be one of 'mr', 'mc', 'mp', 'tp', or 'cc', respectively denoting mapping of rows, mapping of columns, mapping of both rows and columns, transposition, and (making) characteristic. The corresponding actions are applied to the matrix that was extracted according to the location and value specifications.

Additionally, a tag '#xyz' or '##xyz' may be concatenated to the spec (where the `xyz` part is up to your choice). Normally, a generated submatrix is written to a file the name of which contains the spec as a substring. If the '#xyz' tag is present, the submatrix is written to the file 'stemxyz', where 'stem' can be set with the -stem option. If the '##xyz' tag is present, the submatrix is simply written to the file 'xyz'. Examples:

`cR:d0-2`
|  | The submatrix is written to the file out.sub-cR:d0-2.
`cR:d0-2`#foo
|  | The submatrix is written to the file out.sub-foo, or the file xyzfoo if xyz is the argument to the -stem flag.
`cR:d0-2`##foo
|  | The submatrix is written to the file foo.

## AUTHOR

Stijn van Dongen.

## SEE ALSO

mcx, mcl, mcxio.