Error in gl.basic.stats for simulated offspring

92 views
Skip to first unread message

Nga Vu

unread,
Apr 21, 2022, 12:25:17 AM4/21/22
to dartR
Dear all,

I am trying to calculate the genetic diversity of simulated offspring and calculate genetic diversity for simulated offspring.

- First, I simulate offspring 
gl_F1 <- gl.sim.offspring(gl_Dad, gl_Mom, noffpermother=10, sexratio= 1)

 /// GENLIGHT OBJECT /////////

 // 180 genotypes,  3,555 binary SNPs, size: 1.5 Mb
 210717 (32.93 %) missing data

 // Basic content
   @gen: list of 180 SNPbin
   @ploidy: ploidy of each individual  (range: 2-2)

 // Optional content
   @ind.names:  180 individual labels
   @loc.names:  3555 locus labels
   @other: a list containing: sex
 
- Then, Calculates the observed, expected and unbiased expected
df_report_he <- gl.report.heterozygosity(gl_F1)

Starting gl.report.heterozygosity
  Processing genlight object with SNP data
  Warning: data include loci that are scored NA across all individuals.
  Consider filtering using gl <- gl.filter.allna(gl)
  No population assignments detected,
                             individuals assigned to a single population labelled 'pop1'
  Calculating Observed Heterozygosities, averaged across loci, for each population
  Calculating Expected Heterozygosities

Error in if (x@other$loc.metrics.flags$monomorphs == FALSE) { :
  argument is of length zero

- Then, Diverbasic <- gl.basic.stats(gl_F1, digits = 4, verbose = NULL)

Starting gl.basic.stats
  Processing genlight object with SNP data
  Warning: data include loci that are scored NA across all individuals.
  Consider filtering using gl <- gl.filter.allna(gl)
Error in .nextMethod(x = x, value = value) :
  Vector length does no match number of loci
In addition: Warning message:
In df2genind(xx[, ], sep = "/", ncode = 1, ind.names = x...@ind.names,  :
  Markers with no scored alleles have been removed


I don't know what is the issues here. My question is Can I calculate genetic diversity for simulated offspring? if Yes, how can I fix my script?

Thanks and I really appreciate all your help

Cheers
Nga




Bernd.Gruber

unread,
Apr 21, 2022, 12:45:39 AM4/21/22
to da...@googlegroups.com

Hi Nga,

 

Not 100% sure, but the problem most likely is that the genlight obhect your returned does not have a pop label.

 

Can  you try:

 

pop(gl_F1) <- rep(“A”, nInd(gl_F1)

 

and also run

 

gl_F1 <- gl.compliance.check(gl_F1)

 

then it should work.

 

Cheers, Bernd

--
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/692367bf-0873-417c-8144-021c8a60a275n%40googlegroups.com.

Reply all
Reply to author
Forward
0 new messages