Skip to content

Commit

Permalink
Merge pull request #14 from PharmCat/dev
Browse files Browse the repository at this point in the history
metadata
  • Loading branch information
PharmCat authored Jan 16, 2025
2 parents 2de7726 + 5f22ff8 commit d101b12
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 1 deletion.
2 changes: 1 addition & 1 deletion Project.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name = "MetidaBase"
uuid = "075456b7-4006-432f-9324-2f8453996c49"
authors = ["PharmCat <[email protected]> and contributors"]
version = "0.13.0"
version = "0.14.0"

[deps]
CategoricalArrays = "324d7699-5711-5eae-9e2f-1d82baa6b597"
Expand Down
7 changes: 7 additions & 0 deletions src/dataset.jl
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,13 @@
################################################################################
struct DataSet{T <: AbstractData} <: AbstractDataSet{AbstractData}
ds::Vector{T}
metadata::Dict
function DataSet(ds::AbstractVector{T}, metadata::Dict) where T <: AbstractData
new{T}(ds, metadata)::DataSet
end
function DataSet(ds)
DataSet(ds, Dict{Symbol, Any}())
end
end

function getdata(d::DataSet)
Expand Down
12 changes: 12 additions & 0 deletions src/utils.jl
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,18 @@ ispositive(::Nothing) = false
ispositive(x::AbstractFloat) = isnan(x) ? false : x > zero(x)
ispositive(x) = x > zero(x)



################################################################################
# Group keyword parsing
################################################################################

parse_gkw(s::String) = [Symbol(s)]
parse_gkw(s::Symbol) = [s]
parse_gkw(s::AbstractVector{<:AbstractString}) = Symbol.(s)
parse_gkw(s::AbstractVector{Symbol}) = s


################################################################################
################################################################################

Expand Down
8 changes: 8 additions & 0 deletions test/runtests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,9 @@ using Test, Tables, TypedTables, DataFrames, CSV
end
exrsds = MetidaBase.DataSet(exrsdsv)

# metadata
dsmeta = MetidaBase.DataSet(exrsdsv, Dict(:name => "SomeName"))

# Index
@test exrsds[:, :r1][1] == 3
@test exrsds[1, :r1] == 3
Expand Down Expand Up @@ -235,4 +238,9 @@ using Test, Tables, TypedTables, DataFrames, CSV
MetidaBase.cvfromvar(0.4) 0.7013021443295824
MetidaBase.cvfromsd(0.4) 0.41654636115540644


@test MetidaBase.parse_gkw("s") == [:s]
@test MetidaBase.parse_gkw(:s) == [:s]
@test MetidaBase.parse_gkw([:s]) == [:s]
@test MetidaBase.parse_gkw(["s"]) == [:s]
end

2 comments on commit d101b12

@PharmCat
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@JuliaRegistrator register

Release notes:

Breaking changes

  • Change DataSet struct (add metadata)

@JuliaRegistrator
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Registration pull request created: JuliaRegistries/General/123149

Tagging

After the above pull request is merged, it is recommended that a tag is created on this repository for the registered package version.

This will be done automatically if the Julia TagBot GitHub Action is installed, or can be done manually through the github interface, or via:

git tag -a v0.14.0 -m "<description of version>" d101b1265c73389cabaca717b01665ee376db3b8
git push origin v0.14.0

Please sign in to comment.