Skip to content

Commit

Permalink
Support baysor>=0.7.0 (#125)
Browse files Browse the repository at this point in the history
  • Loading branch information
quentinblampey committed Sep 25, 2024
1 parent 02cf901 commit ff9ff66
Show file tree
Hide file tree
Showing 16 changed files with 14 additions and 29 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
## [1.x.x] - 2024-xx-xx

### Fix
- Support `baysor>=0.7.0` (#125, @lguerard).
- NB: For Snakemake, please remove the `new_component_*` arguments from the Baysor config.

## [1.1.5] - 2024-09-17

### Fix
Expand Down
2 changes: 0 additions & 2 deletions docs/tutorials/cli_usage.md
Original file line number Diff line number Diff line change
Expand Up @@ -165,8 +165,6 @@ iters = 500
n_cells_init = 0
nuclei_genes = ""
cyto_genes = ""
new_component_weight = 0.2
new_component_fraction = 0.3
```

Then, we generate the bounding boxes of the patches on which Baysor will be run. Here, the patches have a width and height of 1200 microns and an overlap of 50 microns. We advise bigger sizes for real datasets (see our default parameters in one of our [config files](https://github.com/gustaveroussy/sopa/tree/master/workflow/config)). On the toy dataset, this will generate **4** patches.
Expand Down
9 changes: 7 additions & 2 deletions workflow/Snakefile
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,6 @@ rule patch_segmentation_baysor:
patches_file = paths.smk_patches_file_baysor,
baysor_patch = paths.smk_baysor_temp_dir / "{index}",
output:
paths.smk_baysor_temp_dir / "{index}" / "segmentation_polygons.json",
paths.smk_baysor_temp_dir / "{index}" / "segmentation_counts.loom",
params:
args_baysor_prior_seg = args.baysor_prior_seg,
Expand All @@ -126,7 +125,13 @@ rule patch_segmentation_baysor:
fi
cd {input.baysor_patch}
{config[executables][baysor]} run --save-polygons GeoJSON -c config.toml transcripts.csv {params.args_baysor_prior_seg}
help_output=$({config[executables][baysor]} run --help 2>&1) # check if the polygon-format option is available
if [[ $help_output == *"polygon-format"* ]]; then
{config[executables][baysor]} run --polygon-format GeometryCollection -c config.toml transcripts.csv {params.args_baysor_prior_seg}
else
{config[executables][baysor]} run --save-polygons GeoJSON -c config.toml transcripts.csv {params.args_baysor_prior_seg}
fi
"""

rule patch_segmentation_comseg:
Expand Down
2 changes: 0 additions & 2 deletions workflow/config/cosmx/baysor.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,6 @@ segmentation:
n_cells_init: 0
nuclei_genes: ""
cyto_genes: ""
new_component_weight: 0.2
new_component_fraction: 0.3

aggregate:
average_intensities: true
Expand Down
2 changes: 0 additions & 2 deletions workflow/config/cosmx/cellpose_baysor.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,6 @@ segmentation:
n_cells_init: 0
nuclei_genes: ""
cyto_genes: ""
new_component_weight: 0.2
new_component_fraction: 0.3

aggregate:
average_intensities: true
Expand Down
2 changes: 0 additions & 2 deletions workflow/config/example_commented.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -63,8 +63,6 @@ segmentation:
n_cells_init: 0
nuclei_genes: ""
cyto_genes: ""
new_component_weight: 0.2
new_component_fraction: 0.3


aggregate:
Expand Down
2 changes: 0 additions & 2 deletions workflow/config/merscope/baysor_cellpose.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,6 @@ segmentation:
n_cells_init: 0
nuclei_genes: ""
cyto_genes: ""
new_component_weight: 0.2
new_component_fraction: 0.3

aggregate:
average_intensities: true
Expand Down
2 changes: 0 additions & 2 deletions workflow/config/merscope/baysor_vizgen.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,6 @@ segmentation:
n_cells_init: 0
nuclei_genes: ""
cyto_genes: ""
new_component_weight: 0.2
new_component_fraction: 0.3

aggregate:
average_intensities: true
Expand Down
2 changes: 0 additions & 2 deletions workflow/config/toy/uniform_baysor.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,6 @@ segmentation:
n_cells_init: 0
nuclei_genes: ""
cyto_genes: ""
new_component_weight: 0.2
new_component_fraction: 0.3

aggregate:
average_intensities: true
Expand Down
2 changes: 0 additions & 2 deletions workflow/config/toy/uniform_baysor_overlaps.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,6 @@ segmentation:
n_cells_init: 0
nuclei_genes: ""
cyto_genes: ""
new_component_weight: 0.2
new_component_fraction: 0.3

aggregate:
average_intensities: true
Expand Down
2 changes: 0 additions & 2 deletions workflow/config/toy/uniform_baysor_vizgen.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,6 @@ segmentation:
n_cells_init: 0
nuclei_genes: ""
cyto_genes: ""
new_component_weight: 0.2
new_component_fraction: 0.3

aggregate:
average_intensities: true
Expand Down
2 changes: 0 additions & 2 deletions workflow/config/toy/uniform_cellpose_baysor.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,6 @@ segmentation:
n_cells_init: 0
nuclei_genes: ""
cyto_genes: ""
new_component_weight: 0.2
new_component_fraction: 0.3

aggregate:
average_intensities: true
Expand Down
2 changes: 0 additions & 2 deletions workflow/config/xenium/baysor.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,6 @@ segmentation:
n_cells_init: 0
nuclei_genes: ""
cyto_genes: ""
new_component_weight: 0.2
new_component_fraction: 0.3

aggregate:
average_intensities: true
Expand Down
2 changes: 0 additions & 2 deletions workflow/config/xenium/baysor_multimodal.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,6 @@ segmentation:
n_cells_init: 0
nuclei_genes: ""
cyto_genes: ""
new_component_weight: 0.2
new_component_fraction: 0.3

aggregate:
average_intensities: true
Expand Down
2 changes: 0 additions & 2 deletions workflow/config/xenium/cellpose_baysor.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,6 @@ segmentation:
n_cells_init: 0
nuclei_genes: ""
cyto_genes: ""
new_component_weight: 0.2
new_component_fraction: 0.3

aggregate:
average_intensities: true
Expand Down
2 changes: 1 addition & 1 deletion workflow/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ def cells_paths(self, file_content: str, name, dirs: bool = False):
return [str(self.smk_cellpose_temp_dir / f"{i}.parquet") for i in range(int(file_content))]
if name == "baysor":
indices = map(int, file_content.split())
BAYSOR_FILES = ["segmentation_polygons.json", "segmentation_counts.loom"]
BAYSOR_FILES = ["segmentation_counts.loom"]

if dirs:
return [str(self.smk_baysor_temp_dir / str(i)) for i in indices]
Expand Down

0 comments on commit ff9ff66

Please sign in to comment.