Coder Social home page Coder Social logo

baysor's People

Contributors

dcjones avatar dysclyha avatar evanbiederstedt avatar hiraksarkar avatar latticetower avatar maximilian-heeg avatar pkharchenko avatar repushko avatar vpetukhov avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

baysor's Issues

Error running examples

Hi I am trying to run Baysor on the given examples ISS and got the following error:

I downloaded the binary source and was directly calling baysor in the bin.

bash-4.2$ ~/tool/Baysor/bin/baysor -i 500 -n 20 -p -c ~/tool/Baysor/iss.toml -o ./output_dapi -p ./data/pciSeq_3-3.csv ./data/DAPI_3-3_mask.tif
┌ Error: Can't parse argument -i
└ @ Baysor /home/vpetukhov/.julia/dev/Baysor/src/cli/common.jl:125
Usage: baysor <command> [options]

Commands:
        run             run segmentation of the dataset
        preview         generate preview diagnostics of the dataset

Compile error: sysimage_path not assigned in create_sysimage function in the makefile

The arguments in the create_sysmimage function are different in my PackageCompiler.jl file than what's being called in the makefile.

Here is the error I get when running make

"/home/mike/Baysor/bin/julia-1.6.0//bin/julia -e 'ENV["JULIA_DEPOT_PATH"]="/home/mike/Baysor/bin/.julia/"; using PackageCompiler; import Baysor; create_sysimage(:Baysor; precompile_execution_file="$(dirname(pathof(Baysor)))/../bin/precompile.jl", replace_default=true)'
ERROR: UndefKeywordError: keyword argument sysimage_path not assigned
Stacktrace:
 [1] top-level scope
   @ none:1
