From goatsrunfaster at gmail.com Fri Jun 9 14:03:45 2017 From: goatsrunfaster at gmail.com (Spencer Bruce) Date: Fri, 9 Jun 2017 08:03:45 -0400 Subject: [adegenet-forum] Dictating group membership for DAPC plot Message-ID: Good Morning, I'm interested in creating a DAPC scatter plot for some hatchery fish populations where several of the populations are known F1 hybrids. When I go through the process of defining the clusters these admixed F1 individuals are sometimes assigned to their own cluster, but some individuals are often assigned to either of the two parental clusters. That being said, is there a way to dictate what clusters individuals are assigned to based on prior knowledge of their origin, rather than depending on the inferred grouping? Any help is greatly appreciated. Best, Spencer -- Spencer A Bruce 113 Hill St. Troy, NY 12180 518 225 0787 -------------- next part -------------- An HTML attachment was scrubbed... URL: From thibautjombart at gmail.com Mon Jun 12 13:00:14 2017 From: thibautjombart at gmail.com (Thibaut Jombart) Date: Mon, 12 Jun 2017 12:00:14 +0100 Subject: [adegenet-forum] Dictating group membership for DAPC plot In-Reply-To: References: Message-ID: Hi there, changing the group membership for dapc scatterplot has been discussed repeatedly on this forum, and is documented in ?scatter.dapc - see argument 'grp'. For identifying hybrids, the new method 'genclust' will be much more appropriate - in the devel version for now, paper under review. As a rule I don't think DAPC is appropriate at identifying hybrids. In fact, models which classify individuals in parental populations will most likely assign F1 fully to one of the parental populations (based on geometric criteria or likelihood approaches). Best Thibaut -- Dr Thibaut Jombart Lecturer, Department of Infectious Disease Epidemiology, Imperial College London Head of RECON: repidemicsconsortium.org WHO Consultant - outbreak analysis sites.google.com/site/thibautjombart/ Twitter: @TeebzR +44(0)20 7594 3658 On 9 June 2017 at 13:03, Spencer Bruce wrote: > Good Morning, > > I'm interested in creating a DAPC scatter plot for some hatchery fish > populations where several of the populations are known F1 hybrids. When I go > through the process of defining the clusters these admixed F1 individuals > are sometimes assigned to their own cluster, but some individuals are often > assigned to either of the two parental clusters. That being said, is there a > way to dictate what clusters individuals are assigned to based on prior > knowledge of their origin, rather than depending on the inferred grouping? > > Any help is greatly appreciated. > > Best, > Spencer > > -- > Spencer A Bruce > 113 Hill St. > Troy, NY 12180 > 518 225 0787 > > _______________________________________________ > adegenet-forum mailing list > adegenet-forum at lists.r-forge.r-project.org > https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/adegenet-forum From dcrawford at rsmas.miami.edu Tue Jun 13 03:41:57 2017 From: dcrawford at rsmas.miami.edu (Crawford, Douglas L) Date: Tue, 13 Jun 2017 01:41:57 +0000 Subject: [adegenet-forum] adegenet - a.score.opt vs. xvalDAPC Message-ID: <5EFBAF16-A696-4DE7-8AF6-C63DE8C581DE@miami.edu> Good Afternoon, I cannot get results from ?xialdapc?. I apologize for the long list of attempts. In general, I have followed the advice in the "A tutorial for Discriminant Analysis of Principal Components (DAPC) using adegenet 2.0.0?, "https://grunwaldlab.github.io/Population_Genetics_in_R/DAPC.html? and thibautjombart commented on May 9 ? edited about Replace NA in genlight file for xvalDapc #168 Mydata; Using penlight object: /// GENLIGHT OBJECT ///////// // 69 genotypes, 3,243 binary SNPs, size: 487.6 Kb 32430 (14.49 %) missing data // Basic content @gen: list of 69 SNPbin @ploidy: ploidy of each individual (range: 2-2) // Optional content @ind.names: 69 individual labels @loc.names: 3243 locus labels @pop: population of each individual (group size range: 4-22) @other: a list containing: sex phenotype pat mat COMMANDS & ERRORS: cmd: xval1 <- xvalDapc(CR_grp, grp, n.pca.max = 65, training.set = 0.9, result = "groupMean", center = TRUE, scale = FALSE, n.pca = NULL, n.rep = 30, xval.plot = TRUE) #error Error in sort.list(y) : 'x' must be atomic for 'sort.list' Have you called 'sort' on a list cmd: grp <- pop(CR_grp) cmd: xval1 <- xvalDapc(dapcCRg, grp, n.pca.max = 65, training.set = 0.9, result = "groupMean", center = TRUE, scale = FALSE, n.pca = NULL, n.rep = 30, xval.plot = TRUE) #error Error in as.data.frame.default(df) : cannot coerce class ""dapc"" to a data.frame Following DAPC tutorial 2.0.0 Cmd: mat <- as.matrix(na.replace(CR_grp, method="mean")) # error Error in as.matrix(na.replace(CR_grp, method = "mean")) : error in evaluating the argument 'x' in selecting a method for function 'as.matrix': Error: could not find function "na.replace" Following thibautjombart commented on May 9 Cmd: mat <- as.matrix(CR_grp, NA.method = "mean") #ok Cmd: grp <- pop(CR_grp) #ok Cmd: xvalg <- xvalDapc(mat, grp, n.pca.max = 300, training.set = 0.9, result = "groupMean", center = TRUE, scale = FALSE, n.pca = NULL, n.rep = 30, xval.plot = TRUE) error: Error in dudi.pca(x, nf = n.pca.max, scannf = FALSE, center = center, : na entries in table Following https://grunwaldlab.github.io/Population_Genetics_in_R/DAPC.html CRgrpx <- xvalDapc(tab(CR_grp, NA.method = "mean"), pop(CR_grp)) #Error in (function (classes, fdef, mtable) : unable to find an inherited method for function ?tab? for signature ?"genlight"? CRgrpx <- xvalDapc(CR_grp, pop(CR_grp)) #Error in dudi.pca(x, nf = n.pca.max, scannf = FALSE, center = center,: na entries in table Any suggestions would be appreciated. Douglas ??************________*********???? Douglas L. Crawford Professor, Marine Biology & Ecology Rosenstiel School of Marine & Atmospheric Science University of Miami 4600 Rickenbacker Causeway Mami, FL 33149 305-421-4121 dcrawford at miami.edu http://www.funhe-evol.org/ -------------- next part -------------- An HTML attachment was scrubbed... URL: From thibautjombart at gmail.com Wed Jun 14 13:15:15 2017 From: thibautjombart at gmail.com (Thibaut Jombart) Date: Wed, 14 Jun 2017 12:15:15 +0100 Subject: [adegenet-forum] adegenet - a.score.opt vs. xvalDAPC In-Reply-To: <5EFBAF16-A696-4DE7-8AF6-C63DE8C581DE@miami.edu> References: <5EFBAF16-A696-4DE7-8AF6-C63DE8C581DE@miami.edu> Message-ID: Hello, this should work with the devel version using 'tab' on the genlight object, but I have just seen an issue accessing C functions underlying genlight on most recent R. Investigating. Will post back soon. Best Thibaut -- Dr Thibaut Jombart Lecturer, Department of Infectious Disease Epidemiology, Imperial College London Head of RECON: repidemicsconsortium.org WHO Consultant - outbreak analysis sites.google.com/site/thibautjombart/ Twitter: @TeebzR +44(0)20 7594 3658 On 13 June 2017 at 02:41, Crawford, Douglas L wrote: > Good Afternoon, > I cannot get results from ?xialdapc?. I apologize for the long list of > attempts. > In general, I have followed the advice in the "A tutorial for > Discriminant Analysis of Principal Components (DAPC) using adegenet 2.0.0?, > "https://grunwaldlab.github.io/Population_Genetics_in_R/DAPC.html? and > thibautjombart commented on May 9 ? edited about Replace NA in genlight > file for xvalDapc #168 > > Mydata; > Using penlight object: > /// GENLIGHT OBJECT ///////// > > // 69 genotypes, 3,243 binary SNPs, size: 487.6 Kb > 32430 (14.49 %) missing data > > // Basic content > @gen: list of 69 SNPbin > @ploidy: ploidy of each individual (range: 2-2) > > // Optional content > @ind.names: 69 individual labels > @loc.names: 3243 locus labels > @pop: population of each individual (group size range: 4-22) > @other: a list containing: sex phenotype pat mat > > COMMANDS & ERRORS: > cmd: > xval1 <- xvalDapc(CR_grp, grp, n.pca.max = 65, training.set = 0.9, result = > "groupMean", center = TRUE, scale = FALSE, n.pca = NULL, n.rep = 30, > xval.plot = TRUE) > > #error > Error in sort.list(y) : 'x' must be atomic for 'sort.list' > Have you called 'sort' on a list > > cmd: > grp <- pop(CR_grp) > cmd: > xval1 <- xvalDapc(dapcCRg, grp, n.pca.max = 65, training.set = 0.9, result = > "groupMean", center = TRUE, scale = FALSE, n.pca = NULL, n.rep = 30, > xval.plot = TRUE) > #error > Error in as.data.frame.default(df) : cannot coerce class ""dapc"" to a > data.frame > > Following DAPC tutorial 2.0.0 > Cmd: > mat <- as.matrix(na.replace(CR_grp, method="mean")) > # error > Error in as.matrix(na.replace(CR_grp, method = "mean")) : > error in evaluating the argument 'x' in selecting a method for function > 'as.matrix': Error: could not find function "na.replace" > > Following thibautjombart commented on May 9 > > Cmd: > mat <- as.matrix(CR_grp, NA.method = "mean") > #ok > Cmd: > grp <- pop(CR_grp) > #ok > > Cmd: > xvalg <- xvalDapc(mat, grp, n.pca.max = 300, training.set = 0.9, > result = "groupMean", center = TRUE, scale = FALSE, > n.pca = NULL, n.rep = 30, xval.plot = TRUE) > error: > Error in dudi.pca(x, nf = n.pca.max, scannf = FALSE, center = center, : > na entries in table > > > Following https://grunwaldlab.github.io/Population_Genetics_in_R/DAPC.html > > CRgrpx <- xvalDapc(tab(CR_grp, NA.method = "mean"), pop(CR_grp)) > #Error in (function (classes, fdef, mtable) : unable to find an inherited > method for function ?tab? for signature ?"genlight"? > CRgrpx <- xvalDapc(CR_grp, pop(CR_grp)) > #Error in dudi.pca(x, nf = n.pca.max, scannf = FALSE, center = center,: na > entries in table > > Any suggestions would be appreciated. > > Douglas > > > ??************________*********???? > Douglas L. Crawford > Professor, Marine Biology & Ecology > Rosenstiel School of Marine & Atmospheric Science > University of Miami > 4600 Rickenbacker Causeway > Mami, FL 33149 > 305-421-4121 > > dcrawford at miami.edu > http://www.funhe-evol.org/ > > > > _______________________________________________ > adegenet-forum mailing list > adegenet-forum at lists.r-forge.r-project.org > https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/adegenet-forum From thibautjombart at gmail.com Wed Jun 14 13:47:32 2017 From: thibautjombart at gmail.com (Thibaut Jombart) Date: Wed, 14 Jun 2017 12:47:32 +0100 Subject: [adegenet-forum] adegenet - a.score.opt vs. xvalDAPC In-Reply-To: References: <5EFBAF16-A696-4DE7-8AF6-C63DE8C581DE@miami.edu> Message-ID: Hi again, OK, so it looks like there was a problem with C routine registration, following some new policies enforced by CRAN, which could have created issue with genlight objects. Not related to your problem, but basically you wouldn't have been able to use genlight objects in the first place. This is fixed in the devel now. As for youR problem, after installing the devel version of adegenet, things should work simply with 'tab'. Here's a toy example: > dat <- lapply(1:50, function(i) sample(c(0,1,NA), 1e3, prob=c(.5, .49, .01), replace=TRUE)) > x <- new("genlight", dat, pop = rep(1:2, each = 25)) > x /// GENLIGHT OBJECT ///////// // 50 genotypes, 1,000 binary SNPs, size: 76.5 Kb 530 (1.06 %) missing data // Basic content @gen: list of 50 SNPbin // Optional content @pop: population of each individual (group size range: 25-25) @other: a list containing: elements without names > X <- tab(x, NA.method = "mean") > xval1 <- xvalDapc(X, grp = pop(x)) Best Thibaut -- Dr Thibaut Jombart Lecturer, Department of Infectious Disease Epidemiology, Imperial College London Head of RECON: repidemicsconsortium.org WHO Consultant - outbreak analysis sites.google.com/site/thibautjombart/ Twitter: @TeebzR +44(0)20 7594 3658 On 14 June 2017 at 12:15, Thibaut Jombart wrote: > Hello, > > this should work with the devel version using 'tab' on the genlight > object, but I have just seen an issue accessing C functions underlying > genlight on most recent R. Investigating. Will post back soon. > > Best > Thibaut > > -- > Dr Thibaut Jombart > Lecturer, Department of Infectious Disease Epidemiology, Imperial College London > Head of RECON: repidemicsconsortium.org > WHO Consultant - outbreak analysis > sites.google.com/site/thibautjombart/ > Twitter: @TeebzR > +44(0)20 7594 3658 > > > On 13 June 2017 at 02:41, Crawford, Douglas L wrote: >> Good Afternoon, >> I cannot get results from ?xialdapc?. I apologize for the long list of >> attempts. >> In general, I have followed the advice in the "A tutorial for >> Discriminant Analysis of Principal Components (DAPC) using adegenet 2.0.0?, >> "https://grunwaldlab.github.io/Population_Genetics_in_R/DAPC.html? and >> thibautjombart commented on May 9 ? edited about Replace NA in genlight >> file for xvalDapc #168 >> >> Mydata; >> Using penlight object: >> /// GENLIGHT OBJECT ///////// >> >> // 69 genotypes, 3,243 binary SNPs, size: 487.6 Kb >> 32430 (14.49 %) missing data >> >> // Basic content >> @gen: list of 69 SNPbin >> @ploidy: ploidy of each individual (range: 2-2) >> >> // Optional content >> @ind.names: 69 individual labels >> @loc.names: 3243 locus labels >> @pop: population of each individual (group size range: 4-22) >> @other: a list containing: sex phenotype pat mat >> >> COMMANDS & ERRORS: >> cmd: >> xval1 <- xvalDapc(CR_grp, grp, n.pca.max = 65, training.set = 0.9, result = >> "groupMean", center = TRUE, scale = FALSE, n.pca = NULL, n.rep = 30, >> xval.plot = TRUE) >> >> #error >> Error in sort.list(y) : 'x' must be atomic for 'sort.list' >> Have you called 'sort' on a list >> >> cmd: >> grp <- pop(CR_grp) >> cmd: >> xval1 <- xvalDapc(dapcCRg, grp, n.pca.max = 65, training.set = 0.9, result = >> "groupMean", center = TRUE, scale = FALSE, n.pca = NULL, n.rep = 30, >> xval.plot = TRUE) >> #error >> Error in as.data.frame.default(df) : cannot coerce class ""dapc"" to a >> data.frame >> >> Following DAPC tutorial 2.0.0 >> Cmd: >> mat <- as.matrix(na.replace(CR_grp, method="mean")) >> # error >> Error in as.matrix(na.replace(CR_grp, method = "mean")) : >> error in evaluating the argument 'x' in selecting a method for function >> 'as.matrix': Error: could not find function "na.replace" >> >> Following thibautjombart commented on May 9 >> >> Cmd: >> mat <- as.matrix(CR_grp, NA.method = "mean") >> #ok >> Cmd: >> grp <- pop(CR_grp) >> #ok >> >> Cmd: >> xvalg <- xvalDapc(mat, grp, n.pca.max = 300, training.set = 0.9, >> result = "groupMean", center = TRUE, scale = FALSE, >> n.pca = NULL, n.rep = 30, xval.plot = TRUE) >> error: >> Error in dudi.pca(x, nf = n.pca.max, scannf = FALSE, center = center, : >> na entries in table >> >> >> Following https://grunwaldlab.github.io/Population_Genetics_in_R/DAPC.html >> >> CRgrpx <- xvalDapc(tab(CR_grp, NA.method = "mean"), pop(CR_grp)) >> #Error in (function (classes, fdef, mtable) : unable to find an inherited >> method for function ?tab? for signature ?"genlight"? >> CRgrpx <- xvalDapc(CR_grp, pop(CR_grp)) >> #Error in dudi.pca(x, nf = n.pca.max, scannf = FALSE, center = center,: na >> entries in table >> >> Any suggestions would be appreciated. >> >> Douglas >> >> >> ??************________*********???? >> Douglas L. Crawford >> Professor, Marine Biology & Ecology >> Rosenstiel School of Marine & Atmospheric Science >> University of Miami >> 4600 Rickenbacker Causeway >> Mami, FL 33149 >> 305-421-4121 >> >> dcrawford at miami.edu >> http://www.funhe-evol.org/ >> >> >> >> _______________________________________________ >> adegenet-forum mailing list >> adegenet-forum at lists.r-forge.r-project.org >> https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/adegenet-forum From dcrawford at rsmas.miami.edu Wed Jun 14 14:27:14 2017 From: dcrawford at rsmas.miami.edu (Crawford, Douglas L) Date: Wed, 14 Jun 2017 12:27:14 +0000 Subject: [adegenet-forum] adegenet - a.score.opt vs. xvalDAPC In-Reply-To: References: <5EFBAF16-A696-4DE7-8AF6-C63DE8C581DE@miami.edu> Message-ID: <8532F1A9-12AF-4FD0-8726-0932B91A9426@miami.edu> Thank you. I have said it before and will say it again: your efforts are very much appreciated by many. dlc On Jun 14, 2017, at 7:47 AM, Thibaut Jombart > wrote: Hi again, OK, so it looks like there was a problem with C routine registration, following some new policies enforced by CRAN, which could have created issue with genlight objects. Not related to your problem, but basically you wouldn't have been able to use genlight objects in the first place. This is fixed in the devel now. As for youR problem, after installing the devel version of adegenet, things should work simply with 'tab'. Here's a toy example: dat <- lapply(1:50, function(i) sample(c(0,1,NA), 1e3, prob=c(.5, .49, .01), replace=TRUE)) x <- new("genlight", dat, pop = rep(1:2, each = 25)) x /// GENLIGHT OBJECT ///////// // 50 genotypes, 1,000 binary SNPs, size: 76.5 Kb 530 (1.06 %) missing data // Basic content @gen: list of 50 SNPbin // Optional content @pop: population of each individual (group size range: 25-25) @other: a list containing: elements without names X <- tab(x, NA.method = "mean") xval1 <- xvalDapc(X, grp = pop(x)) Best Thibaut -- Dr Thibaut Jombart Lecturer, Department of Infectious Disease Epidemiology, Imperial College London Head of RECON: repidemicsconsortium.org WHO Consultant - outbreak analysis sites.google.com/site/thibautjombart/ Twitter: @TeebzR +44(0)20 7594 3658 On 14 June 2017 at 12:15, Thibaut Jombart wrote: Hello, this should work with the devel version using 'tab' on the genlight object, but I have just seen an issue accessing C functions underlying genlight on most recent R. Investigating. Will post back soon. Best Thibaut -- Dr Thibaut Jombart Lecturer, Department of Infectious Disease Epidemiology, Imperial College London Head of RECON: repidemicsconsortium.org WHO Consultant - outbreak analysis sites.google.com/site/thibautjombart/ Twitter: @TeebzR +44(0)20 7594 3658 On 13 June 2017 at 02:41, Crawford, Douglas L wrote: Good Afternoon, I cannot get results from ?xialdapc?. I apologize for the long list of attempts. In general, I have followed the advice in the "A tutorial for Discriminant Analysis of Principal Components (DAPC) using adegenet 2.0.0?, "https://urldefense.proofpoint.com/v2/url?u=https-3A__grunwaldlab.github.io_Population-5FGenetics-5Fin-5FR_DAPC.html&d=DwIFaQ&c=y2w-uYmhgFWijp_IQN0DhA&r=BpG6K2k1Rl1JP8zpH3Kivhq29ZS4KUsaaEDq0PE3O4A&m=xWOBcPJ7sxqTwQME6kgKFJbsiua_iZdhojC_48YZSgY&s=dOvQ0Yp8vrw_M9sTQ29-UpiUtWKZc6K-TIcjx9A_45Y&e= ? and thibautjombart commented on May 9 ? edited about Replace NA in genlight file for xvalDapc #168 Mydata; Using penlight object: /// GENLIGHT OBJECT ///////// // 69 genotypes, 3,243 binary SNPs, size: 487.6 Kb 32430 (14.49 %) missing data // Basic content @gen: list of 69 SNPbin @ploidy: ploidy of each individual (range: 2-2) // Optional content @ind.names: 69 individual labels @loc.names: 3243 locus labels @pop: population of each individual (group size range: 4-22) @other: a list containing: sex phenotype pat mat COMMANDS & ERRORS: cmd: xval1 <- xvalDapc(CR_grp, grp, n.pca.max = 65, training.set = 0.9, result = "groupMean", center = TRUE, scale = FALSE, n.pca = NULL, n.rep = 30, xval.plot = TRUE) #error Error in sort.list(y) : 'x' must be atomic for 'sort.list' Have you called 'sort' on a list cmd: grp <- pop(CR_grp) cmd: xval1 <- xvalDapc(dapcCRg, grp, n.pca.max = 65, training.set = 0.9, result = "groupMean", center = TRUE, scale = FALSE, n.pca = NULL, n.rep = 30, xval.plot = TRUE) #error Error in as.data.frame.default(df) : cannot coerce class ""dapc"" to a data.frame Following DAPC tutorial 2.0.0 Cmd: mat <- as.matrix(na.replace(CR_grp, method="mean")) # error Error in as.matrix(na.replace(CR_grp, method = "mean")) : error in evaluating the argument 'x' in selecting a method for function 'as.matrix': Error: could not find function "na.replace" Following thibautjombart commented on May 9 Cmd: mat <- as.matrix(CR_grp, NA.method = "mean") #ok Cmd: grp <- pop(CR_grp) #ok Cmd: xvalg <- xvalDapc(mat, grp, n.pca.max = 300, training.set = 0.9, result = "groupMean", center = TRUE, scale = FALSE, n.pca = NULL, n.rep = 30, xval.plot = TRUE) error: Error in dudi.pca(x, nf = n.pca.max, scannf = FALSE, center = center, : na entries in table Following https://urldefense.proofpoint.com/v2/url?u=https-3A__grunwaldlab.github.io_Population-5FGenetics-5Fin-5FR_DAPC.html&d=DwIFaQ&c=y2w-uYmhgFWijp_IQN0DhA&r=BpG6K2k1Rl1JP8zpH3Kivhq29ZS4KUsaaEDq0PE3O4A&m=xWOBcPJ7sxqTwQME6kgKFJbsiua_iZdhojC_48YZSgY&s=dOvQ0Yp8vrw_M9sTQ29-UpiUtWKZc6K-TIcjx9A_45Y&e= CRgrpx <- xvalDapc(tab(CR_grp, NA.method = "mean"), pop(CR_grp)) #Error in (function (classes, fdef, mtable) : unable to find an inherited method for function ?tab? for signature ?"genlight"? CRgrpx <- xvalDapc(CR_grp, pop(CR_grp)) #Error in dudi.pca(x, nf = n.pca.max, scannf = FALSE, center = center,: na entries in table Any suggestions would be appreciated. Douglas ??************________*********???? Douglas L. Crawford Professor, Marine Biology & Ecology Rosenstiel School of Marine & Atmospheric Science University of Miami 4600 Rickenbacker Causeway Mami, FL 33149 305-421-4121 dcrawford at miami.edu https://urldefense.proofpoint.com/v2/url?u=http-3A__www.funhe-2Devol.org_&d=DwIFaQ&c=y2w-uYmhgFWijp_IQN0DhA&r=BpG6K2k1Rl1JP8zpH3Kivhq29ZS4KUsaaEDq0PE3O4A&m=xWOBcPJ7sxqTwQME6kgKFJbsiua_iZdhojC_48YZSgY&s=3diONTc_po7Rti6_N2AMH7EI6XBXjunupS_xKoA3s6U&e= _______________________________________________ adegenet-forum mailing list adegenet-forum at lists.r-forge.r-project.org https://urldefense.proofpoint.com/v2/url?u=https-3A__lists.r-2Dforge.r-2Dproject.org_cgi-2Dbin_mailman_listinfo_adegenet-2Dforum&d=DwIFaQ&c=y2w-uYmhgFWijp_IQN0DhA&r=BpG6K2k1Rl1JP8zpH3Kivhq29ZS4KUsaaEDq0PE3O4A&m=xWOBcPJ7sxqTwQME6kgKFJbsiua_iZdhojC_48YZSgY&s=Zb2bb0LD_77THMZ35JjMhQFqNbBXN-KrZV_4J0I4zt0&e= -------------- next part -------------- An HTML attachment was scrubbed... URL: From thibautjombart at gmail.com Wed Jun 14 14:52:07 2017 From: thibautjombart at gmail.com (Thibaut Jombart) Date: Wed, 14 Jun 2017 13:52:07 +0100 Subject: [adegenet-forum] adegenet - a.score.opt vs. xvalDAPC In-Reply-To: <8532F1A9-12AF-4FD0-8726-0932B91A9426@miami.edu> References: <5EFBAF16-A696-4DE7-8AF6-C63DE8C581DE@miami.edu> <8532F1A9-12AF-4FD0-8726-0932B91A9426@miami.edu> Message-ID: Well, thanks for the feedback, and apologies on this one: tutorials are slightly outdated. Will recompile them today. Best Thibayt -- Dr Thibaut Jombart Lecturer, Department of Infectious Disease Epidemiology, Imperial College London Head of RECON: repidemicsconsortium.org WHO Consultant - outbreak analysis sites.google.com/site/thibautjombart/ Twitter: @TeebzR +44(0)20 7594 3658 On 14 June 2017 at 13:27, Crawford, Douglas L wrote: > Thank you. > > I have said it before and will say it again: your efforts are very much > appreciated by many. > > dlc > > > On Jun 14, 2017, at 7:47 AM, Thibaut Jombart > wrote: > > Hi again, > > OK, so it looks like there was a problem with C routine registration, > following some new policies enforced by CRAN, which could have created > issue with genlight objects. Not related to your problem, but > basically you wouldn't have been able to use genlight objects in the > first place. This is fixed in the devel now. > > As for youR problem, after installing the devel version of adegenet, > things should work simply with 'tab'. Here's a toy example: > > dat <- lapply(1:50, function(i) sample(c(0,1,NA), 1e3, prob=c(.5, .49, .01), > replace=TRUE)) > x <- new("genlight", dat, pop = rep(1:2, each = 25)) > x > > /// GENLIGHT OBJECT ///////// > > // 50 genotypes, 1,000 binary SNPs, size: 76.5 Kb > 530 (1.06 %) missing data > > // Basic content > @gen: list of 50 SNPbin > > // Optional content > @pop: population of each individual (group size range: 25-25) > @other: a list containing: elements without names > > X <- tab(x, NA.method = "mean") > xval1 <- xvalDapc(X, grp = pop(x)) > > > > Best > Thibaut > > -- > Dr Thibaut Jombart > Lecturer, Department of Infectious Disease Epidemiology, Imperial College > London > Head of RECON: repidemicsconsortium.org > WHO Consultant - outbreak analysis > sites.google.com/site/thibautjombart/ > Twitter: @TeebzR > +44(0)20 7594 3658 > > > On 14 June 2017 at 12:15, Thibaut Jombart wrote: > > Hello, > > this should work with the devel version using 'tab' on the genlight > object, but I have just seen an issue accessing C functions underlying > genlight on most recent R. Investigating. Will post back soon. > > Best > Thibaut > > -- > Dr Thibaut Jombart > Lecturer, Department of Infectious Disease Epidemiology, Imperial College > London > Head of RECON: repidemicsconsortium.org > WHO Consultant - outbreak analysis > sites.google.com/site/thibautjombart/ > Twitter: @TeebzR > +44(0)20 7594 3658 > > > On 13 June 2017 at 02:41, Crawford, Douglas L > wrote: > > Good Afternoon, > I cannot get results from ?xialdapc?. I apologize for the long list of > attempts. > In general, I have followed the advice in the "A tutorial for > Discriminant Analysis of Principal Components (DAPC) using adegenet 2.0.0?, > "https://urldefense.proofpoint.com/v2/url?u=https-3A__grunwaldlab.github.io_Population-5FGenetics-5Fin-5FR_DAPC.html&d=DwIFaQ&c=y2w-uYmhgFWijp_IQN0DhA&r=BpG6K2k1Rl1JP8zpH3Kivhq29ZS4KUsaaEDq0PE3O4A&m=xWOBcPJ7sxqTwQME6kgKFJbsiua_iZdhojC_48YZSgY&s=dOvQ0Yp8vrw_M9sTQ29-UpiUtWKZc6K-TIcjx9A_45Y&e= > ? and > > thibautjombart commented on May 9 ? edited about Replace NA in genlight > file for xvalDapc #168 > > Mydata; > Using penlight object: > /// GENLIGHT OBJECT ///////// > > // 69 genotypes, 3,243 binary SNPs, size: 487.6 Kb > 32430 (14.49 %) missing data > > // Basic content > @gen: list of 69 SNPbin > @ploidy: ploidy of each individual (range: 2-2) > > // Optional content > @ind.names: 69 individual labels > @loc.names: 3243 locus labels > @pop: population of each individual (group size range: 4-22) > @other: a list containing: sex phenotype pat mat > > COMMANDS & ERRORS: > cmd: > xval1 <- xvalDapc(CR_grp, grp, n.pca.max = 65, training.set = 0.9, result = > "groupMean", center = TRUE, scale = FALSE, n.pca = NULL, n.rep = 30, > xval.plot = TRUE) > > #error > Error in sort.list(y) : 'x' must be atomic for 'sort.list' > Have you called 'sort' on a list > > cmd: > grp <- pop(CR_grp) > cmd: > xval1 <- xvalDapc(dapcCRg, grp, n.pca.max = 65, training.set = 0.9, result = > "groupMean", center = TRUE, scale = FALSE, n.pca = NULL, n.rep = 30, > xval.plot = TRUE) > #error > Error in as.data.frame.default(df) : cannot coerce class ""dapc"" to a > data.frame > > Following DAPC tutorial 2.0.0 > Cmd: > mat <- as.matrix(na.replace(CR_grp, method="mean")) > # error > Error in as.matrix(na.replace(CR_grp, method = "mean")) : > error in evaluating the argument 'x' in selecting a method for function > 'as.matrix': Error: could not find function "na.replace" > > Following thibautjombart commented on May 9 > > Cmd: > mat <- as.matrix(CR_grp, NA.method = "mean") > #ok > Cmd: > grp <- pop(CR_grp) > #ok > > Cmd: > xvalg <- xvalDapc(mat, grp, n.pca.max = 300, training.set = 0.9, > result = "groupMean", center = TRUE, scale = FALSE, > n.pca = NULL, n.rep = 30, xval.plot = TRUE) > error: > Error in dudi.pca(x, nf = n.pca.max, scannf = FALSE, center = center, : > na entries in table > > > Following > https://urldefense.proofpoint.com/v2/url?u=https-3A__grunwaldlab.github.io_Population-5FGenetics-5Fin-5FR_DAPC.html&d=DwIFaQ&c=y2w-uYmhgFWijp_IQN0DhA&r=BpG6K2k1Rl1JP8zpH3Kivhq29ZS4KUsaaEDq0PE3O4A&m=xWOBcPJ7sxqTwQME6kgKFJbsiua_iZdhojC_48YZSgY&s=dOvQ0Yp8vrw_M9sTQ29-UpiUtWKZc6K-TIcjx9A_45Y&e= > > CRgrpx <- xvalDapc(tab(CR_grp, NA.method = "mean"), pop(CR_grp)) > #Error in (function (classes, fdef, mtable) : unable to find an inherited > method for function ?tab? for signature ?"genlight"? > CRgrpx <- xvalDapc(CR_grp, pop(CR_grp)) > #Error in dudi.pca(x, nf = n.pca.max, scannf = FALSE, center = center,: na > entries in table > > Any suggestions would be appreciated. > > Douglas > > > ??************________*********???? > Douglas L. Crawford > Professor, Marine Biology & Ecology > Rosenstiel School of Marine & Atmospheric Science > University of Miami > 4600 Rickenbacker Causeway > Mami, FL 33149 > 305-421-4121 > > dcrawford at miami.edu > https://urldefense.proofpoint.com/v2/url?u=http-3A__www.funhe-2Devol.org_&d=DwIFaQ&c=y2w-uYmhgFWijp_IQN0DhA&r=BpG6K2k1Rl1JP8zpH3Kivhq29ZS4KUsaaEDq0PE3O4A&m=xWOBcPJ7sxqTwQME6kgKFJbsiua_iZdhojC_48YZSgY&s=3diONTc_po7Rti6_N2AMH7EI6XBXjunupS_xKoA3s6U&e= > > > > _______________________________________________ > adegenet-forum mailing list > adegenet-forum at lists.r-forge.r-project.org > https://urldefense.proofpoint.com/v2/url?u=https-3A__lists.r-2Dforge.r-2Dproject.org_cgi-2Dbin_mailman_listinfo_adegenet-2Dforum&d=DwIFaQ&c=y2w-uYmhgFWijp_IQN0DhA&r=BpG6K2k1Rl1JP8zpH3Kivhq29ZS4KUsaaEDq0PE3O4A&m=xWOBcPJ7sxqTwQME6kgKFJbsiua_iZdhojC_48YZSgY&s=Zb2bb0LD_77THMZ35JjMhQFqNbBXN-KrZV_4J0I4zt0&e= > > From stephanie.coster at gmail.com Thu Jun 29 23:20:55 2017 From: stephanie.coster at gmail.com (Stephanie Coster) Date: Thu, 29 Jun 2017 17:20:55 -0400 Subject: [adegenet-forum] When cross-validating DAPC (using web server), is it best to use 'group' or 'overall'? Message-ID: Thanks in advance! I have a dataset of genotypes from microsatellite loci and I'm looking to analyze population structure. Program STRUCTURE shows essentially no clusters, and I'd like to use DAPC to get another perspective. I've run the 'find.clusters' code and the BIC suggests K=2, but the assignments are unreliable (equal assignments across all sites to both clusters). I am interpreting this to mean that K=1 and all samples likely form a single cluster. Now, I'd like to use my apriori site groupings to draw a scatterplot and am using the DAPC web server to cross-validate and suggest the number of PCs to retain. I get notably different scatterplots depending on whether I choose 'group' or 'overall' to assess. The sites have more spatial differentiation when using 'group', and essentially all overlap when using 'overall'. I understand that success is calculated by my groups or overall depending on the choice, but what does this mean in application? Can someone help explain why these plots differ and which is better to use? Many thanks! Stephanie -------------- next part -------------- An HTML attachment was scrubbed... URL: From jean-luc.legras at inra.fr Fri Jun 9 17:08:23 2017 From: jean-luc.legras at inra.fr (Jean-Luc Legras) Date: Fri, 09 Jun 2017 15:08:23 -0000 Subject: [adegenet-forum] Varimax Message-ID: <9DA8692B-B1B4-43FD-B568-C961F263308C@inra.fr> Hi all Adegenet is a fantastic tool for population genetic analysis. I used a PCA on my dataset and populations are clearly clustered. However, in this case they do not fit with the axis. I was wondering if it was possible to setup a Varimax procedure after the PCA (here centered, unscaled PCA) in order to make the main population dispersal fit the axis... Best regards. JL scatter plot; [cid:D9361326-297A-4A22-9067-F601280ED06C at supagro.inra.fr] -------------- next part -------------- An HTML attachment was scrubbed... URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: Graphe-PCA.png Type: image/png Size: 53065 bytes Desc: Graphe-PCA.png URL: