RE: [dartR] amova error: Error in pop.num[i] <- which(pop.names[i] == pops) : replacement has length zero

136 views
Skip to first unread message

Bernd.Gruber

unread,
Oct 30, 2020, 2:17:54 AM10/30/20
to da...@googlegroups.com

Sounds like you do not have a definition of your populations.

 

Can you try

 

table(pop(i))

 

and see if you have defined your populations correctly.

 

Cheers,Bernd

 

 

 

==============================================================================

Dr Bernd Gruber                                              )/_         

                                                         _.--..---"-,--c_    

Professor Ecological Modelling                      \|..'           ._O__)_     

Tel: (02) 6206 3804                         ,=.    _.+   _ \..--( /          

Fax: (02) 6201 2328                           \\.-''_.-' \ (     \_          

Institute for Applied Ecology                  `'''       `\__   /\          

Faculty of Science and Technology                          ')                

University of Canberra   ACT 2601 AUSTRALIA

Email: bernd....@canberra.edu.au

WWW: bernd-gruber

 

Australian Government Higher Education Provider Number CRICOS #00212K 

NOTICE & DISCLAIMER: This email and any files transmitted with it may contain
confidential or copyright material and are for the attention of the addressee
only. If you have received this email in error please notify us by email
reply and delete it from your system. The University of Canberra accepts
no liability for any damage caused by any virus transmitted by this email.

==============================================================================

 

From: da...@googlegroups.com <da...@googlegroups.com> On Behalf Of jlsr
Sent: Friday, 30 October 2020 15:38
To: dartR <da...@googlegroups.com>
Subject: [dartR] amova error: Error in pop.num[i] <- which(pop.names[i] == pops) : replacement has length zero

 

Good day everyone,

 

I tried to perform amova for my SNP and DArT data using the code gl.amova(i) and gl.amova2(i). However, both codes resulted to an error: Error in pop.num[i] <- which(pop.names[i] == pops) :    replacement has length zero. I also tried to use the gl.amova2.r file I saw in previous threads here but same error showed.

What could be the problem with the code or the data?

 

Thank you very much.

 

 

 

Laurence

 

--
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/7580b49e-9070-478f-aab7-96d25a1ffa79n%40googlegroups.com.

Arthur Georges

unread,
Oct 30, 2020, 2:22:09 AM10/30/20
to da...@googlegroups.com
Try gl <- gl.compliance.check(gl),

then try again.

A



--
---------------------------------------------------------------------------------------------------------------------------
D-Prof. Arthur Georges
Institute for Applied Ecology, University of Canberra ACT 2601 Australia
Deliveries: Bld 3 Stores, Kirinari Street, Bruce ACT 2617
Tel : +61 (0)2 6201 5786  Fax: +61 (0)2 6201 5305  Mobile: +61 (0)418 866741
WWW: http://georges.biomatix.org
   ORCID ID: http://orcid.org/0000-0003-2428-0361

jlsr

unread,
Nov 2, 2020, 11:58:54 PM11/2/20
to dartR
Good day Dr. Bernd and Dr. Arthur,

I tried this: table(pop(i)) 
which resulted to: < table of extent 0 >.

I also run: gl <- gl.compliance.check(i)
which resulted to: 
/// GENLIGHT OBJECT /////////

 // 150 genotypes,  62,869 binary SNPs, size: 60.4 Mb
 3173859 (33.66 %) missing data

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

 // Optional content
   @ind.names:  150 individual labels
   @loc.names:  62869 locus labels
   @loc.all:  62869 alleles
   @position: integer storing positions of the SNPs
   @pop: population of each individual (group size range: 150-150)
   @other: a list containing: loc.metrics  loc.metrics.flags  verbose  history

I haven't included the population of each sample in the csv file. How can I incorporate it into my file?

Thanks a lot!


Laurence

Berry, Olly (NCMI, IOMRC Crawley)

unread,
Nov 3, 2020, 12:05:05 AM11/3/20
to da...@googlegroups.com

Hi Laurence,

 

Have a look at the dartR manual and specifically the gl.recode.pop function

 

https://cran.r-project.org/web/packages/dartR/dartR.pdf

 

Cheers,

 

Olly

 

-----

Oliver Berry

Leader, Environomics Future Science Platform

National Collections and Marine Infrastructure  |  CSIRO 

oliver...@csiro.au  |  08 9333 6584  |  0400 747 197

Indian Ocean Marine Research Centre, The University of Western Australia, Crawley, WA, 6009, Australia

 

http://www.csiro.au/environomics

 

 CSIRO Australia’s National Science Agency  |  csiro.au

jlsr

unread,
Nov 3, 2020, 12:15:22 AM11/3/20
to dartR
Thank you very much! 

jlsr

unread,
Nov 3, 2020, 1:44:41 AM11/3/20
to dartR
Hello Dr. Olly,

For the line " gl.recode.pop(x, pop.recode, recalc = TRUE, mono.rm = TRUE, verbose = NULL) ", how should the csv file pop.recode looks like? 

Berry, Olly (NCMI, IOMRC Crawley)

unread,
Nov 3, 2020, 1:56:04 AM11/3/20
to da...@googlegroups.com

Hi Laurence,

 

It’s a very simple format, but try the function gl.make.recode.pop on page 59 of the manual to get started.

jlsr

unread,
Nov 3, 2020, 2:05:40 AM11/3/20
to dartR
I tried gl.make.recode.pop but this error shows: Fatal Error: Population names not detected. Same for other edit.recode.

Arthur Georges

unread,
Nov 3, 2020, 2:15:00 AM11/3/20
to da...@googlegroups.com
1. Use gl.make.recode.ind to make a csv file with two identical columns representing the individual labels.
2. Edit the csv file to make the second column a population label of choice for each individual.
3. Use pop(gl) <- indNames(gl).
4. Use gl.recode.pop to assign the new population names in the csv file to the individuals.

We need to work harder to make dartR friendly to non-DArT users.

A

jlsr

unread,
Nov 3, 2020, 10:44:32 PM11/3/20
to dartR
Thank you Arthur! This solved the problem.
Reply all
Reply to author
Forward
0 new messages