Dendogram construction

22 views
Skip to first unread message

Martin Boys

unread,
Nov 6, 2022, 11:45:02 AM11/6/22
to po...@googlegroups.com
Dear Kamvar

Is there any possible way for me to bypass this error which I encountered when trying to plot a dendrogram. My dataset consists of 55 individuals, 10 loci, 3 populations and 1 stratum. Kindly see below the scripts and the outputs in bold which have led to the eventual error. Thank you in advance for your time and assistance.  

###GENETIC DISTANCE###

>library(poppr)

>library(ape)

>library(magrittr)

>martin25

This is a genclone object

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

Genotype information:

 

    4 original multilocus genotypes

   55 haploid individuals

   10 codominant loci

 

Population information:

 

    1 stratum - Pop

    3 populations defined - Hybrid, Heirloom, Grape

>set.seed(30)

>ten_samples<-sample(nInd(martin25),30)

>mic100<-martin25[ten_samples]

>(micdisc<-provesti.dist(mic100))

>theTree<-micdisc%>%nj()%>%ladderize()

>plot(theTree)

>add.scale.bar(length = 0.5)

>NJT1 <- last_plot()

###Bootstrap loci###

>set.seed(999)

>aboot(mic10, dist = provesti.dist, sample = 55, tree = "nj", cutoff = 50, quiet = TRUE)

Phylogenetic tree with 20 tips and 18 internal nodes.

Tip labels:

  T-69, T-77, T-2, T-63, T-46, T-58, ...

Node labels:

  NA, NA, NA, NA, NA, NA, ...

Unrooted; includes branch lengths.

Warning message:

In aboot(mic10, dist = provesti.dist, sample = 55, tree = "nj",  :

Some branch lengths of the tree are negative. Normalizing branches according to Kuhner and Felsenstein (1994)

>strata(martin25)<-data.frame(other(martin25))

Error: Number of rows in data frame not equal to number of individuals in object.




Zhian Kamvar

unread,
Nov 7, 2022, 3:01:24 PM11/7/22
to Martin Boys, po...@googlegroups.com
Hi Martin,

Before you post, check carefully the lines of code you are submitting. When you make an assignment, try printing the output and ask yourself "does this give me what I think it is giving me?
You are trying to set the strata from data.frame(other(martin25)). What is in `other(martin25)`? Likely, there is nothing there.
Read https://grunwaldlab.github.io/Population_Genetics_in_R/Population_Strata.html and see if that clears up the question about strata.

Best,
Zhian

--
You received this message because you are subscribed to the Google Groups "poppr" group.
To unsubscribe from this group and stop receiving emails from it, send an email to poppr+un...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/poppr/CAKiZ3%3DtcdvPeoMKqv1ShXhnWUuPkHMVvV68GC_goVJoXc9WKCA%40mail.gmail.com.
Reply all
Reply to author
Forward
0 new messages