figure_him_matrix

Reliability status: stable

calculates and plots matrices (PWD and proximity) from:
  • a file with single-cell PWD matrices in Numpy format

  • a file with the unique barcodes used

Outputs:
  • Matrix (NxN) of mean pairwise distance, stored in a NPY file.

  • Visualization of this matrix in PNG format (or PDF/SVG)

  • Shadow matrix of NaN (Numpy null value) percentage for each pairwise distance

usage: figure_him_matrix [-h] [-M MATRIX] [-B BARCODES] [-O OUTPUT]
                         [--plot_format PLOT_FORMAT] [--shuffle SHUFFLE]
                         [--mode MODE] [--nan_threshold NAN_THRESHOLD]
                         [-T THRESHOLD] [-K] [--c_min C_MIN] [--c_max C_MAX]
                         [--c_map C_MAP] [--fontsize FONTSIZE]

Required arguments

These both arguments are required.

-M, --matrix

Filename of single-cell PWD matrices in NPY format

-B, --barcodes

csv file with a simple list of unique barcodes (int)

Advanced arguments

[Optional] Advanced args to personalize outputs

-O, --output

Folder for outputs

Default: 'plots'

--plot_format

Available options: svg, pdf, png

Default: 'png'

--shuffle

Provide shuffle vector: 0,1,2,3… of the same size or smaller than the original matrix. No spaces! comma-separated!

--mode

Mode used to calculate the mean distance. Can be either ‘median’, ‘KDE’ or ‘proximity’

Default: 'proximity'

--nan_threshold

Value between 0 and 1. Set a bin to NaN if: nan_percentage[bin] > nan_threshold

Proximity arguments

[Optional] Only for proximity `--mode`

-T, --threshold

Proximity threshold in µm

Default: 0.25

-K, --keep_nan

Matrix normalization mode. By default, NaN values per bin are removed before compute statistics for proximity. Activate this mode to keep NaN values.

Default: False

Visualization arguments

[Optional] Custom visualization

--c_min

Colormap min scale: automatic mode by default (detects the first frequency higher than 0)

Default: -1.0

--c_max

Colormap max scale: automatic mode by default (detects the highest frequency value)

Default: 0.0

--c_map

Colormap (see: matplotlib > colormaps > diverging)

Default: 'coolwarm'

--fontsize

Size of fonts to be used in matrix

Default: 22

Example

Here is examples usage of figure_him_matrix:

Proximity matrix with all data (including bin with NaN value)

figure_him_matrix -M PWDscMatrix.npy -B unique_barcodes.ecsv --keep_nan

Default normalized VS. KDE (c_map: Spectral)

figure_him_matrix -M PWDscMatrix.npy -B unique_barcodes.ecsv

VS.

figure_him_matrix -M PWDscMatrix.npy -B unique_barcodes.ecsv --mode KDE --c_map Spectral