Skip to content

Commit 01af014

Browse files
committed
force AlignedMapping elements to be 2-dimensional
Also fixes reading files written with recent AnnData versions. See scverse/anndata#1962
1 parent 96aad44 commit 01af014

File tree

2 files changed

+4
-1
lines changed

2 files changed

+4
-1
lines changed

src/alignedmapping.jl

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,9 @@ Base.pop!(d::AlignedMapping, k) = pop!(d.d, k)
9292
Base.pop!(d::AlignedMapping, k, default) = pop!(d.d, k, default)
9393
function Base.setindex!(d::AlignedMapping{T}, v::Union{AbstractArray, DataFrame}, k) where {T}
9494
checkdim(T, v, d.ref, k)
95+
if ndims(v) == 1
96+
v = reshape(v, :, 1)
97+
end
9598
d.d[k] = v
9699
end
97100
Base.sizehint!(d::AlignedMapping, n) = sizehint!(d.d, n)

src/mudata.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -465,7 +465,7 @@ function _update_attr!(mdata::MuData, attr::Symbol, axis::Integer, join_common::
465465
globaljoincols = Vector{String}()
466466
for mod in intersect(keys(getproperty(mdata, mapattr)), keys(mdata.mod))
467467
colname = mod * ":" * rowcol
468-
globaldata[!, colname] = getproperty(mdata, mapattr)[mod]
468+
globaldata[!, colname] = reshape(getproperty(mdata, mapattr)[mod], :)
469469
push!(globaljoincols, colname)
470470
end
471471
for col in globaljoincols

0 commit comments

Comments
 (0)