From 95ca78a638a7f01788f8ecea63c4917a465ff2e0 Mon Sep 17 00:00:00 2001 From: jiabowang Date: Tue, 12 Dec 2023 10:59:07 +0800 Subject: [PATCH] Avoid rare frequency genotype in the Random model --- R/GAPIT.Numericalization.R | 16 +++------------- R/GAPIT.R | 1 + R/GAPIT.RandomModel.R | 4 ++++ 3 files changed, 8 insertions(+), 13 deletions(-) diff --git a/R/GAPIT.Numericalization.R b/R/GAPIT.Numericalization.R index f6beb0d..5d23c71 100644 --- a/R/GAPIT.Numericalization.R +++ b/R/GAPIT.Numericalization.R @@ -66,7 +66,9 @@ for(i in 1:len){ count[i]=length(x[(x==lev[i])]) } -#print(count) +# print(count) +# print(len) +# print() if(Major.allele.zero){ if(len>1 & len<=3){ @@ -108,18 +110,6 @@ position=order(count) #Jiabo creat this code to convert AT TA to 1 and 2.2018.5.29 -# lev1=lev -# if(bit==2&len==3) -# { -# lev1[1]=lev[count==sort(count)[1]] -# lev1[2]=lev[count==sort(count)[2]] -# lev1[3]=lev[count==sort(count)[3]] -# position=c(1:3) -# lev=lev1 -# } -#print(lev) -#print(position) -#print(inter) #Jiabo code is end here if(bit==1){ lev0=c("R","Y","S","W","K","M") diff --git a/R/GAPIT.R b/R/GAPIT.R index e581372..e609cc0 100644 --- a/R/GAPIT.R +++ b/R/GAPIT.R @@ -512,6 +512,7 @@ if(!is.null(Y)) out=c(out,myG_simulation) if(file.output)ViewPhenotype<-GAPIT.Phenotype.View(myY=myG_simulation$Y,traitname="Simulated.Phenotype",memo=memo0) } + print("Now the GAPIT is cbind taxa and numeric genotype...") out$GD=data.frame(cbind(as.data.frame(GT),as.data.frame(GD))) out$GM=GI out$G=myGenotype$G diff --git a/R/GAPIT.RandomModel.R b/R/GAPIT.RandomModel.R index 7c4a275..1a5bda1 100644 --- a/R/GAPIT.RandomModel.R +++ b/R/GAPIT.RandomModel.R @@ -33,6 +33,10 @@ function(GWAS,Y,CV=NULL,X,cutOff=0.01,GT=NULL,name.of.trait=NULL,N.sig=NULL,n_ra } geneGD=X[,index,drop=FALSE] geneGWAS=GWAS[index,,drop=FALSE] + var.gd=diag(var(geneGD)) + var.index=var.gd>0.0001 + geneGD=geneGD[,var.index] + geneGWAS=geneGWAS[var.index,] if(ld.cut) { gene.licols=GAPIT.Licols(X=geneGD)