VisiumHD proseg v3 error "ScaleTooSmall"
Hi,
first of all thank you for developing such a cool package - particularly now that it is compatible with Visium HD, in my opinion it adresses many caveats of spatial transcriptomics.
I am trying to run proseg v3 on a Visium HD sample I have generated. The tissue in question is super dense with a lot of small nuclei, so I previously optimized the stardist segmentation on this tissue.
First I created a custom segmentation mask using the complementary HE (so its nuclei) and stardist, then I used this custom segmentation mask as input to spaceranger. The resulting barcodes.parquet and binned_outputs I used as input for proseg. After proseg reads in the files into memory I always get the same error:
/spaceranger_LM_exp1$ RUST_BACKTRACE=1 proseg --visiumhd /spaceranger_LM_exp1/VisiumHD_LM_exp1_sample1_rerun2/outs/binned_outputs
--voxel-size 4
--burnin-voxel-size 12
--voxel-layers 2
--spaceranger-barcode-mappings /spaceranger_LM_exp1/VisiumHD_LM_exp1_sample1_rerun2/outs/barcode_mappings.parquet
Using 64 threads
Read dataset:
474079383 transcripts
292516 cells
37082 genes
0 fovs
thread 'main' panicked at /home/roman/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/proseg-3.0.6/src/sampler/paramsampler.rs:119:18: called Result::unwrap() on an Err value: ScaleTooSmall
stack backtrace: 0: __rustc::rust_begin_unwind at /
rustc/29483883eed69d5fb4db01964cdf2af4d86e9cb2/library/std/src/panicking.rs:697:5 1: core::panicking::panic_fmt at /
rustc/29483883eed69d5fb4db01964cdf2af4d86e9cb2/library/core/src/panicking.rs:75:14 2: core::result::unwrap_failed at /
rustc/29483883eed69d5fb4db01964cdf2af4d86e9cb2/library/core/src/result.rs:1761:5 3: core::result::Result<T,E>::unwrap at /
rustc/29483883eed69d5fb4db01964cdf2af4d86e9cb2/library/core/src/result.rs:1167:23 4: proseg::sampler::paramsampler::ParamSampler::sample_volume_params::{{closure}} at /home/roman/.cargo/registry/src/
index.crates.io-1949cf8c6b5b557f/proseg-3.0.6/src/sampler/paramsampler.rs:119:18 5: ndarray::zip::Zip<(P1,P2),D>::for_each::{{closure}} at /home/
roman/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/ndarray-0.16.1/src/zip/mod.rs:585:41 6: ndarray::zip::Zip<P,D>::inner at /home/
roman/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/ndarray-0.16.1/src/zip/mod.rs:355:31 7: ndarray::zip::Zip<P,D>::for_each_core_contiguous at /home/roman/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/ndarray-0.16.1/src/zip/mod.rs:334:23 8: ndarray::zip::Zip<P,D>::for_each_core at /home/roman/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/ndarray-0.16.1/src/zip/mod.rs:319:18 9: ndarray::zip::Zip<(P1,P2),D>::for_each at /
home/roman/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/ndarray-0.16.1/src/zip/mod.rs:583:22 10: proseg::sampler::paramsampler::ParamSampler::sample_volume_params at /home/roman/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/
proseg-3.0.6/src/sampler/paramsampler.rs:114:14 11: proseg::sampler::paramsampler::ParamSampler::sample at /home/roman/.cargo/registry/src/
index.crates.io-1949cf8c6b5b557f/proseg-3.0.6/src/sampler/paramsampler.rs:37:14 12: proseg::main at /home/roman/.cargo/registry/src/
index.crates.io-1949cf8c6b5b557f/proseg-3.0.6/src/main.rs:891:23 13: core::ops::function::FnOnce::call_once at /
rustc/29483883eed69d5fb4db01964cdf2af4d86e9cb2/library/core/src/ops/function.rs:250:5
note: Some details are omitted, run with RUST_BACKTRACE=full for a verbose backtrace.
This happens with all different args settings, e.g. I used default voxel-sizes etc and then gradually increased - did not make a difference. However, when I use the same sample but ran the spaceranger without a custom segmentation mask just with the default spaceranger segmentation settings, proseg runs with default parameters without a problem.
I assessed the spaceranger web summaries of both runs and the segmentation in the run with custom segmentation mask looks like it worked - here the settings are much more stringent (as the tissue is very dense I do not expand the nucleus), resulting in much smaller cell elements than in the spaceranger run with default segmentation (here, the nucleus mask by default is expanded by a given parameter).
My question now is, could the error of proseg be caused by the fact that the cell elements are too small and therefore sometimes do not contain many transcripts?
Thanks so much,
Lauritz
Hi Lauritz,
I have seen this error occasionally, but usually when something has gone wrong with the input (or proseg's interpretation of the input). For example, if the prior segmentation is imcomplete or has a very low number of assigned transcripts. So it could potentially be caused by cells being too small.
Sorry if thats too vague to be useful, but if its still mysterious and your able to share your data with me, I'd be happy to try to reproduce the issue and figure out what's going on.
Dear David,
thanks so much for your answer. In the end I found a work-around for me by just optimizing the build-in segmentation within spaceranger, however I could not figure out the issue itself..
Lauritz