kharchenkolab / Baysor

Bayesian Segmentation of Spatial Transcriptomics Data
MIT License
142 stars 29 forks source link

Error when using prior segmentation #95

Open kleejin opened 10 months ago

kleejin commented 10 months ago

Hi there, I am trying to use baysor v.0.6.2 and seeing the following error when I try to include a prior segmentation file (tiff format)

[11:01:58] Info: Run R792106752 [11:01:58] Info: (2023-09-01) Run Baysor v0.6.2 [11:01:58] Info: Loading data... [11:02:01] Info: Loaded 2397226 transcripts [11:02:05] Info: Loading segmentation mask... [11:02:06] Warning: Minimum transcript coordinates are < 1: (0, 0). Filling it with 0. └ Baysor.DataLoading /home/viktor_petukhov/.julia/dev/Baysor/src/data_loading/prior_segmentation.jl:30 [11:02:07] Info: Done [11:02:07] Info: Estimating prior segmentation polygons... ERROR: MethodError: no method matching adjacency_list(::Vector{Any}; adjacency_type::Symbol, filter::Bool, return_tesselation::Bool) Closest candidates are: adjacency_list(::Matrix{<:Real}; filter, n_mads, k_adj, adjacency_type, distance, return_tesselation, TD, TD) @ Baysor /home/viktor_petukhov/.julia/dev/Baysor/src/processing/data_processing/triangulation.jl:49 adjacency_list(::DataFrames.DataFrame; kwargs...) @ Baysor /home/viktor_petukhov/.julia/dev/Baysor/src/processing/data_processing/triangulation.jl:107 Stacktrace: [1] boundary_polygons_from_grid(grid_labels::Matrix{UInt32}; grid_step::Int64) @ Baysor.Processing /home/viktor_petukhov/.julia/dev/Baysor/src/processing/data_processing/boundary_estimation.jl:72 [2] load_prior_segmentation!(df_spatial::DataFrames.DataFrame, prior_segmentation::String, opts::Baysor.Utils.SegmentationOptions; min_molecules_per_cell::Int64, min_molecules_per_segment::Int64, plot::Bool) @ Baysor.CommandLine /home/viktor_petukhov/.julia/dev/Baysor/src/cli/main.jl:208 [3] run(coordinates::String, prior_segmentation::String; config::Baysor.Utils.RunOptions, x_column::String, y_column::String, z_column::String, gene_column::String, min_molecules_per_cell::Int64, scale::Float64, scale_std::String, n_clusters::Int64, prior_segmentation_confidence::Float64, output::String, plot::Bool, save_polygons::String, no_ncv_estimation::Bool, count_matrix_format::String) @ Baysor.CommandLine /home/viktor_petukhov/.julia/dev/Baysor/src/cli/main.jl:108 [4] command_main(ARGS::Vector{String}) @ Baysor.CommandLine /home/viktor_petukhov/.julia/packages/Comonicon/HDhA6/src/codegen/julia.jl:343 [5] command_main @ /home/viktor_petukhov/.julia/packages/Comonicon/HDhA6/src/codegen/julia.jl:90 [inlined] [6] julia_main() @ Baysor.CommandLine /home/viktor_petukhov/.julia/packages/Comonicon/HDhA6/src/frontend/cast.jl:481 [7] julia_main(; kwargs::Base.Pairs{Symbol, Union{}, Tuple{}, NamedTuple{(), Tuple{}}}) @ Baysor /home/viktor_petukhov/.julia/dev/Baysor/src/Baysor.jl:42 [8] julia_main() @ Baysor /home/viktor_petukhov/.julia/dev/Baysor/src/Baysor.jl:42 [9] top-level scope @ none:1

Here is the command I am using - the config is mostly keeping the default parameters and forcing 2d. baysor run -c $CONFIG -p --save-polygons=geojson -o $OUTDIR$NAME $f $CPPATH

This error doesn't appear when I remove the path to the prior segmentation file. I am running the binary install on a rocky linux 8.6 OS.

Thanks for your help!

BioinfoTongLI commented 8 months ago

just add an option -m 1 should work. for reference

  -m, --min-molecules-per-cell <m>                          Minimal number of molecules for a cell to be considered as
                                                            real. It's an important parameter, as it's used to infer
                                                            several other parameters. Overrides the config value.