trace_combinator#
The objective of trace_combinator is to combine traces from different ROIs or different experiments.
This script takes JSON file with folders where datasets are stored.
It searches for Trace files with the expected methods, loads them, and
combines them into a single table that is outputted to the buildPWDmatrix folder.
Invoke#
trace_combinator can be run from the command line in two manners:
Provide input parameters in a
folders2Load.jsondictionary (see example below) at execution folder or at arootFolderprovided as argument. The script will read ALL theTracefiles in the paths provided infolders2Load.jsonand will combine them into a uniqueTrace_files. The output oftrace_combinatorwill be generated at therootFolderin the directorycombined_tracesthat will contain a newTracefile with the combined traces.warning:
trace_combinatorwill combine ALL traces found in thebuildPWDmatrixfolders withinfolders2load.json. If you want to filter which Trace files are used, we recommend you to use the second method described below. Alternatively, you can use the--methodcommand-line argument to filter whichTracefiles are used. In that case, make sure to verify the terminal output to ensure the rightTracefiles have been used.An alternative way to use
trace_combinatoris to use pipes. In this case, a list ofTracefiles to process is piped intotrace_combinatorand the--pipeargument is invoked. Piping can be either done using a command or by sending a list in a file. See examples below.Example 1: using
ls# use ls to select which files you want to combine $ ls folder1/Trace*3D*6.ecsv folder1/Trace_3D_barcode_KDtree_ROI:6.ecsv folder1/Trace_3D_barcode_mask:DAPI_ROI:6.ecsv folder1/Trace_3D_barcode_mask:mask0_ROI:6.ecsv # then pipe these files into trace_combinator $ ls folder1/Trace*3D*6.ecsv | trace_combinator --pipe
this will process the three
Tracefiles listed usingls.Example 2: using cat
# first make list of files to process and write it in a file $ cat files_to_combine folder1/Trace_3D_barcode_KDtree_ROI:15.ecsv folder2/Trace_3D_barcode_KDtree_ROI:6.ecsv # then pipe these files into trace_combinator $ cat files_to_combine | trace_combinator --pipe
this will process the files within
files_to_combine.
Use trace_combinator to select traces with specific labels
trace_combinator can also be used to combine traces with specific, user-provided labels, which can be attributed using trace_selector (see above). These can be indicated by using the --label command-line argument. In addition, you need to indicate whether you want to use only the traces that contain the label (labeled), the traces that do not contain the label (unlabeled), or all the traces (all) irrespective of whether they contain or not the label. It is good practice to verify the label column of your output Trace_ file to check that you selected the expected traces.
Inputs#
Name shape |
Quantity |
Mandatory |
Description |
|---|---|---|---|
parameters.json |
1 |
Yes |
Parameter file. |
Outputs#
Name shape |
Quantity |
Description |
|---|---|---|
Relevant options#
usage: trace_combinator [-h] [-F ROOTFOLDER] [-P PARAMETERS] [-A LABEL]
[-W ACTION] [--saveMatrix] [--ndims NDIMS]
[--method METHOD] [--pipe]
optional arguments:
-h, --help show this help message and exit
-F ROOTFOLDER, --rootFolder ROOTFOLDER
Folder with images
-P PARAMETERS, --parameters PARAMETERS
Provide name of parameter files. folders2Load.json
assumed as default
-A LABEL, --label LABEL
Add name of label (e.g. doc)
-W ACTION, --action ACTION
Select: [all], [labeled] or [unlabeled] cells plotted
--saveMatrix Use to load matlab formatted data
--ndims NDIMS Dimensions of trace
--method METHOD Method or mask ID used for tracing: KDtree, mask, DAPI
--pipe inputs Trace file list from stdin (pipe)
folders2Load.json template
{
"dataset_name": {
"Folders": [
"/user_disk/data/Experiment_4/0_Embryo/buildsPWDmatrix",
"/user_disk/data/Experiment_4/1_Embryo/buildsPWDmatrix",
"/user_disk/data/Experiment_4/2_Embryo/buildsPWDmatrix",
"/user_disk/data/Experiment_4/4_Embryo/buildsPWDmatrix",
"/user_disk/data/Experiment_4/5_Embryo/buildsPWDmatrix"
],
"PWD_clim": 1.4,
"PWD_mode": "median",
"iPWD_clim": 6,
"iPWD_mode": "median",
"ContactProbability_scale": 15,
"ContactProbability_cmin": 0.0,
"ContactProbability_distanceThreshold": 0.25
}
}