chenlab-uva / AncestryInference_KING

3 stars 2 forks source link

Problem with regression #1

Open vadimverenich opened 3 years ago

vadimverenich commented 3 years ago

I have recently discovered problem running Ancestry_Inference R code

Rscript Ancestry_Inference.R input/examplepc.txt input/example_popref.txt prefix Error in { : task 1 failed - "Need numeric dependent variable for regression." Calls: %dopar% -> Execution halted

shafiqnoa commented 2 years ago

Hi vadiverenich, Have you solved the issue? I get the same error. Please let me know if you have a solution for this.

liutiming commented 1 year ago

I think the issue here is that y in the svm formula is character type. The formula is defined by svm.mod <- as.formula(paste0("Population~", paste0("PC", 1:numpc, collapse = "+"))) and used in the following two lines: https://github.com/chenlab-uva/AncestryInference_KING/blob/279b3327e729ef1d13fc482d811ae4f56155b053/Ancestry_Inference.R#L32

and

https://github.com/chenlab-uva/AncestryInference_KING/blob/279b3327e729ef1d13fc482d811ae4f56155b053/Ancestry_Inference.R#L65

Thus, I suspect the problem can be partially resolved by set Population as a factor/numeric in dat before the svm step.

However, as I did so, the results of a largely European group now has largely AMR inferences, so I suspect there are some factor levels issue as the inference results are converted back to the population group. In any case, I will contact the project lead regarding this, and the script I have edited is https://gist.github.com/liutiming/8723973ecd0ef2d8fc9245e10fee5324

Thanks to @pontikos for helping with the debugging.

mhelena commented 1 year ago

Thank you @liutiming. I am using your edited script. It works well, but I am getting a lot of AFR inferences. Did you find out why that is happening?

Thanks!

alanmejiamaza commented 1 year ago

Hi,

Thanks for correcting the script. were any of you able to determine why AFR inferences are showing up at high levels? My SNP dataset are supposed to be south east Asians mostly but AFR shows up in a high %. Any idea? Thanks

VasiliosRaptis commented 7 months ago

Hello,

I had the same problem when running on R 4.2. It worked on R version 3.6.

finkbine commented 5 months ago

Hi, Just confirm that R 3.6 works well, I have to install the old R 3.6 on windows. VasiliosRaptis, thank you!