Skip to content

Commit

Permalink
Remove getset (#567)
Browse files Browse the repository at this point in the history
getset is no longer recommended by its maintainer: jbaublitz/getset#87 (comment)

& is thus unlikely to update to `syn 2`
  • Loading branch information
serprex committed Dec 27, 2023
1 parent c1beba7 commit 6b3c367
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 23 deletions.
1 change: 0 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,6 @@ pest = { version = "2", optional = true }
pest_derive = { version = "2", optional = true }
strum = ">= 0.16, < 0.26"
strum_macros = ">= 0.16, < 0.26"
getset = ">=0.0.9, <0.2"
enum-map = ">=0.6.4, <3"
triple_accel = ">=0.3, <0.5"
thiserror = "1"
Expand Down
3 changes: 0 additions & 3 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -245,9 +245,6 @@ extern crate serde_derive;
#[macro_use]
extern crate strum_macros;

#[macro_use]
extern crate getset;

#[cfg(feature = "phylogeny")]
#[macro_use]
extern crate pest_derive;
Expand Down
44 changes: 25 additions & 19 deletions src/stats/bayesian/model.rs
Original file line number Diff line number Diff line change
Expand Up @@ -54,19 +54,7 @@ pub trait Posterior {
/// [here](https://github.com/varlociraptor/varlociraptor/blob/694e994547e8f523e5b0013fdf951b694f3870fa/src/model/modes/generic.rs#L200)
/// for an example.
#[derive(
Default,
Getters,
MutGetters,
Copy,
Clone,
Eq,
PartialEq,
Ord,
PartialOrd,
Hash,
Debug,
Serialize,
Deserialize,
Default, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash, Debug, Serialize, Deserialize,
)]
pub struct Model<L, Pr, Po, Payload = ()>
where
Expand All @@ -75,14 +63,8 @@ where
Po: Posterior,
Payload: Default,
{
#[get = "pub"]
#[get_mut = "pub"]
likelihood: L,
#[get = "pub"]
#[get_mut = "pub"]
prior: Pr,
#[get = "pub"]
#[get_mut = "pub"]
posterior: Po,
payload: PhantomData<Payload>,
}
Expand All @@ -106,6 +88,30 @@ where
}
}

pub fn likelihood(&self) -> &L {
&self.likelihood
}

pub fn likelihood_mut(&mut self) -> &mut L {
&mut self.likelihood
}

pub fn prior(&self) -> &Pr {
&self.prior
}

pub fn prior_mut(&mut self) -> &mut Pr {
&mut self.prior
}

pub fn posterior(&self) -> &Po {
&self.posterior
}

pub fn posterior_mut(&mut self) -> &mut Po {
&mut self.posterior
}

/// Calculate joint probability, i.e. `Pr(event) * Pr(data | event)`.
fn joint_prob(&self, event: &Event, data: &Data, payload: &mut Payload) -> LogProb {
self.prior.compute(event) + self.likelihood.compute(event, data, payload)
Expand Down

0 comments on commit 6b3c367

Please sign in to comment.