Comments (1)
and the second part on Phenotypes...
Phenotype
Phenotype is easier. First with a Phenotype_unitt
giving the phenotype value for a single individual
struct Phenotype_unit
name::String
value::Float64 # value of the trait for 1 individual
end
name(pu::Phenotype_unit) = Phenotype_unit.name
value(pu::Phenotype_unit) = Phenotype_unit.value
Base.:*(p::Phenotype_unit, x::Number) = Phenotype_unit(x*p.phenotype)
Base.:*(x::Number, p::Phenotype_unit) = Phenotype_unit(x*p.phenotype)
Base.:+(p::Phenotype_unit, x::Number) = Phenotype_unit(p.phenotype + x)
Base.:+(x::Number, p::Phenotype_unit) = Phenotype_unit(p.phenotype + x)
# Base.:+(p1::Phenotype_unit, p2::Phenotype_unit) = ... sense ?
Base.:-(p::Phenotype_unit, x::Number) = Phenotype_unit(p.phenotype - x)
Base.:-(x::Number, p::Phenotype_unit) = Phenotype_unit(p.phenotype - x)
# Base.:-(p1::Phenotype_unit, p2::Phenotype_unit) = ... # sense ?
Base.zero(::Type{<:Phenotype_unit{T}}) where {T} = Phenotype_unit(zero(T))
Then there is several possibility
struct Phenotype <: AbstractIndividual
phenotype::Array{Phenotype_unit, 1} # set of values of trait for 1 individual
# TODO: 1. Each name of Phenotype_unit has to be unique within the phenotype vector
end
# Using genericity of Phenotype Unit
# Base.:*(p::Phenotype, x::Number) = ...
# Base.:*(x::Number, p::Phenotype) = ...
struct Population <: AbstractPopulation
size::Float64 # Size of the population. Again an Integer could be relevant
phenotypes::Array{Phenotype, 1} # set of values of trait for 1 individual
# TODO: size is the length of phenotypes vector
end
size(pp::Population) = pp.size
phenotypes(pp::Population) = pp.phenotypes
Then, converting a Population
to a StatsPopulation
allow to make some operation by assuming Normal distribution of phenotypes, we can develop:
X ~ N(\mu, \sigma^2 ) => a X + b ~ N(a \mu + b, a^2 \sigma^2)
X ~ N(\mu_x, \sigma_x^2 ) and Y ~ N(\mu_y, \sigma_y^2 ) => X + Y ~ N(\mu_x + \mu_y, \sigma_x^2 + \sigma_y^2)
struct StatsPopulation <: StatisticsPopulation
size::Int64
phenotypeNames::Array{String, 1} # retrieve from Phenotype_unit
phenotypeMean::Array{Float64, 1}
phenotypeVariance::Array{Float64, 1}
# TODO: INTERNAL CONSTRUCTOR based on
end
size(sp::StatsPopulation) = sp.size
names(sp::StatsPopulation) = sp.phenotypeNames
means(sp::StatsPopulation) = sp.phenotypeMean
variances(sp::StatsPopulation) = sp.phenotypeVariance
from dispersal.jl.
Related Issues (20)
- All rules need example construcors in the docs
- Consider "OrganismDispersal" as a name? HOT 1
- Rename HumanDispersal to GravityDispersal HOT 4
- Provide citations and latex formulas where applicable
- A rule depending on 2 layers and chaining rules using arguments HOT 17
- DateTime of layers seems buggy HOT 1
- Drop `Exact` from growth model names HOT 1
- DateTime handling in layers
- Check human dispersal weights array and grwothmaps aux size in `precalc`
- Idea to better implement subpopulation functions | enhancement HOT 2
- Move optimisation tools to another package.
- Document and clarify kernel generation models HOT 1
- Clarify genetic methods to add to Dispersal.jl HOT 4
- Move downsapling code or use GeoData / DimensionalData
- precalc_auxtimeindex of GeoArray HOT 2
- TagBot trigger issue HOT 11
- Fix broken docs
- Precompile failed HOT 14
- Dispersal weight
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from dispersal.jl.