build_traces
Contents
build_traces¶
Inputs¶
Name shape |
Quantity |
Mandatory |
Description |
|---|---|---|---|
parameters.json |
1 |
Yes |
Parameter file. |
Outputs¶
Name shape |
Quantity |
Description |
|---|---|---|
Relevant options¶
Parameters to run this script will be read from the buildsPWDmatrix field of parameters.json.
"tracing_method": ["masking","clustering"], # list of methods it will use
"mask_expansion": 8,# number of pixels masks will be expanded to assign localizations
"masks2process":{"nuclei":"DAPI","mask1":"mask0"}, # masks identities to process
"KDtree_distance_threshold_mum": 1, # threshold distance used for KDtree clustering
"barcode_coordinates_BEDfile": "", # optional BED file used to annotate barcodes with genomic coordinates
Optional BED-driven barcode annotation¶
If barcode_coordinates_BEDfile is set to a valid BED file path, build_traces will load that file and use it to enrich each saved trace entry with genomic metadata.
Example in parameters.json (buildsPWDmatrix section):
"buildsPWDmatrix": {
"tracing_method": ["masking", "clustering"],
"mask_expansion": 8,
"masks2process": {"nuclei": "DAPI"},
"KDtree_distance_threshold_mum": 1,
"barcode_coordinates_BEDfile": "resources/barcode_coordinates.bed"
}
When a BED file is provided:
Barcode identities are validated against the BED mapping.
If a 5th BED column is present, barcode IDs can be remapped before writing the trace table.
Chrom,Chrom_Start, andChrom_Endcolumns in the output trace table are populated from BED coordinates.
BED file format expected by build_traces¶
Use a tab-separated BED-like file (no header), with at least 4 columns:
chrom(e.g.chr2L,chrX)start(genomic start, basepairs)end(genomic end, basepairs)barcode(barcode ID expected in localizations)(optional)
barcode_remap(barcode ID written to output table after remapping)
Example:
chr2L 150000 151000 1
chr2L 220000 221000 2 102
chr2L 300000 301000 3
In this example, barcode 2 is remapped to 102 when traces are saved, while all entries receive genomic coordinates from columns 1 to 3.
Output images:
_XYZ_ROI*.png
full image |
zoomed images |
|
|---|---|---|
3D mask |
|
|
3D mask |
|
|
3D KDtree |