make: *** [Makefile:20: /home/mike/Baysor/bin/julia-1.6.0//lib/julia/sys.so] Error 1"

Here's the create_sysimage function in PackageCompiler.jl

   create_sysimage(packages::Vector{String}; kwargs...)

Create a system image that includes the package(s) in `packages` (given as a
string or vector). If the `packages` argument is not passed, all packages in the
project will be put into the sysimage.

An attempt to automatically find a compiler will be done but can also be given
explicitly by setting the environment variable `JULIA_CC` to a path to a
compiler (can also include extra arguments to the compiler, like `-g`).

### Keyword arguments:

- `sysimage_path::String`: The path to where the resulting sysimage should be saved.

- `project::String`: The project that should be active when the sysimage is created,
  defaults to the currently active project.

- `precompile_execution_file::Union{String, Vector{String}}`: A file or list of
  files that contain code from which precompilation statements should be recorded.

- `precompile_statements_file::Union{String, Vector{String}}`: A file or list of
  files that contain precompilation statements that should be included in the sysimage.

- `incremental::Bool`: If `true`, build the new sysimage on top of the sysimage
  of the current process otherwise build a new sysimage from scratch. Defaults to `true`.

- `filter_stdlibs::Bool`: If `true`, only include stdlibs that are in the project file.
  Defaults to `false`, only set to `true` if you know the potential pitfalls.

- `include_transitive_dependencies::Bool`: If `true`, explicitly put all
   transitive dependencies into the sysimage. This only makes a difference if some
   packages do not load all their dependencies when themselves are loaded. Defaults to `true`.

### Advanced keyword arguments

- `base_sysimage::Union{Nothing, String}`: If a `String`, names an existing sysimage upon which to build
   the new sysimage incrementally, instead of the sysimage of the current process. Defaults to `nothing`.
   Keyword argument `incremental` must be `true` if `base_sysimage` is not `nothing`.

- `cpu_target::String`: The value to use for `JULIA_CPU_TARGET` when building the system image. Defaults
  to `native`.

- `script::String`: Path to a file that gets executed in the `--output-o` process.

- `sysimage_build_args::Cmd`: A set of command line options that is used in the Julia process building the sysimage,
  for example `-O1 --check-bounds=yes`.
"""
function create_sysimage(packages::Union{Nothing, Symbol, Vector{String}, Vector{Symbol}}=nothing;
                         sysimage_path::String,
                         project::String=dirname(active_project()),
                         precompile_execution_file::Union{String, Vector{String}}=String[],
                         precompile_statements_file::Union{String, Vector{String}}=String[],
                         incremental::Bool=true,
                         filter_stdlibs::Bool=false,
                         cpu_target::String=NATIVE_CPU_TARGET,
                         script::Union{Nothing, String}=nothing,
                         sysimage_build_args::Cmd=``,
                         include_transitive_dependencies::Bool=true,
                         # Internal args
                         base_sysimage::Union{Nothing, String}=nothing,
                         julia_init_c_file=nothing,
                         version=nothing,
                         soname=nothing,
                         compat_level::String="major",
                         )

I tried modifying the function to include sysimage_path="sysimage.so" and removing the replace_default argument in the function call. It was able to run that function without errors. However, I then get a different error.

[ Info: PackageCompiler: Executing /home/mike/Baysor/bin/.julia/packages/Baysor/ujbBh/bin/precompile.jl => /tmp/jl_packagecompiler_JPdQYV/jl_Dd6oiU
ERROR: LoadError: LoadError: ArgumentError: Package DataFrames not found in current path:
- Run `import Pkg; Pkg.add("DataFrames")` to install the DataFrames package.

Performance of Baysor

Hi Viktor,
It's an interesting project! I tried to run Baysor on my computer. However I’m new to Julia and thus struggled with many issues.
In the examples file, it seems that you’ve tested it on STARmap dataset. So I’d appreciate it very much if you could also share the testing result of Baysor on STARmap to show more examples and performance of Baysor better.
Thank you!

Example on Visium data

Hi,

I'm very excited to see that Baysor is out.

I'm trying to run it on a sample from 10X Visium data, and I was wondering if you can provide an example on
how to achieve this using these files.

Thanks!

Error: UndefVarError(:DataFrame!)

Hi,

I have installed Baysor as a Julia package, and I am trying to run the example osm-FISH data. However, the test failed with the below error message.

$ baysor preview -x x -y y --gene gene -c osm_fish.toml -o xxx mRNA_coords_raw_counting.csv
[21:44:21] Info: (2021-05-04) Run Baysor v0.4.3
[21:44:21] Info: Loading data...
[21:44:36] Error: UndefVarError(:DataFrame!)
|                 
|                 read_spatial_df(data_path::String; x_col::Symbol, y_col::Symbol, gene_col::Symbol, filter_cols::Bool) at spatial.jl:5
|                 read_spatial_df at spatial.jl:5 [inlined]
|                 load_df(data_path::String; x_col::Symbol, y_col::Symbol, gene_col::Symbol, min_molecules_per_gene::Int64, kwargs::Base.Iterators.Pairs{Union{}, Union{}, Tuple{}, NamedTuple{(), Tuple{}}}) at initialization.jl:162
|                 (::Baysor.var"#load_df##kw")(::NamedTuple{(:x_col, :y_col, :gene_col, :min_molecules_per_gene), Tuple{Symbol, Symbol, Symbol, Int64}}, ::typeof(Baysor.load_df), data_path::String) at initialization.jl:162
|                 load_df(args::Dict{String, Any}; kwargs::Base.Iterators.Pairs{Union{}, Union{}, Tuple{}, NamedTuple{(), Tuple{}}}) at cli_wrappers.jl:75
|                 load_df(args::Dict{String, Any}) at cli_wrappers.jl:75
|                 run_cli_preview(args::Vector{String}) at cli_wrappers.jl:516
|                 run_cli(args::Vector{String}) at cli_wrappers.jl:623
|                 run_cli() at cli_wrappers.jl:604
|                 top-level scope at baysor:3
|                 eval at boot.jl:360 [inlined]
|                 include_string(mapexpr::typeof(identity), mod::Module, code::String, filename::String) at loading.jl:1094
|                 _include(mapexpr::Function, mod::Module, _path::String) at loading.jl:1148
|                 include(mod::Module, _path::String) at Base.jl:386
|                 exec_options(opts::Base.JLOptions) at client.jl:285
|                 _start() at client.jl:485

It shows that the DataFrame! function is not defined at the 5th line of the spatial.pl file.

$ head -n 6 spatial.jl 
import CSV
using DataFrames

function read_spatial_df(data_path; x_col::Symbol=:x, y_col::Symbol=:y, gene_col::Union{Symbol, Nothing}=:gene, filter_cols::Bool=false)
    df_spatial = DataFrame!(CSV.File(data_path));

DataFrame is defined in the DataFrames package, but DataFrame! is not. Could you please help suggest how to go around this error? Thank you so much.

Problem with ImageMagick

I am running this command:
baysor run -i 500 -n 10 -p -c ../../configs/starmap.toml -o ./output_dapi -p ./data/molecules.csv ./data/segmentation.tiff

using the docker container. But it stopped and wanting ImageMagick:
Fatal error:
[17:05:20] Error: ArgumentError("Package ImageMagick not found in current path:\n- Run import Pkg; Pkg.add(\"ImageMagick\") to install the ImageMagick package.\n")
|
| handle_error(::ArgumentError, ::FileIO.File{FileIO.DataFormat{:TIFF}}) at error_handling.jl:82
| handle_exceptions(::Array{Any,1}, ::String) at error_handling.jl:77
| load(::FileIO.Formatted; options::Base.Iterators.Pairs{Union{},Union{},Tuple{},NamedTuple{(),Tuple{}}}) at loadsave.jl:189
| load at loadsave.jl:169 [inlined]
| #load#13 at loadsave.jl:118 [inlined]
| load at loadsave.jl:118 [inlined]
| load_centers(::String; min_segment_size::Int64, kwargs::Base.Iterators.Pairs{Symbol,Symbol,Tuple{Symbol,Symbol},NamedTuple{(:x_col, :y_col),Tuple{Symbol,Symbo
l}}}) at CenterData.jl:62
| (::Baysor.var"#load_centers##kw")(::NamedTuple{(:x_col, :y_col, :min_segment_size),Tuple{Symbol,Symbol,Int64}}, ::typeof(Baysor.load_centers), ::String) at Ce
nterData.jl:54

Issues on execute baysor:latest in docker.

I am trying to use baysor with docker. I had no problem with vpetukhov/baysor:master. I could run baysor.
However, when I try to use vpetukhov/baysor:latest version, there was some issue.
When I run baysor, the error happened.

baysor
ERROR: Unable to find compatible target in system image.

How can I use baysor:latest version? Can I learn the reason of this error?
Any help would be very appreciated.

I'm using windows(x64).

Error estimating prior segmentation polygons

Hi Viktor

This looks like such a great package, thank you very much for it. I tried using it on my own data while supplying prior segmentation from a DAPI staining, but I get an error. I tried both segmenting on my own with Mesmer (DeepCell) as well as in ImageJ following your tutorial in Readme. Both times it failed with the same error message.

Command:
baysor run -x x_c -y y_c -z z_c --gene gene -o ./results_C1-2/ -i 500 --force-2d -p --n-clusters 7 ../C1-2_results.txt ../C1-2_segmented_fiji.tif

Output:

┌ Warning: No config file provided. Using default parameters.
└ @ Baysor ~/.julia/packages/Baysor/tda03/src/cli/main.jl:96
[14:22:30] Info: (2021-12-07) Run Baysor v0.5.1
[14:22:30] Info: Loading data...
[14:22:48] Info: Loaded 126550 transcripts
[14:22:49] Info: Loading segmentation mask...
[14:23:05] Info: Done
[14:23:05] Info: Estimating prior segmentation polygons...
[14:23:10] Error: MethodError(LightGraphs.kruskal_mst, ({165106, 163115} undirected simple Int64 graph with Float64 weights,), 0x0000000000007b62)
|
|                 border_mst(border_points::Vector{Vector{UInt32}}; min_edge_length::Float64, max_edge_length::Float64) at boundary_estimation.jl:65
|                 border_mst(border_points::Vector{Vector{UInt32}}) at boundary_estimation.jl:42
|                 _broadcast_getindex_evalf at broadcast.jl:670 [inlined]
|                 _broadcast_getindex at broadcast.jl:643 [inlined]
|                 getindex at broadcast.jl:597 [inlined]
|                 copy at broadcast.jl:943 [inlined]
|                 materialize at broadcast.jl:904 [inlined]
|                 extract_polygons_from_label_grid(grid_labels::Matrix{UInt32}; min_border_length::Int64, shape_method::Symbol, max_dev::Float64, exclude_labels::Vector{Int64}, offset::Vector{Float64}, grid_step::Float64) at boundary_estimation.jl:231
|                 (::Baysor.var"#extract_polygons_from_label_grid##kw")(::NamedTuple{(:grid_step,), Tuple{Float64}}, ::typeof(Baysor.extract_polygons_from_label_grid), grid_labels::Matrix{UInt32}) at boundary_estimation.jl:223
|                 load_prior_segmentation(df_spatial::DataFrames.DataFrame, args::Dict{String, Any}) at main.jl:297
|                 load_and_preprocess_data!(args::Dict{String, Any}) at main.jl:335
|                 run_cli_main(args::Vector{String}) at main.jl:442
|                 run_cli(args::Vector{String}) at common.jl:118
|                 run_cli() at common.jl:103
|                 top-level scope at baysor:3
|                 eval at boot.jl:373 [inlined]
|                 include_string(mapexpr::typeof(identity), mod::Module, code::String, filename::String) at loading.jl:1196
|                 _include(mapexpr::Function, mod::Module, _path::String) at loading.jl:1253
|                 include(mod::Module, _path::String) at Base.jl:420
|                 exec_options(opts::Base.JLOptions) at client.jl:292
|                 _start() at client.jl:495
└ Baysor /Users/xvk205/.julia/packages/Baysor/tda03/src/cli/common.jl:132

EDIT:

I've just tried running it without any prior segmentation (only providing the scale parameter) and I'm getting a similar error.

Command:
baysor run -x x_c -y y_c -z z_c --gene gene -o ./results_C1-2/ -i 500 --force-2d -p --n-clusters 7 -s 40 ../C1-2_results.txt

Output:

┌ Warning: No config file provided. Using default parameters.
└ @ Baysor ~/.julia/packages/Baysor/tda03/src/cli/main.jl:96
[14:55:31] Info: (2021-12-07) Run Baysor v0.5.1
[14:55:31] Info: Loading data...
[14:55:50] Info: Loaded 126550 transcripts
[14:55:51] Info: Estimating noise level
[14:55:57] Info: Done
[14:55:59] Info: Clustering molecules...
Progress: 100%|█████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| Time: 0:00:14
  Iteration:                  306
  Max. difference:            0.0010753232764250476
  Fraction of probs changed:  0.6586013433425524
[14:56:17] Info: Algorithm stopped after 306 iterations. Error: 0.00108. Converged: true.
[14:56:17] Info: Done
[14:56:19] Info: Initializing algorithm. Scale: 40.0, scale std: 10.0, initial #components: 84366, #molecules: 126550.
[14:56:21] Info: Using 2D coordinates
Progress: 100%|█████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| Time: 0:01:28
  Iteration:        500
  Noise level, %:   22.36
  Num. components:  1455
[14:57:55] Info: Processing complete.
[14:58:02] Info: Estimating local colors
[14:58:32] Info: Saving results to ./results_C1-2/segmentation.csv
[14:58:33] Info: Plot diagnostics
[14:59:38] Info: Estimating boundary polygons
[15:00:07] Error: MethodError(LightGraphs.kruskal_mst, ({144, 157} undirected simple Int64 graph with Float64 weights,), 0x0000000000007b62)
|
|                 border_mst(border_points::Vector{Vector{UInt32}}; min_edge_length::Float64, max_edge_length::Float64) at boundary_estimation.jl:65
|                 border_mst(border_points::Vector{Vector{UInt32}}) at boundary_estimation.jl:42
|                 _broadcast_getindex_evalf at broadcast.jl:670 [inlined]
|                 _broadcast_getindex at broadcast.jl:643 [inlined]
|                 getindex at broadcast.jl:597 [inlined]
|                 copy at broadcast.jl:943 [inlined]
|                 materialize at broadcast.jl:904 [inlined]
|                 extract_polygons_from_label_grid(grid_labels::Matrix{UInt16}; min_border_length::Int64, shape_method::Symbol, max_dev::Float64, exclude_labels::Vector{Int64}, offset::Vector{Float64}, grid_step::Float64) at boundary_estimation.jl:231
|                 (::Baysor.var"#extract_polygons_from_label_grid##kw")(::NamedTuple{(:min_border_length, :shape_method, :max_dev, :exclude_labels, :offset, :grid_step), Tuple{Int64, Symbol, Float64, Vector{Int64}, Vector{Float64}, Float64}}, ::typeof(Baysor.extract_polygons_from_label_grid), grid_labels::Matrix{UInt16}) at boundary_estimation.jl:223
|                 boundary_polygons(pos_data::Matrix{Float64}, cell_labels::Vector{Int64}; min_x::Nothing, max_x::Nothing, grid_step::Float64, min_border_length::Int64, shape_method::Symbol, max_dev::Float64, bandwidth::Float64, exclude_labels::Vector{Int64}, kwargs::Base.Pairs{Symbol, Union{}, Tuple{}, NamedTuple{(), Tuple{}}}) at boundary_estimation.jl:270
|                 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
|                 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:212
|                 (::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{2}, 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{2}, gene_names::Vector{String}, args::Dict{String, Any}) at main.jl:394
|                 run_cli_main(args::Vector{String}) at main.jl:479
|                 run_cli(args::Vector{String}) at common.jl:118
|                 run_cli() at common.jl:103
|                 top-level scope at baysor:3
|                 eval at boot.jl:373 [inlined]
|                 include_string(mapexpr::typeof(identity), mod::Module, code::String, filename::String) at loading.jl:1196
|                 _include(mapexpr::Function, mod::Module, _path::String) at loading.jl:1253
|                 include(mod::Module, _path::String) at Base.jl:420
|                 exec_options(opts::Base.JLOptions) at client.jl:292
|                 _start() at client.jl:495
└ Baysor /Users/xvk205/.julia/packages/Baysor/tda03/src/cli/common.jl:132

Write ncvs to a file

Hi, this is cool work!

Is there a way to write ncvs to a file while running Baysor from CLI?

Thank you
Roopa

CairoMakie breaks `baysor preview` and `baysor run -p`

Description of the Issue:

Baysor crashes when used in a mode that uses its plotting functionality.

This was tested using the commit 37fb431 (recommened to work around release v0.4.3)
and on the most recent commit f4be88a.

stacktrace for baysor run

baysor run \
  -i 500 \
  -c config.toml \
  -o out/ \
  -p \
  --save-polygons GeoJSON \
  coordinates.csv
[12:56:11] Info: (2021-06-03) Run Baysor v0.4.3                                                                                                                                                                    
[12:56:11] Info: Loading data...                                                                                                                                                                                   
[12:56:22] Info: Loaded 55099 transcripts                                                                                                                                                                          
[12:56:23] Info: Estimating noise level                                                                  
[12:56:27] Info: Done                                                                                    
[12:56:28] Info: Clustering molecules...                                                                 
Progress: 100%|████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| Time: 0:00:01
  Iteration:                  60   
  Max. difference:            0.00232397696692227
  Fraction of probs changed:  0.558013757055482
[12:56:31] Info: Algorithm stopped after 60 iterations. Error: 0.00232. Converged: true.
[12:56:32] Info: Done
[12:56:33] Info: Initializing algorithm. Scale: 60, scale std: 15.0, initial #components: 36732, #molecules: 55099.
[12:56:38] Info: Using 2D coordinates                                                                    
Progress: 100%|████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| Time: 0:01:05           Iteration:        500                                                                                  
  Noise level, %:   4.96                                                                                                                                                                                             Num. components:  3109                                                                                                                                                                                           
[12:57:48] Info: Processing complete.        
[12:58:00] Info: Estimating local colors                                                                                                                                                                           [12:58:28] Info: Saving results to out_plot/segmentation.csv                                                                                                                                                       
[12:58:29] Info: Plot diagnostics                                                                        
[12:59:18] Error: MethodError(Makie.backend_show, (CairoMakie.CairoBackend(CairoMakie.PNG, "/home/user/.julia/packages/CairoMakie/mjJN1/src/display.png", 1.0, 0.75), IOContext(IOStream(<file out_plot/segmentation_diagnostics.html>)), MIME type text/html, Scene (600px, 400px):
|                   36 Plots:                                                                                                                                                                                      |                     ├ Makie.Poly{Tuple{Vector{Vector{GeometryBasics.Point{2, Float32}}}}}                                                                                                                        |                     ├ Makie.LineSegments{Tuple{Vector{GeometryBasics.Point{2, Float32}}}}
|                     ├ Makie.LineSegments{Tuple{Vector{GeometryBasics.Point{2, Float32}}}}
|                     ├ Makie.LineSegments{Tuple{Vector{GeometryBasics.Point{2, Float32}}}}
|                     ├ Makie.LineSegments{Tuple{Vector{GeometryBasics.Point{2, Float32}}}}              
|                     ├ Makie.LineSegments{Tuple{Vector{GeometryBasics.Point{2, Float32}}}}              
|                     ├ Makie.LineSegments{Tuple{Vector{GeometryBasics.Point{2, Float32}}}}              
|                     ├ Makie.Annotations{Tuple{Vector{Tuple{String, GeometryBasics.Point{2, Float32}}}}}                  
|                     ├ Makie.Text{Tuple{String}}                                                        
|                     ├ Makie.Lines{Tuple{Vector{GeometryBasics.Point{2, Float32}}}}
|                     ├ Makie.LineSegments{Tuple{Vector{GeometryBasics.Point{2, Float32}}}}
|                     ├ Makie.LineSegments{Tuple{Vector{GeometryBasics.Point{2, Float32}}}}              
|                     ├ Makie.Annotations{Tuple{Vector{Tuple{String, GeometryBasics.Point{2, Float32}}}}}                                                                                                          
|                     ├ Makie.Text{Tuple{String}}
|                     ├ Makie.Lines{Tuple{Vector{GeometryBasics.Point{2, Float32}}}}
|                     ├ Makie.Lines{Tuple{Vector{GeometryBasics.Point{2, Float32}}}}
|                     ├ Makie.Lines{Tuple{Vector{GeometryBasics.Point{2, Float32}}}}
|                     ├ Makie.Text{Tuple{String}}
|                     ├ Makie.Poly{Tuple{Vector{Vector{GeometryBasics.Point{2, Float32}}}}}
|                     ├ Makie.LineSegments{Tuple{Vector{GeometryBasics.Point{2, Float32}}}}
|                     ├ Makie.LineSegments{Tuple{Vector{GeometryBasics.Point{2, Float32}}}}
|                     ├ Makie.LineSegments{Tuple{Vector{GeometryBasics.Point{2, Float32}}}}
|                     ├ Makie.LineSegments{Tuple{Vector{GeometryBasics.Point{2, Float32}}}}
|                     ├ Makie.LineSegments{Tuple{Vector{GeometryBasics.Point{2, Float32}}}}
|                     ├ Makie.LineSegments{Tuple{Vector{GeometryBasics.Point{2, Float32}}}}
|                     ├ Makie.Annotations{Tuple{Vector{Tuple{String, GeometryBasics.Point{2, Float32}}}}} 
|                     ├ Makie.Text{Tuple{String}}
|                     ├ Makie.Lines{Tuple{Vector{GeometryBasics.Point{2, Float32}}}}
|                     ├ Makie.LineSegments{Tuple{Vector{GeometryBasics.Point{2, Float32}}}}
|                     ├ Makie.LineSegments{Tuple{Vector{GeometryBasics.Point{2, Float32}}}}
|                     ├ Makie.Annotations{Tuple{Vector{Tuple{String, GeometryBasics.Point{2, Float32}}}}} 
|                     ├ Makie.Text{Tuple{String}}
|                     ├ Makie.Lines{Tuple{Vector{GeometryBasics.Point{2, Float32}}}}
|                     ├ Makie.Lines{Tuple{Vector{GeometryBasics.Point{2, Float32}}}}
|                     ├ Makie.Lines{Tuple{Vector{GeometryBasics.Point{2, Float32}}}}
|                     └ Makie.Text{Tuple{String}}
|                   3 Child Scenes:
|                     ├ Scene (489px, 308px)
|                     ├ Scene (166px, 129px)
|                     └ Scene (180px, 150px)), 0x00000000000074ba)
|                 
|                 show(io::IOStream, m::MIME{Symbol("text/html")}, scene::Makie.Scene) at display.jl:117
|                 show(io::IOStream, m::MIME{Symbol("text/html")}, fig::Makie.Figure) at display.jl:106
|                 (::Baysor.var"#325#326"{NamedTuple{(:exprs, :assignment, :diffs, :assignment_probs, :change_fracs), Tuple{Matrix{Float64}, Vector{Int64}, Vector{Float64}, Matrix{Float64}, Vector{Float64}}}, No
thing, DataFrames.DataFrame, Vector{Int64}, Dict{Symbol, Any}})(io::IOStream) at cli_wrappers.jl:245
|                 open(::Baysor.var"#325#326"{NamedTuple{(:exprs, :assignment, :diffs, :assignment_probs, :change_fracs), Tuple{Matrix{Float64}, Vector{Int64}, Vector{Float64}, Matrix{Float64}, Vector{Float64}}}
, Nothing, DataFrames.DataFrame, Vector{Int64}, Dict{Symbol, Any}}, ::String, ::Vararg{String, N} where N; kwargs::Base.Iterators.Pairs{Union{}, Union{}, Tuple{}, NamedTuple{(), Tuple{}}}) at io.jl:330
|                 open at io.jl:328 [inlined]
|                 plot_diagnostics_panel(df_res::DataFrames.DataFrame, assignment::Vector{Int64}, tracer::Dict{Symbol, Any}, args::Dict{String, Any}; clust_res::NamedTuple{(:exprs, :assignment, :diffs, :assignme
nt_probs, :change_fracs), Tuple{Matrix{Float64}, Vector{Int64}, Vector{Float64}, Matrix{Float64}, Vector{Float64}}}, comp_segs::Nothing) at cli_wrappers.jl:224
|                 plot_diagnostics_panel at cli_wrappers.jl:223 [inlined]
|                 save_segmentation_results(bm_data::Baysor.BmmData{2}, 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 cli_wrappers.jl:492
|                 (::Baysor.var"#save_segmentation_results##kw")(::NamedTuple{(:mol_clusts, :comp_segs, :prior_polygons), Tuple{NamedTuple{(:exprs, :assignment, :diffs, :assignment_probs, :change_fracs), Tuple{M
atrix{Float64}, Vector{Int64}, Vector{Float64}, Matrix{Float64}, Vector{Float64}}}, Nothing, Vector{Matrix{Float64}}}}, ::typeof(Baysor.save_segmentation_results), bm_data::Baysor.BmmData{2}, gene_names::Vector{
String}, args::Dict{String, Any}) at cli_wrappers.jl:476
|                 run_cli_main(args::Vector{String}) at cli_wrappers.jl:557
|                 run_cli(args::Vector{String}) at cli_wrappers.jl:748
|                 run_cli() at cli_wrappers.jl:733
|                 top-level scope at baysor:3
|                 eval at boot.jl:360 [inlined]
|                 include_string(mapexpr::typeof(identity), mod::Module, code::String, filename::String) at loading.jl:1094
|                 _include(mapexpr::Function, mod::Module, _path::String) at loading.jl:1148
|                 include(mod::Module, _path::String) at Base.jl:386
|                 exec_options(opts::Base.JLOptions) at client.jl:285
|                 _start() at client.jl:485
└ Baysor /home/user/.julia/packages/Baysor/4K0to/src/cli_wrappers.jl:762

stack trace for baysor preview

baysor preview -x X -y Y -g gene coordinates.csv
[15:02:12] Info: (2021-06-03) Run Baysor v0.4.3
[15:02:12] Info: Loading data...
[15:02:22] Info: Loaded 55832 transcripts
[15:02:23] Info: Estimating noise level
[15:02:27] Info: Done
[15:02:27] Info: Estimating local neighborhoods
[15:02:27] Info: Estimating local colors
[15:03:03] Info: Building transcript plots
[15:03:40] Info: Building gene structure plot
[15:03:49] Info: Plotting
[15:03:51] Error: MethodError(Makie.backend_show, (CairoMakie.CairoBackend(CairoMakie.PNG, "/home/user/.julia/packages/CairoMakie/mjJN1/src/display.png", 1.0, 0.75), IOContext(IOStream(<file preview.html>)), MIME type text/html, Scene (2177px, 1809px):
|                   18 Plots:
|                     ├ Makie.Poly{Tuple{Vector{Vector{GeometryBasics.Point{2, Float32}}}}}
|                     ├ Makie.LineSegments{Tuple{Vector{GeometryBasics.Point{2, Float32}}}}
|                     ├ Makie.LineSegments{Tuple{Vector{GeometryBasics.Point{2, Float32}}}}
|                     ├ Makie.LineSegments{Tuple{Vector{GeometryBasics.Point{2, Float32}}}}
|                     ├ Makie.LineSegments{Tuple{Vector{GeometryBasics.Point{2, Float32}}}}
|                     ├ Makie.LineSegments{Tuple{Vector{GeometryBasics.Point{2, Float32}}}}
|                     ├ Makie.LineSegments{Tuple{Vector{GeometryBasics.Point{2, Float32}}}}
|                     ├ Makie.Annotations{Tuple{Vector{Tuple{String, GeometryBasics.Point{2, Float32}}}}}
|                     ├ Makie.Text{Tuple{String}}
|                     ├ Makie.Lines{Tuple{Vector{GeometryBasics.Point{2, Float32}}}}
|                     ├ Makie.LineSegments{Tuple{Vector{GeometryBasics.Point{2, Float32}}}}
|                     ├ Makie.LineSegments{Tuple{Vector{GeometryBasics.Point{2, Float32}}}}
|                     ├ Makie.Annotations{Tuple{Vector{Tuple{String, GeometryBasics.Point{2, Float32}}}}}
|                     ├ Makie.Text{Tuple{String}}
|                     ├ Makie.Lines{Tuple{Vector{GeometryBasics.Point{2, Float32}}}}
|                     ├ Makie.Lines{Tuple{Vector{GeometryBasics.Point{2, Float32}}}}
|                     ├ Makie.Lines{Tuple{Vector{GeometryBasics.Point{2, Float32}}}}
|                     └ Makie.Text{Tuple{String}}
|                   1 Child Scene:
|                     └ Scene (2106px, 1755px)), 0x00000000000074ba)
|                 
|                 show(io::IOStream, m::MIME{Symbol("text/html")}, scene::Makie.Scene) at display.jl:117
|                 show(io::IOStream, m::MIME{Symbol("text/html")}, fig::Makie.Figure) at display.jl:106
|                 (::Baysor.var"#347#348"{Dict{String, VegaLite.VLSpec}, Makie.Figure, Makie.Figure, Vector{Float64}})(io::IOStream) at cli_wrappers.jl:695
|                 open(::Baysor.var"#347#348"{Dict{String, VegaLite.VLSpec}, Makie.Figure, Makie.Figure, Vector{Float64}}, ::String, ::Vararg{String, N} where N; kwargs::Base.Iterators.Pairs{Union{}, Union{}, Tuple{}, NamedTuple{(), Tuple{}}}) at io.jl:330
|                 open(::Function, ::String, ::String) at io.jl:328
|                 run_cli_preview(args::Vector{String}) at cli_wrappers.jl:676
|                 run_cli(args::Vector{String}) at cli_wrappers.jl:752
|                 run_cli() at cli_wrappers.jl:733
|                 top-level scope at baysor:3
|                 eval at boot.jl:360 [inlined]
|                 include_string(mapexpr::typeof(identity), mod::Module, code::String, filename::String) at loading.jl:1094
|                 _include(mapexpr::Function, mod::Module, _path::String) at loading.jl:1148
|                 include(mod::Module, _path::String) at Base.jl:386
|                 exec_options(opts::Base.JLOptions) at client.jl:285
|                 _start() at client.jl:485
└ Baysor /home/user/.julia/packages/Baysor/4K0to/src/cli_wrappers.jl:762

Installation issue

Hi,

First of all, great package!

My issue: If I try to install using the mac binary I get the following message when trying to run the executable:
ERROR: System image file failed consistency check: maybe opened the wrong version?

If I try to install it using CLI, I notice the makefile downloads the linux version of julia and this messes everything up.

Any ideas how to solve this?

Thanks!

Out of memory error

Hello,

I got this out of memory error in processing a few times which prevents the creation of the output .csv file. Initially I noticed this happening when the -m value was small in which case there were many cells, but a few times, I have seen it happen for larger -m values as well. I am doing a comparison test, so I do need to run Baysor with different parameters. The parameters and log is below:

Run parameters:
./baysor run -p -x X -y Y --prior-segmentation-confidence 0.8 -m 75 -o /Users/jnmark/DAPI_prior_c0_8.csv /Users/jnmark/Reads/reads.csv /Users/jnmark/DAPI/DAPI_proc.tif

Log output:

┌ Warning: No config file provided. Using default parameters.
└ @ Baysor /home/vpetukhov/.julia/dev/Baysor/src/cli/main.jl:91
[08:52:38] Info: (2021-11-03) Run Baysor v0.5.0
[08:52:38] Info: Loading data...
[08:52:52] Info: Loaded 1882562 transcripts
[08:52:52] Info: Loading segmentation mask...
[08:54:27] Info: Done
[08:54:27] Info: Estimating prior segmentation polygons...
[09:41:06] Info: Done
[09:41:07] Info: Estimating noise level
[09:42:50] Info: Done
[09:44:00] Info: Clustering molecules...
Progress: 100%|█████████████████████████████████████████| Time: 0:07:18
  Iteration:                  407
  Max. difference:            0.008663200982013564
  Fraction of probs changed:  0.4727828353063538
[09:52:44] Info: Algorithm stopped after 407 iterations. Error: 0.00866. Converged: true.
[09:52:45] Info: Done
[09:52:46] Info: Initializing algorithm. Scale: 145.626501218387, scale std: 12.348453881948412, initial #components: 50200, #molecules: 1882562.
[09:52:57] Info: Using 2D coordinates
Progress: 100%|█████████████████████████████████████████| Time: 0:57:39
  Iteration:        500
  Noise level, %:   2.36
  Num. components:  4974
[10:51:31] Info: Processing complete.
[10:52:16] Info: Estimating local colors
[10:52:51] Error: OutOfMemoryError()
|                 
|                 Array at boot.jl:450 [inlined]
|                 Array at boot.jl:458 [inlined]
|                 Array at boot.jl:465 [inlined]
|                 similar at abstractarray.jl:785 [inlined]
|                 similar at abstractarray.jl:784 [inlined]
|                 similar at broadcast.jl:197 [inlined]
|                 similar at broadcast.jl:196 [inlined]
|                 copy at broadcast.jl:908 [inlined]
|                 materialize at broadcast.jl:883 [inlined]
|                 covm(x::Matrix{Float64}, xmean::Vector{Float64}, vardim::Int64; corrected::Bool) at Statistics.jl:545
|                 covm at Statistics.jl:545 [inlined]
|                 fit(::Type{MultivariateStats.PCA}, X::Matrix{Float64}; method::Symbol, maxoutdim::Int64, pratio::Float64, mean::Nothing) at pca.jl:152
|                 fit at pca.jl:138 [inlined]
|                 gene_composition_transformation(count_matrix::Matrix{Float64}, confidence::Vector{Float64}; sample_size::Int64, seed::Int64, method::Symbol, return_all::Bool, n_pcs::Int64, out_dim::Int64, kwargs::Base.Iterators.Pairs{Union{}, Union{}, Tuple{}, NamedTuple{(), Tuple{}}}) at neighborhood_composition.jl:68
|                 gene_composition_transformation at neighborhood_composition.jl:60 [inlined]
|                 gene_composition_colors(df_spatial::DataFrames.DataFrame, k::Int64; kwargs::Base.Iterators.Pairs{Union{}, Union{}, Tuple{}, NamedTuple{(), Tuple{}}}) at neighborhood_composition.jl:123
|                 gene_composition_colors at neighborhood_composition.jl:121 [inlined]
|                 save_segmentation_results(bm_data::Baysor.BmmData{2}, 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:393
|                 (::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{2}, gene_names::Vector{String}, args::Dict{String, Any}) at main.jl:389
|                 run_cli_main(args::Vector{String}) at main.jl:470
|                 run_cli(args::Vector{String}) at common.jl:118
|                 run_cli at common.jl:103 [inlined]
|                 julia_main at common.jl:139 [inlined]
|                 julia_main() at none:36
└ Baysor /home/vpetukhov/.julia/dev/Baysor/src/cli/common.jl:132

Thanks for the help!

Adjusting covariance

Hi, I am trying to reimplement this awesome method in R and ran into potential issues with computation of shrunken covariance:

First, the var_posterior function seems to add the shrinkage adjustment to the prior mean rather than to the eigenvalue. This is different from the paper. Interestingly, it does kind of have the intended effect by shrinking the prior towards the eigenvalue, rather than the other way around.

std_adj = (prior_std + sign(d_std) * (sqrt(abs(d_std) / prior_std_std + 1) - 1) * prior_std_std)

Second, when I implement the formulation from the paper, my shape estimates tend to diverge from the prior. I think this is because the formula reads eigval + sign(eigval - prior) * ..., which makes it so that we increase eigenvalues when eigenvalues exceed the prior and vice versa. I think this should be eigval - sign(eigval - prior) * ... to make the shrinkage move towards the prior.

Would love to hear your thoughts and thank you for this wonderful contribution to the field!

Best,
Ilya

Baysor: Method writeup?

Hi Victor,

This is very interesting work. Do you have details of your method written down that you could please share?
Thanks indeed.

Regards,
Sandhya

A question about prior segmentation

Hi @VPetukhov , I've got my cell segmentation plot after running baysor run with [PRIOR_SEGMENTATION] parameter and prior-segmentation-confidence = 1 parameter. And my prior segmentation file is processed under your recommendation, which uses ImagJ to perform watershed segmentation. A part of my plot is like this:
baysor
Does the yellow block correspond to DAPI nuclei? Or cell boundary? Why the cell boundary produced by baysor run is not totally covered by prior segmentation, even if I set prior-segmentation-confidence = 1 ?

A question about cell clustering

Hi @VPetukhov , I'd like to know some information about the cell clustering of Baysor:

  1. Are the cells clustered according to their transcriptomic composition?
  2. Can we adjust the number of clustering communities?
  3. Can we know the differentially expressed genes among different clusters?

Inconsistent cell number in the json file and cell stats file

Hi @VPetukhov
I wonder how to plot the cells (in polygon shapes) in the 2D tissue dimension after I finished clustering and cell type annotation. I saw that the zoom-in figure you showed in your Nature Biotech paper (figure3) is really amazing. I want to do the same with my own dataset.
I have successfully read the json file and make the plot but the cell number in the json file is inconsistent with that in the cell_stats file. Appreciated if you can help or give comments...
THanks!

Error when estimating boundaries

Hi there, I have tried running this on CentOS and MacOS and both instances, the run fails to estimate boundaries and I get the following error. The run still completes and generates the rest of the output files. Any thoughts or troubleshooting tips would be helpful. Thank you!

run parameters:
Baysor run -x x -y y -z z --gene gene -m 30 --n-clusters 3 -s 50 -p --save-polygons=geojson -o $OUTDIR$f $f

error:

[07:57:16] Info: Estimating boundary polygons
[07:58:54] Error: MethodError(Matrix{var"#s565"} where var"#s565"<:Unsigned, (Matrix{Int64}(undef, 0, 0),), 0x00000000000074c6)
|
| convert(#unused#::Type{Matrix{var"#s565"} where var"#s565"<:Unsigned}, a::Matrix{Int64}) at array.jl:532
| 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.find_grid_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_length::Int64, shape_method::Symbol, max_dev::Float64, bandwidth::Float64, exclude_labels::Vector{Int64}, kwargs::Base.Iterators.Pairs{Union{}, Union{}, Tuple{}, NamedTuple{(), 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"#330#334"{DataFrames.DataFrame, Vector{Int64}, Dict{String, Any}, Float64})(mask::BitVector) at main.jl:220
| #47 at ProgressMeter.jl:991 [inlined]
| iterate at generator.jl:47 [inlined]
| _collect(c::Vector{BitVector}, itr::Base.Generator{Vector{BitVector}, ProgressMeter.var"#47#50"{Distributed.RemoteChannel{Channel{Bool}}, Baysor.var"#330#334"{DataFrames.DataFrame, Vector{Int64}, Dict{String, Any}, Float64}}}, #unused#::Base.EltypeUnknown, isz::Base.HasShape{1}) at array.jl:695
| collect_similar(cont::Vector{BitVector}, itr::Base.Generator{Vector{BitVector}, ProgressMeter.var"#47#50"{Distributed.RemoteChannel{Channel{Bool}}, Baysor.var"#330#334"{DataFrames.DataFrame, Vector{Int64}, Dict{String, Any}, Float64}}}) at array.jl:606
| map(f::Function, A::Vector{BitVector}) at abstractarray.jl:2294
| macro expansion at ProgressMeter.jl:990 [inlined]
| macro expansion at task.jl:387 [inlined]
| macro expansion at ProgressMeter.jl:989 [inlined]
| macro expansion at task.jl:387 [inlined]
| progress_map(::Function, ::Vararg{Any, N} where N; mapfun::Function, progress::ProgressMeter.Progress, channel_bufflen::Int64, kwargs::Base.Iterators.Pairs{Union{}, Union{}, Tuple{}, NamedTuple{(), Tuple{}}}) at ProgressMeter.jl:982
| progress_map(::Function, ::Vararg{Any, N} where N) at ProgressMeter.jl:978
| 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:479
| run_cli(args::Vector{String}) at common.jl:118
| run_cli at common.jl:103 [inlined]
| julia_main at common.jl:139 [inlined]
| julia_main() at none:36
└ Baysor /home/runner/work/Baysor/Baysor/src/cli/common.jl:132

env:

LSB Version: :core-4.1-amd64:core-4.1-noarch:cxx-4.1-amd64:cxx-4.1-noarch:desktop-4.1-amd64:desktop-4.1-noarch:languages-4.1-amd64:languages-4.1-noarch:printing-4.1-amd64:printing-4.1-noarch
Distributor ID: CentOS
Description: CentOS Linux release 7.8.2003 (Core)
Release: 7.8.2003
Codename: Core

Providing cell segmentation as a cell label column

If I'm using a cell label column in the molecules table to give Baysor information about a prior segmentation, how would I indicate molecules that don't belong to any cell? Is this supported? I have a prior nuclei segmentation, but because it only includes nuclei there are many molecules outside the nuclei that aren't assigned to cells.

"column name :gene not found in the data frame"

Hi @VPetukhov,

I was trying to run Baysor on the released MERFISH liver dataset and since the entire set of spots is huge, I cropped a small section. When I apply Baysor on the cropped dataset, I encountered the error below:

Any insights into the issue would be much appreciated!

Thanks

 ../../../Projects/Baysor/bin/Baysor preview detected_transcripts_topleft_crop.csv 
[10:44:34] Info: # CLI params: `detected_transcripts_topleft_crop.csv`
[10:44:34] Info: (2022-09-09) Run Baysor v0.5.2
[10:44:34] Info: Loading data...
[10:44:44] Error: ArgumentError("column name :gene not found in the data frame")
|                 
|                 lookupname at index.jl:392 [inlined]
|                 getindex at index.jl:401 [inlined]
|                 getindex(df::DataFrames.DataFrame, #unused#::typeof(!), col_ind::Symbol) at dataframe.jl:525
|                 getproperty at abstractdataframe.jl:378 [inlined]
|                 read_spatial_df(data_path::String; x_col::Symbol, y_col::Symbol, z_col::Symbol, gene_col::Symbol, filter_cols::Bool) at spatial.jl:35
|                 read_spatial_df at spatial.jl:5 [inlined]
|                 load_df(data_path::String; min_molecules_per_gene::Int64, exclude_genes::Vector{String}, kwargs::Base.Iterators.Pairs{Symbol, Symbol, NTuple{4, Symbol}, NamedTuple{(:x_col, :y_col, :z_col, :gene_col), NTuple{4, Symbol}}}) at initialization.jl:191
|                 (::Baysor.var"#load_df##kw")(::NamedTuple{(:x_col, :y_col, :z_col, :gene_col, :min_molecules_per_gene, :exclude_genes), Tuple{Symbol, Symbol, Symbol, Symbol, Int64, Vector{String}}}, ::typeof(Baysor.load_df), data_path::String) at initialization.jl:191
|                 load_df(args::Dict{String, Any}; kwargs::Base.Iterators.Pairs{Union{}, Union{}, Tuple{}, NamedTuple{(), Tuple{}}}) at common.jl:81
|                 load_df(args::Dict{String, Any}) at common.jl:79
|                 run_cli_preview(args::Vector{String}) at preview.jl:82
|                 run_cli(args::Vector{String}) at common.jl:156
|                 run_cli() at common.jl:137
|                 top-level scope at Baysor:4
|                 eval at boot.jl:360 [inlined]
|                 include_string(mapexpr::typeof(identity), mod::Module, code::String, filename::String) at loading.jl:1116
|                 _include(mapexpr::Function, mod::Module, _path::String) at loading.jl:1170
|                 include(mod::Module, _path::String) at Base.jl:384
|                 exec_options(opts::Base.JLOptions) at client.jl:285
|                 _start() at client.jl:485
└ Baysor /data/gpfs/projects/punim0741/rlyu/Projects/Baysor/bin/.julia/packages/Baysor/K7Vqu/src/cli/common.jl:170

Error preparing example data

Hi Viktor,

I am trying to run the in https://github.com/kharchenkolab/Baysor/tree/master/examples/STARmap, however when I am trying to run convert_to_csv.jl I am getting following error,

$julia ../convert_to_csv.jl goodPoints.mat cell_barcode_names.csv labels.npz
[ Info: Read allen_brain/visual_1020/20180505_BY3_1kgenes/goodPoints.mat
[ Info: Read allen_brain/visual_1020/20180505_BY3_1kgenes/cell_barcode_names.csv
ERROR: LoadError: ArgumentError: provide a valid sink argument, like `using DataFrames; CSV.read(source, DataFrame)`
Stacktrace:
 [1] read(source::String, sink::Nothing; copycols::Bool, kwargs::Base.Iterators.Pairs{Symbol, Int64, Tuple{Symbol}, NamedTuple{(:header,), Tuple{Int64}}})
   @ CSV ~/.julia/packages/CSV/9LsxT/src/CSV.jl:89
 [2] top-level scope
   @ ~/Workplace/DART-fish/Baysor/examples/STARmap/convert_to_csv.jl:19
in expression starting at /home/hsarkar/Workplace/DART-fish/Baysor/examples/STARmap/convert_to_csv.jl:19

Did anything change since the example preprocessing is given?

No output when using 'color=:ncv_color' in plot_molecules

New to Julia over here, so this might be an easy problem to fix, but I was following the notebook from the introductory video and was not able to plot the segmentation over cells and the polygons using ':ncv_color' as the value for 'color' in 'plot_molecules':

image

Though

image

Any ideas of what is wrong?

About Multithreading / Parallelization

Hello!

Thank you very much for open-sourcing Baysor! This will help the scientific community for years to come.

I was running Baysor in our inhouse datasets and found that it takes a significant amount of time to run - hours. I also noticed that Baysor doesn't do parallel processing by default. It always attaches to one thread. Is there a way to parallelize the job?

I saw that in an old commit you had JULIA_NUM_THREADS=10; baysor run -n $JULIA_NUM_THREADS as an option. I was wondering if this is still valid. Do you have plans to include parallelism in the pipeline OR am I missing something in the API.
https://github.com/kharchenkolab/Baysor/tree/0f08daedfb1b909660df278eebe9de650954ff0c

Thank you,
Arun

Any idea about projecting cell type labels back to cell segmentation plot?

Hi, @VPetukhov. First of all, thanks for the convenience the Baysor has brought to my ISS study. After a full baysor run, I have obtained a beautiful cell segmentation plot and a useful expression matrix that I can use in the downstream scRNA-seq analysis.

As for scRNA-seq analysis tool, I think Seurat is stabler and more robust than pagoda2, though the latter provides a convenient web app to analyze my data. So I want to perform a standard scRNA-seq pipeline using Seurat and label each cell with a cell type. So is there any recommendation about projecting this result back to the cell segmentation plot created by Baysor? Otherwise, I have to simulate a segmentation plot using ggplot2.

Thanks for your kind reply!

Error estimating boundary polygons

I've gotten the same crash at the same point in processing twice which prevented the export of a GeoJSON file or cell shape plot. The run command and log output below:

Run parameters:
./Baysor/bin/baysor run -g gene -x global_x -y global_y -z global_z --plot --save-polygons GeoJSON -o ./baysor_output/[project name] ./data/[input file] :cell

Log output:

[15:15:00] Info: (2021-10-28) Run Baysor v0.5.0
[15:15:00] Info: Loading data...
[15:15:10] Info: Loaded 5347668 transcripts
[15:15:12] Info: Estimating noise level
[15:15:19] Warning: Only k-nn random field is supported for 3D data
└ Baysor /home/vpetukhov/.julia/dev/Baysor/src/data_processing/triangulation.jl:30
[15:16:57] Info: Done
[15:16:57] Warning: Only k-nn random field is supported for 3D data
└ Baysor /home/vpetukhov/.julia/dev/Baysor/src/data_processing/triangulation.jl:30
[15:18:09] Info: Clustering molecules...
[15:18:09] Warning: Only k-nn random field is supported for 3D data
└ Baysor /home/vpetukhov/.julia/dev/Baysor/src/data_processing/triangulation.jl:30
[15:25:13] Info: Algorithm stopped after 263 iterations. Error: 0.00955. Converged: true.
[15:25:15] Info: Done
[15:25:16] Info: Initializing algorithm. Scale: 3.2142932583089294, scale std: 1.0218244756990273, initial #components: 3565112, #molecules: 5347668.
[15:27:19] Info: Using 3D coordinates
[20:40:46] Info: Processing complete.
[20:42:40] Info: Estimating local colors
[20:48:34] Info: Saving results to ./baysor_output/[project name]
[20:49:12] Info: Plot diagnostics
[20:49:50] Info: Estimating boundary polygons
[20:55:50] Error: InexactError(:trunc, UInt16, 65540)
|                 
|                 throw_inexacterror(f::Symbol, #unused#::Type{UInt16}, val::Int64) at boot.jl:602
|                 checked_trunc_uint at boot.jl:632 [inlined]
|                 toUInt16 at boot.jl:705 [inlined]
|                 UInt16 at boot.jl:755 [inlined]
|                 convert at number.jl:7 [inlined]
|                 setindex! at array.jl:841 [inlined]
|                 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:208
|                 (::Baysor.var"#find_grid_point_labels_kde##kw")(::NamedTuple{(:grid_step, :bandwidth), Tuple{Float64, Float64}}, ::typeof(Baysor.find_grid_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_length::Int64, shape_method::Symbol, max_dev::Float64, bandwidth::Float64, exclude_labels::Vector{Int64}, kwargs::Base.Iterators.Pairs{Union{}, Union{}, Tuple{}, NamedTuple{(), Tuple{}}}) at boundary_estimation.jl:263
|                 boundary_polygons at boundary_estimation.jl:254 [inlined]
|                 #boundary_polygons#217 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:215
|                 #47 at ProgressMeter.jl:991 [inlined]
|                 iterate at generator.jl:47 [inlined]
|                 _collect(c::Vector{BitVector}, itr::Base.Generator{Vector{BitVector}, ProgressMeter.var"#47#50"{Distributed.RemoteChannel{Channel{Bool}}, Baysor.var"#333#337"{DataFrames.DataFrame, Vector{Int64}, Dict{String, Any}, Float64}}}, #unused#::Base.EltypeUnknown, isz::Base.HasShape{1}) at array.jl:691
|                 collect_similar(cont::Vector{BitVector}, itr::Base.Generator{Vector{BitVector}, ProgressMeter.var"#47#50"{Distributed.RemoteChannel{Channel{Bool}}, Baysor.var"#333#337"{DataFrames.DataFrame, Vector{Int64}, Dict{String, Any}, Float64}}}) at array.jl:606
|                 map(f::Function, A::Vector{BitVector}) at abstractarray.jl:2294
|                 macro expansion at ProgressMeter.jl:990 [inlined]
|                 macro expansion at task.jl:382 [inlined]
|                 macro expansion at ProgressMeter.jl:989 [inlined]
|                 macro expansion at task.jl:382 [inlined]
|                 progress_map(::Function, ::Vararg{Any, N} where N; mapfun::Function, progress::ProgressMeter.Progress, channel_bufflen::Int64, kwargs::Base.Iterators.Pairs{Union{}, Union{}, Tuple{}, NamedTuple{(), Tuple{}}}) at ProgressMeter.jl:982
|                 progress_map(::Function, ::Vararg{Any, N} where N) at ProgressMeter.jl:978
|                 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:215
|                 (::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:200
|                 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:406
|                 (::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:389
|                 run_cli_main(args::Vector{String}) at main.jl:470
|                 run_cli(args::Vector{String}) at common.jl:118
|                 run_cli at common.jl:103 [inlined]
|                 julia_main at common.jl:139 [inlined]
|                 julia_main() at none:36
└ Baysor /home/vpetukhov/.julia/dev/Baysor/src/cli/common.jl:132

Environment is Ubuntu 20.04.2, Baysor was running in a screen 4.08.00 session.

Installation Issue

Hi @VPetukhov

When installing the Baysor by Building CLI application from source, I got the error: The manifest file you are using was most likely generated by a different version of Julia and is not compatible with this Julia version. More details are shown as follows:

Stacktrace:
[1] load_urls(ctx::Pkg.Types.Context, pkgs::Vector{Pkg.Types.PackageSpec})
@ Pkg.Operations /buildworker/worker/package_linux64/build/usr/share/julia/stdlib/v1.6/Pkg/src/Operations.jl:545
[2] #download_source#57
@ /buildworker/worker/package_linux64/build/usr/share/julia/stdlib/v1.6/Pkg/src/Operations.jl:733 [inlined]
[3] download_source
@ /buildworker/worker/package_linux64/build/usr/share/julia/stdlib/v1.6/Pkg/src/Operations.jl:732 [inlined]
[4] instantiate(ctx::Pkg.Types.Context; manifest::Nothing, update_registry::Bool, verbose::Bool, platform::Base.BinaryPlatforms.Platform, allow_build::Bool, allow_autoprecomp::Bool, kwargs::Base.Iterators.Pairs{Union{}, Union{}, Tuple{}, NamedTuple{(), Tuple{}}})
@ Pkg.API /buildworker/worker/package_linux64/build/usr/share/julia/stdlib/v1.6/Pkg/src/API.jl:1408
[5] instantiate
@ /buildworker/worker/package_linux64/build/usr/share/julia/stdlib/v1.6/Pkg/src/API.jl:1325 [inlined]
[6] #instantiate#252
@ /buildworker/worker/package_linux64/build/usr/share/julia/stdlib/v1.6/Pkg/src/API.jl:1321 [inlined]
[7] instantiate()
@ Pkg.API /buildworker/worker/package_linux64/build/usr/share/julia/stdlib/v1.6/Pkg/src/API.jl:1321
[8] top-level scope
@ none:1
make: *** [/home/anaconda3/envs/baysor/Baysor-0.5.2/bin/julia-1.6.4//../BaysorSysimage.so] Error 1

System information: Linux version 5.10.120-1.el7.x86_64 (rpmbuild@compile-rh7) (gcc (GCC) 9.3.1 20200408 (Red Hat 9.3.1-2), GNU ld version 2.32-16.el7) #1

I would really appreciate it if you could help or give some advice.

Best
YW

How to change color in plot_molecules

Dear @VPetukhov ,
If I don't like the default color in the :ncv_color column of the df_spatial DataFrame, how can I change it to a customized color palette? I really like to use Baysor but my Julia skill is at baby stage so far. Thanks in advance!
Zhang

Using Known Cell Types from scRNA seq data?

Hello,

Based on the biorxiv paper, it is suggested that Baysor can use known known cluster definitions from scRNA seq data. I dont see any option to integrate scRNA seq data in the docs though. Is this no longer a possible implementation?

Using [PRIOR_SEGMENTATION] table when not all transcripts are assigned

I am interested in using Baysor to improve my segmentation results after running a basic thresholding and watershed segmentation. The output of this segmentation is a csv file with a column where some transcripts receive cell assignments, and many are left as nan. Is there a way to specify that some transcripts do not have a prior? Inputting the table as-is results in the following error.

# baysor run -x xc -y yc -z zc --gene target /var/data.csv :cell_id
┌ Warning: No config file provided. Using default parameters.
└ @ Baysor ~/.julia/packages/Baysor/RVP5y/src/cli/main.jl:91
[23:31:59] Info: (2022-01-03) Run Baysor v0.5.0
[23:31:59] Info: Loading data...
[23:32:22] Info: Loaded 6516 transcripts
[23:32:24] Error: ErrorException("The prior segmentation column 'cell_id' must be of integer type")
|
|                 error(s::String) at error.jl:33
|                 parse_prior_assignment(df_spatial::DataFrames.DataFrame, args::Dict{String, Any}) at main.jl:253
|                 load_prior_segmentation(df_spatial::DataFrames.DataFrame, args::Dict{String, Any}) at main.jl:273
|                 load_and_preprocess_data!(args::Dict{String, Any}) at main.jl:330
|                 run_cli_main(args::Vector{String}) at main.jl:433
|                 run_cli(args::Vector{String}) at common.jl:118
|                 run_cli() at common.jl:103
|                 top-level scope at baysor:4
|                 eval at boot.jl:360 [inlined]
|                 include_string(mapexpr::typeof(identity), mod::Module, code::String, filename::String) at loading.jl:1094
|                 _include(mapexpr::Function, mod::Module, _path::String) at loading.jl:1148
|                 include(mod::Module, _path::String) at Base.jl:386
|                 exec_options(opts::Base.JLOptions) at client.jl:285
|                 _start() at client.jl:485
└ Baysor /root/.julia/packages/Baysor/RVP5y/src/cli/common.jl:132

I see that there is the prior-segmentation-confidence parameter, but is this for the entire prior segmentation? Or is there a way to assign it per item or per cell_id?

Issue with MacOS binaries

Hello, I am having trouble using the MacOS binaries, getting the following message. Any ideas?

./baysor --help
Two passes with the same argument (-LowerPTLS) attempted to be registered!
zsh: illegal hardware instruction ./baysor --help

Errors about boundary_polygons

Hi, I'm using the Julia-1.7.0 on ubuntu and successfully ran the Baysor for the first few steps.

However, when I want to analyze the boundary using the following codes:

grid_step = 1.0
@time polygons = B.boundary_polygons(df_spatial, df_spatial.cell, grid_step=grid_step);
length(polygons)

I got:

MethodError: no method matching kruskal_mst(::SimpleWeightedGraph{Int64, Float64})
Closest candidates are:
kruskal_mst(::AG) where {U, AG<:LightGraphs.AbstractGraph{U}} at ~/.julia/packages/SimpleTraits/l1ZsK/src/SimpleTraits.jl:338
kruskal_mst(::AG, ::AbstractMatrix{T}; kwargs...) where {T<:Real, U, AG<:LightGraphs.AbstractGraph{U}} at ~/.julia/packages/SimpleTraits/l1ZsK/src/SimpleTraits.jl:338
kruskal_mst(::Type{SimpleTraits.Not{LightGraphs.IsDirected{AG}}}, ::AG, ::AbstractMatrix{T}; minimize) where {T<:Real, U, AG<:LightGraphs.AbstractGraph{U}} at ~/.julia/packages/LightGraphs/IgJif/src/spanningtrees/kruskal.jl:12

Stacktrace:
[1] border_mst(border_points::Vector{Vector{UInt32}}; min_edge_length::Float64, max_edge_length::Float64)
@ Baysor ~/.julia/packages/Baysor/Kag1d/src/data_processing/boundary_estimation.jl:65
[2] border_mst(border_points::Vector{Vector{UInt32}})
@ Baysor ~/.julia/packages/Baysor/Kag1d/src/data_processing/boundary_estimation.jl:42
[3] _broadcast_getindex_evalf
@ ./broadcast.jl:670 [inlined]
[4] _broadcast_getindex
@ ./broadcast.jl:643 [inlined]
[5] getindex
@ ./broadcast.jl:597 [inlined]
[6] copy
@ ./broadcast.jl:899 [inlined]
[7] materialize
@ ./broadcast.jl:860 [inlined]
[8] extract_polygons_from_label_grid(grid_labels::Matrix{UInt32}; min_border_length::Int64, shape_method::Symbol, max_dev::Float64, exclude_labels::Vector{Int64}, offset::Vector{Float64}, grid_step::Float64)
@ Baysor ~/.julia/packages/Baysor/Kag1d/src/data_processing/boundary_estimation.jl:231
[9] boundary_polygons(pos_data::Matrix{Float64}, cell_labels::Vector{Int64}; min_x::Nothing, max_x::Nothing, grid_step::Float64, min_border_length::Int64, shape_method::Symbol, max_dev::Float64, bandwidth::Float64, exclude_labels::Vector{Int64}, kwargs::Base.Pairs{Symbol, Union{}, Tuple{}, NamedTuple{(), Tuple{}}})
@ Baysor ~/.julia/packages/Baysor/Kag1d/src/data_processing/boundary_estimation.jl:270
[10] #boundary_polygons#214
@ ~/.julia/packages/Baysor/Kag1d/src/data_processing/boundary_estimation.jl:248 [inlined]
[11] top-level scope
@ ./timing.jl:220 [inlined]
[12] top-level scope
@ ./In[89]:0
[13] eval
@ ./boot.jl:373 [inlined]
[14] include_string(mapexpr::typeof(REPL.softscope), mod::Module, code::String, filename::String)
@ Base ./loading.jl:1196

Is that because I'm using the wrong versions of dependency packages?

Thank you in advance! :)

installing version 0.4.3

Hi, I'm trying to install the latest version 0.4.3 and I'm getting an error (using AWS Sagemaker). I ran

git clone https://github.com/kharchenkolab/Baysor.git
cd Baysor/bin
make

It appeared to finishing running the make command but running $ ./baysor run --help gives an error that starts with

fatal: error thrown and no exception handler available.
InitError(mod=:XML2_jll, error=ErrorException("Artifact "XML2" was not installed correctly. Try `using Pkg; Pkg.instantiate()` to re-install all missing resources."))
error at ./error.jl:33

Dataset Preview Issue

Hello, when I used my own data for preview, I met the following error, please how to solve it

[19:02:47] Info: (2021-10-31) Run Baysor v0.5.0
[19:02:47] Info: Loading data...
[19:02:59] Info: Loaded 122333 transcripts
[19:02:59] Info: Estimating noise level
[19:03:09] Error: ArgumentError("Normal: the condition σ >= zero(σ) is not satisfied.")
|
| macro expansion at utils.jl:6 [inlined]
| #Normal#109 at normal.jl:37 [inlined]
| Normal at normal.jl:37 [inlined]
| (::Baysor.var"#132#133"{Vector{Int64}, Vector{Float64}, Matrix{Float64}})(i::Int64) at none:0
| iterate at generator.jl:47 [inlined]
| indexed_iterate at tuple.jl:89 [inlined]
| fit_noise_probabilities(edge_lengths::Vector{Float64}, adjacent_points::Vector{Vector{Int64}}, adjacent_weights::Vector{Vector{Float64}}; min_confidence::Nothing, max_iters::Int64, tol::Float64, verbose::Bool, progress::Nothing) at noise_estimation.jl:59
| fit_noise_probabilities at noise_estimation.jl:38 [inlined]
| append_confidence!(df_spatial::DataFrames.DataFrame, prior_assignment::Nothing; nn_id::Int64, prior_confidence::Float64) at noise_estimation.jl:110
| append_confidence! at noise_estimation.jl:104 [inlined]
| (::Baysor.var"#append_confidence!##kw")(::NamedTuple{(:nn_id,), Tuple{Int64}}, ::typeof(Baysor.append_confidence!), df_spatial::DataFrames.DataFrame) at noise_estimation.jl:104
| run_cli_preview(args::Vector{String}) at preview.jl:88
| run_cli(args::Vector{String}) at common.jl:122
| run_cli at common.jl:103 [inlined]
| julia_main at common.jl:139 [inlined]
| julia_main() at none:36
└ Baysor /home/vpetukhov/.julia/dev/Baysor/src/cli/common.jl:132

Build CLI from source error

I am attempting to make the Baysor CLI from source without having Julia installed. I entered the commands on the front page of the repo

git clone https://github.com/kharchenkolab/Baysor.git
cd Baysor/bin
make

And produce the following trace

petar@/projects/petar/baysor_from_source/Baysor/bin$ make
make: Warning: File `Makefile' has modification time 26 s in the future
wget https://julialang-s3.julialang.org/bin/linux/x64/1.6/julia-1.6.4-linux-x86_64.tar.gz
--2022-08-02 14:27:24--  https://julialang-s3.julialang.org/bin/linux/x64/1.6/julia-1.6.4-linux-x86_64.tar.gz
Resolving julialang-s3.julialang.org (julialang-s3.julialang.org)... 151.101.2.49, 151.101.66.49, 151.101.130.49, ...
Connecting to julialang-s3.julialang.org (julialang-s3.julialang.org)|151.101.2.49|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 113341695 (108M) [application/x-tar]
Saving to: ‘julia-1.6.4-linux-x86_64.tar.gz’

100%[================================================================================================================================================================>] 113,341,695  215MB/s   in 0.5s

2022-08-02 14:27:25 (215 MB/s) - ‘julia-1.6.4-linux-x86_64.tar.gz’ saved [113341695/113341695]

rm -rf /nfsdata/projects/petar/baysor_from_source/Baysor/bin/julia-1.6.4/
tar xf julia-1.6.4-linux-x86_64.tar.gz && touch /nfsdata/projects/petar/baysor_from_source/Baysor/bin/julia-1.6.4//bin/julia_success
mkdir -p /nfsdata/projects/petar/baysor_from_source/Baysor/bin/.julia/
echo 'empty!(DEPOT_PATH); push!(DEPOT_PATH, "/nfsdata/projects/petar/baysor_from_source/Baysor/bin/.julia/")' >> /nfsdata/projects/petar/baysor_from_source/Baysor/bin/julia-1.6.4//etc/julia/startup.jl
/nfsdata/projects/petar/baysor_from_source/Baysor/bin/julia-1.6.4//bin/julia -e 'using Pkg; Pkg.add(PackageSpec(url="https://github.com/kharchenkolab/Baysor.git")); Pkg.add(Pkg.PackageSpec(name="PackageCompiler", version="2.0.2"));'
     Cloning git-repo `https://github.com/kharchenkolab/Baysor.git`
    Updating git-repo `https://github.com/kharchenkolab/Baysor.git`
   Resolving package versions...
julia version requirement for package `Baysor [cc9f9468]` not satisfied
  Installing known registries into `/nfsdata/projects/petar/baysor_from_source/Baysor/bin/.julia/`


       Added registry `General` to `/nfsdata/projects/petar/baysor_from_source/Baysor/bin/.julia/registries/General`
   Installed OpenEXR_jll ───────────────── v3.1.1+0
   Installed Glib_jll ──────────────────── v2.68.3+2
   Installed ImageQualityIndexes ───────── v0.3.3
   Installed PCRE_jll ──────────────────── v8.44.0+0
   Installed Formatting ────────────────── v0.4.2
   Installed LogExpFunctions ───────────── v0.3.17
   Installed PNGFiles ──────────────────── v0.3.16
   Installed FixedPointNumbers ─────────── v0.8.4
   Installed HDF5_jll ──────────────────── v1.12.2+1
   Installed x264_jll ──────────────────── v2021.5.5+0
   Installed DataValueInterfaces ───────── v1.0.0
   Installed NearestNeighborDescent ────── v0.3.5
   Installed Distributions ─────────────── v0.25.66
   Installed LaTeXStrings ──────────────── v1.3.0
   Installed IntegralArrays ────────────── v0.1.5
   Installed JSON ──────────────────────── v0.21.3
   Installed Vega ──────────────────────── v2.3.1
   Installed StructArrays ──────────────── v0.6.11
   Installed ConstructionBase ──────────── v1.4.0
   Installed MetaGraphs ────────────────── v0.7.1
   Installed libass_jll ────────────────── v0.15.1+0
   Installed OpenEXR ───────────────────── v0.3.2
   Installed ChangesOfVariables ────────── v0.1.4
   Installed TableTraitsUtils ──────────── v1.0.2
   Installed Xorg_libXext_jll ──────────── v1.3.4+4
   Installed OrderedCollections ────────── v1.4.1
   Installed MappedArrays ──────────────── v0.4.1
   Installed FFTViews ──────────────────── v0.3.2
   Installed Graphics ──────────────────── v1.1.2
   Installed HDF5 ──────────────────────── v0.16.10
   Installed ProgressMeter ─────────────── v1.7.2
   Installed StatsAPI ──────────────────── v1.2.2
   Installed Distances ─────────────────── v0.10.7
   Installed Inflate ───────────────────── v0.1.2
   Installed Gettext_jll ───────────────── v0.21.0+0
   Installed LoggingExtras ─────────────── v0.4.9
   Installed SIMD ──────────────────────── v3.4.1
   Installed TiffImages ────────────────── v0.6.0
   Installed Rmath_jll ─────────────────── v0.3.0+0
   Installed XML2_jll ──────────────────── v2.9.14+0
   Installed Calculus ──────────────────── v0.5.1
   Installed ImageTransformations ──────── v0.9.5
   Installed IntervalSets ──────────────── v0.7.1
   Installed ColorTypes ────────────────── v0.11.4
   Installed VoronoiDelaunay ───────────── v0.4.3
   Installed ImageShow ─────────────────── v0.3.6
   Installed Cairo ─────────────────────── v1.0.5
   Installed SignedDistanceFields ──────── v0.4.0
   Installed AxisArrays ────────────────── v0.4.6
   Installed PolygonOps ────────────────── v0.1.2
   Installed JpegTurbo_jll ─────────────── v2.1.2+0
   Installed Crayons ───────────────────── v4.1.1
   Installed libpng_jll ────────────────── v1.6.38+0
   Installed MbedTLS ───────────────────── v1.1.2
   Installed IteratorInterfaceExtensions ─ v1.0.0
   Installed ArrayInterfaceCore ────────── v0.1.16
   Installed CodecZlib ─────────────────── v0.7.0
   Installed LERC_jll ──────────────────── v3.0.0+1
   Installed Requires ──────────────────── v1.3.0
   Installed Netpbm ────────────────────── v1.0.2
   Installed ImageSegmentation ─────────── v1.7.0
   Installed Fontconfig_jll ────────────── v2.13.93+0
   Installed DensityInterface ──────────── v0.4.0
   Installed HypergeometricFunctions ───── v0.3.11
   Installed Parameters ────────────────── v0.12.3
   Installed QOI ───────────────────────── v1.0.0
   Installed InvertedIndices ───────────── v1.1.0
   Installed FreeType2_jll ─────────────── v2.10.4+0
   Installed SentinelArrays ────────────── v1.3.13
   Installed Xorg_libxcb_jll ───────────── v1.13.0+3
   Installed Opus_jll ──────────────────── v1.3.2+0
   Installed Xorg_libXdmcp_jll ─────────── v1.1.3+4
   Installed Preferences ───────────────── v1.3.0
   Installed FillArrays ────────────────── v0.13.2
   Installed InlineStrings ─────────────── v1.1.4
   Installed SpecialFunctions ──────────── v2.1.7
   Installed ScanByte ──────────────────── v0.3.3
   Installed Libtiff_jll ───────────────── v4.4.0+0
   Installed ImageBase ─────────────────── v0.1.5
   Installed Xorg_libXau_jll ───────────── v1.0.9+4
   Installed AbstractFFTs ──────────────── v1.2.1
   Installed URIs ──────────────────────── v1.4.0
   Installed RegionTrees ───────────────── v0.3.2
   Installed NodeJS ────────────────────── v1.3.0
   Installed CustomUnitRanges ──────────── v1.0.2
   Installed DiffResults ───────────────── v1.0.3
   Installed DiffRules ─────────────────── v1.11.0
   Installed GeometricalPredicates ─────── v0.4.2
   Installed ImageMetadata ─────────────── v0.9.8
   Installed JLD2 ──────────────────────── v0.4.22
   Installed RangeArrays ───────────────── v0.3.2
   Installed Graphs ────────────────────── v1.7.1
   Installed StatsBase ─────────────────── v0.33.20
   Installed Imath_jll ─────────────────── v3.1.2+0
   Installed Quaternions ───────────────── v0.5.6
   Installed FFMPEG ────────────────────── v0.4.1
   Installed ImageCore ─────────────────── v0.9.4
   Installed MosaicViews ───────────────── v0.3.3
   Installed ImageFiltering ────────────── v0.7.1
   Installed Pixman_jll ────────────────── v0.40.1+0
   Installed DataFrames ────────────────── v1.3.4
   Installed PkgVersion ────────────────── v0.1.1
   Installed UnPack ────────────────────── v1.0.2
   Installed IterTools ─────────────────── v1.4.0
   Installed OptimBase ─────────────────── v2.0.2
   Installed Sixel ─────────────────────── v0.1.2
   Installed Showoff ───────────────────── v1.0.3
   Installed OffsetArrays ──────────────── v1.12.7
   Installed LightGraphs ───────────────── v1.3.5
   Installed PaddedViews ───────────────── v0.5.11
   Installed Adapt ─────────────────────── v3.4.0
   Installed Libgpg_error_jll ──────────── v1.42.0+0
   Installed IndirectArrays ────────────── v1.0.0
   Installed ColorBrewer ───────────────── v0.4.0
   Installed AbstractTrees ─────────────── v0.4.2
   Installed MakieCore ─────────────────── v0.3.6
   Installed TensorCore ────────────────── v0.1.1
   Installed ImageMagick_jll ───────────── v6.9.10-12+3
   Installed Tables ────────────────────── v1.7.0
   Installed Packing ───────────────────── v0.4.2
   Installed Rmath ─────────────────────── v0.7.0
   Installed Automa ────────────────────── v0.8.2
   Installed Graphite2_jll ─────────────── v1.3.14+0
   Installed FFTW_jll ──────────────────── v3.3.10+0
   Installed Grisu ─────────────────────── v1.0.2
   Installed ArnoldiMethod ─────────────── v0.1.0
   Installed FreeType ──────────────────── v4.0.0
   Installed LZO_jll ───────────────────── v2.10.1+0
   Installed QuadGK ────────────────────── v2.4.2
   Installed PooledArrays ──────────────── v1.4.2
   Installed StackViews ────────────────── v0.1.1
   Installed x265_jll ──────────────────── v3.5.0+0
   Installed InverseFunctions ──────────── v0.1.7
   Installed libvorbis_jll ─────────────── v1.3.7+1
   Installed libsixel_jll ──────────────── v1.8.6+1
   Installed Missings ──────────────────── v1.0.2
   Installed Xorg_xtrans_jll ───────────── v1.4.0+3
   Installed MultivariateStats ─────────── v0.9.1
   Installed FFTW ──────────────────────── v1.5.0
   Installed StatsFuns ─────────────────── v1.0.1
   Installed DualNumbers ───────────────── v0.6.8
   Installed Bzip2_jll ─────────────────── v1.0.8+0
   Installed JpegTurbo ─────────────────── v0.1.1
   Installed WeakRefStrings ────────────── v1.4.2
   Installed SimpleTraits ──────────────── v0.9.4
   Installed StaticArraysCore ──────────── v1.0.1
   Installed OpenSSL_jll ───────────────── v1.1.17+0
   Installed MathTeXEngine ─────────────── v0.4.3
   Installed FriBidi_jll ───────────────── v1.0.10+0
   Installed DataStructures ────────────── v0.18.13
   Installed CoordinateTransformations ─── v0.6.2
   Installed RelocatableFolders ────────── v0.3.0
   Installed EarCut_jll ────────────────── v2.2.3+0
   Installed MacroTools ────────────────── v0.5.9
   Installed Xorg_libpthread_stubs_jll ─── v0.1.0+3
   Installed AxisAlgorithms ────────────── v1.0.1
   Installed DataAPI ───────────────────── v1.10.0
   Installed FiniteDiff ────────────────── v2.14.0
   Installed SimpleBufferStream ────────── v1.1.0
   Installed StaticArrays ──────────────── v1.5.2
   Installed LazyModules ───────────────── v0.3.1
   Installed FFMPEG_jll ────────────────── v4.4.2+0
   Installed NearestNeighbors ──────────── v0.4.11
   Installed CSV ───────────────────────── v0.10.4
   Installed Animations ────────────────── v0.4.1
   Installed ForwardDiff ───────────────── v0.10.30
   Installed IniFile ───────────────────── v0.5.1
   Installed NaNMath ───────────────────── v1.0.1
   Installed PlotUtils ─────────────────── v1.3.0
   Installed Libgcrypt_jll ─────────────── v1.8.7+0
   Installed Rotations ─────────────────── v1.3.1
   Installed URIParser ─────────────────── v0.4.1
   Installed Ogg_jll ───────────────────── v1.3.5+1
   Installed MAT ───────────────────────── v0.10.3
   Installed BufferedStreams ───────────── v1.1.0
   Installed ColorVectorSpace ──────────── v0.9.9
   Installed Compat ────────────────────── v3.45.0
   Installed CommonSubexpressions ──────── v0.3.0
   Installed Libuuid_jll ───────────────── v2.36.0+0
   Installed Parsers ───────────────────── v2.3.2
   Installed JLLWrappers ───────────────── v1.4.1
   Installed PDMats ────────────────────── v0.11.16
   Installed Libffi_jll ────────────────── v3.2.2+1
   Installed HTTP ──────────────────────── v1.2.0
   Installed SortingAlgorithms ─────────── v1.0.1
   Installed CairoMakie ────────────────── v0.8.12
   Installed FilePaths ─────────────────── v0.8.3
   Installed WoodburyMatrices ──────────── v0.5.5
   Installed Libiconv_jll ──────────────── v1.16.1+1
   Installed ComputationalResources ────── v0.3.2
   Installed LsqFit ────────────────────── v0.12.1
   Installed ArgParse ──────────────────── v1.1.4
   Installed NLSolversBase ─────────────── v7.8.2
   Installed Pango_jll ─────────────────── v1.50.3+0
   Installed ImageMagick ───────────────── v1.2.2
   Installed UMAP ──────────────────────── v0.1.9
   Installed ImageDistances ────────────── v0.2.16
   Installed Xorg_libXrender_jll ───────── v0.9.10+4
   Installed CatIndices ────────────────── v0.2.2
   Installed Contour ───────────────────── v0.6.2
   Installed GridLayoutBase ────────────── v0.9.0
   Installed libfdk_aac_jll ────────────── v2.0.2+0
   Installed Arpack ────────────────────── v0.5.3
   Installed FreeTypeAbstraction ───────── v0.9.9
   Installed Images ────────────────────── v0.25.2
   Installed isoband_jll ───────────────── v0.2.3+0
   Installed Cairo_jll ─────────────────── v1.16.1+1
   Installed ImageContrastAdjustment ───── v0.3.10
   Installed Xorg_libX11_jll ───────────── v1.6.9+4
   Installed Reexport ──────────────────── v1.2.2
   Installed ColorSchemes ──────────────── v3.19.0
   Installed Match ─────────────────────── v1.2.0
   Installed Zstd_jll ──────────────────── v1.5.2+0
   Installed Observables ───────────────── v0.5.1
   Installed DocStringExtensions ───────── v0.9.1
   Installed Clustering ────────────────── v0.14.2
   Installed IrrationalConstants ───────── v0.1.1
   Installed PrettyTables ──────────────── v1.3.1
   Installed Expat_jll ─────────────────── v2.4.8+0
   Installed Isoband ───────────────────── v0.1.1
   Installed UnicodeFun ────────────────── v0.4.1
   Installed Colors ────────────────────── v0.12.8
   Installed FilePathsBase ─────────────── v0.9.18
   Installed VegaLite ──────────────────── v2.6.0
   Installed GeometryBasics ────────────── v0.4.2
   Installed libaom_jll ────────────────── v3.4.0+0
   Installed SimpleWeightedGraphs ──────── v1.2.1
   Installed ImageMorphology ───────────── v0.3.2
   Installed TiledIteration ────────────── v0.3.1
   Installed JSONSchema ────────────────── v1.0.1
   Installed Ratios ────────────────────── v0.4.3
   Installed OpenSpecFun_jll ───────────── v0.5.5+0
   Installed TableTraits ───────────────── v1.0.1
   Installed HarfBuzz_jll ──────────────── v2.8.1+1
   Installed XSLT_jll ──────────────────── v1.1.34+0
   Installed Libmount_jll ──────────────── v2.35.0+0
   Installed DataValues ────────────────── v0.4.13
   Installed MKL_jll ───────────────────── v2022.0.0+0
   Installed Arpack_jll ────────────────── v3.5.0+3
   Installed CEnum ─────────────────────── v0.4.2
   Installed TextWrap ──────────────────── v1.0.1
   Installed LAME_jll ──────────────────── v3.100.1+0
   Installed ImageAxes ─────────────────── v0.6.10
   Installed FileIO ────────────────────── v1.15.0
   Installed IntelOpenMP_jll ───────────── v2018.0.3+2
   Installed Setfield ──────────────────── v1.0.0
   Installed ChainRulesCore ────────────── v1.15.3
   Installed KernelDensity ─────────────── v0.6.5
   Installed Makie ─────────────────────── v0.17.12
   Installed Scratch ───────────────────── v1.1.1
   Installed TranscodingStreams ────────── v0.9.6
   Installed ImageIO ───────────────────── v0.6.6
   Installed Interpolations ────────────── v0.14.3
  Downloaded artifact: OpenEXR
  Downloaded artifact: PCRE
  Downloaded artifact: Glib
  Downloaded artifact: HDF5
  Downloaded artifact: vegalite_app
  Downloaded artifact: x264
  Downloaded artifact: libass
  Downloaded artifact: Xorg_libXext
  Downloaded artifact: Gettext
  Downloaded artifact: Rmath
  Downloaded artifact: XML2
  Downloaded artifact: JpegTurbo
  Downloaded artifact: libpng
  Downloaded artifact: LERC
  Downloaded artifact: Fontconfig
  Downloaded artifact: FreeType2
  Downloaded artifact: Xorg_libxcb
  Downloaded artifact: Opus
  Downloaded artifact: Xorg_libXdmcp
  Downloaded artifact: Libtiff
  Downloaded artifact: Xorg_libXau
  Downloaded artifact: nodejs_app
  Downloaded artifact: Imath
  Downloaded artifact: Pixman
  Downloaded artifact: Libgpg_error
  Downloaded artifact: ImageMagick
  Downloaded artifact: Graphite2
  Downloaded artifact: FFTW
  Downloaded artifact: LZO
  Downloaded artifact: x265
  Downloaded artifact: libsixel
  Downloaded artifact: libvorbis
  Downloaded artifact: Xorg_xtrans
  Downloaded artifact: Bzip2
  Downloaded artifact: OpenSSL
  Downloaded artifact: FriBidi
  Downloaded artifact: EarCut
  Downloaded artifact: Xorg_libpthread_stubs
  Downloaded artifact: FFMPEG
  Downloaded artifact: Libgcrypt
  Downloaded artifact: Ogg
  Downloaded artifact: Libuuid
  Downloaded artifact: Libffi
  Downloaded artifact: Libiconv
  Downloaded artifact: Pango
  Downloaded artifact: Xorg_libXrender
  Downloaded artifact: libfdk_aac
  Downloaded artifact: Cairo
  Downloaded artifact: isoband
  Downloaded artifact: Xorg_libX11
  Downloaded artifact: Zstd
  Downloaded artifact: Expat
  Downloaded artifact: libaom
  Downloaded artifact: OpenSpecFun
  Downloaded artifact: HarfBuzz
  Downloaded artifact: XSLT
  Downloaded artifact: Libmount
  Downloaded artifact: Arpack
  Downloaded artifact: LAME
  Downloaded artifact: IntelOpenMP
    Updating `/nfsdata/projects/petar/baysor_from_source/Baysor/bin/.julia/environments/v1.6/Project.toml`
  [cc9f9468] + Baysor v0.5.2 `https://github.com/kharchenkolab/Baysor.git#master`
    Updating `/nfsdata/projects/petar/baysor_from_source/Baysor/bin/.julia/environments/v1.6/Manifest.toml`
  [621f4979] + AbstractFFTs v1.2.1
  [1520ce14] + AbstractTrees v0.4.2
  [79e6a3ab] + Adapt v3.4.0
  [27a7e980] + Animations v0.4.1
  [c7e460c6] + ArgParse v1.1.4
  [ec485272] + ArnoldiMethod v0.1.0
  [7d9fca2a] + Arpack v0.5.3
  [30b0a656] + ArrayInterfaceCore v0.1.16
  [67c07d97] + Automa v0.8.2
  [13072b0f] + AxisAlgorithms v1.0.1
  [39de3d68] + AxisArrays v0.4.6
  [cc9f9468] + Baysor v0.5.2 `https://github.com/kharchenkolab/Baysor.git#master`
  [e1450e63] + BufferedStreams v1.1.0
  [fa961155] + CEnum v0.4.2
  [336ed68f] + CSV v0.10.4
  [159f3aea] + Cairo v1.0.5
  [13f3f980] + CairoMakie v0.8.12
  [49dc2e85] + Calculus v0.5.1
  [aafaddc9] + CatIndices v0.2.2
  [d360d2e6] + ChainRulesCore v1.15.3
  [9e997f8a] + ChangesOfVariables v0.1.4
  [aaaa29a8] + Clustering v0.14.2
  [944b1d66] + CodecZlib v0.7.0
  [a2cac450] + ColorBrewer v0.4.0
  [35d6a980] + ColorSchemes v3.19.0
  [3da002f7] + ColorTypes v0.11.4
  [c3611d14] + ColorVectorSpace v0.9.9
  [5ae59095] + Colors v0.12.8
  [bbf7d656] + CommonSubexpressions v0.3.0
  [34da2185] + Compat v3.45.0
  [ed09eef8] + ComputationalResources v0.3.2
  [187b0558] + ConstructionBase v1.4.0
  [d38c429a] + Contour v0.6.2
  [150eb455] + CoordinateTransformations v0.6.2
  [a8cc5b0e] + Crayons v4.1.1
  [dc8bdbbb] + CustomUnitRanges v1.0.2
  [9a962f9c] + DataAPI v1.10.0
  [a93c6f00] + DataFrames v1.3.4
  [864edb3b] + DataStructures v0.18.13
  [e2d170a0] + DataValueInterfaces v1.0.0
  [e7dc6d0d] + DataValues v0.4.13
  [b429d917] + DensityInterface v0.4.0
  [163ba53b] + DiffResults v1.0.3
  [b552c78f] + DiffRules v1.11.0
  [b4f34e82] + Distances v0.10.7
  [31c24e10] + Distributions v0.25.66
  [ffbed154] + DocStringExtensions v0.9.1
  [fa6b7ba4] + DualNumbers v0.6.8
  [c87230d0] + FFMPEG v0.4.1
  [4f61f5a4] + FFTViews v0.3.2
  [7a1cc6ca] + FFTW v1.5.0
  [5789e2e9] + FileIO v1.15.0
  [8fc22ac5] + FilePaths v0.8.3
  [48062228] + FilePathsBase v0.9.18
  [1a297f60] + FillArrays v0.13.2
  [6a86dc24] + FiniteDiff v2.14.0
  [53c48c17] + FixedPointNumbers v0.8.4
  [59287772] + Formatting v0.4.2
  [f6369f11] + ForwardDiff v0.10.30
  [b38be410] + FreeType v4.0.0
  [663a7486] + FreeTypeAbstraction v0.9.9
  [fd0ad045] + GeometricalPredicates v0.4.2
  [5c1252a2] + GeometryBasics v0.4.2
  [a2bd30eb] + Graphics v1.1.2
  [86223c79] + Graphs v1.7.1
  [3955a311] + GridLayoutBase v0.9.0
  [42e2da0e] + Grisu v1.0.2
  [f67ccb44] + HDF5 v0.16.10
  [cd3eb016] + HTTP v1.2.0
  [34004b35] + HypergeometricFunctions v0.3.11
  [2803e5a7] + ImageAxes v0.6.10
  [c817782e] + ImageBase v0.1.5
  [f332f351] + ImageContrastAdjustment v0.3.10
  [a09fc81d] + ImageCore v0.9.4
  [51556ac3] + ImageDistances v0.2.16
  [6a3955dd] + ImageFiltering v0.7.1
  [82e4d734] + ImageIO v0.6.6
  [6218d12a] + ImageMagick v1.2.2
  [bc367c6b] + ImageMetadata v0.9.8
  [787d08f9] + ImageMorphology v0.3.2
  [2996bd0c] + ImageQualityIndexes v0.3.3
  [80713f31] + ImageSegmentation v1.7.0
  [4e3cecfd] + ImageShow v0.3.6
  [02fcd773] + ImageTransformations v0.9.5
  [916415d5] + Images v0.25.2
  [9b13fd28] + IndirectArrays v1.0.0
  [d25df0c9] + Inflate v0.1.2
  [83e8ac13] + IniFile v0.5.1
  [842dd82b] + InlineStrings v1.1.4
  [1d092043] + IntegralArrays v0.1.5
  [a98d9a8b] + Interpolations v0.14.3
  [8197267c] + IntervalSets v0.7.1
  [3587e190] + InverseFunctions v0.1.7
  [41ab1584] + InvertedIndices v1.1.0
  [92d709cd] + IrrationalConstants v0.1.1
  [f1662d9f] + Isoband v0.1.1
  [c8e1da08] + IterTools v1.4.0
  [82899510] + IteratorInterfaceExtensions v1.0.0
  [033835bb] + JLD2 v0.4.22
  [692b3bcd] + JLLWrappers v1.4.1
  [682c06a0] + JSON v0.21.3
  [7d188eb4] + JSONSchema v1.0.1
  [b835a17e] + JpegTurbo v0.1.1
  [5ab0869b] + KernelDensity v0.6.5
  [b964fa9f] + LaTeXStrings v1.3.0
  [8cdb02fc] + LazyModules v0.3.1
  [093fc24a] + LightGraphs v1.3.5
  [2ab3a3ac] + LogExpFunctions v0.3.17
  [e6f89c97] + LoggingExtras v0.4.9
  [2fda8390] + LsqFit v0.12.1
  [23992714] + MAT v0.10.3
  [1914dd2f] + MacroTools v0.5.9
  [ee78f7c6] + Makie v0.17.12
  [20f20a25] + MakieCore v0.3.6
  [dbb5928d] + MappedArrays v0.4.1
  [7eb4fadd] + Match v1.2.0
  [0a4f8689] + MathTeXEngine v0.4.3
  [739be429] + MbedTLS v1.1.2
  [626554b9] + MetaGraphs v0.7.1
  [e1d29d7a] + Missings v1.0.2
  [e94cdb99] + MosaicViews v0.3.3
  [6f286f6a] + MultivariateStats v0.9.1
  [d41bc354] + NLSolversBase v7.8.2
  [77ba4419] + NaNMath v1.0.1
  [dd2c4c9e] + NearestNeighborDescent v0.3.5
  [b8a86587] + NearestNeighbors v0.4.11
  [f09324ee] + Netpbm v1.0.2
  [2bd173c7] + NodeJS v1.3.0
  [510215fc] + Observables v0.5.1
  [6fe1bfb0] + OffsetArrays v1.12.7
  [52e1d378] + OpenEXR v0.3.2
  [87e2bd06] + OptimBase v2.0.2
  [bac558e1] + OrderedCollections v1.4.1
  [90014a1f] + PDMats v0.11.16
  [f57f5aa1] + PNGFiles v0.3.16
  [19eb6ba3] + Packing v0.4.2
  [5432bcbf] + PaddedViews v0.5.11
  [d96e819e] + Parameters v0.12.3
  [69de0a69] + Parsers v2.3.2
  [eebad327] + PkgVersion v0.1.1
  [995b91a9] + PlotUtils v1.3.0
  [647866c9] + PolygonOps v0.1.2
  [2dfb63ee] + PooledArrays v1.4.2
  [21216c6a] + Preferences v1.3.0
  [08abe8d2] + PrettyTables v1.3.1
  [92933f4c] + ProgressMeter v1.7.2
  [4b34888f] + QOI v1.0.0
  [1fd47b50] + QuadGK v2.4.2
  [94ee1d12] + Quaternions v0.5.6
  [b3c3ace0] + RangeArrays v0.3.2
  [c84ed2f1] + Ratios v0.4.3
  [189a3867] + Reexport v1.2.2
  [dee08c22] + RegionTrees v0.3.2
  [05181044] + RelocatableFolders v0.3.0
  [ae029012] + Requires v1.3.0
  [79098fc4] + Rmath v0.7.0
  [6038ab10] + Rotations v1.3.1
  [fdea26ae] + SIMD v3.4.1
  [7b38b023] + ScanByte v0.3.3
  [6c6a2e73] + Scratch v1.1.1
  [91c51154] + SentinelArrays v1.3.13
  [efcf1570] + Setfield v1.0.0
  [992d4aef] + Showoff v1.0.3
  [73760f76] + SignedDistanceFields v0.4.0
  [777ac1f9] + SimpleBufferStream v1.1.0
  [699a6c99] + SimpleTraits v0.9.4
  [47aef6b3] + SimpleWeightedGraphs v1.2.1
  [45858cf5] + Sixel v0.1.2
  [a2af1166] + SortingAlgorithms v1.0.1
  [276daf66] + SpecialFunctions v2.1.7
  [cae243ae] + StackViews v0.1.1
  [90137ffa] + StaticArrays v1.5.2
  [1e83bf80] + StaticArraysCore v1.0.1
  [82ae8749] + StatsAPI v1.2.2
  [2913bbd2] + StatsBase v0.33.20
  [4c63d2b9] + StatsFuns v1.0.1
  [09ab397b] + StructArrays v0.6.11
  [3783bdb8] + TableTraits v1.0.1
  [382cd787] + TableTraitsUtils v1.0.2
  [bd369af6] + Tables v1.7.0
  [62fd8b95] + TensorCore v0.1.1
  [b718987f] + TextWrap v1.0.1
  [731e570b] + TiffImages v0.6.0
  [06e1c1a7] + TiledIteration v0.3.1
  [3bb67fe8] + TranscodingStreams v0.9.6
  [c4f8c510] + UMAP v0.1.9
  [30578b45] + URIParser v0.4.1
  [5c2747f8] + URIs v1.4.0
  [3a884ed6] + UnPack v1.0.2
  [1cfade01] + UnicodeFun v0.4.1
  [239c3e63] + Vega v2.3.1
  [112f6efa] + VegaLite v2.6.0
  [72f80fcb] + VoronoiDelaunay v0.4.3
  [ea10d353] + WeakRefStrings v1.4.2
  [efce3f68] + WoodburyMatrices v0.5.5
  [68821587] + Arpack_jll v3.5.0+3
  [6e34b625] + Bzip2_jll v1.0.8+0
  [83423d85] + Cairo_jll v1.16.1+1
  [5ae413db] + EarCut_jll v2.2.3+0
  [2e619515] + Expat_jll v2.4.8+0
  [b22a6f82] + FFMPEG_jll v4.4.2+0
  [f5851436] + FFTW_jll v3.3.10+0
  [a3f928ae] + Fontconfig_jll v2.13.93+0
  [d7e528f0] + FreeType2_jll v2.10.4+0
  [559328eb] + FriBidi_jll v1.0.10+0
  [78b55507] + Gettext_jll v0.21.0+0
  [7746bdde] + Glib_jll v2.68.3+2
  [3b182d85] + Graphite2_jll v1.3.14+0
  [0234f1f7] + HDF5_jll v1.12.2+1
  [2e76f6c2] + HarfBuzz_jll v2.8.1+1
  [c73af94c] + ImageMagick_jll v6.9.10-12+3
  [905a6f67] + Imath_jll v3.1.2+0
  [1d5cc7b8] + IntelOpenMP_jll v2018.0.3+2
  [aacddb02] + JpegTurbo_jll v2.1.2+0
  [c1c5ebd0] + LAME_jll v3.100.1+0
  [88015f11] + LERC_jll v3.0.0+1
  [dd4b983a] + LZO_jll v2.10.1+0
  [e9f186c6] + Libffi_jll v3.2.2+1
  [d4300ac3] + Libgcrypt_jll v1.8.7+0
  [7add5ba3] + Libgpg_error_jll v1.42.0+0
  [94ce4f54] + Libiconv_jll v1.16.1+1
  [4b2f31a3] + Libmount_jll v2.35.0+0
  [89763e89] + Libtiff_jll v4.4.0+0
  [38a345b3] + Libuuid_jll v2.36.0+0
  [856f044c] + MKL_jll v2022.0.0+0
  [e7412a2a] + Ogg_jll v1.3.5+1
  [18a262bb] + OpenEXR_jll v3.1.1+0
  [458c3c95] + OpenSSL_jll v1.1.17+0
  [efe28fd5] + OpenSpecFun_jll v0.5.5+0
  [91d4177d] + Opus_jll v1.3.2+0
  [2f80f16e] + PCRE_jll v8.44.0+0
  [36c8627f] + Pango_jll v1.50.3+0
  [30392449] + Pixman_jll v0.40.1+0
  [f50d1b31] + Rmath_jll v0.3.0+0
  [02c8fc9c] + XML2_jll v2.9.14+0
  [aed1982a] + XSLT_jll v1.1.34+0
  [4f6342f7] + Xorg_libX11_jll v1.6.9+4
  [0c0b7dd1] + Xorg_libXau_jll v1.0.9+4
  [a3789734] + Xorg_libXdmcp_jll v1.1.3+4
  [1082639a] + Xorg_libXext_jll v1.3.4+4
  [ea2f1a96] + Xorg_libXrender_jll v0.9.10+4
  [14d82f49] + Xorg_libpthread_stubs_jll v0.1.0+3
  [c7cfdc94] + Xorg_libxcb_jll v1.13.0+3
  [c5fb5394] + Xorg_xtrans_jll v1.4.0+3
  [3161d3a3] + Zstd_jll v1.5.2+0
  [9a68df92] + isoband_jll v0.2.3+0
  [a4ae2306] + libaom_jll v3.4.0+0
  [0ac62f75] + libass_jll v0.15.1+0
  [f638f0a6] + libfdk_aac_jll v2.0.2+0
  [b53b4c65] + libpng_jll v1.6.38+0
  [075b6546] + libsixel_jll v1.8.6+1
  [f27f6e37] + libvorbis_jll v1.3.7+1
  [1270edf5] + x264_jll v2021.5.5+0
  [dfaa095f] + x265_jll v3.5.0+0
  [0dad84c5] + ArgTools
  [56f22d72] + Artifacts
  [2a0f44e3] + Base64
  [ade2ca70] + Dates
  [8bb1440f] + DelimitedFiles
  [8ba89e20] + Distributed
  [f43a241f] + Downloads
  [9fa8497b] + Future
  [b77e0a4c] + InteractiveUtils
  [4af54fe1] + LazyArtifacts
  [b27032c2] + LibCURL
  [76f85450] + LibGit2
  [8f399da3] + Libdl
  [37e2e46d] + LinearAlgebra
  [56ddb016] + Logging
  [d6f4376e] + Markdown
  [a63ad114] + Mmap
  [ca575930] + NetworkOptions
  [44cfe95a] + Pkg
  [de0858da] + Printf
  [3fa0cd96] + REPL
  [9a3f8284] + Random
  [ea8e919c] + SHA
  [9e88b42a] + Serialization
  [1a1011a3] + SharedArrays
  [6462fe0b] + Sockets
  [2f01184e] + SparseArrays
  [10745b16] + Statistics
  [4607b0f0] + SuiteSparse
  [fa267f1f] + TOML
  [a4e569a6] + Tar
  [8dfed614] + Test
  [cf7118a7] + UUIDs
  [4ec0a83e] + Unicode
  [e66e0078] + CompilerSupportLibraries_jll
  [deac9b47] + LibCURL_jll
  [29816b5a] + LibSSH2_jll
  [c8ffd9c3] + MbedTLS_jll
  [14a3606d] + MozillaCACerts_jll
  [4536629a] + OpenBLAS_jll
  [05823500] + OpenLibm_jll
  [83775a58] + Zlib_jll
  [8e850ede] + nghttp2_jll
  [3f19e933] + p7zip_jll
    Building HDF5 → `/nfsdata/projects/petar/baysor_from_source/Baysor/bin/.julia/scratchspaces/44cfe95a-1eb2-52ea-b672-e2afdf69b78f/9ffc57b9bb643bf3fce34f3daf9ff506ed2d8b7a/build.log`
Precompiling project...
  260 dependencies successfully precompiled in 325 seconds
   Resolving package versions...
julia version requirement for package `Baysor [cc9f9468]` not satisfied
julia version requirement for package `Baysor [cc9f9468]` not satisfied
   Installed RelocatableFolders ─ v0.1.3
   Installed PackageCompiler ──── v2.0.2
    Updating `/nfsdata/projects/petar/baysor_from_source/Baysor/bin/.julia/environments/v1.6/Project.toml`
  [9b87118b] + PackageCompiler v2.0.2
    Updating `/nfsdata/projects/petar/baysor_from_source/Baysor/bin/.julia/environments/v1.6/Manifest.toml`
  [9b87118b] + PackageCompiler v2.0.2
  [05181044] ↓ RelocatableFolders v0.3.0 ⇒ v0.1.3
Precompiling project...
  6 dependencies successfully precompiled in 283 seconds (255 already precompiled)
/nfsdata/projects/petar/baysor_from_source/Baysor/bin/julia-1.6.4//bin/julia -e 'using Pkg; Pkg.build(); using Baysor' && touch /nfsdata/projects/petar/baysor_from_source/Baysor/bin/.julia//deps_success
    Building HDF5 → `/nfsdata/projects/petar/baysor_from_source/Baysor/bin/.julia/scratchspaces/44cfe95a-1eb2-52ea-b672-e2afdf69b78f/9ffc57b9bb643bf3fce34f3daf9ff506ed2d8b7a/build.log`
/nfsdata/projects/petar/baysor_from_source/Baysor/bin/julia-1.6.4//bin/julia -e 'ENV["JULIA_DEPOT_PATH"]="/nfsdata/projects/petar/baysor_from_source/Baysor/bin/.julia/"; using PackageCompiler; import Pkg; Pkg.activate(".."); Pkg.instantiate(); import Baysor; create_sysimage(:Baysor; precompile_execution_file="$(dirname(pathof(Baysor)))/../bin/precompile.jl", sysimage_path="BaysorSysimage.so")'
  Activating environment at `/nfsdata/projects/petar/baysor_from_source/Baysor/Project.toml`
     Cloning git-repo `https://github.com/VPetukhov/Vega.jl`
     Cloning git-repo `https://github.com/queryverse/VegaLite.jl.git`
ERROR: The manifest file you are using was most likely generated by a different version of Julia and is not compatible with this Julia version
Stacktrace:
 [1] load_urls(ctx::Pkg.Types.Context, pkgs::Vector{Pkg.Types.PackageSpec})
   @ Pkg.Operations /buildworker/worker/package_linux64/build/usr/share/julia/stdlib/v1.6/Pkg/src/Operations.jl:545
 [2] #download_source#57
   @ /buildworker/worker/package_linux64/build/usr/share/julia/stdlib/v1.6/Pkg/src/Operations.jl:733 [inlined]
 [3] download_source
   @ /buildworker/worker/package_linux64/build/usr/share/julia/stdlib/v1.6/Pkg/src/Operations.jl:732 [inlined]
 [4] instantiate(ctx::Pkg.Types.Context; manifest::Nothing, update_registry::Bool, verbose::Bool, platform::Base.BinaryPlatforms.Platform, allow_build::Bool, allow_autoprecomp::Bool, kwargs::Base.Iterators.Pairs{Union{}, Union{}, Tuple{}, NamedTuple{(), Tuple{}}})
   @ Pkg.API /buildworker/worker/package_linux64/build/usr/share/julia/stdlib/v1.6/Pkg/src/API.jl:1408
 [5] instantiate
   @ /buildworker/worker/package_linux64/build/usr/share/julia/stdlib/v1.6/Pkg/src/API.jl:1325 [inlined]
 [6] #instantiate#252
   @ /buildworker/worker/package_linux64/build/usr/share/julia/stdlib/v1.6/Pkg/src/API.jl:1321 [inlined]
 [7] instantiate()
   @ Pkg.API /buildworker/worker/package_linux64/build/usr/share/julia/stdlib/v1.6/Pkg/src/API.jl:1321
 [8] top-level scope
   @ none:1
make: *** [/nfsdata/projects/petar/baysor_from_source/Baysor/bin/julia-1.6.4//../BaysorSysimage.so] Error 1

Input data format

@hi,author,
I'm trying to run Baysor with tiff and the MOLECULES_CSV contain information about x and y positions and gene assignment for each molecule, command just like the follow:
baysor run -p -c ./Adult_data/adult.toml -o ./output_adult_dapi -p ./Adult_data/molecules_2.csv ./Adult_data/segmentation.tiff

But I don't know why it sent an error . May be there are Non-symmetric matrix in my data? I got the raw data why it has Non-symmetric matrix ?
image

I would appreciate it if you could reply soon! Thank you!

Updated Binary for Linux

I would like to try --no-ncv-estimation option to prevent Out of Memory errors. However, the only binary for linux available does not have this option. Could you please provide an updated linux binary(not ubuntu specific)?

inconsistent number of cells between the output files

The number of cell boundaries in segmentation_polygons.json far exceeds the number of cells in segmentation.csv
and segmentation_cell_stats.csv.
For example one of my runs produced 4013 polygons but only 2430 cells.

I would like to filter the boundaries that I plot with the diagnostics information in segmentation_cell_stats.csv, but due to the different numbers of elements they contain I cannot match the diagnostics information with the cell boundaries :(

The expected behaviour would be one polygon for each cell that baysor finds.

Prior segmentation doesn't work for not 16-bit tiffs

Hi authors,

I am trying to run Baysor with a segmentation tif file where the background is 0, and all the indivudual cells are marked with 1,2,3,4...I noticed that Baysor gave error in this case, while it is ok with a binary image. Can authors confirm this issue? Thanks!

(base) bash-4.2$ cd data/
(base) bash-4.2$ ~/tool/Baysor/bin/baysor run -i 500 -p -c ~/project/sparcle/data/iss.toml -o ./output_dapi -p spot.csv segmentation.tif
[17:08:12] Info: (2021-07-16) Run Baysor v0.5.0
[17:08:12] Info: Loading data...
[17:08:37] Info: Loaded 71907 transcripts
[17:08:38] Info: Loading segmentation mask...
[17:08:39] Warning: some versions of ImageMagick give spurious low-order bits for 32-bit TIFFs
└ ImageMagick /home/vpetukhov/.julia/packages/ImageMagick/b8swT/src/ImageMagick.jl:100
[17:08:44] Warning: Minimum transcript coordinates are < 1: (10, -1). Filling it with 0.
└ Baysor /home/vpetukhov/.julia/dev/Baysor/src/data_processing/initialization.jl:279
[17:08:45] Error: ArgumentError("reducing over an empty collection is not allowed")
|                 
|                 _empty_reduce_error() at reduce.jl:299
|                 reduce_empty(op::Function, #unused#::Type{UInt32}) at reduce.jl:309
|                 mapreduce_empty(#unused#::typeof(identity), op::Function, T::Type) at reduce.jl:343
|                 reduce_empty(op::Base.MappingRF{typeof(identity), typeof(max)}, #unused#::Type{UInt32}) at reduce.jl:329
|                 reduce_empty_iter at reduce.jl:355 [inlined]
|                 mapreduce_empty_iter(f::Function, op::Function, itr::Vector{UInt32}, ItrEltype::Base.HasEltype) at reduce.jl:351
|                 _mapreduce at reduce.jl:400 [inlined]
|                 _mapreduce_dim at reducedim.jl:318 [inlined]
|                 #mapreduce#672 at reducedim.jl:310 [inlined]
|                 mapreduce at reducedim.jl:310 [inlined]
|                 #_maximum#690 at reducedim.jl:878 [inlined]
|                 _maximum at reducedim.jl:878 [inlined]
|                 #_maximum#689 at reducedim.jl:877 [inlined]
|                 _maximum at reducedim.jl:877 [inlined]
|                 #maximum#687 at reducedim.jl:873 [inlined]
|                 maximum at reducedim.jl:873 [inlined]
|                 filter_segmentation_labels!(segmentation_labels::Vector{UInt32}, segment_per_transcript::Vector{Int64}; min_molecules_per_segment::Int64) at prior_segmentation.jl:74
|                 filter_segmentation_labels! at prior_segmentation.jl:74 [inlined]
|                 #filter_segmentation_labels!#91 at prior_segmentation.jl:68 [inlined]
|                 (::Baysor.var"#filter_segmentation_labels!##kw")(::NamedTuple{(:min_molecules_per_segment,), Tuple{Int64}}, ::typeof(Baysor.filter_segmentation_labels!), segmentation_labels::SparseArrays.SparseMatrixCSC{UInt32, Int64}, segment_per_transcript::Vector{Int64}) at prior_segmentation.jl:68
|                 load_prior_segmentation(df_spatial::DataFrames.DataFrame, args::Dict{String, Any}) at main.jl:280
|                 load_and_preprocess_data!(args::Dict{String, Any}) at main.jl:330
|                 run_cli_main(args::Vector{String}) at main.jl:433
|                 run_cli(args::Vector{String}) at common.jl:118
|                 run_cli at common.jl:103 [inlined]
|                 julia_main at common.jl:139 [inlined]
|                 julia_main() at none:36
└ Baysor /home/vpetukhov/.julia/dev/Baysor/src/cli/common.jl:132

Error from `plot_molecules` function

Hi,

Related to the previous issue, I am trying to build segmentation_free_allen_smfish notebook and met with the following error after executing plot_molecules

sub_lims = [((11000, 13000), (12000, 13500)), ((11500, 13500), (8750, 10250))];

fig = B.plot_molecules(df_spatial, color=:ncv_color, markersize=0.5, xlims=(5000, 18000), ylims=(2500, 15500), size=(500, 500))
# for ((xs, xe), (ys, ye)) in sub_lims
#     Plots.plot!([xs, xs, xe, xe, xs], [ys, ye, ye, ys, ys], color="black", label="", lw=3.0, alpha=0.75)
# end

MK.save(plotsdir("/home/hsarkar/Workplace/DART-fish/BaysorAnalysis/data/raw_data/allen_brain/data_20180505/gene_coloring.png"), fig)
fig

Gives the following error

Can't convert #004993 to a colorant

Stacktrace:
  [1] error(s::String)
    @ Base ./error.jl:33
  [2] rgbatuple(c::InlineStrings.String7)
    @ CairoMakie ~/.julia/packages/CairoMakie/0yMYf/src/utils.jl:93
  [3] (::CairoMakie.var"#26#27"{Makie.Scene, MakieCore.Scatter{Tuple{Vector{GeometryBasics.Point{2, Float32}}}}, FreeTypeAbstraction.FTFont, StaticArrays.SMatrix{4, 4, Float32, 16}, StaticArrays.SMatrix{4, 4, Float32, 16}, Cairo.CairoContext})(point::GeometryBasics.Point{2, Float32}, col::InlineStrings.String7, markersize::Float64, strokecolor::RGBA{Float32}, strokewidth::Float32, marker::Type, mo::GeometryBasics.Vec{2, Float32}, rotation::Makie.Quaternionf0)
    @ CairoMakie ~/.julia/packages/CairoMakie/0yMYf/src/primitives.jl:209
  [4] broadcast_foreach(::Function, ::Vector{GeometryBasics.Point{2, Float32}}, ::Vararg{Any, N} where N)
    @ Makie ~/.julia/packages/Makie/NL7Xw/src/utilities/utilities.jl:176
  [5] draw_atomic(scene::Makie.Scene, screen::CairoMakie.CairoScreen{Cairo.CairoSurfaceBase{UInt32}}, primitive::MakieCore.Scatter{Tuple{Vector{GeometryBasics.Point{2, Float32}}}})
    @ CairoMakie ~/.julia/packages/CairoMakie/0yMYf/src/primitives.jl:187
  [6] draw_plot(scene::Makie.Scene, screen::CairoMakie.CairoScreen{Cairo.CairoSurfaceBase{UInt32}}, primitive::MakieCore.Scatter{Tuple{Vector{GeometryBasics.Point{2, Float32}}}})
    @ CairoMakie ~/.julia/packages/CairoMakie/0yMYf/src/infrastructure.jl:240
  [7] cairo_draw(screen::CairoMakie.CairoScreen{Cairo.CairoSurfaceBase{UInt32}}, scene::Makie.Scene)
    @ CairoMakie ~/.julia/packages/CairoMakie/0yMYf/src/infrastructure.jl:173
  [8] backend_show(x::CairoMakie.CairoBackend, io::IOContext{IOStream}, #unused#::MIME{Symbol("image/png")}, scene::Makie.Scene)
    @ CairoMakie ~/.julia/packages/CairoMakie/0yMYf/src/infrastructure.jl:339
  [9] show(io::IOContext{IOStream}, m::MIME{Symbol("image/png")}, scene::Makie.Scene; update::Bool)
    @ Makie ~/.julia/packages/Makie/NL7Xw/src/display.jl:113
 [10] (::Makie.var"#914#915"{Float64, Float64, Bool, DataType, Makie.Scene})(s::IOStream)
    @ Makie ~/.julia/packages/Makie/NL7Xw/src/display.jl:252
 [11] open(::Makie.var"#914#915"{Float64, Float64, Bool, DataType, Makie.Scene}, ::String, ::Vararg{String, N} where N; kwargs::Base.Iterators.Pairs{Union{}, Union{}, Tuple{}, NamedTuple{(), Tuple{}}})
    @ Base ./io.jl:330
 [12] open
    @ ./io.jl:328 [inlined]
 [13] save(file::FileIO.File{FileIO.DataFormat{:PNG}, String}, fig::Makie.Figure; resolution::Tuple{Int64, Int64}, pt_per_unit::Float64, px_per_unit::Float64, update::Bool)
    @ Makie ~/.julia/packages/Makie/NL7Xw/src/display.jl:246
 [14] save(file::FileIO.File{FileIO.DataFormat{:PNG}, String}, fig::Makie.Figure)
    @ Makie ~/.julia/packages/Makie/NL7Xw/src/display.jl:228
 [15] save(filename::String, fig::Makie.Figure; args::Base.Iterators.Pairs{Union{}, Union{}, Tuple{}, NamedTuple{(), Tuple{}}})
    @ Makie ~/.julia/packages/Makie/NL7Xw/src/display.jl:218
 [16] save(filename::String, fig::Makie.Figure)
    @ Makie ~/.julia/packages/Makie/NL7Xw/src/display.jl:218
 [17] top-level scope
    @ In[44]:8
 [18] eval
    @ ./boot.jl:360 [inlined]
 [19] include_string(mapexpr::typeof(REPL.softscope), mod::Module, code::String, filename::String)
    @ Base ./loading.jl:1116
 

I suspected that probably saving the the plot to file is where the error is coming from, so I re-ran without saving, which got rid of the error, but no figure is shown.

image

I have uploaded the dataframe here so that the problem can be reproduced.

Error installing CLI

Hello,

I'm trying to install the command line interface, and get the following Errors:

I only provided the end of the compilation logs, let me know if you need anything else.

Thanks in advanced!

[9b87118b] + PackageCompiler v1.2.4
/u/flashscratch/r/rlittman/merfish_scratch/Baysor/bin/julia-1.5.3//bin/julia -e 'using Pkg; Pkg.build(); using Baysor' && touch /u/flashscratch/r/rlittman/merfish_scratch/Baysor/bin/.julia//deps_success
Building FFTW → /u/flashscratch/r/rlittman/merfish_scratch/Baysor/bin/.julia/packages/FFTW/DMUbN/deps/build.log
Building GR ──→ /u/flashscratch/r/rlittman/merfish_scratch/Baysor/bin/.julia/packages/GR/RlE5Y/deps/build.log
Building HDF5 → /u/flashscratch/r/rlittman/merfish_scratch/Baysor/bin/.julia/packages/HDF5/d0V7K/deps/build.log
WARNING: using StatsBase.wmedian in module Baysor conflicts with an existing identifier.
WARNING: using StatsBase.wmean in module Baysor conflicts with an existing identifier.
/u/flashscratch/r/rlittman/merfish_scratch/Baysor/bin/julia-1.5.3//bin/julia -e 'using PackageCompiler; import Baysor; create_sysimage(:Baysor; precompile_execution_file="$(dirname(pathof(Baysor)))/../bin/build.jl", replace_default=true)'
ERROR: LoadError: ArgumentError: Package Baysor [cc9f9468-1fbe-11e9-0acf-e9460511877c] is required but does not seem to be installed:

  • Run Pkg.instantiate() to install all recorded dependencies.

Stacktrace:
[1] _require(::Base.PkgId) at ./loading.jl:999
[2] require(::Base.PkgId) at ./loading.jl:928
[3] require(::Module, ::Symbol) at ./loading.jl:923
[4] include(::Function, ::Module, ::String) at ./Base.jl:380
[5] include(::Module, ::String) at ./Base.jl:368
[6] exec_options(::Base.JLOptions) at ./client.jl:296
[7] _start() at ./client.jl:506
in expression starting at /u/flashscratch/r/rlittman/merfish_scratch/Baysor/bin/.julia/packages/Baysor/KriXT/bin/build.jl:1
ERROR: failed process: Process(/u/flashscratch/r/rlittman/merfish_scratch/Baysor/bin/julia-1.5.3/bin/julia --color=yes --startup-file=no --sysimage=/u/flashscratch/r/rlittman/merfish_scratch/Baysor/bin/julia-1.5.3/lib/julia/sys.so --project=/u/flashscratch/r/rlittman/merfish_scratch/Baysor/bin/.julia/environments/v1.5 --compile=all --trace-compile=/tmp/jl_dDxMxX /u/flashscratch/r/rlittman/merfish_scratch/Baysor/bin/.julia/packages/Baysor/KriXT/bin/build.jl, ProcessExited(1)) [1]

why I always got stopped at this step

My code and process shown below

root@c04e1c64b14a:~/sec# baysor run -s 150 -x x -y y --gene Gene cc.csv
┌ Warning: No config file provided. Using default parameters.
└ @ Baysor ~/.julia/packages/Baysor/RVP5y/src/cli/main.jl:91
[14:23:20] Info: (2022-08-30) Run Baysor v0.5.0
[14:23:20] Info: Loading data...
[14:23:50] Info: Loaded 55513 transcripts
[14:23:50] Info: Estimating noise level
[14:23:52] Info: Done
[14:23:53] Info: Clustering molecules...
Progress: 100%|█████████████████████████████████████████████████████████████████| Time: 0:00:07
Iteration: 114
Max. difference: 0.009485599121030835
Fraction of probs changed: 0.5809089762758273
[14:28:22] Info: Algorithm stopped after 114 iterations. Error: 0.00949. Converged: true.
[14:28:23] Info: Done
[14:28:23] Info: Initializing algorithm. Scale: 150.0, scale std: 37.5, initial #components: 37008, #molecules: 55513.
[14:28:33] Info: Using 2D coordinates
Progress: 100%|█████████████████████████████████████████████████████████████████| Time: 0:25:25
Iteration: 500
Noise level, %: 42.69
Num. components: 2979
[14:54:35] Info: Processing complete.
[14:55:30] Info: Estimating local colors
Killed

It cant finish

Error with `select_ids_uniformly`

Hi,

While running the examples from here , the execution of

sample_ids = Baysor.select_ids_uniformly(df_spatial.x, df_spatial.y, df_spatial.confidence,n= 2000)

gives the following error,

MethodError: no method matching select_ids_uniformly(::Vector{Int64}, ::Vector{Int64}, ::Vector{Float64}; n=2000)
Closest candidates are:
  select_ids_uniformly(::Union{AbstractMatrix{var"#s84"} where var"#s84"<:Real, Vector{var"#s83"} where var"#s83"<:Real}) at /home/hsarkar/.julia/packages/Baysor/Mbd2S/src/data_processing/initialization.jl:302 got unsupported keyword argument "n"
  select_ids_uniformly(::Union{AbstractMatrix{var"#s81"} where var"#s81"<:Real, Vector{var"#s80"} where var"#s80"<:Real}, ::Union{Nothing, Vector{Float64}}; n, confidence_threshold) at /home/hsarkar/.julia/packages/Baysor/Mbd2S/src/data_processing/initialization.jl:302

Stacktrace:
 [1] top-level scope
   @ In[82]:1
 [2] eval
   @ ./boot.jl:360 [inlined]
 [3] include_string(mapexpr::typeof(REPL.softscope), mod::Module, code::String, filename::String)
   @ Base ./loading.jl:1116
  

The df_spatial looks as follows,

print(first(df_spatial[!,[:x, :y, :confidence]],10))

 Row │ x      y      confidence 
     │ Int64  Int64  Float64    
─────┼──────────────────────────
   1 │   810   9292    0.0
   2 │  1943   9727    0.0
   3 │  2802  12527    0.999772
   4 │  3917  12000    0.999911
   5 │  2755  13641    0.999938
   6 │  2505  13139    0.999938
   7 │  2785  12526    0.999895

Same issue as #18 though I have the -p option

Successfully ran things from the pciSeq example and still could not make the HTML files:

/home/segonzal/baysor run -i 500 -m 8 -s 14 -o ./output_no_dapi -p ./data/pciSeq_3-3.csv

Output:

┌ Warning: No config file provided. Using default parameters.
└ @ Baysor ~/.julia/packages/Baysor/HvJao/src/cli/main.jl:96
[12:51:17] Info: (2022-07-29) Run Baysor v0.5.1
[12:51:17] Info: Loading data...
[12:51:28] Info: Loaded 1228540 transcripts
[12:51:29] Info: Estimating noise level
[12:52:00] Info: Done
[12:52:11] Info: Clustering molecules...
Progress: 100%|█████████████████████████████████████████████████████████████████████████████████████████████| Time: 0:02:07
Iteration: 341
Max. difference: 0.0023564694867172133
Fraction of probs changed: 0.035359858042880166
[12:54:33] Info: Algorithm stopped after 341 iterations. Error: 0.00236. Converged: true.
[12:54:34] Info: Done
[12:54:36] Info: Initializing algorithm. Scale: 14.0, scale std: 3.5, initial #components: 307134, #molecules: 1228540.
[12:54:48] Info: Using 2D coordinates
Progress: 100%|█████████████████████████████████████████████████████████████████████████████████████████████| Time: 0:31:18
Iteration: 500
Noise level, %: 29.32
Num. components: 49220
[13:26:31] Info: Processing complete.
[13:26:57] Info: Estimating local colors
[13:29:04] Info: Saving results to ./output_no_dapi/segmentation.csv
[13:29:13] Info: Plot diagnostics
ERROR: LoadError: UndefRefError: access to undefined reference
Stacktrace:
[1] getproperty
@ ./Base.jl:42 [inlined]
[2] show
@ ~/.julia/packages/Makie/h8AEO/src/makielayout/blocks/axis.jl:1210 [inlined]
[3] show_delim_array(io::IOContext{IOBuffer}, itr::Tuple{NamedTuple{(:font,), Tuple{String}}, typeof(Makie.initialize_block!), Makie.Axis}, op::Char, delim::Char, cl::Char, delim_one::Bool, i1::Int64, n::Int64)
@ Base ./show.jl:1244
[4] show_delim_array
@ ./show.jl:1229 [inlined]
[5] show(io::IOContext{IOBuffer}, t::Tuple{NamedTuple{(:font,), Tuple{String}}, typeof(Makie.initialize_block!), Makie.Axis})
@ Base ./show.jl:1262
[6] _show_default(io::IOBuffer, x::Any)
@ Base ./show.jl:413
[7] show_default
@ ./show.jl:396 [inlined]
[8] show
@ ./show.jl:391 [inlined]
[9] print(io::IOBuffer, x::MethodError)
@ Base ./strings/io.jl:35
[10] print_to_string(::MethodError, ::Vararg{Any})
@ Base ./strings/io.jl:144
[11] string(::MethodError, ::String)
@ Base ./strings/io.jl:185
[12] macro expansion
@ ./logging.jl:360 [inlined]
[13] run_cli(args::Vector{String})
@ Baysor ~/.julia/packages/Baysor/HvJao/src/cli/common.jl:170
[14] run_cli()
@ Baysor ~/.julia/packages/Baysor/HvJao/src/cli/common.jl:137
[15] top-level scope
@ ~/baysor:3
in expression starting at /home/segonzal/baysor:3

caused by: MethodError: no method matching initialize_block!(::Makie.Axis; font="Helvetica")
Closest candidates are:
initialize_block!(::Makie.Axis; palette) at ~/.julia/packages/Makie/h8AEO/src/makielayout/blocks/axis.jl:168 got unsupported keyword argument "font"
initialize_block!(::Makie.Textbox) at ~/.julia/packages/Makie/h8AEO/src/makielayout/blocks/textbox.jl:1 got unsupported keyword argument "font"
initialize_block!(::Makie.Toggle) at ~/.julia/packages/Makie/h8AEO/src/makielayout/blocks/toggle.jl:1 got unsupported keyword argument "font"
...
Stacktrace:
[1] kwerr(::NamedTuple{(:font,), Tuple{String}}, ::Function, ::Makie.Axis)
@ Base ./error.jl:163
[2] block(::Type{Makie.Axis}, ::Makie.Figure; bbox::Nothing, kwargs::Base.Pairs{Symbol, Any, NTuple{10, Symbol}, NamedTuple{(:title, :xticksvisible, :yticksvisible, :xticklabelsize, :yticklabelsize, :xlabel, :ylabel, :xlabelpadding, :ylabelpadding, :font), Tuple{String, Bool, Bool, Int64, Int64, String, String, Int64, Int64, String}}})
@ Makie ~/.julia/packages/Makie/h8AEO/src/makielayout/blocks.jl:403
[3] #
#999
@ ~/.julia/packages/Makie/h8AEO/src/makielayout/blocks.jl:279 [inlined]
[4] plot_num_of_cells_per_iterarion(tracer::Dict{Symbol, Any})
@ Baysor ~/.julia/packages/Baysor/HvJao/src/data_processing/plots.jl:155
[5] (::Baysor.var"#329#330"{NamedTuple{(:exprs, :assignment, :diffs, :assignment_probs, :change_fracs), Tuple{Matrix{Float64}, Vector{Int64}, Vector{Float64}, Matrix{Float64}, Vector{Float64}}}, Nothing, DataFrames.DataFrame, Vector{Int64}, Dict{Symbol, Any}})(io::IOStream)
@ Baysor ~/.julia/packages/Baysor/HvJao/src/cli/main.jl:162
[6] open(::Baysor.var"#329#330"{NamedTuple{(:exprs, :assignment, :diffs, :assignment_probs, :change_fracs), Tuple{Matrix{Float64}, Vector{Int64}, Vector{Float64}, Matrix{Float64}, Vector{Float64}}}, Nothing, DataFrames.DataFrame, Vector{Int64}, Dict{Symbol, Any}}, ::String, ::Vararg{String}; kwargs::Base.Pairs{Symbol, Union{}, Tuple{}, NamedTuple{(), Tuple{}}})
@ Base ./io.jl:330
[7] open
@ ./io.jl:328 [inlined]
[8] plot_diagnostics_panel(df_res::DataFrames.DataFrame, assignment::Vector{Int64}, tracer::Dict{Symbol, Any}, args::Dict{String, Any}; clust_res::NamedTuple{(:exprs, :assignment, :diffs, :assignment_probs, :change_fracs), Tuple{Matrix{Float64}, Vector{Int64}, Vector{Float64}, Matrix{Float64}, Vector{Float64}}}, comp_segs::Nothing)
@ Baysor ~/.julia/packages/Baysor/HvJao/src/cli/main.jl:142
[9] save_segmentation_results(bm_data::Baysor.BmmData{2}, 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}})
@ Baysor ~/.julia/packages/Baysor/HvJao/src/cli/main.jl:412
[10] run_cli_main(args::Vector{String})
@ Baysor ~/.julia/packages/Baysor/HvJao/src/cli/main.jl:481
[11] run_cli(args::Vector{String})
@ Baysor ~/.julia/packages/Baysor/HvJao/src/cli/common.jl:152
[12] run_cli()
@ Baysor ~/.julia/packages/Baysor/HvJao/src/cli/common.jl:137
[13] top-level scope
@ ~/baysor:3

Am I missing something? Thanks a lot in advance!

Export segmentation polygons as .geojson or tiff

Hello!

Thx for sharing such a nice job!

Just wondering if there's way to export cell border coordinates to a .geojson file (to load it in other tools) for visualization?

Many thx!

Best,
Tong

Parameter question

Dear team,

Thank you for the outstanding work! I have a question regarding the parameter. If I do -s 10, and in the toml file, I do:
[Data]
min-molecules-per-gene = 50
min-molecules-per-cell = 8
scale = 14

May I ask, in this case, will Baysor go with 10 or 14?

Best,
Huimin

Segmentation html files not generated

Hello, I am trying to run Baysor using the command line as follows:
./baysor run -x X -y Y -m 50 -o prior_seg.csv counts.csv dapi_seg.tif

There is no error on the log and it seems to have finished the process successfully, however the segmentation html files mentioned in your demo video are not generated. Could you please clarify?

[01:40:39] Info: (2021-08-14) Run Baysor v0.5.0
[01:40:39] Info: Loading data...
[01:41:02] Info: Loaded 1882562 transcripts
[01:41:03] Info: Loading segmentation mask...
[01:43:07] Info: Done
[01:43:07] Info: Estimating noise level
[01:44:48] Info: Done
[01:45:39] Info: Clustering molecules...
Progress: 100%|█████████████████████████████████████████| Time: 0:09:18
Iteration: 435
Max. difference: 0.0007704690133824172
Fraction of probs changed: 0.2804024515527244
[01:56:02] Info: Algorithm stopped after 435 iterations. Error: 0.00077. Converged: true.
[01:56:05] Info: Done
[01:56:05] Info: Initializing algorithm. Scale: 147.31831615654386, scale std: 8.636411367031021, initial #components: 18824, #molecules: 1882562.
[01:56:17] Info: Using 2D coordinates
Progress: 100%|█████████████████████████████████████████| Time: 0:43:13
Iteration: 500
Noise level, %: 62.96
Num. components: 873
[02:40:03] Info: Processing complete.
[02:40:59] Info: Estimating local colors
[02:45:45] Info: Saving results to prior_seg.csv
[02:46:00] Info: All done!

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.