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

K=1 #14

Closed j-a-thia closed 4 years ago

j-a-thia commented 6 years ago

Hey there,

I have attached the code for an analysis using pool-seq data to run pairwise tests of selection. At the end of the run, all loadings that are not NA are the same values, and $pvalues vector contains all NA.

I noted that there have been fixes made for when K=1, but does it make sense to use pcadapt for just 2 populations and were these fixes made specifically for dealing with pairwise tests?

Thanks heaps.

Best,

~ Josh

# 2 pops, 11404 SNPs
> dim(subMat)
[1]     2 11404

# Pool-seq outlier test
selTest <- pcadapt(read.pcadapt(subMat, type='pool'))

# All loadings onto the first PC are the same, when not NA
> selTest$loadings[1:20]
 [1]         NA 0.02788612 0.02788612         NA         NA         NA 0.02788612         NA 0.02788612 0.02788612 0.02788612 0.02788612
[13] 0.02788612 0.02788612         NA 0.02788612 0.02788612 0.02788612 0.02788612 0.02788612

# Number of NA p-values is the same as number of SNPs
> length(is.na(selTest$pvalues))
[1] 11404
privefl commented 6 years ago

Please try again with devtools::install_github("bcm-uga/pcadapt@privefl-patch-1"). Also, use sum(is.na(selTest$pvalues)) to check the number of missing values.

For the interpretability of the results, I leave the answer to @mblumuga.

j-a-thia commented 6 years ago

Aah! Good point re is.na call; but I can assure you there were no p-values present in the original analysis above.

However, upon re-installing with above patch, the pairwise analysis has indeed run.

Thanks so much for your help, @privefl.

Best,

~ Josh

> dim(subMat)
[1]     2 11106

> selTest <- pcadapt(read.pcadapt(subMat, type='pool'))

> selTest$loadings[1:20]
 [1]          NA  0.02788612 -0.05923945          NA          NA          NA
 [7]          NA -0.13019456 -0.10317272 -0.10078836  0.02355193  0.07366143
[13]  0.03001970          NA  0.01409565 -0.00162545 -0.09218894  0.01146441
[19] -0.04221162  0.01018394

> selTest$pvalues[1:20]
 [1]         NA 0.66335563 0.25891224         NA         NA         NA         NA
 [8] 0.01626596 0.05514360 0.06080177 0.72074090 0.20870517 0.63579147         NA
[15] 0.85111889 0.92466010 0.08533423 0.88830464 0.41036657 0.90649535