bcm-uga / pcadapt

Performing highly efficient genome scans for local adaptation with R package pcadapt v4
https://bcm-uga.github.io/pcadapt
37 stars 10 forks source link

Error in R package pcadapt when trying to use "screeplot" #28

Closed LRobo000 closed 5 years ago

LRobo000 commented 5 years ago

I am using the pcadapt package Version: 4.0.2, Title: Fast Principle Component Analysis for Outlier Detection.

I have used the following script before and it has worked with different N-populations/ N-SNPs .

setwd("C:/Users/liamg/Desktop/fox30 from LD onwards") pop30LD07HWE0000001 <- "30popLD07HWE0000001plink.ped" pop30LD07HWE0000001pca <- read.pcadapt(pop30LD07HWE0000001, type = "ped")

pop30LD07HWE0000001KP <- pcadapt(input = pop30LD07HWE0000001pca, K= 20) plot(pop30LD07HWE0000001KP, option = "screeplot") plot(pop30LD07HWE0000001KP, option = "screeplot", K = 10)

poplist.int <- c(rep(1,16), rep(2, 20), rep(3,20), rep(4,7), rep(5,13), rep(6,8), rep(7,26), rep(8,27), rep(9,9), rep(10,19), rep(11,25), rep(12,9), rep(13,13), rep(14,19), rep(15,7), rep(16,12), rep(17,8), rep(18,19), rep(19,7), rep(20,16), rep(21,10), rep(22,8), rep(23,7), rep(24,28), rep(25,14), rep(26,9), rep(27,18), rep(28,15), rep(29,20), rep(30,7))
poplist.names <- c(rep("POL_NE", 16),rep("IRE_W", 20),rep("NIR", 20),rep("FR_N", 7),rep("FR_C", 13),rep("RU_KOM", 8),rep("SP_N", 26),rep("UK_S", 27),rep("UK_N", 9),rep("RU_KIR", 19),rep("SOV", 25),rep("RU_YAK", 9),rep("POL_S", 13),rep("POL_W", 19),rep("URK", 7),rep("FN_S", 12),rep("FN_N", 8),rep("SWZ", 19),rep("IT_N", 7),rep("SW_N", 16),rep("SW_S", 10),rep("POR_S", 8),rep("POR_N", 7),rep("GER", 28),rep("BEL", 14),rep("CRO", 9),rep("SER_N", 18),rep("NOR_NE", 15),rep("IT_CW", 20),rep("SP_S", 7))
print(poplist.int) print(poplist.names) plot(pop30LD07HWE0000001KP = "scores", pop = poplist.int) plot(pop30LD07HWE0000001KP = "scores", pop = poplist.names) plot(pop30LD07HWE0000001KP = "scores", i = 3, j = 4, pop = poplist.names)

pop30LD07HWE0000001KP<-pcadapt(pop30LD07HWE0000001pca, K= 2) pop30LD07HWE0000001KP<-pcadapt(pop30LD07HWE0000001pca, K= 2, min.maf = 0.01) summary(pop30LD07HWE0000001KP) plot(pop30LD07HWE0000001KP, option = "manhattan") plot(pop30LD07HWE0000001KP, option ="qqplot", threshold =0.1) hist(pop30LD07HWE0000001KP$pvalues, xlab="p-values", main= NULL, breaks =50, col = "orange") plot(pop30LD07HWE0000001KP, option = "stat.distribution")

However the script stops at

plot(pop30LD07HWE0000001KP, option = "screeplot")

which results in the same error as above.

where it gives the following Error in dot_call(capture_dots, frame_env = frame_env, named = named, : Incorrect number of arguments (6), expecting 4 for 'rlang_quos_interp'

I have also Used scree_plot(pop30LD07HWE0000001KP, K=20) which results in the same error as above.

I have tried to understand this via many different ways such as Stack Overflow but can not figure out. I am fairly new to R but I can usually get information on the error I was thinking it could perhaps be a bug? if you have time to let me know if it something I can do I would appreciate the response.

Thank you Liam

privefl commented 5 years ago

This is an {rlang} issue. Googling it, I found https://github.com/r-lib/rlang/issues/329. Basically, close all your R sessions, open a fresh session and reinstall package {rlang}.

LRobo000 commented 5 years ago

Hi, I did that previously but perhaps not correctly. I now redownloaded R-Studio as well as deleting and redownloading rlang with devtools::install_github("r-lib/rlang", build_vignettes = TRUE). It has worked for this so thank you very much for answering my question. However It now shows an error on

plot(pop30LD07HWE0000001KP = "scores", pop = poplist.int) Error in xy.coords(x, y, xlabel, ylabel, log) : argument "x" is missing, with no default

which has never been shown before, is this the same package or is it a fault with a different package? Thank you for all your help.

privefl commented 5 years ago

Did you mean plot(pop30LD07HWE0000001KP, option = "scores", pop = poplist.int)?

LRobo000 commented 5 years ago

Yes with option = it works. You are fantastic thanks for the help I appreciate it.