| Safe Haskell | None |
|---|---|
| Language | Haskell2010 |
Epidemic.Utility
Synopsis
- initialIdentifier :: Identifier
- newPerson :: Identifier -> (Person, Identifier)
- selectElem :: Vector a -> Int -> (a, Vector a)
- randomPerson :: People -> GenIO -> IO (Person, People)
- type NName = Maybe String
- type NLength = Maybe Double
- data NBranch = NBranch NSubtree NLength
- data NBranchSet = NBranchSet [NBranch]
- data NSubtree
- data NTree = NTree [NBranch]
- sort :: Ord a => [a] -> [a]
- count' :: (a -> Bool) -> [a] -> Int
- simulationWithGenIO :: (ModelParameters a b, Population b) => SimulationConfiguration a b -> (a -> AbsoluteTime -> Maybe (b -> Bool) -> SimulationState b -> GenIO -> IO (SimulationState b)) -> GenIO -> IO [EpidemicEvent]
- simulation :: (ModelParameters a b, Population b) => SimulationConfiguration a b -> (a -> AbsoluteTime -> Maybe (b -> Bool) -> SimulationState b -> GenIO -> IO (SimulationState b)) -> IO [EpidemicEvent]
- isReconTreeLeaf :: EpidemicEvent -> Bool
- simulation' :: (ModelParameters a b, Population b) => SimulationConfiguration a b -> (a -> AbsoluteTime -> Maybe (b -> Bool) -> SimulationState b -> GenIO -> IO (SimulationState b)) -> GenIO -> IO [EpidemicEvent]
- simulationWithSystemRandom :: (ModelParameters a b, Population b) => SimulationConfiguration a b -> (a -> AbsoluteTime -> Maybe (b -> Bool) -> SimulationState b -> GenIO -> IO (SimulationState b)) -> IO [EpidemicEvent]
- finalSize :: [EpidemicEvent] -> Integer
- inhomExponential :: PrimMonad m => Timed Double -> AbsoluteTime -> Gen (PrimState m) -> m (Maybe AbsoluteTime)
- randInhomExp :: PrimMonad m => AbsoluteTime -> Timed Double -> Gen (PrimState m) -> m (Maybe AbsoluteTime)
- maybeToRight :: a -> Maybe b -> Either a b
Documentation
newPerson :: Identifier -> (Person, Identifier) Source #
data NBranchSet Source #
Constructors
| NBranchSet [NBranch] |
Instances
| Eq NBranchSet Source # | |
Defined in Epidemic.Utility | |
| Show NBranchSet Source # | |
Defined in Epidemic.Utility Methods showsPrec :: Int -> NBranchSet -> ShowS # show :: NBranchSet -> String # showList :: [NBranchSet] -> ShowS # | |
Constructors
| NLeaf NName | |
| NInternal NBranchSet |
Instances
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
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
Arguments
| :: [EpidemicEvent] | The events from the simulation |
| -> Integer |
The number of lineages at the end of a simulation.
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.
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.