22 Jun 2004    mcxsubs 1.004, 04-174

1.  
2.  
3.  
4.  
5.  
6.  
7.  

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 -imx <fname> [options] <specs>+

mcxsubs -imx <fname> (input matrix) [-dom <fname> (domain matrix)] [-dfac <num> (random domain selection)] [-rfac <num> (random column selection)] [-cfac <num> (random row selection)] [--rand-discard (remove random selections)] [--rand-merge (merge random selections)] [--rand-intersect (intersect random selections)] [--rand-exclusive (only random selections)] [--spec-doms (use specified domains)] [--spec-cols (use specified column domain)] [--spec-rows (use specified row domain)] [-stem str (for output files)] [-digits k (set precision)] [--from-disk (space/speed optimizer)] [--tag (tag nodes)] <specs>+

If you are a frequent mcxsubs user with very large graphs, consider converting the input matrix into binary format using mcxconvert and then using the mcxsubs --from-disk option. This should give you a 400-fold speed gain.

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

-imx <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.
   
-dfac <num> (random domain selection)
   
num should be inbetween zero and one. It denotes the probability with which entries in the domains will make it into the randomized selection used for subsequent processing. If the column and row domain are identical, they are submitted to the same selection process and will end up identical. If you don't want this, use -rfac and -cfac separately.
   
-rfac <num> (random column selection)
   
As -dfac, limited to the column domain.
   
-cfac <num> (random row selection)
   
As -dfac, limited to the row domain.
   
--spec-doms (use specified domains)
   
By default, the initial submatrix has its domains restricted to be subdomains of the input matrix. This option overrides that behaviour, so that the submatrix domains will, at the initial selection stage, be identical to the domains resulting from the specificiation process.
   
--spec-cols (use specified column domain)
   
See the --spec-doms option above.
   
--spec-rows (use specified row domain)
   
See the --spec-doms option above.
   
--rand-merge (merge random selections)
   
The random selection(s) of domains identify parts of the matrix that will be merged with the result of the main selection process (default).
   
--rand-discard (remove random selections)
   
The random selection(s) of domains identify parts of the matrix that will be removed from the result of the main selection process.
   
--rand-intersect (intersect random selections)
   
The random selection(s) of domains identify parts of the matrix that will be intersected with the result of the main selection process.
   
--rand-exclusive (only random selections)
   
The random selection(s) of domains identify parts of the matrix from which the result of the main selection process will be removed.
   
-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.
   
--from-disk (space/speed optimizer)
   
Use this if the input graph is in binary format, or if the input graph is very large and the subgraph(s) to extract are small in comparison, or if the available memory does not comfortably exceed the size of the graph.

The effect of this option is that the subgraph will be read directly from disk, without reading in the entire graph in advance. This will be done repeatedly for all subgraphs that are specified.

This option reduces memory consumption to the size of the subgraph(s) to be extracted.

For graphs in ascii format, the speed gain is not dramatic. If more than one subgraph is specified, there will most likely be a loss in speed.

With input graphs in binary format, mcxsubs will be *very* much faster, to the extent of 400-fold speed gains. It does not matter whether more than one subgraph is specified.

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. Additionally there is a special key 'b' that takes no value, which instructs mcx to create a block diagonal matrix.

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, ranges of indices (which may overlap), or staircases of indices (lists of indices with a fixed increment inbetween successive indices). 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.

A range is specified e.g. as 10-14 and it is inclusive, denoting in this case the indices {10,11,12,13,14}. A staircase is specified e.g. as 4%13, denoting the list of indices {4,17,30,43,...}, not extending further than the natural upper bound as infered from the domains of the input matrix.

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 block key is always introduced as 'b:'. It takes no value and it simply specifies that the submatrix is taken consisting of the union of all blocks induced by the domains listed in the domain matrix.

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', 'md', 'tp', 'cc', or 'wb', respectively denoting mapping of rows, mapping of columns, mapping of both domains (rows and columns), transposition, making characteristic, and finally writing the result in binary format. 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, and mclfamily for an overview of all the documentation and the utilities in the mcl family.