-
Notifications
You must be signed in to change notification settings - Fork 4
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 knn(train = pcaND[rownames(eigenvect)[-1 * nrow(eigenvect)]: no missing values are allowed #179
Comments
Hi Mikhail, The The I can see a problem with
|
Thanks, Astrid. I follow the explanation, but even with sourcing your code the same error remains. It is expectedly in the y_pred <- knn(train=pcaND[rownames(eigenvect)[-1*nrow(eigenvect)],],
test=pcaND[rownames(eigenvect)[nrow(eigenvect)],,
drop=FALSE],
cl=factor(spRef[rownames(eigenvect)[-1*nrow(eigenvect)]],
levels=listCatPop, labels=listCatPop),
k=kList[kV],
prob=FALSE) All values to the arguments are complete, e.g., > nrow(pcaND)
[1] 3250
> nrow(pcaND[complete.cases(pcaND),])
[1] 3250 The |
Hi Mikhail, Do you have any |
Both |
What about |
This is indeed the cause: > sum(is.na(factor(spRef[rownames(eigenvect)[-1*nrow(eigenvect)]],
... levels=listCatPop, labels=listCatPop)))
[1] 780 Looks like these NAs are at the end of 3249-long factor. Trying to understand why.. |
What |
It has the expected > table(spRef[rownames(eigenvect)[-1*nrow(eigenvect)]], useNA = "always")
AFR AMR EAS EUR SAS <NA>
627 344 507 512 479 780 |
|
Will keep debugging the previous steps. Thank you, Astrid. |
Hopefully, we will have more time to work on the package after final submission of the paper (probably beginning of next week). |
I was able to run all steps except the last, Step 4 - Run the ancestry inference on the external study. The error is in this function call:
I tried to debug the source code - the error is generated by the following:
I tried to go deeper, but running into questions like which package the
knn
function is coming from, etc.The strange thing is that I was able to successfully run the code on two samples. But then, this error started to occur. I'm running the same samples. I took the original vignette and again adjusted the code for my samples, to minimize the chance I modified something incorrectly. The error persists. Any suggestions?
The text was updated successfully, but these errors were encountered: