[adegenet-forum] error in find.clusters hierarchically
Jombart, Thibaut
t.jombart at imperial.ac.uk
Thu Jul 30 12:33:01 CEST 2015
Hi Simon,
by the look of your genind object, you are using an old version of adegenet. Can you update and check?
This is an old feature which probably has not been used much. We should think about how to integrate this with the new strata support in adegenet 2.0.0.
Cheers
Thibaut
________________________________
From: adegenet-forum-bounces at lists.r-forge.r-project.org [adegenet-forum-bounces at lists.r-forge.r-project.org] on behalf of Crameri Simon [simon.crameri at env.ethz.ch]
Sent: 30 July 2015 10:52
To: <adegenet-forum at lists.r-forge.r-project.org>
Subject: [adegenet-forum] error in find.clusters hierarchically
Hi Thibaut
There seems to be a problem with the function find.clusters if applied hierarchically using the argument clust:
> test
#####################
### Genind object ###
#####################
- genotypes of individuals -
S4 class: genind
@call: .local(x = x, i = i, j = j, drop = drop)
@tab: 396 x 209 matrix of genotypes
@ind.names: vector of 396 individual names
@loc.names: vector of 20 locus names
@loc.nall: number of alleles per locus
@loc.fac: locus factor for the 209 columns of @tab
@all.names: list of 20 components yielding allele names for each locus
@ploidy: 2
@type: codom
Optional contents:
@pop: - empty -
@pop.names: - empty -
@other: - empty -
> str(clustfac)
Factor w/ 4 levels "A","B","C","D": 1 1 1 1 1 1 1 1 1 1 …
This is where the error appears:
> hclust <- find.clusters(test, clust=clustfac)
Looking for sub-clusters in cluster A
Choose the number PCs to retain (>=1):
32
Error: number of cluster centres must lie between 1 and nrow(x)
> table(clustfac)
clustfac
A B C D
33 30 138 195
If not applied hierarchically, find.clusters will take the maximal available n.pca, even if the n.pca argument passed over is greater than nrow(x), right? Here, 33 individuals have factor level "A", therefore 32 is NOT outside 1 and nrow(x). The same error appears when using any number of PCs, say 2, 5, 30 or 400.
What went wrong? Any help is greatly appreciated.
Best,
Simon
PhD Candidate
Institute of Integrative Biology
ETH Zurich
Switzerland
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.r-forge.r-project.org/pipermail/adegenet-forum/attachments/20150730/cd3f4f47/attachment.html>
More information about the adegenet-forum
mailing list