elynx-seq-0.0.1: Handle molecular sequences

Copyright(c) Dominik Schrempf 2017
LicenseGPLv3
Maintainerdominik.schrempf@gmail.com
Stabilityunstable
Portabilitynon-portable (not tested)
Safe HaskellNone
LanguageHaskell2010

ELynx.Data.Character.BoundaryMutation

Contents

Description

The boundary mutation model is a discrete-state, continuous-time Markov process that allows mutations only when the population is monomorphic.

  • Changelog

TODO: BM states can not be read and written with a single letter, like characters.

Synopsis

Types

data Nucleotide Source #

Nucleotides.

Instances
Bounded Nucleotide Source # 
Instance details

Defined in ELynx.Data.Character.Nucleotide

Enum Nucleotide Source # 
Instance details

Defined in ELynx.Data.Character.Nucleotide

Eq Nucleotide Source # 
Instance details

Defined in ELynx.Data.Character.Nucleotide

Ord Nucleotide Source # 
Instance details

Defined in ELynx.Data.Character.Nucleotide

Read Nucleotide Source # 
Instance details

Defined in ELynx.Data.Character.Nucleotide

Show Nucleotide Source # 
Instance details

Defined in ELynx.Data.Character.Nucleotide

Unbox Nucleotide Source # 
Instance details

Defined in ELynx.Data.Character.Nucleotide

Character Nucleotide Source # 
Instance details

Defined in ELynx.Data.Character.Nucleotide

Vector Vector Nucleotide Source # 
Instance details

Defined in ELynx.Data.Character.Nucleotide

MVector MVector Nucleotide Source # 
Instance details

Defined in ELynx.Data.Character.Nucleotide

newtype Vector Nucleotide Source # 
Instance details

Defined in ELynx.Data.Character.Nucleotide

newtype MVector s Nucleotide Source # 
Instance details

Defined in ELynx.Data.Character.Nucleotide

type Allele = Nucleotide Source #

Alleles are just nucleotides at the moment. However, I want to keep the code such that it can be extended easily to codons or amino acids.

type PopulationSize = Int Source #

The population size has to be larger than one otherwise there be dragons.

type AlleleCount = Int Source #

The absolute frequency of an allele.

data State Source #

A boundary mutation model state is either a boundary state or a polymorphic state. The population size has to be larger than one; the allele count has to be larger than one and lower than the population size, otherwise there be dragons.

Another possibility would be: data State = Bnd Allele | Ply AlleleCount Allele Allele data StateComplete = StateComplete PopulationSize State But then, I think it is more important that the information is kept in one, at the cost of some overhead.

Constructors

Bnd 

Fields

Ply 

Fields

Instances
Bounded State Source #

A fixed population size nFixed is assumed.

Instance details

Defined in ELynx.Data.Character.BoundaryMutation

Enum State Source #

Enumeration only works when the population size is nFixed. Only then, toEnum . fromEnum == id can be guaranteed. This is because toEnum :: State is only defined if the population size is known. See also fromIndexWith, and toIndex, as well as, setPopulationSize.

Instance details

Defined in ELynx.Data.Character.BoundaryMutation

Eq State Source # 
Instance details

Defined in ELynx.Data.Character.BoundaryMutation

Methods

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

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

Ord State Source #

A total order on the boundary mutation model states. In general, Bnd < Ply. Then, sorting happens according to the order population size, first allele, second allele, allele count. It may be beneficial to reverse the allele count order (i.e., make a polymorphic state with higher allele count show up before a polymorphic state with lower allele count, this would move some polymorphic states closer to their respective boundaries),

Instance details

Defined in ELynx.Data.Character.BoundaryMutation

Methods

compare :: State -> State -> Ordering #

(<) :: State -> State -> Bool #

(<=) :: State -> State -> Bool #

(>) :: State -> State -> Bool #

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

max :: State -> State -> State #

min :: State -> State -> State #

Read State Source # 
Instance details

Defined in ELynx.Data.Character.BoundaryMutation

showCounts :: State -> ByteString Source #

L.ByteString representation of State; without surrounding brackets.

nFixed :: Int Source #

Fixed population size when converting a State to or from a number. In this case, a fixed population size is necessary so that toEnum . fromEnum == id. When converting from a number to State, the population size has to be given or assumed (see fromIndexWith) anyways. Especially when performing IO, the same number should always correspond to the same State (bijection). nFixed has been set such that the size of the state space is 256.

Functions

setPopulationSize :: PopulationSize -> State -> Maybe State Source #

Set the population size of a State; validity of resulting State is checked.

fromIndexWith :: PopulationSize -> Int -> State Source #

For a given population size PopulationSize, convert a number Int to State.

toIndex :: State -> Int Source #

Convert State to a number Int for the given population size PopulationSize. Back conversion can be done with fromIndexWith, with the same population size.

stateSpace :: PopulationSize -> [State] Source #

Sorted list of all possible PoMo states for a specific population size.

stateSpaceSize :: PopulationSize -> Int Source #

The state space of the boundary mutation model for four alleles and a population size N is 4 + 6*(N-1).

neighbors :: State -> State -> Bool Source #

Check if two states are connected. By definition, states are NOT connected with themselves.