!MX script for a univariate imprinted QTL model from Chapter 11 ! Estimate QTL, additive genetic and non-shared environmental components ! AEQ model ! Imprinted QTL model #loop $file 395 430 1 #define nvar 1 #define nsib 2 #define nvar2 2 G1: Model Parameters marker $file ! $ file is included on the title line to make it easy to see what marker is ! being analyzed while the job is running Calculation Ngroups=4 Matrices ; X Lower nvar nvar Free ! additive genetic path, a Z Lower nvar nvar Free ! specific environmental path, e B Full nvar 1 Free ! maternal specific qtl genetic path, qm C Full nvar 1 Free ! paternal specific qtl genetic path, qp H Full 1 1 ! scalar, 0.5 T Full 1 1 Free ! means matrix R Full 1 1 Free ! regression beta to correct for sex effects on the ! means End Matrices ; !adding labels to matrices Label Row X add_gen Label Row Z spec_env Label Row B mat_qtl Label Row C pat_qtl Matrix H 1 !starting values Matrix x 2000 Matrix z 500 Matrix b 100 Matrix c 100 Start 2000 T 1 1 1 Begin Algebra ; A= X*X'; ! additive genetic variance, a^2 E= Z*Z'; ! specific environmental variance, e^2 M= B*B'; ! Maternal QTL variance, qm^2 F= C*C'; ! Paternal QTL variance, qp^2 V=A+E+M+F; ! total variance W=A+M+F; ! mz covariance End Algebra ; end G2: MZ data group Data NInput=8 Rectangular File=mzfile.dat labels fam phenotype sex1 phenotype2 sex2 mat pat pihat Select phenotype1 phenotype2 sex1 sex2 ; Definiton_variables sex1 sex2 ; Matrices ; V computed nvar nvar =V1 ! total variance C computed nvar nvar =W1 ! precomputed mz covariance T Full 1 1 =T1 ! means matrix R Full 1 1 =R1 ! regression beta to correct for sex effects on the means S Full 1 nsib ! contains sex covariate End Matrices ; !place covariates in matrices Specify S sex1 sex2; Means (T|T)+(R@S) ; Covariances V|C_C|V; option no_output ! reduces the size of the output by omitting output for this group end Title G3:DZ data group Data NInput=8 Rectangular File=ss_mx$file`.dat ! the ` is required to avoid placing a space after the loop string Labels fam phenotype1 sex1 phenotype2 sex2 mat pat pihat Select phenotype1 phenotype2 mat pat sex1 sex2 ; ! mat and pat are precomputed maternal and paternal pihat estimates Definiton_variables mat pat sex1 sex2 ; Matrices ; A computed nvar nvar =A1 ! genetic variance E computed nvar nvar =E1 ! specific environmental variance M computed nvar nvar =M1 ! Qm variance F computed nvar nvar =F1 ! Qp variance T Full 1 1 =T1 ! means matrix R Full 1 1 =R1 ! regression beta to correct for sex effects on the means S Full 1 nsib ! contains sex covariate End Matrices ; !place covariates in matrices Specify S sex1 sex2; Specify X mat Specify Y pat Means (T|T)+(R@S) ; Covariances A+E+M+F|A+X@M+Y@F_ A+X@M+Y@F|A+E+M+F ; option no_output end Title G7: Standardization Calculation Matrices ; ! reading precomputed matrices V computed nvar nvar =V1 ! total variance A computed nvar nvar =A1 ! genetic variance E computed nvar nvar =E1 ! specific environmental variance M computed nvar nvar =M1 ! Qm variance F computed nvar nvar =F1 ! Qp variance End Matrices ; Begin Algebra ; Y=A|E|M|F; ! concatenate parameter estimates S=Y@V~; ! standardized parameter estimates End Algebra ; option MXS=standardized.txt ! outputs the standardized parameter estimates to standardized.txt option append ! stops standardized.txt being overwritten with each analysis option multiple jiggle end !test to Qm=Qf EQ B 1 1 1 C 1 1 1 exit #end loop