kharchenkolab / Baysor

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

Error: MethodError(Matrix{<:Unsigned} #79

Open ccbvib opened 1 year ago

ccbvib commented 1 year ago

I am apply Baysor to Resolve data. The "preview" step works, and outputs the HTML report, which looks fine, but the "run" step crashes with the following error. Any idea what is going on here?

[17:26:42] Info: Processing complete. [17:26:50] Info: Estimating local colors [17:27:29] Info: Saving results to /staging/leuven/stg_00104/vsc/Projects/Project_Theo/resolve/output/segmentation.csv [17:27:32] Info: Plot diagnostics [17:28:33] Info: Estimating boundary polygons [17:30:16] Error: MethodError(Matrix{<:Unsigned}, (Matrix{Int64}(undef, 0, 0),), 0x0000000000007b7d) |
| convert(#unused#::Type{Matrix{<:Unsigned}}, a::Matrix{Int64}) at array.jl:554 | find_grid_point_labels_kde(pos_data::Matrix{Float64}, cell_labels::Vector{Int64}, min_x::Vector{Float64}, max_x::Vector{Float64}; grid_step ::Float64, bandwidth::Float64, dens_threshold::Float64, min_molecules_per_cell::Int64, verbose::Bool) at boundary_estimation.jl:165 | (::Baysor.var"#find_grid_point_labels_kde##kw")(::NamedTuple{(:grid_step, :bandwidth), Tuple{Float64, Float64}}, ::typeof(Baysor.findgrid point_labels_kde), pos_data::Matrix{Float64}, cell_labels::Vector{Int64}, min_x::Vector{Float64}, max_x::Vector{Float64}) at boundary_estimation.jl:159 | boundary_polygons(pos_data::Matrix{Float64}, cell_labels::Vector{Int64}; min_x::Nothing, max_x::Nothing, grid_step::Float64, min_border_len gth::Int64, shape_method::Symbol, max_dev::Float64, bandwidth::Float64, exclude_labels::Vector{Int64}, kwargs::Base.Pairs{Symbol, Union{}, Tuple{}, NamedTupl e{(), Tuple{}}}) at boundary_estimation.jl:263 | boundary_polygons at boundary_estimation.jl:254 [inlined] | #boundary_polygons#214 at boundary_estimation.jl:248 [inlined] | (::Baysor.var"#boundary_polygons##kw")(::NamedTuple{(:grid_step, :bandwidth), Tuple{Float64, Float64}}, ::typeof(Baysor.boundary_polygons), spatial_df::DataFrames.DataFrame, args::Vector{Int64}) at boundary_estimation.jl:248 | (::Baysor.var"#333#337"{DataFrames.DataFrame, Vector{Int64}, Dict{String, Any}, Float64})(mask::BitVector) at main.jl:220 | (::ProgressMeter.var"#56#59"{Distributed.RemoteChannel{Channel{Bool}}, Baysor.var"#333#337"{DataFrames.DataFrame, Vector{Int64}, Dict{Strin g, Any}, Float64}})(x::BitVector) at ProgressMeter.jl:1018 | iterate at generator.jl:47 [inlined] | _collect(c::Vector{BitVector}, itr::Base.Generator{Vector{BitVector}, ProgressMeter.var"#56#59"{Distributed.RemoteChannel{Channel{Bool}}, B aysor.var"#333#337"{DataFrames.DataFrame, Vector{Int64}, Dict{String, Any}, Float64}}}, #unused#::Base.EltypeUnknown, isz::Base.HasShape{1}) at array.jl:744 | collect_similar(cont::Vector{BitVector}, itr::Base.Generator{Vector{BitVector}, ProgressMeter.var"#56#59"{Distributed.RemoteChannel{Channel {Bool}}, Baysor.var"#333#337"{DataFrames.DataFrame, Vector{Int64}, Dict{String, Any}, Float64}}}) at array.jl:653 | map(f::Function, A::Vector{BitVector}) at abstractarray.jl:2849 | macro expansion at ProgressMeter.jl:1017 [inlined] | macro expansion at task.jl:399 [inlined] | macro expansion at ProgressMeter.jl:1016 [inlined] | macro expansion at task.jl:399 [inlined] | progress_map(::Function, ::Vararg{Any}; mapfun::Function, progress::ProgressMeter.Progress, channel_bufflen::Int64, kwargs::Base.Pairs{Symbol, Union{}, Tuple{}, NamedTuple{(), Tuple{}}}) at ProgressMeter.jl:1009 | progress_map(::Function, ::Vararg{Any}) at ProgressMeter.jl:1005 | plot_transcript_assignment_panel(df_res::DataFrames.DataFrame, assignment::Vector{Int64}, args::Dict{String, Any}; clusters::Vector{Int64}, prior_polygons::Vector{Matrix{Float64}}, gene_colors::Vector{ColorTypes.Lab{Float64}}) at main.jl:220 | (::Baysor.var"#plot_transcript_assignment_panel##kw")(::NamedTuple{(:clusters, :prior_polygons, :gene_colors), Tuple{Vector{Int64}, Vector{Matrix{Float64}}, Vector{ColorTypes.Lab{Float64}}}}, ::typeof(Baysor.plot_transcript_assignment_panel), df_res::DataFrames.DataFrame, assignment::Vector{Int64}, args::Dict{String, Any}) at main.jl:205 | save_segmentation_results(bm_data::Baysor.BmmData{3}, gene_names::Vector{String}, args::Dict{String, Any}; mol_clusts::NamedTuple{(:exprs, :assignment, :diffs, :assignment_probs, :change_fracs), Tuple{Matrix{Float64}, Vector{Int64}, Vector{Float64}, Matrix{Float64}, Vector{Float64}}}, comp_segs::Nothing, prior_polygons::Vector{Matrix{Float64}}) at main.jl:414 | (::Baysor.var"#save_segmentation_results##kw")(::NamedTuple{(:mol_clusts, :comp_segs, :prior_polygons), Tuple{NamedTuple{(:exprs, :assignment, :diffs, :assignment_probs, :change_fracs), Tuple{Matrix{Float64}, Vector{Int64}, Vector{Float64}, Matrix{Float64}, Vector{Float64}}}, Nothing, Vector{Matrix{Float64}}}}, ::typeof(Baysor.save_segmentation_results), bm_data::Baysor.BmmData{3}, gene_names::Vector{String}, args::Dict{String, Any}) at main.jl:394 | run_cli_main(args::Vector{String}) at main.jl:481 | run_cli(args::Vector{String}) at common.jl:152 | run_cli at common.jl:137 [inlined] | julia_main() at common.jl:177 | top-level scope at none:1

sarahyk commented 1 year ago

Hi @ccbvib, I had a similar issue. Were you able to find a solution or explanation?

pakiessling commented 1 year ago

@ccbvib give this a shot https://github.com/kharchenkolab/Baysor/issues/82#issuecomment-1593566888

VPetukhov commented 12 months ago

@sarahyk , @ccbvib , could you please provide the Baysor version here? It looks like one prior to 0.6.