epi-sim-0.4.2: A library for simulating epidemics as birth-death processes.
Safe HaskellNone
LanguageHaskell2010

Epidemic.Utility

Synopsis

Documentation

selectElem :: Vector a -> Int -> (a, Vector a) Source #

data NBranch Source #

Constructors

NBranch NSubtree NLength 

Instances

Instances details
Eq NBranch Source # 
Instance details

Defined in Epidemic.Utility

Methods

(==) :: NBranch -> NBranch -> Bool #

(/=) :: NBranch -> NBranch -> Bool #

Show NBranch Source # 
Instance details

Defined in Epidemic.Utility

data NBranchSet Source #

Constructors

NBranchSet [NBranch] 

Instances

Instances details
Eq NBranchSet Source # 
Instance details

Defined in Epidemic.Utility

Show NBranchSet Source # 
Instance details

Defined in Epidemic.Utility

data NSubtree Source #

Instances

Instances details
Eq NSubtree Source # 
Instance details

Defined in Epidemic.Utility

Show NSubtree Source # 
Instance details

Defined in Epidemic.Utility

data NTree Source #

Constructors

NTree [NBranch] 

Instances

Instances details
Eq NTree Source # 
Instance details

Defined in Epidemic.Utility

Methods

(==) :: NTree -> NTree -> Bool #

(/=) :: NTree -> NTree -> Bool #

Show NTree Source # 
Instance details

Defined in Epidemic.Utility

Methods

showsPrec :: Int -> NTree -> ShowS #

show :: NTree -> String #

showList :: [NTree] -> ShowS #

sort :: Ord a => [a] -> [a] Source #

Example run > (Success foo) = parseString newickTree mempty "((foo:1.1,bar:1.2):1.3,baz:1.4);" > (Success bar) = parseString newickTree mempty $ show foo > foo == bar True

count' :: (a -> Bool) -> [a] -> Int Source #

simulationWithGenIO :: (ModelParameters a b, Population b) => SimulationConfiguration a b -> (a -> AbsoluteTime -> Maybe (b -> Bool) -> SimulationState b -> GenIO -> IO (SimulationState b)) -> GenIO -> IO [EpidemicEvent] Source #

Run a simulation described by a configuration object with the provided PRNG.

simulation :: (ModelParameters a b, Population b) => SimulationConfiguration a b -> (a -> AbsoluteTime -> Maybe (b -> Bool) -> SimulationState b -> GenIO -> IO (SimulationState b)) -> IO [EpidemicEvent] Source #

Run a simulation described by a configuration object using the fixed PRNG that is hardcoded in the mwc-random package.

isReconTreeLeaf :: EpidemicEvent -> Bool Source #

Predicate for whether an epidemic event will appear as a leaf in the reconstructed tree.

simulation' :: (ModelParameters a b, Population b) => SimulationConfiguration a b -> (a -> AbsoluteTime -> Maybe (b -> Bool) -> SimulationState b -> GenIO -> IO (SimulationState b)) -> GenIO -> IO [EpidemicEvent] Source #

Simulation conditioned upon there being at least two sequenced samples. NOTE This function is deprecated and will be removed in future versions.

simulationWithSystemRandom :: (ModelParameters a b, Population b) => SimulationConfiguration a b -> (a -> AbsoluteTime -> Maybe (b -> Bool) -> SimulationState b -> GenIO -> IO (SimulationState b)) -> IO [EpidemicEvent] Source #

Run a simulation described by a configuration object but using a random seed generated by the system rather than a seed

finalSize Source #

Arguments

:: [EpidemicEvent]

The events from the simulation

-> Integer 

The number of lineages at the end of a simulation.

inhomExponential Source #

Arguments

:: PrimMonad m 
=> Timed Double

Step function

-> AbsoluteTime

Start time

-> Gen (PrimState m)

Generator

-> m (Maybe AbsoluteTime) 

Generate exponentially distributed random variates with inhomogeneous rate starting from a particular point in time.

Assuming the stepFunc is the intensity of arrivals and t0 is the start time this returns t1 the time of the next arrival.

randInhomExp Source #

Arguments

:: PrimMonad m 
=> AbsoluteTime

Timer

-> Timed Double

Step function

-> Gen (PrimState m)

Generator.

-> m (Maybe AbsoluteTime) 

Generate exponentially distributed random variates with inhomogeneous rate.

TODO The algorithm used here generates more variates than are needed. It would be nice to use a more efficient implementation.

maybeToRight :: a -> Maybe b -> Either a b Source #

Helper function for converting between the Maybe monad and the Either monad.