Skip to content

Help in Pegas

2 messages · Ramendra Nath Sarma, Zhian Kamvar

#
Hi,
I used a file converted from Structure to use Pegas to analysis AMOVA and
to analyse Fst or other population parameters. Iam getting the error with
NA as:
Warning message:
In pegas::amova(amova_dist ~ Pop, data = amova_stra, nperm = 0) :
  at least one missing value in the distance object.
Analysis of Molecular Variance

Call: pegas::amova(formula = amova_dist ~ Pop, data = amova_stra, nperm = 0)

           SSD      MSD  df
Pop         NA       NA   2
Error 16241.53 113.5772 143
Total       NA       NA 145

Variance components:
     Pop    Error
      NA 113.5772

Variance coefficients:
       a
29.23973



My scripts in R as follows:
library("poppr")
library("adegenet")
amova<-read.structure ("~/Desktop/HARENDRA/structure1.str")
strata(amova) <- data.frame(Pop = pop(amova))
library(pegas)
amova_dist  <- dist(amova) # Euclidean distance
amova_dist
amova_stra  <- strata(amova)
amova_stra
pegas_amova <- pegas::amova(amova_dist ~Pop, data = amova_stra, nperm = 0)
pegas_amova


Where I am wrong? Please suggest as novice to R.


----------------------------------------------------------------------------------------------------------------------------------------






*Dr R N SarmaProfessorDepartment of Plant Breeding and GeneticsAssam
Agricultural UniversityJorhat-785013Assam, Indiaweb: www.aau.ac.in;
<http://www.aaau.ac.in> Phone: +91-376-2310526; +91-376231133(R);
9435350529(M)*
--------------------------------------------------------------------------------------------------------------------------
#
Hi Ramendra,
This warning is most likely caused by having genotypes with reciprocal missing data, which result in a distance matrix with missing data. You have two options:

1. Interpolate the missing data in the distance matrix with the ape functions additive() or ultrametric() (see: http://stackoverflow.com/a/34022156/2752888 <http://stackoverflow.com/a/34022156/2752888> and http://dx.doi.org/10.1093/bioinformatics/bth211).
2. Find the genotypes that have the most incompatibilities (you can use the poppr function incomp() for this) and remove them.

Hope that helps,
Zhian