diff --git a/Project.toml b/Project.toml index 4a59b38..52e8a97 100644 --- a/Project.toml +++ b/Project.toml @@ -1,7 +1,7 @@ name = "MetidaBase" uuid = "075456b7-4006-432f-9324-2f8453996c49" authors = ["PharmCat and contributors"] -version = "0.10.1" +version = "0.10.2" [deps] CategoricalArrays = "324d7699-5711-5eae-9e2f-1d82baa6b597" @@ -16,7 +16,7 @@ CPUSummary = "2a0fbf3d-bb9c-48f3-b0a9-814d99fd7ab9" [compat] CategoricalArrays = "0.8, 0.9, 0.10" -DataFrames = "0.22, 1" +DataFrames = "1" Distributions = "0.20, 0.21, 0.22, 0.23, 0.24, 0.25" StatsBase = "0.29, 0.30, 0.31, 0.32, 0.33" StatsModels = "0.6" diff --git a/src/types.jl b/src/types.jl index 5973ded..1910df8 100644 --- a/src/types.jl +++ b/src/types.jl @@ -210,6 +210,9 @@ function Base.getindex(d::DataSet, ind::Int) d.ds[ind] end +Base.getindex(d::DataSet, inds::UnitRange{Int64}) = subset(d, inds) + + @inline function getresultindex_safe(rd::T, ind::Symbol) where T <: AbstractResultData getindormiss(rd.result, ind) end @@ -350,6 +353,19 @@ function uniqueidlist(d::DataSet{T}, list::Symbol) where T <: AbstractIdData end dl end +#= +function uniqueidlist(d::DataSet{T}) where T <: AbstractIdData + dl = Vector{Dict}(undef, 0) + for i in d + id = getid(i) + if id ∉ dl push!(dl, id) end + end + dl +end +=# +function uniqueidlist(::DataSet{T}, ::Nothing) where T <: AbstractIdData + nothing +end function subset(d::DataSet{T}, sort::Dict) where T <: AbstractIdData