diff --git a/docs/v0.1.0/.documenter-siteinfo.json b/docs/v0.1.0/.documenter-siteinfo.json index 246c9c7..2c5f3c1 100644 --- a/docs/v0.1.0/.documenter-siteinfo.json +++ b/docs/v0.1.0/.documenter-siteinfo.json @@ -1 +1 @@ -{"documenter":{"julia_version":"1.10.2","generation_timestamp":"2024-04-11T10:26:28","documenter_version":"1.3.0"}} \ No newline at end of file +{"documenter":{"julia_version":"1.10.2","generation_timestamp":"2024-04-11T10:54:13","documenter_version":"1.3.0"}} \ No newline at end of file diff --git a/src/messages.jl b/src/messages.jl index 47782c6..7ffeeb4 100644 --- a/src/messages.jl +++ b/src/messages.jl @@ -91,8 +91,8 @@ function depict(value::Symbol)::String return ":$(value)" end -function depict(value::AbstractVector)::String - return depict_vector(value, "") +function depict(vector::AbstractVector)::String + return depict_array(vector, depict_vector(vector, "")) end function depict_vector(vector::SparseArrays.ReadOnly, prefix::AbstractString)::String @@ -129,7 +129,7 @@ function depict_vector_size(vector::AbstractVector, kind::AbstractString)::Strin end function depict(matrix::AbstractMatrix)::String - return depict_matrix(matrix, ""; transposed = false) + return depict_array(matrix, depict_matrix(matrix, ""; transposed = false)) end function depict_matrix(matrix::SparseArrays.ReadOnly, prefix::AbstractString; transposed::Bool = false)::String @@ -171,16 +171,24 @@ function depict_matrix(matrix::AbstractMatrix, ::AbstractString; transposed::Boo end end -function depict(value::AbstractArray)::String +function depict(array::AbstractArray)::String text = "" - for dim_size in size(value) + for dim_size in size(array) if text == "" text = "$(dim_size)" else text = "$(text) x $(dim_size)" end end - return "$(text) x $(eltype(value)) ($(typeof(value)))" + return depict_array(array, "$(text) x $(eltype(array)) ($(typeof(array)))") +end + +function depict_array(array::AbstractArray, text::String)::String + if eltype(array) == Bool + trues = sum(array) # NOJET + text *= " ($(trues) true, $(depict_percent(trues, length(array))))" + end + return text end """ diff --git a/test/example_data.jl b/test/example_data.jl index f20b639..1c891e4 100644 --- a/test/example_data.jl +++ b/test/example_data.jl @@ -25,10 +25,10 @@ function test_description( batch.partial: 20 x String (Dense) type: 20 x String (Dense) gene: - lateral: 10 x Bool (Dense) - marker: 10 x Bool (Dense) + lateral: 10 x Bool (Dense) (7 true, 70%) + marker: 10 x Bool (Dense) (4 true, 40%) module: 10 x String (Dense) - noisy: 10 x Bool (Dense) + noisy: 10 x Bool (Dense) (4 true, 40%) type: color: 3 x String (Dense) matrices: