Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error in if (lev[1] != inter) { : the condition has length > 1 #145

Open
grtomam1 opened this issue Sep 16, 2024 · 9 comments
Open

Error in if (lev[1] != inter) { : the condition has length > 1 #145

grtomam1 opened this issue Sep 16, 2024 · 9 comments

Comments

@grtomam1
Copy link

In the latest version of GAPIT I have been getting this error message "Error in if (lev[1] != inter) { : the condition has length > 1" while trying to numericalize the hapmap file.

The same input files are not giving this error in an older version of GAPIT. Also the version giving an error is installed on a HPC. I am one of two people I know having this issue. I have tried both R 4.3.0 and 4.4.0

@jiabowang
Copy link
Owner

Yes, some functions were needed to update above R 4.4.0.
Now we have fixed this BUG, please re-source GAPIT function and try again.

@Eason418
Copy link

Yes, some functions were needed to update above R 4.4.0. Now we have fixed this BUG, please re-source GAPIT function and try again.

您好,我的R版本是4.4.0,GAPIT版本是GAPIT_3.4.0,依然是同样的报错,请问如何解决这个报错?

@Eason418
Copy link

报错信息如下:
QQ截图20241019172141

@jiabowang
Copy link
Owner

@Eason418 请使用最新的GAPIT, 现在是3.5版本,或者从GitHub上下载GAPIT.Numericalization函数,本地source一下

@ShonaStrachan
Copy link

Hello,
I've tried using your fix and still get the same error as Eason418. I was using R 4.4.0 and GAPIT 3.5. Tried re-sourcing GAPIT as well as going back to an older version - nothing seems to fix it.

@jiabowang
Copy link
Owner

@ShonaStrachan Could you send your data with me? So I can help.

@ShonaStrachan
Copy link

@jiabowang
Copy link
Owner

jiabowang commented Nov 11, 2024

@ShonaStrachan Thanks for your data. I noticed that there are lots of multiple mutations in your genotype file. we call them as MNPs, not as SNPs. So GAPIT can not deal with this type data directly.
image
We designed another function for this type data recently. Below is code.

X=myG[-1,]
newG=NULL
for(i in 1:nrow(X))
{
Gstore=GAPIT.HMP.Amplification(X[i,])
newG=rbind(newG,Gstore)
if(i%%100==0)print(i)
}
newG=rbind(myG[1,],newG)
write.table(newG,"new.HapMap.txt",sep="\t",row.names=F,quote=F,col.names=F)

myG=data.table::fread("new.HapMap.txt",
header = F,
na.strings = c("NA", "NaN"),
data.table = F)
myGAPIT <- GAPIT(
G=myG,#Genotype
PCA.total=3)

write.table(myGAPIT$GD,"GD.txt",row.names=F,quote=F)
write.table(myGAPIT$GM,"GM.txt",row.names=F,quote=F)
write.table(myGAPIT$PCA,"CV.txt",row.names=F,quote=F)
myGD=myGAPIT$GD
myGM=myGAPIT$GM
myCV=myGAPIT$PCA
After got the numeric genotype data, you can use them to do GWAS.

@ShonaStrachan
Copy link

I've tried the fix and it's working now. Thank you for your help.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants