reworkhow / JWAS.jl

Julia for Whole-genome Analysis Software
http://QTL.rocks
GNU General Public License v2.0
96 stars 44 forks source link

add variance module #145

Closed zhaotianjing closed 9 months ago

zhaotianjing commented 9 months ago

wiki page: https://github.com/reworkhow/JWAS.jl/wiki/Constraint-on-variance-components

  1. change estimateScale to estimate_scale;
  2. delete mega_trait because it equals adding constraint on variances
  3. move constraint argument in runMCMC() to build_model(). This is to put all residual variance related argument together.
  4. add variance structural, and modify related code. add printed info if constraint; add error if constraint in ST

      mutable struct Variance
          val::Union{AbstractFloat, AbstractArray, Bool}   #value of the variance, e.g., single-trait: 1.5, two-trait: [1.3 0.4; 0.4 0.8]
          df::Union{AbstractFloat,Bool}                    #degrees of freedom, e.g., 4.0
          scale::Union{AbstractFloat, AbstractArray, Bool} #scale, e.g., single-trait: 1.0, two-trait: [1.0 0; 0 1.0]
    
          estimate_variance::Bool  #estimate_variance=true means estimate variance at each MCMC iteration
          estimate_scale::Bool     #estimate_scale=true means estimate scale at each MCMC iteration
          constraint::Bool        #constraint=true means in multi-trait analysis, covariance is zero
      end
  5. make scale in MT be a diagonal matrix everywhere
  6. organize arguments in build_model(), get_genotypes(), set_random ()
  7. relocate some comments in NNMM
  8. relocate initialization of scale_R, df_R to build_model()
  9. add R_constraint!() and G_constraint!() functions to change scale and df if constraint