Skip to content

Commit f23770d

Browse files
committed
fixup! disallow DataFrames in obsp/varp, obsmap/varmap, layers
1 parent 8a18615 commit f23770d

File tree

2 files changed

+9
-17
lines changed

2 files changed

+9
-17
lines changed

src/alignedmapping.jl

Lines changed: 7 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,17 @@
11
abstract type AbstractAlignedMapping{T <: Tuple, K, V} <: AbstractDict{K, V} end
22

3-
struct AlignedMapping{T <: Tuple, K, R, D} <: AbstractAlignedMapping{
4-
T,
5-
K,
6-
Union{AbstractArray{<:Number}, AbstractArray{Union{Missing, T}} where T <: Number, D == true ? DataFrame : Union{}},
7-
}
3+
struct AlignedMapping{T <: Tuple, K, R, D, V} <: AbstractAlignedMapping{T, K, V}
84
ref::R # any type as long as it supports size()
9-
d::Dict{
10-
K,
11-
Union{
12-
AbstractArray{<:Number},
13-
AbstractArray{Union{Missing, T}} where T <: Number,
14-
D == true ? DataFrame : Union{},
15-
},
16-
}
5+
d::Dict{K, V}
176

187
function AlignedMapping{T, K, D}(r, d::AbstractDict{K}) where {T <: Tuple, K, D}
8+
@assert isa(D, Bool)
199
for (k, v) d
2010
checkdim(T, v, r, k)
2111
end
22-
return new{T, K, typeof(r), D}(r, d)
12+
13+
V = Union{AbstractArray{<:Number}, AbstractArray{Union{Missing, T}} where T <: Number, D ? DataFrame : Union{}}
14+
return new{T, K, typeof(r), D, V}(r, d)
2315
end
2416
end
2517

@@ -266,5 +258,5 @@ function Base.view(parentview::AlignedMappingView{T}, indices...) where {T <: Tu
266258
return AlignedMappingView(parent(parentview), Base.reindex(parentindices(parentview), indices))
267259
end
268260

269-
const StrAlignedMapping{T <: Tuple, R, D} = AlignedMapping{T, String, R, D}
261+
const StrAlignedMapping{T <: Tuple, R, D, V} = AlignedMapping{T, String, R, D, V}
270262
const StrAlignedMappingView{T <: Tuple} = AlignedMappingView{T, String}

src/mudata.jl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -553,7 +553,7 @@ function _update_attr!(mdata::MuData, attr::Symbol, axis::UInt8)
553553
chunk = DataFrame(chunk, names(v))
554554
ellipsis = (:) # EllipsisNotation.jl doesn't work with DataFrames
555555
end
556-
attrm[k] = vcat(view(v, keep_index, ellipsis), chunk)
556+
attrm[k] = vcat(view(v, old_index, ellipsis), chunk)
557557
end
558558
end
559559

@@ -562,7 +562,7 @@ function _update_attr!(mdata::MuData, attr::Symbol, axis::UInt8)
562562
topright = Fill(missing, n_kept_rows, n_new_rows, size(v)[3:end]...)
563563
bottomleft = Fill(missing, n_new_rows, n_kept_rows, size(v)[3:end]...)
564564
bottomright = Fill(missing, n_new_rows, n_new_rows, size(v)[3:end]...)
565-
attrp[k] = hvcat(2, view(v, keep_index, keep_index), topright, bottomleft, bottomright)
565+
attrp[k] = hvcat(2, view(v, old_index, old_index), topright, bottomleft, bottomright)
566566
end
567567
end
568568
return mdata

0 commit comments

Comments
 (0)