Skip to content

Commit

Permalink
DeBUG taxa index and GTindex
Browse files Browse the repository at this point in the history
  • Loading branch information
jiabowang committed May 8, 2024
1 parent 4e8702e commit 8d6651c
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 13 deletions.
8 changes: 6 additions & 2 deletions R/GAPIT.EMMAxP3D.R
Original file line number Diff line number Diff line change
Expand Up @@ -421,7 +421,8 @@
}
m <- ncol(xs) #number of SNPs
t <- nrow(xs) #number of individuals

# print(m)
# print(t)
Timmer=GAPIT.Timmer(Timmer=Timmer,Infor="Before cleaning")
Memory=GAPIT.Memory(Memory=Memory,Infor="Before cleaning")
#allocate spaces for SNPs
Expand Down Expand Up @@ -620,6 +621,7 @@
#if(i == 1) {print("the head of X for running GWAS is")}
#if(i == 1) {print(head(X))}
}
# print(X)
} #end of i >0 | file>file.from|frag>1
#Recalculate eig and REML if not using P3D NOTE THIS USED TO BE BEFORE the two solid lines
if(SNP.P3D==FALSE & !is.null(K))
Expand Down Expand Up @@ -759,7 +761,9 @@
}

beta <- crossprod(iXX,XY) #Note: we can use crossprod here becase iXX is symmetric

# print(iXX)
# print(XY)
# print(beta)
#--------------------------------------------------------------------------------------------------------------------<
if(i ==0 &file==file.from &frag==1)
{
Expand Down
7 changes: 3 additions & 4 deletions R/GAPIT.HapMap.R
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,8 @@ function(G,SNP.effect="Add",SNP.impute="Middle",heading=TRUE, Create.indicator =
#print(paste("Number of bits for genotype: ", bit))

print("Perform numericalization")

# Gtest=G[-1,-(1:11)]
# print(Gtest[1:5,1:6])
if(heading){
if(!Create.indicator) GD= apply(G[-1,-(1:11)],1,function(one) GAPIT.Numericalization(one,bit=bit,effect=SNP.effect,impute=SNP.impute, Major.allele.zero=Major.allele.zero))
if(Create.indicator) GD= t(G[-1,-(1:11)])
Expand All @@ -43,9 +44,7 @@ function(G,SNP.effect="Add",SNP.impute="Middle",heading=TRUE, Create.indicator =
GT=NULL
GI=NULL
}

#print("The dimension of GD is:")
#print(dim(GD))
# print(GD[1:6,1:5])


if(!Create.indicator) {print(paste("Succesfuly finished converting HapMap which has bits of ", bit,sep="")) }
Expand Down
2 changes: 1 addition & 1 deletion R/GAPIT.Main.R
Original file line number Diff line number Diff line change
Expand Up @@ -692,7 +692,7 @@ function(Y,
#Z1=matrix(as.numeric(as.matrix(zc$Z[,-1])),nrow=zrow,ncol=zcol)
Timmer=GAPIT.Timmer(Timmer=Timmer,Infor="Prio PreP3D")
Memory=GAPIT.Memory(Memory=Memory,Infor="Prio PreP3D")
# print(optOnly)
# print(colInclude)
# print(head(CVI))
p3d <- GAPIT.EMMAxP3D(ys=ys,
xs=as.matrix(as.data.frame(GD[,colInclude])),
Expand Down
12 changes: 6 additions & 6 deletions R/GAPIT.Numericalization.R
Original file line number Diff line number Diff line change
Expand Up @@ -114,27 +114,27 @@ position=order(count)
if(bit==1){
lev0=c("R","Y","S","W","K","M")
inter=intersect(lev,lev0)
}else{
inter=lev
}
}#else{
#inter=lev
#}#

#1status other than 2 or 3
if(len<=1 | len> 3)x=0

#2 status
if(len==2)
{

if(!setequal(character(0),inter))
{
x=ifelse(x=="N",NA,ifelse(x==inter,1,0))
}else{
}else{
x=ifelse(x=="N",NA,ifelse(x==lev[1],0,2)) # the most is set 0, the least is set 2
}
}

#3 status
if(bit==1){
if(bit==1)
{
if(len==3)x=ifelse(x=="N",NA,ifelse(x==lev[1],0,ifelse(x==lev[3],1,2)))
}else{
if(len==3)x=ifelse(x=="N",NA,ifelse(x==lev[lev!=inter][1],0,ifelse(x==inter,1,2)))
Expand Down

0 comments on commit 8d6651c

Please sign in to comment.