diff --git a/Manifest.toml b/Manifest.toml index 744f212..c0c9661 100644 --- a/Manifest.toml +++ b/Manifest.toml @@ -2,7 +2,7 @@ julia_version = "1.10.4" manifest_format = "2.0" -project_hash = "2dd7c363e927c99e3e00bdc1071c09b6a60dab07" +project_hash = "141f134cca0e625801b6251fbde9284db6f7c28a" [[deps.AbstractFFTs]] deps = ["LinearAlgebra"] @@ -1205,6 +1205,11 @@ git-tree-sha1 = "8489905bcdbcfac64d1daa51ca07c0d8f0283821" uuid = "69de0a69-1ddd-5017-9359-2bf0b02dc9f0" version = "2.8.1" +[[deps.Pipe]] +git-tree-sha1 = "6842804e7867b115ca9de748a0cf6b364523c16d" +uuid = "b98c9c47-44ae-5843-9183-064241ee97a0" +version = "1.3.0" + [[deps.Pixman_jll]] deps = ["Artifacts", "CompilerSupportLibraries_jll", "JLLWrappers", "LLVMOpenMP_jll", "Libdl"] git-tree-sha1 = "35621f10a7531bc8fa58f74610b1bfb70a3cfc6b" diff --git a/Project.toml b/Project.toml index 78fee9d..733c505 100644 --- a/Project.toml +++ b/Project.toml @@ -36,6 +36,7 @@ MAT = "23992714-dd62-5051-b70f-ba57cb901cac" Makie = "ee78f7c6-11fb-53f2-987a-cfe4a2b5a57a" MultivariateStats = "6f286f6a-111f-5878-ab1e-185364afe411" NearestNeighbors = "b8a86587-4115-5ab1-83bc-aa920d37bbce" +Pipe = "b98c9c47-44ae-5843-9183-064241ee97a0" Pkg = "44cfe95a-1eb2-52ea-b672-e2afdf69b78f" ProgressMeter = "92933f4c-e287-5a05-a399-4b506db050ca" Random = "9a3f8284-a2c9-5f02-9a11-845980a1fd5c" @@ -56,8 +57,8 @@ Colors = "~0.12" Comonicon = "~1.0" Compat = "3.46 - 4.15" Configurations = "~0.17" -Deneb = "~0.3" DataFrames = "1.4 - 1.7" +Deneb = "~0.3" Distances = "~0.10" Distributions = "~0.25" FastRandPCA = "^0.2.1" diff --git a/src/cli/main.jl b/src/cli/main.jl index a89bd49..c623e13 100644 --- a/src/cli/main.jl +++ b/src/cli/main.jl @@ -50,8 +50,8 @@ Run cell segmentation @cast function run( coordinates::String, prior_segmentation::String=""; config::RunOptions=RunOptions(), - x_column::String=config.data.x, y_column::String=config.data.y, z_column::String=config.data.z, - gene_column::String=config.data.gene, min_molecules_per_cell::Int=config.data.min_molecules_per_cell, + x_column::Symbol=config.data.x, y_column::Symbol=config.data.y, z_column::Symbol=config.data.z, + gene_column::Symbol=config.data.gene, min_molecules_per_cell::Int=config.data.min_molecules_per_cell, scale::Float64=config.segmentation.scale, scale_std::String=config.segmentation.scale_std, n_clusters::Int=config.segmentation.n_clusters, diff --git a/src/cli/preview.jl b/src/cli/preview.jl index 0de34f3..6076ed3 100644 --- a/src/cli/preview.jl +++ b/src/cli/preview.jl @@ -22,8 +22,8 @@ Plot an html with the dataset preview. @cast function preview( coordinates::String; config::RunOptions=RunOptions(), - x_column::String=config.data.x, y_column::String=config.data.y, z_column::String=config.data.z, - gene_column::String=config.data.gene, min_molecules_per_cell::Int=config.data.min_molecules_per_cell, + x_column::Symbol=config.data.x, y_column::Symbol=config.data.y, z_column::Symbol=config.data.z, + gene_column::Symbol=config.data.gene, min_molecules_per_cell::Int=config.data.min_molecules_per_cell, output::String="preview.html" ) # Parse options diff --git a/src/cli/segfree.jl b/src/cli/segfree.jl index 38ae654..3eb1384 100644 --- a/src/cli/segfree.jl +++ b/src/cli/segfree.jl @@ -27,8 +27,8 @@ Extract Neighborhood Composition Vectors (NCVs) from a dataset config::RunOptions=RunOptions(), k_neighbors::Int=0, # ncvs_to_save::Int=0, # TODO: uncomment and use it in the code - x_column::String=config.data.x, y_column::String=config.data.y, z_column::String=config.data.z, - gene_column::String=config.data.gene, min_molecules_per_cell::Int=config.data.min_molecules_per_cell, + x_column::Symbol=config.data.x, y_column::Symbol=config.data.y, z_column::Symbol=config.data.z, + gene_column::Symbol=config.data.gene, min_molecules_per_cell::Int=config.data.min_molecules_per_cell, output::String="ncvs.loom" ) opts = config.data; diff --git a/src/data_loading/cli_wrappers.jl b/src/data_loading/cli_wrappers.jl index 666f04d..4fb1567 100644 --- a/src/data_loading/cli_wrappers.jl +++ b/src/data_loading/cli_wrappers.jl @@ -178,11 +178,9 @@ using ..Utils: DataOptions function load_df(coordinates::String, data_opts::DataOptions; kwargs...) exclude_genes = split_string_list(data_opts.exclude_genes) - # TODO: fix Symbol when Configurations are fixed. Also replace this whole call with `to_dict(data_opts)...` df_spatial, gene_names = load_df( - coordinates; x_col=Symbol(data_opts.x), y_col=Symbol(data_opts.y), z_col=Symbol(data_opts.z), gene_col=Symbol(data_opts.gene), - min_molecules_per_gene=data_opts.min_molecules_per_gene, exclude_genes=exclude_genes, - drop_z=data_opts.force_2d, kwargs... + coordinates; x_col=data_opts.x, y_col=data_opts.y, z_col=data_opts.z, gene_col=data_opts.gene, + drop_z=data_opts.force_2d, data_opts.min_molecules_per_gene, exclude_genes, kwargs... ) @info "Loaded $(size(df_spatial, 1)) transcripts, $(length(gene_names)) genes." diff --git a/src/utils/options.jl b/src/utils/options.jl index aa8d471..a9e3f30 100644 --- a/src/utils/options.jl +++ b/src/utils/options.jl @@ -1,10 +1,10 @@ using Configurations @option mutable struct DataOptions # --config.data.* - x::String = "x" # Name of the x column in the input data. Default: "x" - y::String = "y" # Name of the y column in the input data. Default: "y" - z::String = "z" # Name of the y column in the input data. Default: "z" - gene::String = "gene" # Name of gene column in the input data. Default: "gene" + x::Symbol = :x # Name of the x column in the input data. Default: "x" + y::Symbol = :y # Name of the y column in the input data. Default: "y" + z::Symbol = :z # Name of the y column in the input data. Default: "z" + gene::Symbol = :gene # Name of gene column in the input data. Default: "gene" force_2d::Bool = false # Ignores z-column in the data if it is provided min_molecules_per_gene::Int = 1 # Minimal number of molecules per gene. Default: 1 exclude_genes::String = "" # Comma-separated list of genes or regular expressions to ignore during segmentation. Example: 'Blank*,MALAT1'