Skip to content

Commit

Permalink
Replaced String with Symbol in DataOptions
Browse files Browse the repository at this point in the history
  • Loading branch information
Viktor Petukhov committed Aug 23, 2024
1 parent 45d144a commit 73064d3
Show file tree
Hide file tree
Showing 7 changed files with 20 additions and 16 deletions.
7 changes: 6 additions & 1 deletion Manifest.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

julia_version = "1.10.4"
manifest_format = "2.0"
project_hash = "2dd7c363e927c99e3e00bdc1071c09b6a60dab07"
project_hash = "141f134cca0e625801b6251fbde9284db6f7c28a"

[[deps.AbstractFFTs]]
deps = ["LinearAlgebra"]
Expand Down Expand Up @@ -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"
Expand Down
3 changes: 2 additions & 1 deletion Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand All @@ -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"
Expand Down
4 changes: 2 additions & 2 deletions src/cli/main.jl
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
4 changes: 2 additions & 2 deletions src/cli/preview.jl
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions src/cli/segfree.jl
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
6 changes: 2 additions & 4 deletions src/data_loading/cli_wrappers.jl
Original file line number Diff line number Diff line change
Expand Up @@ -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."
Expand Down
8 changes: 4 additions & 4 deletions src/utils/options.jl
Original file line number Diff line number Diff line change
@@ -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'
Expand Down

0 comments on commit 73064d3

Please sign in to comment.