Skip to content

Commit 30536b8

Browse files
committed
added parquet output style, output modifications for xeniumranger
annotation import, docs
1 parent 2a11c51 commit 30536b8

24 files changed

Lines changed: 1921 additions & 62 deletions

File tree

CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,7 @@ add_library(baysor_lib
9595
# Utils
9696
src/utils/general.cpp
9797
src/utils/options.cpp
98+
src/utils/xenium.cpp
9899

99100
# Data loading
100101
src/data_loading/data.cpp

README.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,10 @@ Example datasets and runnable commands:
2323
- [osm-FISH](examples/osm-FISH/README.md)
2424
- [STARmap](examples/STARmap/README.md)
2525

26+
User-facing documentation for this branch:
27+
28+
- [docs/README.md](docs/README.md)
29+
2630
## Build
2731

2832
### Dependencies

docs/README.md

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
# Baysor C++ Branch Documentation
2+
3+
This directory contains the user-facing documentation for the native C++
4+
implementation.
5+
6+
Current pages:
7+
8+
- [Overview](index.md)
9+
- [Installation](installation.md)
10+
- [Running Baysor](run.md)
11+
- [Dataset Preview](preview.md)
12+
- [Segmentation-Free NCVs](segfree.md)
13+
- [Input Data](inputs.md)
14+
- [Prior Segmentation Inputs](priors.md)
15+
- [Outputs](outputs.md)
16+
- [Xenium Workflow](xenium.md)
17+
- [Configuration](configuration.md)
18+
- [Examples](examples.md)
19+
- [Citation](citation.md)
20+
21+
This structure follows the useful parts of the old `master` documentation, but
22+
it is intentionally narrower:
23+
24+
- it documents the currently implemented C++ CLI surface
25+
- it treats Xenium Explorer support as a Xenium Ranger handoff workflow rather
26+
than direct bundle generation

docs/citation.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
# Citation
2+
3+
If you find Baysor useful for your publication, please cite:
4+
5+
```text
6+
Petukhov V, Xu RJ, Soldatov RA, Cadinu P, Khodosevich K, Moffitt JR & Kharchenko PV.
7+
Cell segmentation in imaging-based spatial transcriptomics.
8+
Nat Biotechnol (2021). https://doi.org/10.1038/s41587-021-01044-w
9+
```
10+
11+
For the method background, see the published paper above. For the current C++
12+
implementation details, refer to the documentation in this branch.

docs/configuration.md

Lines changed: 99 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,99 @@
1+
# Configuration
2+
3+
The main protocol presets live under [configs/](../configs/):
4+
5+
- [example_config.toml](../configs/example_config.toml)
6+
- [xenium.toml](../configs/xenium.toml)
7+
- [iss.toml](../configs/iss.toml)
8+
- [starmap.toml](../configs/starmap.toml)
9+
- [osm_fish.toml](../configs/osm_fish.toml)
10+
11+
Use them with:
12+
13+
```bash
14+
./build/baysor run -c configs/xenium.toml ...
15+
```
16+
17+
## Config Structure
18+
19+
The example config is organized into sections such as:
20+
21+
- `[data]`
22+
- `[segmentation]`
23+
- `[plotting]`
24+
25+
Common fields include:
26+
27+
### `[data]`
28+
29+
- column names (`x`, `y`, `z`, `gene`)
30+
- filtering:
31+
- `min_molecules_per_gene`
32+
- `exclude_genes`
33+
- `min_molecules_per_cell`
34+
- `force_2d`
35+
36+
### `[segmentation]`
37+
38+
- `scale`
39+
- `scale_std`
40+
- `estimate_scale_from_centers`
41+
- `n_clusters`
42+
- `prior_segmentation_confidence`
43+
- `iters`
44+
- `n_cells_init`
45+
- `nuclei_genes`
46+
- `cyto_genes`
47+
- `unassigned_prior_label`
48+
49+
### `[plotting]`
50+
51+
- `gene_composition_neigborhood`
52+
- `min_pixels_per_cell`
53+
- `max_plot_size`
54+
- `ncv_method`
55+
56+
## CLI vs Config
57+
58+
Config values set defaults. CLI flags override them.
59+
60+
Typical pattern:
61+
62+
```bash
63+
./build/baysor run \
64+
-c configs/xenium.toml \
65+
--x-min 0 --x-max 2000 \
66+
--y-min 0 --y-max 2000 \
67+
data/experiment.xenium :cell_id
68+
```
69+
70+
## Protocol-Specific Notes
71+
72+
### Xenium
73+
74+
[configs/xenium.toml](../configs/xenium.toml) maps Xenium columns:
75+
76+
- `x_location`
77+
- `y_location`
78+
- `z_location`
79+
- `feature_name`
80+
- `qv`
81+
82+
and sets:
83+
84+
- Xenium-style transcript filtering
85+
- Xenium prior defaults
86+
87+
### ISS / STARmap / osm-FISH
88+
89+
The protocol config files mainly adjust:
90+
91+
- minimum molecules per gene / cell
92+
- plotting defaults
93+
- expected coordinate / gene column layout
94+
95+
## Recommendation
96+
97+
For protocol-specific work, start from the closest existing config and override
98+
only the values that are truly dataset-specific. For a fuller list of fields and
99+
comments, use [example_config.toml](../configs/example_config.toml).

docs/examples.md

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
# Examples
2+
3+
Protocol-specific runnable examples live under `examples/`.
4+
5+
Currently documented examples:
6+
7+
- [Xenium pancreas](../examples/Xenium_pancreas_membrane_377/README.md)
8+
- [ISS](../examples/iss/README.md)
9+
- [osm-FISH](../examples/osm-FISH/README.md)
10+
- [STARmap](../examples/STARmap/README.md)
11+
12+
Notes:
13+
14+
- we currently carry one Xenium example README
15+
- the Xenium example is the main reference for Xenium-aware input handling and
16+
Xenium Ranger handoff
17+
- the other examples remain useful references for non-Xenium protocols and for
18+
prior-mask / prior-boundary workflows

docs/index.md

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
# Baysor C++ Branch
2+
3+
Baysor segments imaging-based spatial transcriptomics data using spatial
4+
position, local gene composition, and optional prior segmentation inputs.
5+
6+
This `cpp` branch is the native C++ implementation of the main Baysor workflow.
7+
It is built with CMake and currently exposes three CLI subcommands:
8+
9+
- `run`
10+
- `preview`
11+
- `segfree`
12+
13+
## What Is Implemented
14+
15+
- `baysor run`
16+
- `baysor preview`
17+
- `baysor segfree`
18+
- CSV / Parquet transcript-table input
19+
- image-mask and polygon prior segmentation
20+
- Xenium-aware input resolution through `experiment.xenium`
21+
- `legacy` and `parquet` output styles
22+
- HTML plotting / diagnostic outputs from `run`
23+
24+
## Start Here
25+
26+
- [Installation](installation.md)
27+
- [Running Baysor](run.md)
28+
- [Dataset Preview](preview.md)
29+
- [Segmentation-Free NCVs](segfree.md)
30+
- [Input Data](inputs.md)
31+
- [Outputs](outputs.md)
32+
- [Xenium Workflow](xenium.md)
33+
- [Examples](examples.md)

docs/inputs.md

Lines changed: 91 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,91 @@
1+
# Input Data
2+
3+
Baysor consumes a molecule table plus an optional prior segmentation input.
4+
5+
## Supported Molecule Inputs
6+
7+
The `coordinates` positional argument may be:
8+
9+
- CSV molecule table
10+
- Parquet molecule table
11+
- `experiment.xenium`
12+
13+
When `experiment.xenium` is used, Baysor resolves the adjacent Xenium
14+
transcript table automatically and keeps enough source context to make the
15+
legacy outputs compatible with `xeniumranger import-segmentation`.
16+
17+
## Required Molecule Columns
18+
19+
At minimum, Baysor needs:
20+
21+
- `x`
22+
- `y`
23+
- `gene`
24+
25+
If the data are 3D, it can also use:
26+
27+
- `z`
28+
29+
Column names are configurable through CLI flags or the config file.
30+
31+
## Common Column Mapping Flags
32+
33+
- `--x-column`
34+
- `--y-column`
35+
- `--z-column`
36+
- `--gene-column`
37+
- `--qv-column`
38+
39+
For Xenium, [configs/xenium.toml](../configs/xenium.toml) already maps:
40+
41+
- `x_location`
42+
- `y_location`
43+
- `z_location`
44+
- `feature_name`
45+
- `qv`
46+
47+
## Optional Source Columns
48+
49+
Depending on the workflow, the input table may also carry:
50+
51+
- a transcript-native prior column such as `cell_id`
52+
- confidence / quality columns
53+
- Xenium `transcript_id`
54+
55+
For Xenium-origin inputs, Baysor preserves `transcript_id` so it can be written
56+
back to `legacy` output when appropriate.
57+
58+
## Cropping During Input Load
59+
60+
The C++ branch supports spatial filtering during input loading:
61+
62+
- `--x-min`, `--x-max`
63+
- `--y-min`, `--y-max`
64+
- `--z-min`, `--z-max`
65+
66+
This is useful for:
67+
68+
- quick development runs
69+
- protocol debugging
70+
- visualization crops
71+
- testing large datasets without loading the full field of view
72+
73+
## Protocol Notes
74+
75+
### Xenium
76+
77+
Preferred input:
78+
79+
```bash
80+
./build/baysor run -c configs/xenium.toml data/experiment.xenium :cell_id
81+
```
82+
83+
### ISS / osm-FISH / STARmap
84+
85+
These usually use CSV molecule tables plus either:
86+
87+
- no prior, with explicit `--scale`
88+
- an image mask prior
89+
- a boundary file prior
90+
91+
See [Examples](examples.md) for runnable commands.

0 commit comments

Comments
 (0)