Skip to content

Commit

Permalink
Get rid of Tableregressionmodel (#194)
Browse files Browse the repository at this point in the history
- The PhyloNetworkLinearModel is no longer wrapped in a TableRegression Model
- field name for evolutionary model: changed from 'model' to 'evomodel' in TraitSimulation and PhyloNetworkLinearModel.
- deprecation notices for old access to model formula and model matrix
  • Loading branch information
pbastide authored Mar 21, 2023
1 parent 948975d commit 0083081
Show file tree
Hide file tree
Showing 6 changed files with 128 additions and 123 deletions.
1 change: 1 addition & 0 deletions src/PhyloNetworks.jl
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ module PhyloNetworks

import Base: show
import GLM: ftest
import StatsModels: coefnames

const DEBUGC = false # even more debug messages
global CHECKNET = false # for debugging only
Expand Down
23 changes: 23 additions & 0 deletions src/deprecated.jl
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,26 @@
@deprecate getMajorParentEdge getparentedge false
@deprecate getMinorParentEdge getparentedgeminor false
@deprecate getPartner getpartneredge false

function Base.getproperty(mm::PhyloNetworkLinearModel, f::Symbol)
if f === :model
Base.depwarn("accessing the `model` field of PhyloNetworkLinearModel.jl models is deprecated, " *
"as they are no longer wrapped in a `TableRegressionModel` " *
"and can be used directly now", :getproperty)
return mm
elseif f === :mf
Base.depwarn("accessing the `mf` field of PhyloNetworkLinearModel.jl models is deprecated, " *
"as they are no longer wrapped in a `TableRegressionModel`." *
"Use `formula(m)` to access the model formula.", :getproperty)
form = formula(mm)
return ModelFrame{Nothing, typeof(mm)}(form, nothing, nothing, typeof(mm))
elseif f === :mm
Base.depwarn("accessing the `mm` field of PhyloNetworkLinearModel.jl models is deprecated, " *
"as they are no longer wrapped in a `TableRegressionModel`." *
"Use `modelmatrix(m)` to access the model matrix.", :getproperty)
modmatr = modelmatrix(mm)
return ModelMatrix{typeof(modmatr)}(modmatr, Int[])
else
return getfield(mm, f)
end
end
Loading

0 comments on commit 0083081

Please sign in to comment.