plot_4m

Reliability status: development

Compute barcode interaction frequencies with bootstrapping.

A script for performing 4M (Multi-way Measurement of Molecular interactions in space) analysis on chromatin trace data. This tool analyzes spatial colocalization between a specified anchor barcode and all other barcodes in 3D chromatin trace data.

The script calculates colocalization frequencies based on a distance cutoff and performs bootstrapping to estimate statistical confidence (mean and standard error). It generates a plot showing the frequency of interaction between the anchor barcode and all others.

This is particularly useful for analyzing chromatin organization, DNA-DNA interactions, and spatial proximity relationships in microscopy data.

usage: plot_4m [-h] --input INPUT --anchors ANCHORS [ANCHORS ...]
               [--cutoff CUTOFF] [--bootstrapping_cycles BOOTSTRAPPING_CYCLES]
               [--output OUTPUT] [--pipe] [--x_min X_MIN] [--x_max X_MAX]

Named Arguments

--input

Path to input trace table (ECSV format).

--anchors

List of anchor barcode numbers.

--cutoff

Distance cutoff for colocalization. Default = 0.2 um

Default: 0.2

--bootstrapping_cycles

Number of bootstrap iterations.

Default: 10

--output

Output file for the plot.

Default: 'colocalization_plot.png'

--pipe

inputs Trace file list from stdin (pipe)

Default: False

--x_min

xscale minimum

--x_max

xscale maximum

Usage

plot_4m --input TRACE_FILE.ecsv --anchor BARCODE_NUMBER [options]
cat file_list.txt | python plot_4m --pipe --anchor BARCODE_NUMBER [options]
find . -name "*.ecsv" | python plot_4m --pipe --anchor BARCODE_NUMBER [options]

Examples

Analyze a single trace file with default parameters:

plot_4m --input traces.ecsv --anchor 42

Analyze with custom distance cutoff and more bootstrap cycles:

plot_4m --input traces.ecsv --anchor 42 --cutoff 0.25 --bootstrapping_cycles 100

Process multiple trace files in batch mode:

cat trace_files.txt | plot_4m --pipe --anchor 42 --output batch_results.png

Process all ECSV files in a directory:

find ./data -name "*.ecsv" | plot_4m --pipe --anchor 42

Output

A PNG image with a plot showing colocalization frequencies between the anchor barcode and all other barcodes, including error bars derived from bootstrapping The output filename will be modified to include the anchor barcode number (e.g., “colocalization_plot_anchor_42.png”)

Notes

The script requires the ChromatinTraceTable class from the matrixOperations module Input files must be in ECSV format compatible with ChromatinTraceTable.load() Bootstrapping is used to estimate mean and standard error of colocalization frequencies The distance cutoff is in micrometers (µm) Higher numbers of bootstrapping cycles increase statistical confidence but require more computation time