Skip to content

Commit

Permalink
Dev (#27)
Browse files Browse the repository at this point in the history
* plot update (ldict)

* plotting

* docs pkg

* docs, minor fix

* docs

* show ds

* show res ds

* save plots

* version bump

* update

* update

* update

* docs, plot output

* fix plots

* export, fix docs

* fix plots

* breaking changes in plots output

* fix docs

* pd tau

* plot dose time

* tests

* minor changes

* update MetidaBase minor changes
  • Loading branch information
PharmCat authored Jan 16, 2025
1 parent 7e2f843 commit fa39745
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 9 deletions.
4 changes: 2 additions & 2 deletions Project.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name = "MetidaNCA"
uuid = "097c2839-c7bc-4c4b-a5f2-b4167c1b4e7c"
authors = ["PharmCat <[email protected]>"]
version = "0.5.14"
version = "0.5.15"



Expand All @@ -13,7 +13,7 @@ Requires = "ae029012-a4dd-5104-9daa-d747884805df"

[compat]

MetidaBase = "0.11.2, 0.11.3, 0.12"
MetidaBase = "0.11.2, 0.11.3, 0.12, 0.13, 0.14"
RecipesBase = "1"
Requires = "1"
julia = "1"
Expand Down
40 changes: 33 additions & 7 deletions src/import.jl
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,32 @@

nonunique(v) = [k for (k, v) in StatsBase.countmap(v) if v > 1]

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

function floatparse(data::Missing, warn)
warn && @warn "Value $data parsed as `NaN`"
return NaN
end

function floatparse(data::Nothing, warn)
warn && @warn "Value $data parsed as `NaN`"
return NaN
end

floatparse(data::AbstractFloat, ::Any) = data

function floatparse(data::AbstractString, warn)
tp = tryparse(Float64, data)
warn && isnothing(tp) && @warn "Value $data parsed as `NaN`"
floatparse(tp, false)
end
function floatparse(data::Int, warn)
float(data)
end
#=
function floatparse(data, warn)
if !isa(data, AbstractFloat) && !ismissing(data)
if isa(data, AbstractString)
Expand All @@ -25,7 +51,7 @@ function floatparse(data, warn)
return data
end
end

=#

#=
function floatparse(data::AbstractVector)
Expand Down Expand Up @@ -107,8 +133,8 @@ keywords:
See also: [`ElimRange`](@ref), [`DoseTime`](@ref), [`LimitRule`](@ref).
"""
function pkimport(data, time, conc, sort; kelauto = true, elimrange = ElimRange(), dosetime = nothing, limitrule::Union{Nothing, LimitRule} = nothing, warn = true, kwargs...)
if isa(sort, String) sort = [Symbol(sort)] end
if isa(sort, Symbol) sort = [sort] end

sort = parse_gkw(sort)

Tables.istable(data) || error("Data not a table!")

Expand Down Expand Up @@ -216,8 +242,8 @@ Import urine PK data from table `data`.
* `sort` - subject sorting columns.
"""
function upkimport(data, stime, etime, conc, vol, sort; kelauto = true, elimrange = ElimRange(), dosetime = nothing)
if isa(sort, String) sort = [Symbol(sort)] end
if isa(sort, Symbol) sort = [sort] end

sort = parse_gkw(sort)

cols = Tables.columns(data)
cdata = Tuple(Tables.getcolumn(cols, y) for y in sort)
Expand Down Expand Up @@ -328,8 +354,8 @@ Keywords:
"""
function pdimport(data, time, obs, sort; bl = 0, th = 0, dosetime::Union{Nothing, DoseTime} = nothing, limitrule::Union{Nothing, LimitRule} = nothing, warn = true)
if isa(sort, String) sort = [Symbol(sort)] end
if isa(sort, Symbol) sort = [sort] end

sort = parse_gkw(sort)

Tables.istable(data) || error("Data not a table!")

Expand Down

2 comments on commit fa39745

@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
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/123155

Tip: Release Notes

Did you know you can add release notes too? Just add markdown formatted text underneath the comment after the text
"Release notes:" and it will be added to the registry PR, and if TagBot is installed it will also be added to the
release that TagBot creates. i.e.

@JuliaRegistrator register

Release notes:

## Breaking changes

- blah

To add them here just re-invoke and the PR will be updated.

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.5.15 -m "<description of version>" fa39745b508fe7bf89dfb284a3deff46365c4010
git push origin v0.5.15

Please sign in to comment.