Problema with my strata

273 views
Skip to first unread message

Laia Juliana Muñoz

unread,
Feb 18, 2022, 7:59:55 PM2/18/22
to da...@googlegroups.com


Hi. I am working on improving the AMOVA analysis. Developers from adegenet suggested me to contact you. I have my genlight object but when I try to run the AMOVA I have the error(I am using a genind object). 


strata_df <- data.frame(other(geni)) # Create a data frame from the list.

Starting gl.read.dart

Starting utils.read.dart
Topskip not provided. Setting topskip to 6 .
Reading in the SNP data
Detected 2 row format.
Added the following locus metrics:
AlleleID AlleleSequence TrimmedSequence Chrom_Bacterias_NCBI ChromPos_Bacterias_NCBI AlnCnt_Bacterias_NCBI AlnEvalue_Bacterias_NCBI SNP SnpPosition CallRate OneRatioRef OneRatioSnp FreqHomRef FreqHomSnp FreqHets PICRef PICSnp AvgPIC AvgCountRef AvgCountSnp RepAvg .
Number of rows per clone (should be only 2 s): 2
Recognised: 198 individuals and 86911 SNPs in a 2 row format using YFT2.csv
Completed: utils.read.dart
Starting utils.dart2genlight
Starting conversion....
Format is 2 rows.
Please note conversion of bigger data sets will take some time!
Once finished, we recommend to save the object using save(object, file="object.rdata")
Adding individual metrics: meta2.csv .
Ids for individual metadata (at least a subset of) are matching!
Found 198 matching ids out of 198 ids provided in the ind.metadata file.
Added population assignments.
Added latlon data
Added id to the other$ind.metrics slot.
Added pop to the other$ind.metrics slot.
Added lat to the other$ind.metrics slot.
Added lon to the other$ind.metrics slot.
Completed: utils.dart2genlight
Data read in. Please check carefully the output above
Read depth calculated and added to the locus metrics
Minor Allele Frequency (MAF) calculated and added to the locus metrics
Recalculating locus metrics provided by DArT (optionally specified)
Completed: gl.read.dart
Error in (function (..., row.names = NULL, check.rows = FALSE, check.names = TRUE, :
arguments imply differing number of rows: 86911, 198, 1


I am following the adegenet  tutorial but l dont have data in my strata. 


I will be extremely grateful if you could help me with this issue, as I have been trying to solve it for quite a few days already.


Best,

Laia 


Jose Luis Mijangos

unread,
Feb 18, 2022, 11:16:37 PM2/18/22
to dartR
Hi Laia,

I could not figure out what is the error you are getting with the information you sent. Could you please check the following link about how to produce a reproducible example:


Please send the exact code you are using and preferably using a test dataset as in the code below.

library(dartR)
# test data as provided by DArT
test <- gl.read.dart(filename =system.file('extdata', 'testset_SNPs_2Row.csv', package = 'dartR'))
# checking the compliance of the genlight object
test <- gl.compliance.check(test)
# performing amova
test_amova <- gl.amova(test)                    

Note that dartR uses the format genlight not genind. You can convert a genind object to genlight object as follows:

# Converting genind to genlight
# test datset from adegenet
data(microbov)
test_gl <- gi2gl(microbov)
 

Cheers,
Luis

Laia Juliana Muñoz

unread,
Feb 19, 2022, 9:17:00 AM2/19/22
to da...@googlegroups.com

Hi Luis. It was the code that I ran. I know about the objects, I have both because, according to adegenet, I need the genind and also I was trying to use poppr but I have been having the same error (I need the strata) The amova analyses with dartR work well but plosone is the revision of my manuscript is asking me for a  more complete analysis that show differences between populations and individuals. Radiator does not have AMOVA analysis and it is the reason why I am using other packages. 

Here thee example with poppr
library(dartR)
setwd("C:/Users/User/Desktop/Laia/Desktop/YFT/YFT-Ecuador-Laia update/YFT-Ecuador-Laia")
gl <- gl.read.dart(filename = "YFT2.csv", ind.metafile = "meta2.csv")
geni <- gl2gi(gl, probar=FALSE, verbose = NULL)
  genclone <- poppr::as.genclone(geni)
library("poppr")
data("Aeut")
strata(Aeut) <- data.frame(other(Aeut)$population)
Aeut <- as.genclone(Aeut)
Aeut 

Error in (function (..., row.names = NULL, check.rows = FALSE, check.names = TRUE, :
arguments imply differing number of rows: 86911, 198, 1


Please let me know if it is clear now. 
Thank you,
Laia
--
You received this message because you are subscribed to the Google Groups "dartR" group.
To unsubscribe from this group and stop receiving emails from it, send an email to dartr+un...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/dartr/2070f98d-083a-4eff-a7d6-55986f6e4d88n%40googlegroups.com.

Jose Luis Mijangos

unread,
Feb 20, 2022, 6:34:34 PM2/20/22
to dartR
Hi Laia,

I still could not figure out where you got the error from the information you sent.

There are different methods to perform AMOVA; dartR uses the AMOVA implementation from package pegas. I think you are trying to perform AMOVA using the method implemented in the package poppr. If you get the error from poppr, I suggest contacting poppr developers.

I suggest reading the documentation of the different AMOVA functions carefully. You can access the documentation of the functions, for example, by typing in the R console:
 
?poppr::poppr.AMOVA
?dartR::gl.AMOVA
?pegas::AMOVA
?StAMPP::stamppAMOVA

Here is how you can perform AMOVA in dartR and in poppr

library(dartR)
library(poppr)

# Here is AMOVA using dartR
# Don't use gl as a variable because it is a function in base R
gl_test <- bandicoot.gl
# Performing AMOVA
amova_dartr <- gl.amova(gl_test)

# Here is AMOVA using poppr
# Converting genlight to genind
geni <- gl2gi(gl_test)
# Assign pop information to strata
strata(geni) <- data.frame(pop = pop(geni))
# Performing AMOVA
amova_poppr <- poppr.amova(geni,~pop,nperm = 100)

Cheers,
Luis

Laia Juliana Muñoz

unread,
Feb 22, 2022, 10:28:58 AM2/22/22
to da...@googlegroups.com
Thank you Luis.
Best,
Laia

Reply all
Reply to author
Forward
0 new messages