From snook91901 at gmail.com Wed Oct 4 00:47:42 2017 From: snook91901 at gmail.com (David Dayan) Date: Tue, 3 Oct 2017 18:47:42 -0400 Subject: [adegenet-forum] sPCA randtest in adegenet devel Message-ID: Hi, I've been a longtime user of this forum, but never a poster, so first thanks to Thibaut and everyone on the team for their work in keeping the forum such a useful place. I'm trying to get to the bottom of an error running the new spca_randtest function in the development package. The error I receive is: Error in 1:nrow(obj) : argument of length 0 I looked to see if the the nrow function worked on either the spca object or the genind obj that I ran the spca on: >nrow(oc_spca) NULL >nrow(oc.gid) NULL I also attempted to run spca_randtest on the example spca data, spcaIllus, and was successful. Can anyone venture a guess as to what's happening here? I've copied the summary of the spca object below Thanks, David ######################################## # spatial Principal Component Analysis # ######################################## class: spca $call: spca(obj = oc.gid, xy = xy_oc_jitter) $nfposi: 2 axis-components saved $nfnega: 1 axis-components saved Positive eigenvalues: 8.311 6.044 5.207 5.179 4.758 ... Negative eigenvalues: -3.39 -3.045 -2.905 -2.848 -2.757 ... vector length mode content 1 $eig 167 numeric eigenvalues data.frame nrow ncol 1 $tab transformed data: optionally centred / scaled $tab 2 $c1 10898 3 3 $li 113 3 4 $ls 113 3 5 $as 2 3 content 1 transformed data: optionally centred / scaled 2 principal axes: scaled vectors of alleles loadings 3 principal components: coordinates of entities ('scores') 4 lag vector of principal components 5 pca axes onto spca axes $xy: matrix of spatial coordinates $lw: a list of spatial weights (class 'listw') other elements: NULL -------------- next part -------------- An HTML attachment was scrubbed... URL: From pifferdavide at gmail.com Wed Oct 4 15:08:38 2017 From: pifferdavide at gmail.com (Davide Piffer) Date: Wed, 4 Oct 2017 15:08:38 +0200 Subject: [adegenet-forum] Retrieving population allele frequencies of SNPs using HGDP file Message-ID: Hello, I am new to Adegenet. I would like to retrieve population frequencies of SNPs (using rsID) from the HGDP file "HGDP_FinalReport_Forward.txt" : http://www.hagsc.org/hgdp/files.html However, the file lacks population information. It contains SNPs x individuals. I need a file structured like the eHGDP (except with SNPs and not microsatellite data) file provided with the package, that can be easily converted into genpop file and then compute the frequencies via makefreq. Do you know if there is any such file downloadable on the internet? i guess there must be a way to produce such a file using ADEGENET starting from raw data. but my knowledge of this package is not advanced enough yet. Best wishes, Davide -------------- next part -------------- An HTML attachment was scrubbed... URL: From thibautjombart at gmail.com Thu Oct 5 15:53:01 2017 From: thibautjombart at gmail.com (Thibaut Jombart) Date: Thu, 5 Oct 2017 14:53:01 +0100 Subject: [adegenet-forum] sPCA randtest in adegenet devel In-Reply-To: References: Message-ID: Hello David, can you post an issue on github, attaching the dataset and with the code to reproduce the error? 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 3 October 2017 at 23:47, David Dayan wrote: > Hi, > > I've been a longtime user of this forum, but never a poster, so first thanks > to Thibaut and everyone on the team for their work in keeping the forum such > a useful place. > > I'm trying to get to the bottom of an error running the new spca_randtest > function in the development package. > > The error I receive is: > Error in 1:nrow(obj) : argument of length 0 > > I looked to see if the the nrow function worked on either the spca object or > the genind obj that I ran the spca on: > >>nrow(oc_spca) > NULL > >>nrow(oc.gid) > NULL > > I also attempted to run spca_randtest on the example spca data, spcaIllus, > and was successful. > > Can anyone venture a guess as to what's happening here? I've copied the > summary of the spca object below > > Thanks, > David > > ######################################## > # spatial Principal Component Analysis # > ######################################## > class: spca > $call: spca(obj = oc.gid, xy = xy_oc_jitter) > > $nfposi: 2 axis-components saved > $nfnega: 1 axis-components saved > Positive eigenvalues: 8.311 6.044 5.207 5.179 4.758 ... > Negative eigenvalues: -3.39 -3.045 -2.905 -2.848 -2.757 ... > > vector length mode content > 1 $eig 167 numeric eigenvalues > > data.frame nrow ncol > 1 $tab transformed data: optionally centred / scaled $tab > 2 $c1 10898 3 > 3 $li 113 3 > 4 $ls 113 3 > 5 $as 2 3 > content > 1 transformed data: optionally centred / scaled > 2 principal axes: scaled vectors of alleles loadings > 3 principal components: coordinates of entities ('scores') > 4 lag vector of principal components > 5 pca axes onto spca axes > > $xy: matrix of spatial coordinates > $lw: a list of spatial weights (class 'listw') > > other elements: NULL > > _______________________________________________ > 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 Fri Oct 6 10:56:13 2017 From: thibautjombart at gmail.com (Thibaut Jombart) Date: Fri, 6 Oct 2017 09:56:13 +0100 Subject: [adegenet-forum] Retrieving population allele frequencies of SNPs using HGDP file In-Reply-To: References: Message-ID: Hi Davide, I am not entirely sure what you need, so sorry if I miss the point. adegenet cannot make up for absent population information, but you can try to identify clusters of course, e.g. using find.clusters. eHGDP is not a file (at least not in the sense you probably mean), but a genind object. If the question is how you can get a file looking like the one you link into a genind object, you probably want to use something like read.csv and then df2genind. Imports should be detailed in the basics tutorial: https://github.com/thibautjombart/adegenet/wiki/Tutorials 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 4 October 2017 at 14:08, Davide Piffer wrote: > Hello, > > I am new to Adegenet. I would like to retrieve population frequencies of > SNPs (using rsID) from the HGDP file "HGDP_FinalReport_Forward.txt" : > http://www.hagsc.org/hgdp/files.html > > However, the file lacks population information. It contains SNPs x > individuals. > I need a file structured like the eHGDP (except with SNPs and not > microsatellite data) file provided with the package, that can be easily > converted into genpop file and then compute the frequencies via makefreq. > Do you know if there is any such file downloadable on the internet? > i guess there must be a way to produce such a file using ADEGENET starting > from raw data. but my knowledge of this package is not advanced enough yet. > > Best wishes, > > Davide > > _______________________________________________ > 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 pifferdavide at gmail.com Fri Oct 6 11:24:18 2017 From: pifferdavide at gmail.com (Davide Piffer) Date: Fri, 6 Oct 2017 11:24:18 +0200 Subject: [adegenet-forum] Retrieving population allele frequencies of SNPs using HGDP file In-Reply-To: References: Message-ID: Dear Thibaut, thanks for answering my question. I will try to reformulate my question differently, stating the assumptions: 1) I assume that the eHGDP object was made into a genpop object from some raw .txt file, like the HGDP file I linked to in the previous email. 2) I need an object that looks exactly like the eHGDP object, but with SNPs instead of microsatellite alleles. 3) Since it's gonna be a rather complex task, I asked if any of you knows if someone has already done this job before and published it (e.g. as supplementary file). 4) Otherwise, I would like to know how to produce such a file myself, starting from a version of the HGDP file with population information. If this was done for microsatellites, surely it can be done for the SNPs as well? I assume they rely on the same raw HGDP file. Many thanks! Davide On 6 October 2017 at 10:56, Thibaut Jombart wrote: > Hi Davide, > > I am not entirely sure what you need, so sorry if I miss the point. > adegenet cannot make up for absent population information, but you can > try to identify clusters of course, e.g. using find.clusters. > > eHGDP is not a file (at least not in the sense you probably mean), but > a genind object. If the question is how you can get a file looking > like the one you link into a genind object, you probably want to use > something like read.csv and then df2genind. Imports should be detailed > in the basics tutorial: > https://github.com/thibautjombart/adegenet/wiki/Tutorials > > 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 4 October 2017 at 14:08, Davide Piffer wrote: > > Hello, > > > > I am new to Adegenet. I would like to retrieve population frequencies of > > SNPs (using rsID) from the HGDP file "HGDP_FinalReport_Forward.txt" : > > http://www.hagsc.org/hgdp/files.html > > > > However, the file lacks population information. It contains SNPs x > > individuals. > > I need a file structured like the eHGDP (except with SNPs and not > > microsatellite data) file provided with the package, that can be easily > > converted into genpop file and then compute the frequencies via makefreq. > > Do you know if there is any such file downloadable on the internet? > > i guess there must be a way to produce such a file using ADEGENET > starting > > from raw data. but my knowledge of this package is not advanced enough > yet. > > > > Best wishes, > > > > Davide > > > > _______________________________________________ > > 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 > -------------- next part -------------- An HTML attachment was scrubbed... URL: From thibautjombart at gmail.com Fri Oct 6 11:35:18 2017 From: thibautjombart at gmail.com (Thibaut Jombart) Date: Fri, 6 Oct 2017 10:35:18 +0100 Subject: [adegenet-forum] Retrieving population allele frequencies of SNPs using HGDP file In-Reply-To: References: Message-ID: Hi again, OK I think I got it. So: - I can't remember how I built the eHGDP dataset, but it's an easy task - I don't know if the data you're looking for is publicly available - assuming you find it, there are two ways to get a genpop object: #1: from individual data with pop info: read data in (read.csv / read.table), use df2genind (be patient there, that'll take a while), then genind2genpop #2: from population data (allele counts): read data in (read.csv / read.table), use the genpop() constructor to make the data a genpop object; I think this is documented in the basics tutorial, but definitely also in ?genpop HTH 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 6 October 2017 at 10:24, Davide Piffer wrote: > Dear Thibaut, > > thanks for answering my question. I will try to reformulate my question > differently, stating the assumptions: > 1) I assume that the eHGDP object was made into a genpop object from some > raw .txt file, like the HGDP file I linked to in the previous email. > 2) I need an object that looks exactly like the eHGDP object, but with SNPs > instead of microsatellite alleles. > 3) Since it's gonna be a rather complex task, I asked if any of you knows if > someone has already done this job before and published it (e.g. as > supplementary file). > 4) Otherwise, I would like to know how to produce such a file myself, > starting from a version of the HGDP file with population information. If > this was done for microsatellites, surely it can be done for the SNPs as > well? I assume they rely on the same raw HGDP file. > > Many thanks! > > Davide > > On 6 October 2017 at 10:56, Thibaut Jombart > wrote: >> >> Hi Davide, >> >> I am not entirely sure what you need, so sorry if I miss the point. >> adegenet cannot make up for absent population information, but you can >> try to identify clusters of course, e.g. using find.clusters. >> >> eHGDP is not a file (at least not in the sense you probably mean), but >> a genind object. If the question is how you can get a file looking >> like the one you link into a genind object, you probably want to use >> something like read.csv and then df2genind. Imports should be detailed >> in the basics tutorial: >> https://github.com/thibautjombart/adegenet/wiki/Tutorials >> >> 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 4 October 2017 at 14:08, Davide Piffer wrote: >> > Hello, >> > >> > I am new to Adegenet. I would like to retrieve population frequencies of >> > SNPs (using rsID) from the HGDP file "HGDP_FinalReport_Forward.txt" : >> > http://www.hagsc.org/hgdp/files.html >> > >> > However, the file lacks population information. It contains SNPs x >> > individuals. >> > I need a file structured like the eHGDP (except with SNPs and not >> > microsatellite data) file provided with the package, that can be easily >> > converted into genpop file and then compute the frequencies via >> > makefreq. >> > Do you know if there is any such file downloadable on the internet? >> > i guess there must be a way to produce such a file using ADEGENET >> > starting >> > from raw data. but my knowledge of this package is not advanced enough >> > yet. >> > >> > Best wishes, >> > >> > Davide >> > >> > _______________________________________________ >> > 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 Fri Oct 6 11:31:02 2017 From: thibautjombart at gmail.com (Thibaut Jombart) Date: Fri, 6 Oct 2017 10:31:02 +0100 Subject: [adegenet-forum] Identification of mixture individuals In-Reply-To: References: Message-ID: Hi Sandra it depends on what you are looking for, and which method you used for this analysis. What you are looking for: - migrants: I would assume these would be individuals fully classified in a group while being tagged as members of another - admixed individuals: these would be hybrids between parental populations, so appearing as 'mixed genotypes' The method: DAPC tends to make clear-cut groups, so you may be good at identifying migrants as defined above. If you are looking for hybrids, then DAPC is not the way to go. Adegenet has a good alternative for this now, but it is not too well documented, with a disclaimer: "don't use yet, we work on that stuff". As a matter of fact I am submitting a revision of the MS today. If you are interested in this, then PM me and we can discuss things further. 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 12 September 2017 at 14:15, Sandra Ludwig wrote: > Hello, > > I`m working with 8 loci of msats in several fish populations from Brazil, > and during the analysis I'm using adegenet package to identify clusters (k) > and also to estimate migration pattern between the populations. > So...I'm wondering if I can assume that the individuals with mixed > genotypes (see the output below) could be migrants individuals that were > sampled in distinct populations? [image: Imagem inline 1] > > Thanks for your help!! > Sandra > ------ > Sandra Ludwig > Substitute Profesor of Zoology > Laboratory of Biotecnology and Molecular Markers - E3 179 > Universidade Federal de Minas Gerais, Belo Horizonte, Brazil > Phone: (+55031) 97101-3052 <+55%2031%2097101-3052> > s andraludwig at ufmg.br > http://lattes.cnpq.br/6627603237397917 > > > > > _______________________________________________ > 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 > -------------- next part -------------- An HTML attachment was scrubbed... URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: image.png Type: image/png Size: 188068 bytes Desc: not available URL: From pifferdavide at gmail.com Fri Oct 6 12:12:14 2017 From: pifferdavide at gmail.com (Davide Piffer) Date: Fri, 6 Oct 2017 12:12:14 +0200 Subject: [adegenet-forum] Retrieving population allele frequencies of SNPs using HGDP file In-Reply-To: References: Message-ID: Thanks, this is pretty clear. I hope I will find the dataset I need! Please let me know if you come across it! Davide On 6 October 2017 at 11:35, Thibaut Jombart wrote: > Hi again, > > OK I think I got it. So: > - I can't remember how I built the eHGDP dataset, but it's an easy task > - I don't know if the data you're looking for is publicly available > - assuming you find it, there are two ways to get a genpop object: > #1: from individual data with pop info: read data in (read.csv / > read.table), use df2genind (be patient there, that'll take a while), > then genind2genpop > > #2: from population data (allele counts): read data in (read.csv / > read.table), use the genpop() constructor to make the data a genpop > object; I think this is documented in the basics tutorial, but > definitely also in ?genpop > > HTH > 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 6 October 2017 at 10:24, Davide Piffer wrote: > > Dear Thibaut, > > > > thanks for answering my question. I will try to reformulate my question > > differently, stating the assumptions: > > 1) I assume that the eHGDP object was made into a genpop object from > some > > raw .txt file, like the HGDP file I linked to in the previous email. > > 2) I need an object that looks exactly like the eHGDP object, but with > SNPs > > instead of microsatellite alleles. > > 3) Since it's gonna be a rather complex task, I asked if any of you > knows if > > someone has already done this job before and published it (e.g. as > > supplementary file). > > 4) Otherwise, I would like to know how to produce such a file myself, > > starting from a version of the HGDP file with population information. If > > this was done for microsatellites, surely it can be done for the SNPs as > > well? I assume they rely on the same raw HGDP file. > > > > Many thanks! > > > > Davide > > > > On 6 October 2017 at 10:56, Thibaut Jombart > > wrote: > >> > >> Hi Davide, > >> > >> I am not entirely sure what you need, so sorry if I miss the point. > >> adegenet cannot make up for absent population information, but you can > >> try to identify clusters of course, e.g. using find.clusters. > >> > >> eHGDP is not a file (at least not in the sense you probably mean), but > >> a genind object. If the question is how you can get a file looking > >> like the one you link into a genind object, you probably want to use > >> something like read.csv and then df2genind. Imports should be detailed > >> in the basics tutorial: > >> https://github.com/thibautjombart/adegenet/wiki/Tutorials > >> > >> 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 4 October 2017 at 14:08, Davide Piffer > wrote: > >> > Hello, > >> > > >> > I am new to Adegenet. I would like to retrieve population frequencies > of > >> > SNPs (using rsID) from the HGDP file "HGDP_FinalReport_Forward.txt" : > >> > http://www.hagsc.org/hgdp/files.html > >> > > >> > However, the file lacks population information. It contains SNPs x > >> > individuals. > >> > I need a file structured like the eHGDP (except with SNPs and not > >> > microsatellite data) file provided with the package, that can be > easily > >> > converted into genpop file and then compute the frequencies via > >> > makefreq. > >> > Do you know if there is any such file downloadable on the internet? > >> > i guess there must be a way to produce such a file using ADEGENET > >> > starting > >> > from raw data. but my knowledge of this package is not advanced enough > >> > yet. > >> > > >> > Best wishes, > >> > > >> > Davide > >> > > >> > _______________________________________________ > >> > 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 > > > > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From pifferdavide at gmail.com Fri Oct 6 13:08:32 2017 From: pifferdavide at gmail.com (Davide Piffer) Date: Fri, 6 Oct 2017 13:08:32 +0200 Subject: [adegenet-forum] Retrieving population allele frequencies of SNPs using HGDP file In-Reply-To: References: Message-ID: Ok, I think have found the file I need here: https://rosenberglab.stanford.edu/data/huangEtAl2011/HuangEtAl_2011-GenetEpi.zip . However, it's in .str format. Following the instructions on the manual, I tried to assign correct labels based on the Readme file ( https://rosenberglab.stanford.edu/data/huangEtAl2011/huangEtAl2011snpdata_readme ) Mydata=read.structure("unphased_HGDP+India+Africa_2810SNPs-regions1to36.stru", onerowperind = FALSE,col.lab = 8,col.pop = 2,row.marknames = 1,n.ind = 1107, n.loc = 2810, ask = FALSE)#convert into genind Mydata_pop=genind2genpop(Mydata)#convert into genpop However, I get a file with only 1 population. head(Mydata_pop) /// GENPOP OBJECT ///////// // 1 population; 2,810 loci; 7,217 alleles; size: 1.5 Mb // Basic content @tab: 1 x 7217 matrix of allele counts @loc.n.all: number of alleles per locus (range: 2-4) @loc.fac: locus factor for the 7217 columns of @tab @all.names: list of allele names for each locus @ploidy: ploidy of each individual (range: 2-2) @type: codom @call: .local(x = x, i = i, j = j, drop = dro This is obviously wrong since there are 50+ populations. I tried changing col.pop from 2 to 3 but got the same output. Am I missing something? All the best, Davide On 6 October 2017 at 11:35, Thibaut Jombart wrote: > Hi again, > > OK I think I got it. So: > - I can't remember how I built the eHGDP dataset, but it's an easy task > - I don't know if the data you're looking for is publicly available > - assuming you find it, there are two ways to get a genpop object: > #1: from individual data with pop info: read data in (read.csv / > read.table), use df2genind (be patient there, that'll take a while), > then genind2genpop > > #2: from population data (allele counts): read data in (read.csv / > read.table), use the genpop() constructor to make the data a genpop > object; I think this is documented in the basics tutorial, but > definitely also in ?genpop > > HTH > 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 6 October 2017 at 10:24, Davide Piffer wrote: > > Dear Thibaut, > > > > thanks for answering my question. I will try to reformulate my question > > differently, stating the assumptions: > > 1) I assume that the eHGDP object was made into a genpop object from > some > > raw .txt file, like the HGDP file I linked to in the previous email. > > 2) I need an object that looks exactly like the eHGDP object, but with > SNPs > > instead of microsatellite alleles. > > 3) Since it's gonna be a rather complex task, I asked if any of you > knows if > > someone has already done this job before and published it (e.g. as > > supplementary file). > > 4) Otherwise, I would like to know how to produce such a file myself, > > starting from a version of the HGDP file with population information. If > > this was done for microsatellites, surely it can be done for the SNPs as > > well? I assume they rely on the same raw HGDP file. > > > > Many thanks! > > > > Davide > > > > On 6 October 2017 at 10:56, Thibaut Jombart > > wrote: > >> > >> Hi Davide, > >> > >> I am not entirely sure what you need, so sorry if I miss the point. > >> adegenet cannot make up for absent population information, but you can > >> try to identify clusters of course, e.g. using find.clusters. > >> > >> eHGDP is not a file (at least not in the sense you probably mean), but > >> a genind object. If the question is how you can get a file looking > >> like the one you link into a genind object, you probably want to use > >> something like read.csv and then df2genind. Imports should be detailed > >> in the basics tutorial: > >> https://github.com/thibautjombart/adegenet/wiki/Tutorials > >> > >> 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 4 October 2017 at 14:08, Davide Piffer > wrote: > >> > Hello, > >> > > >> > I am new to Adegenet. I would like to retrieve population frequencies > of > >> > SNPs (using rsID) from the HGDP file "HGDP_FinalReport_Forward.txt" : > >> > http://www.hagsc.org/hgdp/files.html > >> > > >> > However, the file lacks population information. It contains SNPs x > >> > individuals. > >> > I need a file structured like the eHGDP (except with SNPs and not > >> > microsatellite data) file provided with the package, that can be > easily > >> > converted into genpop file and then compute the frequencies via > >> > makefreq. > >> > Do you know if there is any such file downloadable on the internet? > >> > i guess there must be a way to produce such a file using ADEGENET > >> > starting > >> > from raw data. but my knowledge of this package is not advanced enough > >> > yet. > >> > > >> > Best wishes, > >> > > >> > Davide > >> > > >> > _______________________________________________ > >> > 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 > > > > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From thibautjombart at gmail.com Wed Oct 11 11:53:25 2017 From: thibautjombart at gmail.com (Thibaut Jombart) Date: Wed, 11 Oct 2017 10:53:25 +0100 Subject: [adegenet-forum] Retrieving population allele frequencies of SNPs using HGDP file In-Reply-To: References: Message-ID: Hi there, reading populations info hasn't been a problem before (I think) in read.structure. I would double-check which column it is, though I assume you have. If you think there is a problem with the function please post an issue on github with a reproducible example and we'll try to sort it out. 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 6 October 2017 at 12:08, Davide Piffer wrote: > Ok, I think have found the file I need here: > https://rosenberglab.stanford.edu/data/huangEtAl2011/HuangEtAl_2011-GenetEpi.zip > . However, it's in .str format. Following the instructions on the manual, I > tried to assign correct labels based on the Readme file > (https://rosenberglab.stanford.edu/data/huangEtAl2011/huangEtAl2011snpdata_readme) > > Mydata=read.structure("unphased_HGDP+India+Africa_2810SNPs-regions1to36.stru", > onerowperind = FALSE,col.lab = 8,col.pop = 2,row.marknames = 1,n.ind = 1107, > n.loc = 2810, ask = FALSE)#convert into genind > Mydata_pop=genind2genpop(Mydata)#convert into genpop > > However, I get a file with only 1 population. > > head(Mydata_pop) > /// GENPOP OBJECT ///////// > > // 1 population; 2,810 loci; 7,217 alleles; size: 1.5 Mb > > // Basic content > @tab: 1 x 7217 matrix of allele counts > @loc.n.all: number of alleles per locus (range: 2-4) > @loc.fac: locus factor for the 7217 columns of @tab > @all.names: list of allele names for each locus > @ploidy: ploidy of each individual (range: 2-2) > @type: codom > @call: .local(x = x, i = i, j = j, drop = dro > > This is obviously wrong since there are 50+ populations. > > I tried changing col.pop from 2 to 3 but got the same output. > > Am I missing something? > > > All the best, > Davide > > > > On 6 October 2017 at 11:35, Thibaut Jombart > wrote: >> >> Hi again, >> >> OK I think I got it. So: >> - I can't remember how I built the eHGDP dataset, but it's an easy task >> - I don't know if the data you're looking for is publicly available >> - assuming you find it, there are two ways to get a genpop object: >> #1: from individual data with pop info: read data in (read.csv / >> read.table), use df2genind (be patient there, that'll take a while), >> then genind2genpop >> >> #2: from population data (allele counts): read data in (read.csv / >> read.table), use the genpop() constructor to make the data a genpop >> object; I think this is documented in the basics tutorial, but >> definitely also in ?genpop >> >> HTH >> 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 6 October 2017 at 10:24, Davide Piffer wrote: >> > Dear Thibaut, >> > >> > thanks for answering my question. I will try to reformulate my question >> > differently, stating the assumptions: >> > 1) I assume that the eHGDP object was made into a genpop object from >> > some >> > raw .txt file, like the HGDP file I linked to in the previous email. >> > 2) I need an object that looks exactly like the eHGDP object, but with >> > SNPs >> > instead of microsatellite alleles. >> > 3) Since it's gonna be a rather complex task, I asked if any of you >> > knows if >> > someone has already done this job before and published it (e.g. as >> > supplementary file). >> > 4) Otherwise, I would like to know how to produce such a file myself, >> > starting from a version of the HGDP file with population information. If >> > this was done for microsatellites, surely it can be done for the SNPs as >> > well? I assume they rely on the same raw HGDP file. >> > >> > Many thanks! >> > >> > Davide >> > >> > On 6 October 2017 at 10:56, Thibaut Jombart >> > wrote: >> >> >> >> Hi Davide, >> >> >> >> I am not entirely sure what you need, so sorry if I miss the point. >> >> adegenet cannot make up for absent population information, but you can >> >> try to identify clusters of course, e.g. using find.clusters. >> >> >> >> eHGDP is not a file (at least not in the sense you probably mean), but >> >> a genind object. If the question is how you can get a file looking >> >> like the one you link into a genind object, you probably want to use >> >> something like read.csv and then df2genind. Imports should be detailed >> >> in the basics tutorial: >> >> https://github.com/thibautjombart/adegenet/wiki/Tutorials >> >> >> >> 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 4 October 2017 at 14:08, Davide Piffer >> >> wrote: >> >> > Hello, >> >> > >> >> > I am new to Adegenet. I would like to retrieve population frequencies >> >> > of >> >> > SNPs (using rsID) from the HGDP file "HGDP_FinalReport_Forward.txt" : >> >> > http://www.hagsc.org/hgdp/files.html >> >> > >> >> > However, the file lacks population information. It contains SNPs x >> >> > individuals. >> >> > I need a file structured like the eHGDP (except with SNPs and not >> >> > microsatellite data) file provided with the package, that can be >> >> > easily >> >> > converted into genpop file and then compute the frequencies via >> >> > makefreq. >> >> > Do you know if there is any such file downloadable on the internet? >> >> > i guess there must be a way to produce such a file using ADEGENET >> >> > starting >> >> > from raw data. but my knowledge of this package is not advanced >> >> > enough >> >> > yet. >> >> > >> >> > Best wishes, >> >> > >> >> > Davide >> >> > >> >> > _______________________________________________ >> >> > 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 aurelle.didier at gmail.com Wed Oct 11 12:08:05 2017 From: aurelle.didier at gmail.com (Didier Aurelle) Date: Wed, 11 Oct 2017 12:08:05 +0200 Subject: [adegenet-forum] define population level for PCA analysis in adegenet Message-ID: Dear all I want to perform a PCA analysis in adegenet starting from a genepop file without defined populations. I imported the data like this: datapop <- read.genepop('tous.gen', ncode=3, quiet = FALSE) it works, and I can perform a PCA after scaling the data. But I would like to plot the results / individuals on the PCA axis according to their population of origin using s.class. I have a vcf file with a three lettre code for each individual. I imported it in R: pops_list <- read.csv('liste_pops.csv', header=FALSE) but now how can I use it to define population levels in the genind object 'datapop'? I tried something likes this: setPop(datapop, formula = NULL) setPop(datapop) <- pops_list but it doesn't work; even the first line doesn't work: I get this message: "Erreur : formula must be a valid formula object." And then how should I use it in s.class? thanks Didier -------------- next part -------------- An HTML attachment was scrubbed... URL: From pifferdavide at gmail.com Wed Oct 11 13:13:20 2017 From: pifferdavide at gmail.com (Davide Piffer) Date: Wed, 11 Oct 2017 13:13:20 +0200 Subject: [adegenet-forum] Retrieving population allele frequencies of SNPs using HGDP file In-Reply-To: References: Message-ID: Hi, I tried using different columns for the population. The Readme file lists these but none actually works. I am not sure if the problem is with the file or with the function because I am not an expert. Columns for individual data (HGDP/India/Africa individuals): 1. HGDP ID number or HapMap NA number 2. numeric code for population 3. name of population 4. country of origin On 11 October 2017 at 11:53, Thibaut Jombart wrote: > Hi there, > > reading populations info hasn't been a problem before (I think) in > read.structure. I would double-check which column it is, though I > assume you have. If you think there is a problem with the function > please post an issue on github with a reproducible example and we'll > try to sort it out. > > 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 6 October 2017 at 12:08, Davide Piffer wrote: > > Ok, I think have found the file I need here: > > https://rosenberglab.stanford.edu/data/huangEtAl2011/ > HuangEtAl_2011-GenetEpi.zip > > . However, it's in .str format. Following the instructions on the > manual, I > > tried to assign correct labels based on the Readme file > > (https://rosenberglab.stanford.edu/data/huangEtAl2011/ > huangEtAl2011snpdata_readme) > > > > Mydata=read.structure("unphased_HGDP+India+Africa_ > 2810SNPs-regions1to36.stru", > > onerowperind = FALSE,col.lab = 8,col.pop = 2,row.marknames = 1,n.ind = > 1107, > > n.loc = 2810, ask = FALSE)#convert into genind > > Mydata_pop=genind2genpop(Mydata)#convert into genpop > > > > However, I get a file with only 1 population. > > > > head(Mydata_pop) > > /// GENPOP OBJECT ///////// > > > > // 1 population; 2,810 loci; 7,217 alleles; size: 1.5 Mb > > > > // Basic content > > @tab: 1 x 7217 matrix of allele counts > > @loc.n.all: number of alleles per locus (range: 2-4) > > @loc.fac: locus factor for the 7217 columns of @tab > > @all.names: list of allele names for each locus > > @ploidy: ploidy of each individual (range: 2-2) > > @type: codom > > @call: .local(x = x, i = i, j = j, drop = dro > > > > This is obviously wrong since there are 50+ populations. > > > > I tried changing col.pop from 2 to 3 but got the same output. > > > > Am I missing something? > > > > > > All the best, > > Davide > > > > > > > > On 6 October 2017 at 11:35, Thibaut Jombart > > wrote: > >> > >> Hi again, > >> > >> OK I think I got it. So: > >> - I can't remember how I built the eHGDP dataset, but it's an easy task > >> - I don't know if the data you're looking for is publicly available > >> - assuming you find it, there are two ways to get a genpop object: > >> #1: from individual data with pop info: read data in (read.csv / > >> read.table), use df2genind (be patient there, that'll take a while), > >> then genind2genpop > >> > >> #2: from population data (allele counts): read data in (read.csv / > >> read.table), use the genpop() constructor to make the data a genpop > >> object; I think this is documented in the basics tutorial, but > >> definitely also in ?genpop > >> > >> HTH > >> 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 6 October 2017 at 10:24, Davide Piffer > wrote: > >> > Dear Thibaut, > >> > > >> > thanks for answering my question. I will try to reformulate my > question > >> > differently, stating the assumptions: > >> > 1) I assume that the eHGDP object was made into a genpop object from > >> > some > >> > raw .txt file, like the HGDP file I linked to in the previous email. > >> > 2) I need an object that looks exactly like the eHGDP object, but with > >> > SNPs > >> > instead of microsatellite alleles. > >> > 3) Since it's gonna be a rather complex task, I asked if any of you > >> > knows if > >> > someone has already done this job before and published it (e.g. as > >> > supplementary file). > >> > 4) Otherwise, I would like to know how to produce such a file myself, > >> > starting from a version of the HGDP file with population information. > If > >> > this was done for microsatellites, surely it can be done for the SNPs > as > >> > well? I assume they rely on the same raw HGDP file. > >> > > >> > Many thanks! > >> > > >> > Davide > >> > > >> > On 6 October 2017 at 10:56, Thibaut Jombart > > >> > wrote: > >> >> > >> >> Hi Davide, > >> >> > >> >> I am not entirely sure what you need, so sorry if I miss the point. > >> >> adegenet cannot make up for absent population information, but you > can > >> >> try to identify clusters of course, e.g. using find.clusters. > >> >> > >> >> eHGDP is not a file (at least not in the sense you probably mean), > but > >> >> a genind object. If the question is how you can get a file looking > >> >> like the one you link into a genind object, you probably want to use > >> >> something like read.csv and then df2genind. Imports should be > detailed > >> >> in the basics tutorial: > >> >> https://github.com/thibautjombart/adegenet/wiki/Tutorials > >> >> > >> >> 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 4 October 2017 at 14:08, Davide Piffer > >> >> wrote: > >> >> > Hello, > >> >> > > >> >> > I am new to Adegenet. I would like to retrieve population > frequencies > >> >> > of > >> >> > SNPs (using rsID) from the HGDP file > "HGDP_FinalReport_Forward.txt" : > >> >> > http://www.hagsc.org/hgdp/files.html > >> >> > > >> >> > However, the file lacks population information. It contains SNPs x > >> >> > individuals. > >> >> > I need a file structured like the eHGDP (except with SNPs and not > >> >> > microsatellite data) file provided with the package, that can be > >> >> > easily > >> >> > converted into genpop file and then compute the frequencies via > >> >> > makefreq. > >> >> > Do you know if there is any such file downloadable on the internet? > >> >> > i guess there must be a way to produce such a file using ADEGENET > >> >> > starting > >> >> > from raw data. but my knowledge of this package is not advanced > >> >> > enough > >> >> > yet. > >> >> > > >> >> > Best wishes, > >> >> > > >> >> > Davide > >> >> > > >> >> > _______________________________________________ > >> >> > 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 > >> > > >> > > > > > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From thibautjombart at gmail.com Wed Oct 11 13:19:59 2017 From: thibautjombart at gmail.com (Thibaut Jombart) Date: Wed, 11 Oct 2017 12:19:59 +0100 Subject: [adegenet-forum] define population level for PCA analysis in adegenet In-Reply-To: References: Message-ID: Hi Didier, you are looking for 'pop(x) <- ...'. Accessors like this one, and other useful things are in the 'basics' tutorial: https://github.com/thibautjombart/adegenet/wiki/Tutorials 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 11 October 2017 at 11:08, Didier Aurelle wrote: > Dear all > > I want to perform a PCA analysis in adegenet starting from a genepop file > without defined populations. I imported the data like this: datapop <- > read.genepop('tous.gen', ncode=3, quiet = FALSE) > > it works, and I can perform a PCA after scaling the data. But I would like > to plot the results / individuals on the PCA axis according to their > population of origin using s.class. I have a vcf file with a three lettre > code for each individual. I imported it in R: pops_list <- > read.csv('liste_pops.csv', header=FALSE) > > but now how can I use it to define population levels in the genind object > 'datapop'? I tried something likes this: setPop(datapop, formula = NULL) > > setPop(datapop) <- pops_list but it doesn't work; even the first line > doesn't work: I get this message: "Erreur : formula must be a valid formula > object." > > And then how should I use it in s.class? > > thanks > > Didier > > > _______________________________________________ > 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 roman.lustrik at biolitika.si Wed Oct 11 13:49:14 2017 From: roman.lustrik at biolitika.si (Roman =?utf-8?Q?Lu=C5=A1trik?=) Date: Wed, 11 Oct 2017 13:49:14 +0200 (CEST) Subject: [adegenet-forum] define population level for PCA analysis in adegenet In-Reply-To: References: Message-ID: <1007134353.279482.1507722554120.JavaMail.zimbra@biolitika.si> It goes without saying that order in your vcf (pops_list) file should correspond to the order in your datapop. To assign population to your pops_list should be a vector or a factor like so: library(adegenet) data(nancycats) pop(nancycats) <- 1:237 (see basics manual at https://github.com/thibautjombart/adegenet/wiki/Tutorials) If you want to assign names to your populations, you can use popNames(x) <- y. Cheers, Roman ---- In god we trust, all others bring data. > Zahtevaj IJZ na https://kurc.biolitika.si From: "Didier Aurelle" To: adegenet-forum at lists.r-forge.r-project.org Sent: Wednesday, October 11, 2017 12:08:05 PM Subject: [adegenet-forum] define population level for PCA analysis in adegenet Dear all I want to perform a PCA analysis in adegenet starting from a genepop file without defined populations. I imported the data like this: datapop <- read.genepop('tous.gen', ncode=3, quiet = FALSE) it works, and I can perform a PCA after scaling the data. But I would like to plot the results / individuals on the PCA axis according to their population of origin using s.class. I have a vcf file with a three lettre code for each individual. I imported it in R: pops_list <- read.csv('liste_pops.csv', header=FALSE) but now how can I use it to define population levels in the genind object 'datapop'? I tried something likes this: setPop(datapop, formula = NULL) setPop(datapop) <- pops_list but it doesn't work; even the first line doesn't work: I get this message: "Erreur : formula must be a valid formula object." And then how should I use it in s.class? thanks Didier _______________________________________________ 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 -------------- next part -------------- An HTML attachment was scrubbed... URL: From thibautjombart at gmail.com Wed Oct 11 14:16:59 2017 From: thibautjombart at gmail.com (Thibaut Jombart) Date: Wed, 11 Oct 2017 13:16:59 +0100 Subject: [adegenet-forum] Retrieving population allele frequencies of SNPs using HGDP file In-Reply-To: References: Message-ID: Have you tried to open the file manually to check if the population information was indeed there in the third column? Best Thibaut On 11 Oct 2017 12:13, "Davide Piffer" wrote: > Hi, > > I tried using different columns for the population. The Readme file lists > these but none actually works. I am not sure if the problem is with the > file or with the function because I am not an expert. > > Columns for individual data (HGDP/India/Africa individuals): > 1. HGDP ID number or HapMap NA number > 2. numeric code for population > 3. name of population > 4. country of origin > > > > On 11 October 2017 at 11:53, Thibaut Jombart > wrote: > >> Hi there, >> >> reading populations info hasn't been a problem before (I think) in >> read.structure. I would double-check which column it is, though I >> assume you have. If you think there is a problem with the function >> please post an issue on github with a reproducible example and we'll >> try to sort it out. >> >> 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 6 October 2017 at 12:08, Davide Piffer wrote: >> > Ok, I think have found the file I need here: >> > https://rosenberglab.stanford.edu/data/huangEtAl2011/HuangEt >> Al_2011-GenetEpi.zip >> > . However, it's in .str format. Following the instructions on the >> manual, I >> > tried to assign correct labels based on the Readme file >> > (https://rosenberglab.stanford.edu/data/huangEtAl2011/huangE >> tAl2011snpdata_readme) >> > >> > Mydata=read.structure("unphased_HGDP+India+Africa_2810SNPs- >> regions1to36.stru", >> > onerowperind = FALSE,col.lab = 8,col.pop = 2,row.marknames = 1,n.ind = >> 1107, >> > n.loc = 2810, ask = FALSE)#convert into genind >> > Mydata_pop=genind2genpop(Mydata)#convert into genpop >> > >> > However, I get a file with only 1 population. >> > >> > head(Mydata_pop) >> > /// GENPOP OBJECT ///////// >> > >> > // 1 population; 2,810 loci; 7,217 alleles; size: 1.5 Mb >> > >> > // Basic content >> > @tab: 1 x 7217 matrix of allele counts >> > @loc.n.all: number of alleles per locus (range: 2-4) >> > @loc.fac: locus factor for the 7217 columns of @tab >> > @all.names: list of allele names for each locus >> > @ploidy: ploidy of each individual (range: 2-2) >> > @type: codom >> > @call: .local(x = x, i = i, j = j, drop = dro >> > >> > This is obviously wrong since there are 50+ populations. >> > >> > I tried changing col.pop from 2 to 3 but got the same output. >> > >> > Am I missing something? >> > >> > >> > All the best, >> > Davide >> > >> > >> > >> > On 6 October 2017 at 11:35, Thibaut Jombart >> > wrote: >> >> >> >> Hi again, >> >> >> >> OK I think I got it. So: >> >> - I can't remember how I built the eHGDP dataset, but it's an easy task >> >> - I don't know if the data you're looking for is publicly available >> >> - assuming you find it, there are two ways to get a genpop object: >> >> #1: from individual data with pop info: read data in (read.csv / >> >> read.table), use df2genind (be patient there, that'll take a while), >> >> then genind2genpop >> >> >> >> #2: from population data (allele counts): read data in (read.csv / >> >> read.table), use the genpop() constructor to make the data a genpop >> >> object; I think this is documented in the basics tutorial, but >> >> definitely also in ?genpop >> >> >> >> HTH >> >> 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 6 October 2017 at 10:24, Davide Piffer >> wrote: >> >> > Dear Thibaut, >> >> > >> >> > thanks for answering my question. I will try to reformulate my >> question >> >> > differently, stating the assumptions: >> >> > 1) I assume that the eHGDP object was made into a genpop object from >> >> > some >> >> > raw .txt file, like the HGDP file I linked to in the previous email. >> >> > 2) I need an object that looks exactly like the eHGDP object, but >> with >> >> > SNPs >> >> > instead of microsatellite alleles. >> >> > 3) Since it's gonna be a rather complex task, I asked if any of you >> >> > knows if >> >> > someone has already done this job before and published it (e.g. as >> >> > supplementary file). >> >> > 4) Otherwise, I would like to know how to produce such a file myself, >> >> > starting from a version of the HGDP file with population >> information. If >> >> > this was done for microsatellites, surely it can be done for the >> SNPs as >> >> > well? I assume they rely on the same raw HGDP file. >> >> > >> >> > Many thanks! >> >> > >> >> > Davide >> >> > >> >> > On 6 October 2017 at 10:56, Thibaut Jombart < >> thibautjombart at gmail.com> >> >> > wrote: >> >> >> >> >> >> Hi Davide, >> >> >> >> >> >> I am not entirely sure what you need, so sorry if I miss the point. >> >> >> adegenet cannot make up for absent population information, but you >> can >> >> >> try to identify clusters of course, e.g. using find.clusters. >> >> >> >> >> >> eHGDP is not a file (at least not in the sense you probably mean), >> but >> >> >> a genind object. If the question is how you can get a file looking >> >> >> like the one you link into a genind object, you probably want to use >> >> >> something like read.csv and then df2genind. Imports should be >> detailed >> >> >> in the basics tutorial: >> >> >> https://github.com/thibautjombart/adegenet/wiki/Tutorials >> >> >> >> >> >> 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 4 October 2017 at 14:08, Davide Piffer >> >> >> wrote: >> >> >> > Hello, >> >> >> > >> >> >> > I am new to Adegenet. I would like to retrieve population >> frequencies >> >> >> > of >> >> >> > SNPs (using rsID) from the HGDP file >> "HGDP_FinalReport_Forward.txt" : >> >> >> > http://www.hagsc.org/hgdp/files.html >> >> >> > >> >> >> > However, the file lacks population information. It contains SNPs x >> >> >> > individuals. >> >> >> > I need a file structured like the eHGDP (except with SNPs and not >> >> >> > microsatellite data) file provided with the package, that can be >> >> >> > easily >> >> >> > converted into genpop file and then compute the frequencies via >> >> >> > makefreq. >> >> >> > Do you know if there is any such file downloadable on the >> internet? >> >> >> > i guess there must be a way to produce such a file using ADEGENET >> >> >> > starting >> >> >> > from raw data. but my knowledge of this package is not advanced >> >> >> > enough >> >> >> > yet. >> >> >> > >> >> >> > Best wishes, >> >> >> > >> >> >> > Davide >> >> >> > >> >> >> > _______________________________________________ >> >> >> > 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 >> >> > >> >> > >> > >> > >> > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From pifferdavide at gmail.com Wed Oct 11 14:47:38 2017 From: pifferdavide at gmail.com (Davide Piffer) Date: Wed, 11 Oct 2017 14:47:38 +0200 Subject: [adegenet-forum] Retrieving population allele frequencies of SNPs using HGDP file In-Reply-To: References: Message-ID: Yes.It is there Best wishes On 11 Oct 2017 2:17 pm, "Thibaut Jombart" wrote: > Have you tried to open the file manually to check if the population > information was indeed there in the third column? > > Best > Thibaut > > On 11 Oct 2017 12:13, "Davide Piffer" wrote: > >> Hi, >> >> I tried using different columns for the population. The Readme file lists >> these but none actually works. I am not sure if the problem is with the >> file or with the function because I am not an expert. >> >> Columns for individual data (HGDP/India/Africa individuals): >> 1. HGDP ID number or HapMap NA number >> 2. numeric code for population >> 3. name of population >> 4. country of origin >> >> >> >> On 11 October 2017 at 11:53, Thibaut Jombart >> wrote: >> >>> Hi there, >>> >>> reading populations info hasn't been a problem before (I think) in >>> read.structure. I would double-check which column it is, though I >>> assume you have. If you think there is a problem with the function >>> please post an issue on github with a reproducible example and we'll >>> try to sort it out. >>> >>> 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 6 October 2017 at 12:08, Davide Piffer >>> wrote: >>> > Ok, I think have found the file I need here: >>> > https://rosenberglab.stanford.edu/data/huangEtAl2011/HuangEt >>> Al_2011-GenetEpi.zip >>> > . However, it's in .str format. Following the instructions on the >>> manual, I >>> > tried to assign correct labels based on the Readme file >>> > (https://rosenberglab.stanford.edu/data/huangEtAl2011/huangE >>> tAl2011snpdata_readme) >>> > >>> > Mydata=read.structure("unphased_HGDP+India+Africa_2810SNPs-r >>> egions1to36.stru", >>> > onerowperind = FALSE,col.lab = 8,col.pop = 2,row.marknames = 1,n.ind = >>> 1107, >>> > n.loc = 2810, ask = FALSE)#convert into genind >>> > Mydata_pop=genind2genpop(Mydata)#convert into genpop >>> > >>> > However, I get a file with only 1 population. >>> > >>> > head(Mydata_pop) >>> > /// GENPOP OBJECT ///////// >>> > >>> > // 1 population; 2,810 loci; 7,217 alleles; size: 1.5 Mb >>> > >>> > // Basic content >>> > @tab: 1 x 7217 matrix of allele counts >>> > @loc.n.all: number of alleles per locus (range: 2-4) >>> > @loc.fac: locus factor for the 7217 columns of @tab >>> > @all.names: list of allele names for each locus >>> > @ploidy: ploidy of each individual (range: 2-2) >>> > @type: codom >>> > @call: .local(x = x, i = i, j = j, drop = dro >>> > >>> > This is obviously wrong since there are 50+ populations. >>> > >>> > I tried changing col.pop from 2 to 3 but got the same output. >>> > >>> > Am I missing something? >>> > >>> > >>> > All the best, >>> > Davide >>> > >>> > >>> > >>> > On 6 October 2017 at 11:35, Thibaut Jombart >>> > wrote: >>> >> >>> >> Hi again, >>> >> >>> >> OK I think I got it. So: >>> >> - I can't remember how I built the eHGDP dataset, but it's an easy >>> task >>> >> - I don't know if the data you're looking for is publicly available >>> >> - assuming you find it, there are two ways to get a genpop object: >>> >> #1: from individual data with pop info: read data in (read.csv / >>> >> read.table), use df2genind (be patient there, that'll take a while), >>> >> then genind2genpop >>> >> >>> >> #2: from population data (allele counts): read data in (read.csv / >>> >> read.table), use the genpop() constructor to make the data a genpop >>> >> object; I think this is documented in the basics tutorial, but >>> >> definitely also in ?genpop >>> >> >>> >> HTH >>> >> 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 6 October 2017 at 10:24, Davide Piffer >>> wrote: >>> >> > Dear Thibaut, >>> >> > >>> >> > thanks for answering my question. I will try to reformulate my >>> question >>> >> > differently, stating the assumptions: >>> >> > 1) I assume that the eHGDP object was made into a genpop object >>> from >>> >> > some >>> >> > raw .txt file, like the HGDP file I linked to in the previous email. >>> >> > 2) I need an object that looks exactly like the eHGDP object, but >>> with >>> >> > SNPs >>> >> > instead of microsatellite alleles. >>> >> > 3) Since it's gonna be a rather complex task, I asked if any of you >>> >> > knows if >>> >> > someone has already done this job before and published it (e.g. as >>> >> > supplementary file). >>> >> > 4) Otherwise, I would like to know how to produce such a file >>> myself, >>> >> > starting from a version of the HGDP file with population >>> information. If >>> >> > this was done for microsatellites, surely it can be done for the >>> SNPs as >>> >> > well? I assume they rely on the same raw HGDP file. >>> >> > >>> >> > Many thanks! >>> >> > >>> >> > Davide >>> >> > >>> >> > On 6 October 2017 at 10:56, Thibaut Jombart < >>> thibautjombart at gmail.com> >>> >> > wrote: >>> >> >> >>> >> >> Hi Davide, >>> >> >> >>> >> >> I am not entirely sure what you need, so sorry if I miss the point. >>> >> >> adegenet cannot make up for absent population information, but you >>> can >>> >> >> try to identify clusters of course, e.g. using find.clusters. >>> >> >> >>> >> >> eHGDP is not a file (at least not in the sense you probably mean), >>> but >>> >> >> a genind object. If the question is how you can get a file looking >>> >> >> like the one you link into a genind object, you probably want to >>> use >>> >> >> something like read.csv and then df2genind. Imports should be >>> detailed >>> >> >> in the basics tutorial: >>> >> >> https://github.com/thibautjombart/adegenet/wiki/Tutorials >>> >> >> >>> >> >> 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 4 October 2017 at 14:08, Davide Piffer >>> >> >> wrote: >>> >> >> > Hello, >>> >> >> > >>> >> >> > I am new to Adegenet. I would like to retrieve population >>> frequencies >>> >> >> > of >>> >> >> > SNPs (using rsID) from the HGDP file >>> "HGDP_FinalReport_Forward.txt" : >>> >> >> > http://www.hagsc.org/hgdp/files.html >>> >> >> > >>> >> >> > However, the file lacks population information. It contains SNPs >>> x >>> >> >> > individuals. >>> >> >> > I need a file structured like the eHGDP (except with SNPs and not >>> >> >> > microsatellite data) file provided with the package, that can be >>> >> >> > easily >>> >> >> > converted into genpop file and then compute the frequencies via >>> >> >> > makefreq. >>> >> >> > Do you know if there is any such file downloadable on the >>> internet? >>> >> >> > i guess there must be a way to produce such a file using ADEGENET >>> >> >> > starting >>> >> >> > from raw data. but my knowledge of this package is not advanced >>> >> >> > enough >>> >> >> > yet. >>> >> >> > >>> >> >> > Best wishes, >>> >> >> > >>> >> >> > Davide >>> >> >> > >>> >> >> > _______________________________________________ >>> >> >> > 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 >>> >> > >>> >> > >>> > >>> > >>> >> >> -------------- next part -------------- An HTML attachment was scrubbed... URL: From thibautjombart at gmail.com Wed Oct 11 14:52:12 2017 From: thibautjombart at gmail.com (Thibaut Jombart) Date: Wed, 11 Oct 2017 13:52:12 +0100 Subject: [adegenet-forum] Retrieving population allele frequencies of SNPs using HGDP file In-Reply-To: References: Message-ID: Okay great, if you post an issue on github with a minimal reproducible example (data and code) I'll have a look today. We are finalising a new release of adegenet as we speak. Best Thibaut On 11 October 2017 at 13:47, Davide Piffer wrote: > Yes.It is there > > Best wishes > > On 11 Oct 2017 2:17 pm, "Thibaut Jombart" wrote: >> >> Have you tried to open the file manually to check if the population >> information was indeed there in the third column? >> >> Best >> Thibaut >> >> On 11 Oct 2017 12:13, "Davide Piffer" wrote: >>> >>> Hi, >>> >>> I tried using different columns for the population. The Readme file lists >>> these but none actually works. I am not sure if the problem is with the file >>> or with the function because I am not an expert. >>> >>> Columns for individual data (HGDP/India/Africa individuals): >>> 1. HGDP ID number or HapMap NA number >>> 2. numeric code for population >>> 3. name of population >>> 4. country of origin >>> >>> >>> >>> On 11 October 2017 at 11:53, Thibaut Jombart >>> wrote: >>>> >>>> Hi there, >>>> >>>> reading populations info hasn't been a problem before (I think) in >>>> read.structure. I would double-check which column it is, though I >>>> assume you have. If you think there is a problem with the function >>>> please post an issue on github with a reproducible example and we'll >>>> try to sort it out. >>>> >>>> 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 6 October 2017 at 12:08, Davide Piffer >>>> wrote: >>>> > Ok, I think have found the file I need here: >>>> > >>>> > https://rosenberglab.stanford.edu/data/huangEtAl2011/HuangEtAl_2011-GenetEpi.zip >>>> > . However, it's in .str format. Following the instructions on the >>>> > manual, I >>>> > tried to assign correct labels based on the Readme file >>>> > >>>> > (https://rosenberglab.stanford.edu/data/huangEtAl2011/huangEtAl2011snpdata_readme) >>>> > >>>> > >>>> > Mydata=read.structure("unphased_HGDP+India+Africa_2810SNPs-regions1to36.stru", >>>> > onerowperind = FALSE,col.lab = 8,col.pop = 2,row.marknames = 1,n.ind = >>>> > 1107, >>>> > n.loc = 2810, ask = FALSE)#convert into genind >>>> > Mydata_pop=genind2genpop(Mydata)#convert into genpop >>>> > >>>> > However, I get a file with only 1 population. >>>> > >>>> > head(Mydata_pop) >>>> > /// GENPOP OBJECT ///////// >>>> > >>>> > // 1 population; 2,810 loci; 7,217 alleles; size: 1.5 Mb >>>> > >>>> > // Basic content >>>> > @tab: 1 x 7217 matrix of allele counts >>>> > @loc.n.all: number of alleles per locus (range: 2-4) >>>> > @loc.fac: locus factor for the 7217 columns of @tab >>>> > @all.names: list of allele names for each locus >>>> > @ploidy: ploidy of each individual (range: 2-2) >>>> > @type: codom >>>> > @call: .local(x = x, i = i, j = j, drop = dro >>>> > >>>> > This is obviously wrong since there are 50+ populations. >>>> > >>>> > I tried changing col.pop from 2 to 3 but got the same output. >>>> > >>>> > Am I missing something? >>>> > >>>> > >>>> > All the best, >>>> > Davide >>>> > >>>> > >>>> > >>>> > On 6 October 2017 at 11:35, Thibaut Jombart >>>> > wrote: >>>> >> >>>> >> Hi again, >>>> >> >>>> >> OK I think I got it. So: >>>> >> - I can't remember how I built the eHGDP dataset, but it's an easy >>>> >> task >>>> >> - I don't know if the data you're looking for is publicly available >>>> >> - assuming you find it, there are two ways to get a genpop object: >>>> >> #1: from individual data with pop info: read data in (read.csv / >>>> >> read.table), use df2genind (be patient there, that'll take a while), >>>> >> then genind2genpop >>>> >> >>>> >> #2: from population data (allele counts): read data in (read.csv / >>>> >> read.table), use the genpop() constructor to make the data a genpop >>>> >> object; I think this is documented in the basics tutorial, but >>>> >> definitely also in ?genpop >>>> >> >>>> >> HTH >>>> >> 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 6 October 2017 at 10:24, Davide Piffer >>>> >> wrote: >>>> >> > Dear Thibaut, >>>> >> > >>>> >> > thanks for answering my question. I will try to reformulate my >>>> >> > question >>>> >> > differently, stating the assumptions: >>>> >> > 1) I assume that the eHGDP object was made into a genpop object >>>> >> > from >>>> >> > some >>>> >> > raw .txt file, like the HGDP file I linked to in the previous >>>> >> > email. >>>> >> > 2) I need an object that looks exactly like the eHGDP object, but >>>> >> > with >>>> >> > SNPs >>>> >> > instead of microsatellite alleles. >>>> >> > 3) Since it's gonna be a rather complex task, I asked if any of you >>>> >> > knows if >>>> >> > someone has already done this job before and published it (e.g. as >>>> >> > supplementary file). >>>> >> > 4) Otherwise, I would like to know how to produce such a file >>>> >> > myself, >>>> >> > starting from a version of the HGDP file with population >>>> >> > information. If >>>> >> > this was done for microsatellites, surely it can be done for the >>>> >> > SNPs as >>>> >> > well? I assume they rely on the same raw HGDP file. >>>> >> > >>>> >> > Many thanks! >>>> >> > >>>> >> > Davide >>>> >> > >>>> >> > On 6 October 2017 at 10:56, Thibaut Jombart >>>> >> > >>>> >> > wrote: >>>> >> >> >>>> >> >> Hi Davide, >>>> >> >> >>>> >> >> I am not entirely sure what you need, so sorry if I miss the >>>> >> >> point. >>>> >> >> adegenet cannot make up for absent population information, but you >>>> >> >> can >>>> >> >> try to identify clusters of course, e.g. using find.clusters. >>>> >> >> >>>> >> >> eHGDP is not a file (at least not in the sense you probably mean), >>>> >> >> but >>>> >> >> a genind object. If the question is how you can get a file looking >>>> >> >> like the one you link into a genind object, you probably want to >>>> >> >> use >>>> >> >> something like read.csv and then df2genind. Imports should be >>>> >> >> detailed >>>> >> >> in the basics tutorial: >>>> >> >> https://github.com/thibautjombart/adegenet/wiki/Tutorials >>>> >> >> >>>> >> >> 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 4 October 2017 at 14:08, Davide Piffer >>>> >> >> wrote: >>>> >> >> > Hello, >>>> >> >> > >>>> >> >> > I am new to Adegenet. I would like to retrieve population >>>> >> >> > frequencies >>>> >> >> > of >>>> >> >> > SNPs (using rsID) from the HGDP file >>>> >> >> > "HGDP_FinalReport_Forward.txt" : >>>> >> >> > http://www.hagsc.org/hgdp/files.html >>>> >> >> > >>>> >> >> > However, the file lacks population information. It contains SNPs >>>> >> >> > x >>>> >> >> > individuals. >>>> >> >> > I need a file structured like the eHGDP (except with SNPs and >>>> >> >> > not >>>> >> >> > microsatellite data) file provided with the package, that can be >>>> >> >> > easily >>>> >> >> > converted into genpop file and then compute the frequencies via >>>> >> >> > makefreq. >>>> >> >> > Do you know if there is any such file downloadable on the >>>> >> >> > internet? >>>> >> >> > i guess there must be a way to produce such a file using >>>> >> >> > ADEGENET >>>> >> >> > starting >>>> >> >> > from raw data. but my knowledge of this package is not advanced >>>> >> >> > enough >>>> >> >> > yet. >>>> >> >> > >>>> >> >> > Best wishes, >>>> >> >> > >>>> >> >> > Davide >>>> >> >> > >>>> >> >> > _______________________________________________ >>>> >> >> > 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 zkamvar at gmail.com Wed Oct 11 16:35:05 2017 From: zkamvar at gmail.com (Zhian Kamvar) Date: Wed, 11 Oct 2017 09:35:05 -0500 Subject: [adegenet-forum] define population level for PCA analysis in adegenet Message-ID: <9821E87A-2260-46F7-A536-12B66BE9388E@gmail.com> The strata() function may be what you are looking for: strata(datpop) <- pop_list setPop(datpop) <- ~clusters Where clusters is a column name in pop_list -Zhian Sent from my iPhone > Date: Wed, 11 Oct 2017 12:08:05 +0200 > From: Didier Aurelle > To: adegenet-forum at lists.r-forge.r-project.org > Subject: [adegenet-forum] define population level for PCA analysis in > adegenet > Message-ID: > > Content-Type: text/plain; charset="utf-8" > > Dear all > > I want to perform a PCA analysis in adegenet starting from a genepop file > without defined populations. I imported the data like this: datapop <- > read.genepop('tous.gen', ncode=3, quiet = FALSE) > > it works, and I can perform a PCA after scaling the data. But I would like > to plot the results / individuals on the PCA axis according to their > population of origin using s.class. I have a vcf file with a three lettre > code for each individual. I imported it in R: pops_list <- > read.csv('liste_pops.csv', header=FALSE) > > but now how can I use it to define population levels in the genind object > 'datapop'? I tried something likes this: setPop(datapop, formula = NULL) > > setPop(datapop) <- pops_list but it doesn't work; even the first line > doesn't work: I get this message: "Erreur : formula must be a valid formula > object." > > And then how should I use it in s.class? > > thanks > > Didier > -------------- next part -------------- > An HTML attachment was scrubbed... > URL: > > ------------------------------ > > Message: 2 > Date: Wed, 11 Oct 2017 13:13:20 +0200 > From: Davide Piffer > To: Thibaut Jombart > Cc: "adegenet-forum at lists.r-forge.r-project.org" > > Subject: Re: [adegenet-forum] Retrieving population allele frequencies > of SNPs using HGDP file > Message-ID: > > Content-Type: text/plain; charset="utf-8" > > Hi, > > I tried using different columns for the population. The Readme file lists > these but none actually works. I am not sure if the problem is with the > file or with the function because I am not an expert. > > Columns for individual data (HGDP/India/Africa individuals): > 1. HGDP ID number or HapMap NA number > 2. numeric code for population > 3. name of population > 4. country of origin > > > > On 11 October 2017 at 11:53, Thibaut Jombart > wrote: > >> Hi there, >> >> reading populations info hasn't been a problem before (I think) in >> read.structure. I would double-check which column it is, though I >> assume you have. If you think there is a problem with the function >> please post an issue on github with a reproducible example and we'll >> try to sort it out. >> >> 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 6 October 2017 at 12:08, Davide Piffer wrote: >>> Ok, I think have found the file I need here: >>> https://rosenberglab.stanford.edu/data/huangEtAl2011/ >> HuangEtAl_2011-GenetEpi.zip >>> . However, it's in .str format. Following the instructions on the >> manual, I >>> tried to assign correct labels based on the Readme file >>> (https://rosenberglab.stanford.edu/data/huangEtAl2011/ >> huangEtAl2011snpdata_readme) >>> >>> Mydata=read.structure("unphased_HGDP+India+Africa_ >> 2810SNPs-regions1to36.stru", >>> onerowperind = FALSE,col.lab = 8,col.pop = 2,row.marknames = 1,n.ind = >> 1107, >>> n.loc = 2810, ask = FALSE)#convert into genind >>> Mydata_pop=genind2genpop(Mydata)#convert into genpop >>> >>> However, I get a file with only 1 population. >>> >>> head(Mydata_pop) >>> /// GENPOP OBJECT ///////// >>> >>> // 1 population; 2,810 loci; 7,217 alleles; size: 1.5 Mb >>> >>> // Basic content >>> @tab: 1 x 7217 matrix of allele counts >>> @loc.n.all: number of alleles per locus (range: 2-4) >>> @loc.fac: locus factor for the 7217 columns of @tab >>> @all.names: list of allele names for each locus >>> @ploidy: ploidy of each individual (range: 2-2) >>> @type: codom >>> @call: .local(x = x, i = i, j = j, drop = dro >>> >>> This is obviously wrong since there are 50+ populations. >>> >>> I tried changing col.pop from 2 to 3 but got the same output. >>> >>> Am I missing something? >>> >>> >>> All the best, >>> Davide >>> >>> >>> >>> On 6 October 2017 at 11:35, Thibaut Jombart >>> wrote: >>>> >>>> Hi again, >>>> >>>> OK I think I got it. So: >>>> - I can't remember how I built the eHGDP dataset, but it's an easy task >>>> - I don't know if the data you're looking for is publicly available >>>> - assuming you find it, there are two ways to get a genpop object: >>>> #1: from individual data with pop info: read data in (read.csv / >>>> read.table), use df2genind (be patient there, that'll take a while), >>>> then genind2genpop >>>> >>>> #2: from population data (allele counts): read data in (read.csv / >>>> read.table), use the genpop() constructor to make the data a genpop >>>> object; I think this is documented in the basics tutorial, but >>>> definitely also in ?genpop >>>> >>>> HTH >>>> 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 6 October 2017 at 10:24, Davide Piffer >> wrote: >>>>> Dear Thibaut, >>>>> >>>>> thanks for answering my question. I will try to reformulate my >> question >>>>> differently, stating the assumptions: >>>>> 1) I assume that the eHGDP object was made into a genpop object from >>>>> some >>>>> raw .txt file, like the HGDP file I linked to in the previous email. >>>>> 2) I need an object that looks exactly like the eHGDP object, but with >>>>> SNPs >>>>> instead of microsatellite alleles. >>>>> 3) Since it's gonna be a rather complex task, I asked if any of you >>>>> knows if >>>>> someone has already done this job before and published it (e.g. as >>>>> supplementary file). >>>>> 4) Otherwise, I would like to know how to produce such a file myself, >>>>> starting from a version of the HGDP file with population information. >> If >>>>> this was done for microsatellites, surely it can be done for the SNPs >> as >>>>> well? I assume they rely on the same raw HGDP file. >>>>> >>>>> Many thanks! >>>>> >>>>> Davide >>>>> >>>>> On 6 October 2017 at 10:56, Thibaut Jombart >> >>>>> wrote: >>>>>> >>>>>> Hi Davide, >>>>>> >>>>>> I am not entirely sure what you need, so sorry if I miss the point. >>>>>> adegenet cannot make up for absent population information, but you >> can >>>>>> try to identify clusters of course, e.g. using find.clusters. >>>>>> >>>>>> eHGDP is not a file (at least not in the sense you probably mean), >> but >>>>>> a genind object. If the question is how you can get a file looking >>>>>> like the one you link into a genind object, you probably want to use >>>>>> something like read.csv and then df2genind. Imports should be >> detailed >>>>>> in the basics tutorial: >>>>>> https://github.com/thibautjombart/adegenet/wiki/Tutorials >>>>>> >>>>>> 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 4 October 2017 at 14:08, Davide Piffer >>>>>> wrote: >>>>>>> Hello, >>>>>>> >>>>>>> I am new to Adegenet. I would like to retrieve population >> frequencies >>>>>>> of >>>>>>> SNPs (using rsID) from the HGDP file >> "HGDP_FinalReport_Forward.txt" : >>>>>>> http://www.hagsc.org/hgdp/files.html >>>>>>> >>>>>>> However, the file lacks population information. It contains SNPs x >>>>>>> individuals. >>>>>>> I need a file structured like the eHGDP (except with SNPs and not >>>>>>> microsatellite data) file provided with the package, that can be >>>>>>> easily >>>>>>> converted into genpop file and then compute the frequencies via >>>>>>> makefreq. >>>>>>> Do you know if there is any such file downloadable on the internet? >>>>>>> i guess there must be a way to produce such a file using ADEGENET >>>>>>> starting >>>>>>> from raw data. but my knowledge of this package is not advanced >>>>>>> enough >>>>>>> yet. >>>>>>> >>>>>>> Best wishes, >>>>>>> >>>>>>> Davide >>>>>>> >>>>>>> _______________________________________________ >>>>>>> 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 >>>>> >>>>> >>> >>> >> > -------------- next part -------------- > An HTML attachment was scrubbed... > URL: > > ------------------------------ > > Message: 3 > Date: Wed, 11 Oct 2017 12:19:59 +0100 > From: Thibaut Jombart > To: Didier Aurelle > Cc: "adegenet-forum at lists.r-forge.r-project.org" > > Subject: Re: [adegenet-forum] define population level for PCA analysis > in adegenet > Message-ID: > > Content-Type: text/plain; charset="UTF-8" > > Hi Didier, > > you are looking for 'pop(x) <- ...'. > > Accessors like this one, and other useful things are in the 'basics' tutorial: > https://github.com/thibautjombart/adegenet/wiki/Tutorials > > 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 11 October 2017 at 11:08, Didier Aurelle wrote: >> Dear all >> >> I want to perform a PCA analysis in adegenet starting from a genepop file >> without defined populations. I imported the data like this: datapop <- >> read.genepop('tous.gen', ncode=3, quiet = FALSE) >> >> it works, and I can perform a PCA after scaling the data. But I would like >> to plot the results / individuals on the PCA axis according to their >> population of origin using s.class. I have a vcf file with a three lettre >> code for each individual. I imported it in R: pops_list <- >> read.csv('liste_pops.csv', header=FALSE) >> >> but now how can I use it to define population levels in the genind object >> 'datapop'? I tried something likes this: setPop(datapop, formula = NULL) >> >> setPop(datapop) <- pops_list but it doesn't work; even the first line >> doesn't work: I get this message: "Erreur : formula must be a valid formula >> object." >> >> And then how should I use it in s.class? >> >> thanks >> >> Didier >> >> >> _______________________________________________ >> 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 > > > ------------------------------ > > _______________________________________________ > 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 > > End of adegenet-forum Digest, Vol 110, Issue 7 > ********************************************** From lucasfip at yahoo.com.br Thu Oct 12 01:34:19 2017 From: lucasfip at yahoo.com.br (Lucas Veiga) Date: Wed, 11 Oct 2017 23:34:19 +0000 (UTC) Subject: [adegenet-forum] Dots in the DAPC graphic References: <2106647146.138432.1507764859711.ref@mail.yahoo.com> Message-ID: <2106647146.138432.1507764859711@mail.yahoo.com> Dear all,I would like to know what I can do for the dots in DAPC graph to be colored according to the populations and not according to the DAPC analysis groups? Best regards, Lucas Veiga Ayres Pimenta -------------- next part -------------- An HTML attachment was scrubbed... URL: From roman.lustrik at biolitika.si Thu Oct 12 10:48:34 2017 From: roman.lustrik at biolitika.si (Roman =?utf-8?Q?Lu=C5=A1trik?=) Date: Thu, 12 Oct 2017 10:48:34 +0200 (CEST) Subject: [adegenet-forum] Dots in the DAPC graphic In-Reply-To: <2106647146.138432.1507764859711@mail.yahoo.com> References: <2106647146.138432.1507764859711.ref@mail.yahoo.com> <2106647146.138432.1507764859711@mail.yahoo.com> Message-ID: <1272245685.282238.1507798114245.JavaMail.zimbra@biolitika.si> Map `grp` argument to your desired grouping. Make sure that you pass `col` the correct number of colors which should match the number of groups you are specifying. By default, coloring is done on grouping ( see here ). See this example: library(adegenet) data(H3N2) pop(H3N2) <- factor(H3N2$other$epid) dapc1 <- dapc(H3N2, var.contrib=FALSE, scale=FALSE, n.pca=150, n.da=5) data.frame(dapc1$grp, pop(H3N2)) # they are matching Cheers, Roman ---- In god we trust, all others bring data. > Zahtevaj IJZ na https://kurc.biolitika.si From: "Lucas Veiga" To: adegenet-forum at lists.r-forge.r-project.org Sent: Thursday, October 12, 2017 1:34:19 AM Subject: [adegenet-forum] Dots in the DAPC graphic Dear all, I would like to know what I can do for the dots in DAPC graph to be colored according to the populations and not according to the DAPC analysis groups? Best regards, Lucas Veiga Ayres Pimenta _______________________________________________ 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 -------------- next part -------------- An HTML attachment was scrubbed... URL: From lucasfip at yahoo.com.br Thu Oct 12 14:03:35 2017 From: lucasfip at yahoo.com.br (Lucas Veiga) Date: Thu, 12 Oct 2017 12:03:35 +0000 (UTC) Subject: [adegenet-forum] Dots in the DAPC graphic In-Reply-To: <1272245685.282238.1507798114245.JavaMail.zimbra@biolitika.si> References: <2106647146.138432.1507764859711.ref@mail.yahoo.com> <2106647146.138432.1507764859711@mail.yahoo.com> <1272245685.282238.1507798114245.JavaMail.zimbra@biolitika.si> Message-ID: <1994389766.433362.1507809815326@mail.yahoo.com> Dear Roman,First, thank you for the help. Unfortunaly, apparently your command not worked for me. I will try explain better my situation. I work with phytopathology and the fungus that I work affects different crops (I have put in my input file .csv the crops as my populations, different crops are different populations). Due the migration of genotypes of the fungus between the crops, inside of one group formed by DAPC there are genotypes obtained of different crops (populations) and for better viewing of this migration I want to plot the dots according of the hosts and not according of the groups formed by DAPC analysis. So, inside of one group there will are dots of different colors.?I hope have explain better my situation and that you can help me. Best regards,Lucas Veiga Ayres pimenta Em Quinta-feira, 12 de Outubro de 2017 5:49, Roman Lu?trik escreveu: Map `grp` argument to your desired grouping. Make sure that you pass `col` the correct number of colors which should match the number of groups you are specifying. By default, coloring is done on grouping (see here). See this example: library(adegenet) data(H3N2) pop(H3N2) <- factor(H3N2$other$epid) dapc1 <- dapc(H3N2, var.contrib=FALSE, scale=FALSE, n.pca=150, n.da=5) data.frame(dapc1$grp, pop(H3N2)) # they are matching Cheers,Roman ---- In god we trust, all others bring data. > Zahtevaj IJZ na https://kurc.biolitika.si From: "Lucas Veiga" To: adegenet-forum at lists.r-forge.r-project.org Sent: Thursday, October 12, 2017 1:34:19 AM Subject: [adegenet-forum] Dots in the DAPC graphic Dear all,I would like to know what I can do for the dots in DAPC graph to be colored according to the populations and not according to the DAPC analysis groups? Best regards, Lucas Veiga Ayres Pimenta _______________________________________________ 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 -------------- next part -------------- An HTML attachment was scrubbed... URL: From lucasfip at yahoo.com.br Thu Oct 12 14:10:28 2017 From: lucasfip at yahoo.com.br (Lucas Veiga) Date: Thu, 12 Oct 2017 12:10:28 +0000 (UTC) Subject: [adegenet-forum] Dots in the DAPC graphic References: <342879047.415645.1507810228644.ref@mail.yahoo.com> Message-ID: <342879047.415645.1507810228644@mail.yahoo.com> Dear Roman,First, thank you for the help. Unfortunaly, apparently your command not worked for me. I will try explain better my situation. I work with phytopathology and the fungus that I work affects different crops (I have put in my input file .csv the crops as my populations, different crops are different populations). Due the migration of genotypes of the fungus between the crops, inside of one group formed by DAPC there are genotypes obtained of different crops (populations) and for better viewing of this migration I want to plot the dots according to the hosts and not according to the groups formed by DAPC analysis. So, inside of one group there will are dots of different colors.?I hope I have explained better my situation and that you can help me. Best regards,Lucas Veiga Ayres pimenta Em Quinta-feira, 12 de Outubro de 2017 9:03, Lucas Veiga escreveu: Dear Roman,First, thank you for the help. Unfortunaly, apparently your command not worked for me. I will try explain better my situation. I work with phytopathology and the fungus that I work affects different crops (I have put in my input file .csv the crops as my populations, different crops are different populations). Due the migration of genotypes of the fungus between the crops, inside of one group formed by DAPC there are genotypes obtained of different crops (populations) and for better viewing of this migration I want to plot the dots according of the hosts and not according of the groups formed by DAPC analysis. So, inside of one group there will are dots of different colors.?I hope have explain better my situation and that you can help me. Best regards,Lucas Veiga Ayres pimenta Em Quinta-feira, 12 de Outubro de 2017 5:49, Roman Lu?trik escreveu: Map `grp` argument to your desired grouping. Make sure that you pass `col` the correct number of colors which should match the number of groups you are specifying. By default, coloring is done on grouping (see here). See this example: library(adegenet) data(H3N2) pop(H3N2) <- factor(H3N2$other$epid) dapc1 <- dapc(H3N2, var.contrib=FALSE, scale=FALSE, n.pca=150, n.da=5) data.frame(dapc1$grp, pop(H3N2)) # they are matching Cheers,Roman ---- In god we trust, all others bring data. > Zahtevaj IJZ na https://kurc.biolitika.si From: "Lucas Veiga" To: adegenet-forum at lists.r-forge.r-project.org Sent: Thursday, October 12, 2017 1:34:19 AM Subject: [adegenet-forum] Dots in the DAPC graphic Dear all,I would like to know what I can do for the dots in DAPC graph to be colored according to the populations and not according to the DAPC analysis groups? Best regards, Lucas Veiga Ayres Pimenta _______________________________________________ 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 -------------- next part -------------- An HTML attachment was scrubbed... URL: From roman.lustrik at biolitika.si Fri Oct 13 10:38:57 2017 From: roman.lustrik at biolitika.si (Roman =?utf-8?Q?Lu=C5=A1trik?=) Date: Fri, 13 Oct 2017 10:38:57 +0200 (CEST) Subject: [adegenet-forum] Dots in the DAPC graphic In-Reply-To: <1994389766.433362.1507809815326@mail.yahoo.com> References: <2106647146.138432.1507764859711.ref@mail.yahoo.com> <2106647146.138432.1507764859711@mail.yahoo.com> <1272245685.282238.1507798114245.JavaMail.zimbra@biolitika.si> <1994389766.433362.1507809815326@mail.yahoo.com> Message-ID: <181441774.286421.1507883937636.JavaMail.zimbra@biolitika.si> A-ha, I think I see where you're getting at. Right now I'm not sure it's possible to have DAPC groups with samples colored by some specific variable. Perhaps Thibaut will be able to chime in. If I'm right, this is something we could think about in the upcoming releases. In the mean time, you can construct your own plot, taking bits and pieces from https://github.com/thibautjombart/adegenet/blob/master/R/dapc.R#L539 Cheers, Roman ---- In god we trust, all others bring data. > Zahtevaj IJZ na https://kurc.biolitika.si From: "Lucas Veiga" To: "Roman Lu?trik" Cc: adegenet-forum at lists.r-forge.r-project.org Sent: Thursday, October 12, 2017 2:03:35 PM Subject: Re: [adegenet-forum] Dots in the DAPC graphic Dear Roman, First, thank you for the help. Unfortunaly, apparently your command not worked for me. I will try explain better my situation. I work with phytopathology and the fungus that I work affects different crops (I have put in my input file .csv the crops as my populations, different crops are different populations). Due the migration of genotypes of the fungus between the crops, inside of one group formed by DAPC there are genotypes obtained of different crops (populations) and for better viewing of this migration I want to plot the dots according of the hosts and not according of the groups formed by DAPC analysis. So, inside of one group there will are dots of different colors. I hope have explain better my situation and that you can help me. Best regards, Lucas Veiga Ayres pimenta Em Quinta-feira, 12 de Outubro de 2017 5:49, Roman Lu?trik escreveu: Map `grp` argument to your desired grouping. Make sure that you pass `col` the correct number of colors which should match the number of groups you are specifying. By default, coloring is done on grouping ( see here ). See this example: library(adegenet) data(H3N2) pop(H3N2) <- factor(H3N2$other$epid) dapc1 <- dapc(H3N2, var.contrib=FALSE, scale=FALSE, n.pca=150, n.da=5) data.frame(dapc1$grp, pop(H3N2)) # they are matching Cheers, Roman ---- In god we trust, all others bring data. > Zahtevaj IJZ na https://kurc.biolitika.si From: "Lucas Veiga" To: adegenet-forum at lists.r-forge.r-project.org Sent: Thursday, October 12, 2017 1:34:19 AM Subject: [adegenet-forum] Dots in the DAPC graphic Dear all, I would like to know what I can do for the dots in DAPC graph to be colored according to the populations and not according to the DAPC analysis groups? Best regards, Lucas Veiga Ayres Pimenta _______________________________________________ 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 -------------- next part -------------- An HTML attachment was scrubbed... URL: From thibautjombart at gmail.com Fri Oct 13 12:28:36 2017 From: thibautjombart at gmail.com (Thibaut Jombart) Date: Fri, 13 Oct 2017 11:28:36 +0100 Subject: [adegenet-forum] Dots in the DAPC graphic In-Reply-To: <181441774.286421.1507883937636.JavaMail.zimbra@biolitika.si> References: <2106647146.138432.1507764859711.ref@mail.yahoo.com> <2106647146.138432.1507764859711@mail.yahoo.com> <1272245685.282238.1507798114245.JavaMail.zimbra@biolitika.si> <1994389766.433362.1507809815326@mail.yahoo.com> <181441774.286421.1507883937636.JavaMail.zimbra@biolitika.si> Message-ID: Hello, The function 'scatter' is meant for general purposes, but fine customisation of the graph like you suggest goes beyond this function. I would recommend having a look at adegraphics, which has plenty of options for this kind of graphics: https://cran.r-project.org/web/packages/adegraphics/vignettes/adegraphics.html Here, I think you want to create the first layer using s.class (with no color) and then add color points using s.value 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 October 2017 at 09:38, Roman Lu?trik wrote: > A-ha, I think I see where you're getting at. Right now I'm not sure it's > possible to have DAPC groups with samples colored by some specific variable. > Perhaps Thibaut will be able to chime in. If I'm right, this is something we > could think about in the upcoming releases. > > In the mean time, you can construct your own plot, taking bits and pieces > from https://github.com/thibautjombart/adegenet/blob/master/R/dapc.R#L539 > > > > Cheers, > Roman > > ---- > In god we trust, all others bring data. >> Zahtevaj IJZ na https://kurc.biolitika.si > > ________________________________ > From: "Lucas Veiga" > To: "Roman Lu?trik" > Cc: adegenet-forum at lists.r-forge.r-project.org > Sent: Thursday, October 12, 2017 2:03:35 PM > Subject: Re: [adegenet-forum] Dots in the DAPC graphic > > Dear Roman, > First, thank you for the help. Unfortunaly, apparently your command not > worked for me. I will try explain better my situation. I work with > phytopathology and the fungus that I work affects different crops (I have > put in my input file .csv the crops as my populations, different crops are > different populations). Due the migration of genotypes of the fungus between > the crops, inside of one group formed by DAPC there are genotypes obtained > of different crops (populations) and for better viewing of this migration I > want to plot the dots according of the hosts and not according of the groups > formed by DAPC analysis. So, inside of one group there will are dots of > different colors. > I hope have explain better my situation and that you can help me. > > Best regards, > Lucas Veiga Ayres pimenta > > > Em Quinta-feira, 12 de Outubro de 2017 5:49, Roman Lu?trik > escreveu: > > > Map `grp` argument to your desired grouping. Make sure that you pass `col` > the correct number of colors which should match the number of groups you are > specifying. > By default, coloring is done on grouping (see here). See this example: > > library(adegenet) > > data(H3N2) > pop(H3N2) <- factor(H3N2$other$epid) > dapc1 <- dapc(H3N2, var.contrib=FALSE, scale=FALSE, n.pca=150, n.da=5) > > data.frame(dapc1$grp, pop(H3N2)) # they are matching > > Cheers, > Roman > > > > ---- > In god we trust, all others bring data. >> Zahtevaj IJZ na https://kurc.biolitika.si > > ________________________________ > From: "Lucas Veiga" > To: adegenet-forum at lists.r-forge.r-project.org > Sent: Thursday, October 12, 2017 1:34:19 AM > Subject: [adegenet-forum] Dots in the DAPC graphic > > Dear all, > I would like to know what I can do for the dots in DAPC graph to be colored > according to the populations and not according to the DAPC analysis groups? > > Best regards, > Lucas Veiga Ayres Pimenta > > _______________________________________________ > 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 > > > > > _______________________________________________ > 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 zkamvar at gmail.com Fri Oct 13 17:47:54 2017 From: zkamvar at gmail.com (Zhian Kamvar) Date: Fri, 13 Oct 2017 10:47:54 -0500 Subject: [adegenet-forum] Dots in the DAPC graphic In-Reply-To: References: Message-ID: <75BA3AB8-1E37-4185-B7AC-B026ECC071A8@gmail.com> Hi, The individual coordinates are in the @ind.coord slot of the DAPC object. You can use those to plot and color them with your desired population factor. I have recently come up with a ggplot2 solution for this: https://github.com/everhartlab/sclerotinia-366/blame/v1.0/results/by-year.md#L508-L558 , the results of which look like so: https://github.com/everhartlab/sclerotinia-366/blob/v1.0/results/figures/by-year/dapc_plot-2.png Hope that helps, Zhian ----- Zhian N. Kamvar, Ph. D. Postdoctoral Researcher (Everhart Lab) Department of Plant Pathology University of Nebraska-Lincoln ORCID: 0000-0003-1458-7108 > On Oct 13, 2017, at 03:39 , adegenet-forum-request at lists.r-forge.r-project.org wrote: > > Send adegenet-forum mailing list submissions to > adegenet-forum at lists.r-forge.r-project.org > > To subscribe or unsubscribe via the World Wide Web, visit > https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/adegenet-forum > > or, via email, send a message with subject or body 'help' to > adegenet-forum-request at lists.r-forge.r-project.org > > You can reach the person managing the list at > adegenet-forum-owner at lists.r-forge.r-project.org > > When replying, please edit your Subject line so it is more specific > than "Re: Contents of adegenet-forum digest..." > > > Today's Topics: > > 1. Re: Dots in the DAPC graphic (Lucas Veiga) > 2. Re: Dots in the DAPC graphic (Lucas Veiga) > 3. Re: Dots in the DAPC graphic (Roman Lu?trik) > > > ---------------------------------------------------------------------- > > Message: 1 > Date: Thu, 12 Oct 2017 12:03:35 +0000 (UTC) > From: Lucas Veiga > To: Roman Lu?trik > Cc: "adegenet-forum at lists.r-forge.r-project.org" > > Subject: Re: [adegenet-forum] Dots in the DAPC graphic > Message-ID: <1994389766.433362.1507809815326 at mail.yahoo.com> > Content-Type: text/plain; charset="utf-8" > > Dear Roman,First, thank you for the help. Unfortunaly, apparently your command not worked for me. I will try explain better my situation. I work with phytopathology and the fungus that I work affects different crops (I have put in my input file .csv the crops as my populations, different crops are different populations). Due the migration of genotypes of the fungus between the crops, inside of one group formed by DAPC there are genotypes obtained of different crops (populations) and for better viewing of this migration I want to plot the dots according of the hosts and not according of the groups formed by DAPC analysis. So, inside of one group there will are dots of different colors.?I hope have explain better my situation and that you can help me. > Best regards,Lucas Veiga Ayres pimenta > > Em Quinta-feira, 12 de Outubro de 2017 5:49, Roman Lu?trik escreveu: > > > Map `grp` argument to your desired grouping. Make sure that you pass `col` the correct number of colors which should match the number of groups you are specifying. > By default, coloring is done on grouping (see here). See this example: > library(adegenet) > > data(H3N2) > pop(H3N2) <- factor(H3N2$other$epid) > dapc1 <- dapc(H3N2, var.contrib=FALSE, scale=FALSE, n.pca=150, n.da=5) > > data.frame(dapc1$grp, pop(H3N2)) # they are matching > > Cheers,Roman > > > ---- > In god we trust, all others bring data. >> Zahtevaj IJZ na https://kurc.biolitika.si > From: "Lucas Veiga" > To: adegenet-forum at lists.r-forge.r-project.org > Sent: Thursday, October 12, 2017 1:34:19 AM > Subject: [adegenet-forum] Dots in the DAPC graphic > > Dear all,I would like to know what I can do for the dots in DAPC graph to be colored according to the populations and not according to the DAPC analysis groups? > > Best regards, > Lucas Veiga Ayres Pimenta > _______________________________________________ > 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 > > > > -------------- next part -------------- > An HTML attachment was scrubbed... > URL: > > ------------------------------ > > Message: 2 > Date: Thu, 12 Oct 2017 12:10:28 +0000 (UTC) > From: Lucas Veiga > To: Roman Lu?trik > Cc: "adegenet-forum at lists.r-forge.r-project.org" > > Subject: Re: [adegenet-forum] Dots in the DAPC graphic > Message-ID: <342879047.415645.1507810228644 at mail.yahoo.com> > Content-Type: text/plain; charset="utf-8" > > Dear Roman,First, thank you for the help. Unfortunaly, apparently your command not worked for me. I will try explain better my situation. I work with phytopathology and the fungus that I work affects different crops (I have put in my input file .csv the crops as my populations, different crops are different populations). Due the migration of genotypes of the fungus between the crops, inside of one group formed by DAPC there are genotypes obtained of different crops (populations) and for better viewing of this migration I want to plot the dots according to the hosts and not according to the groups formed by DAPC analysis. So, inside of one group there will are dots of different colors.?I hope I have explained better my situation and that you can help me. > Best regards,Lucas Veiga Ayres pimenta > > Em Quinta-feira, 12 de Outubro de 2017 9:03, Lucas Veiga escreveu: > > > Dear Roman,First, thank you for the help. Unfortunaly, apparently your command not worked for me. I will try explain better my situation. I work with phytopathology and the fungus that I work affects different crops (I have put in my input file .csv the crops as my populations, different crops are different populations). Due the migration of genotypes of the fungus between the crops, inside of one group formed by DAPC there are genotypes obtained of different crops (populations) and for better viewing of this migration I want to plot the dots according of the hosts and not according of the groups formed by DAPC analysis. So, inside of one group there will are dots of different colors.?I hope have explain better my situation and that you can help me. > Best regards,Lucas Veiga Ayres pimenta > > Em Quinta-feira, 12 de Outubro de 2017 5:49, Roman Lu?trik escreveu: > > > Map `grp` argument to your desired grouping. Make sure that you pass `col` the correct number of colors which should match the number of groups you are specifying. > By default, coloring is done on grouping (see here). See this example: > library(adegenet) > > data(H3N2) > pop(H3N2) <- factor(H3N2$other$epid) > dapc1 <- dapc(H3N2, var.contrib=FALSE, scale=FALSE, n.pca=150, n.da=5) > > data.frame(dapc1$grp, pop(H3N2)) # they are matching > > Cheers,Roman > > > ---- > In god we trust, all others bring data. >> Zahtevaj IJZ na https://kurc.biolitika.si > From: "Lucas Veiga" > To: adegenet-forum at lists.r-forge.r-project.org > Sent: Thursday, October 12, 2017 1:34:19 AM > Subject: [adegenet-forum] Dots in the DAPC graphic > > Dear all,I would like to know what I can do for the dots in DAPC graph to be colored according to the populations and not according to the DAPC analysis groups? > > Best regards, > Lucas Veiga Ayres Pimenta > _______________________________________________ > 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 > > > > > > -------------- next part -------------- > An HTML attachment was scrubbed... > URL: > > ------------------------------ > > Message: 3 > Date: Fri, 13 Oct 2017 10:38:57 +0200 (CEST) > From: Roman Lu?trik > To: Lucas Veiga > Cc: adegenet-forum at lists.r-forge.r-project.org > Subject: Re: [adegenet-forum] Dots in the DAPC graphic > Message-ID: > <181441774.286421.1507883937636.JavaMail.zimbra at biolitika.si> > Content-Type: text/plain; charset="utf-8" > > A-ha, I think I see where you're getting at. Right now I'm not sure it's possible to have DAPC groups with samples colored by some specific variable. Perhaps Thibaut will be able to chime in. If I'm right, this is something we could think about in the upcoming releases. > > In the mean time, you can construct your own plot, taking bits and pieces from https://github.com/thibautjombart/adegenet/blob/master/R/dapc.R#L539 > > > > Cheers, > Roman > > ---- > In god we trust, all others bring data. >> Zahtevaj IJZ na https://kurc.biolitika.si > > > From: "Lucas Veiga" > To: "Roman Lu?trik" > Cc: adegenet-forum at lists.r-forge.r-project.org > Sent: Thursday, October 12, 2017 2:03:35 PM > Subject: Re: [adegenet-forum] Dots in the DAPC graphic > > Dear Roman, > First, thank you for the help. Unfortunaly, apparently your command not worked for me. I will try explain better my situation. I work with phytopathology and the fungus that I work affects different crops (I have put in my input file .csv the crops as my populations, different crops are different populations). Due the migration of genotypes of the fungus between the crops, inside of one group formed by DAPC there are genotypes obtained of different crops (populations) and for better viewing of this migration I want to plot the dots according of the hosts and not according of the groups formed by DAPC analysis. So, inside of one group there will are dots of different colors. > I hope have explain better my situation and that you can help me. > > Best regards, > Lucas Veiga Ayres pimenta > > > Em Quinta-feira, 12 de Outubro de 2017 5:49, Roman Lu?trik escreveu: > > > Map `grp` argument to your desired grouping. Make sure that you pass `col` the correct number of colors which should match the number of groups you are specifying. > By default, coloring is done on grouping ( see here ). See this example: > > library(adegenet) > > data(H3N2) > pop(H3N2) <- factor(H3N2$other$epid) > dapc1 <- dapc(H3N2, var.contrib=FALSE, scale=FALSE, n.pca=150, n.da=5) > > data.frame(dapc1$grp, pop(H3N2)) # they are matching > > Cheers, > Roman > > > > ---- > In god we trust, all others bring data. >> Zahtevaj IJZ na https://kurc.biolitika.si > > > From: "Lucas Veiga" > To: adegenet-forum at lists.r-forge.r-project.org > Sent: Thursday, October 12, 2017 1:34:19 AM > Subject: [adegenet-forum] Dots in the DAPC graphic > > Dear all, > I would like to know what I can do for the dots in DAPC graph to be colored according to the populations and not according to the DAPC analysis groups? > > Best regards, > Lucas Veiga Ayres Pimenta > > _______________________________________________ > 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 > > > > -------------- next part -------------- > An HTML attachment was scrubbed... > URL: > > ------------------------------ > > _______________________________________________ > 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 > > End of adegenet-forum Digest, Vol 110, Issue 11 > *********************************************** -------------- next part -------------- An HTML attachment was scrubbed... URL: From lucasfip at yahoo.com.br Mon Oct 16 19:10:49 2017 From: lucasfip at yahoo.com.br (Lucas Veiga) Date: Mon, 16 Oct 2017 17:10:49 +0000 (UTC) Subject: [adegenet-forum] Dots in the DAPC graphic In-Reply-To: <75BA3AB8-1E37-4185-B7AC-B026ECC071A8@gmail.com> References: <75BA3AB8-1E37-4185-B7AC-B026ECC071A8@gmail.com> Message-ID: <1729769391.894921.1508173849615@mail.yahoo.com> Dear All (Kamvar, Jombart and Roman),First, I would like to thank you all for spending a little of your time on my problem. Unfortunely, it was not possible to do what I want with commands that you showed me. I think that I will have to write very? carefully my work to explain my groups and my dots (haployd individuals) inside of the groups formed by DAPC analysis.?Obs: Kamvar, your command is very useful, but it was not possible to have dots with different colors or forms inside of the same group. Best regards,Lucas Veiga Ayres Pimenta Em Sexta-feira, 13 de Outubro de 2017 12:48, Zhian Kamvar escreveu: Hi, The individual coordinates are in the @ind.coord slot of the DAPC object. You can use those to plot and color them with your desired population factor. I have recently come up with a ggplot2 solution for this:?https://github.com/everhartlab/sclerotinia-366/blame/v1.0/results/by-year.md#L508-L558, the results of which look like so:?https://github.com/everhartlab/sclerotinia-366/blob/v1.0/results/figures/by-year/dapc_plot-2.png Hope that helps,Zhian -----Zhian N. Kamvar, Ph. D.Postdoctoral Researcher (Everhart Lab)Department of Plant PathologyUniversity of Nebraska-LincolnORCID:?0000-0003-1458-7108 On Oct 13, 2017, at 03:39 , adegenet-forum-request at lists.r-forge.r-project.org wrote: Send adegenet-forum mailing list submissions to adegenet-forum at lists.r-forge.r-project.org To subscribe or unsubscribe via the World Wide Web, visit https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/adegenet-forum or, via email, send a message with subject or body 'help' to adegenet-forum-request at lists.r-forge.r-project.org You can reach the person managing the list at adegenet-forum-owner at lists.r-forge.r-project.org When replying, please edit your Subject line so it is more specific than "Re: Contents of adegenet-forum digest..." Today's Topics: ??1. Re: Dots in the DAPC graphic (Lucas Veiga) ??2. Re: Dots in the DAPC graphic (Lucas Veiga) ??3. Re: Dots in the DAPC graphic (Roman Lu?trik) ---------------------------------------------------------------------- Message: 1 Date: Thu, 12 Oct 2017 12:03:35 +0000 (UTC) From: Lucas Veiga To: Roman Lu?trik Cc: "adegenet-forum at lists.r-forge.r-project.org" Subject: Re: [adegenet-forum] Dots in the DAPC graphic Message-ID: <1994389766.433362.1507809815326 at mail.yahoo.com> Content-Type: text/plain; charset="utf-8" Dear Roman,First, thank you for the help. Unfortunaly, apparently your command not worked for me. I will try explain better my situation. I work with phytopathology and the fungus that I work affects different crops (I have put in my input file .csv the crops as my populations, different crops are different populations). Due the migration of genotypes of the fungus between the crops, inside of one group formed by DAPC there are genotypes obtained of different crops (populations) and for better viewing of this migration I want to plot the dots according of the hosts and not according of the groups formed by DAPC analysis. So, inside of one group there will are dots of different colors.?I hope have explain better my situation and that you can help me. Best regards,Lucas Veiga Ayres pimenta ???Em Quinta-feira, 12 de Outubro de 2017 5:49, Roman Lu?trik escreveu: Map `grp` argument to your desired grouping. Make sure that you pass `col` the correct number of colors which should match the number of groups you are specifying. By default, coloring is done on grouping (see here). See this example: library(adegenet) data(H3N2) pop(H3N2) <- factor(H3N2$other$epid) dapc1 <- dapc(H3N2, var.contrib=FALSE, scale=FALSE, n.pca=150, n.da=5) data.frame(dapc1$grp, pop(H3N2)) # they are matching Cheers,Roman ---- In god we trust, all others bring data. Zahtevaj IJZ na https://kurc.biolitika.si From: "Lucas Veiga" To: adegenet-forum at lists.r-forge.r-project.org Sent: Thursday, October 12, 2017 1:34:19 AM Subject: [adegenet-forum] Dots in the DAPC graphic Dear all,I would like to know what I can do for the dots in DAPC graph to be colored according to the populations and not according to the DAPC analysis groups? Best regards, Lucas Veiga Ayres Pimenta _______________________________________________ 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 -------------- next part -------------- An HTML attachment was scrubbed... URL: ------------------------------ Message: 2 Date: Thu, 12 Oct 2017 12:10:28 +0000 (UTC) From: Lucas Veiga To: Roman Lu?trik Cc: "adegenet-forum at lists.r-forge.r-project.org" Subject: Re: [adegenet-forum] Dots in the DAPC graphic Message-ID: <342879047.415645.1507810228644 at mail.yahoo.com> Content-Type: text/plain; charset="utf-8" Dear Roman,First, thank you for the help. Unfortunaly, apparently your command not worked for me. I will try explain better my situation. I work with phytopathology and the fungus that I work affects different crops (I have put in my input file .csv the crops as my populations, different crops are different populations). Due the migration of genotypes of the fungus between the crops, inside of one group formed by DAPC there are genotypes obtained of different crops (populations) and for better viewing of this migration I want to plot the dots according to the hosts and not according to the groups formed by DAPC analysis. So, inside of one group there will are dots of different colors.?I hope I have explained better my situation and that you can help me. Best regards,Lucas Veiga Ayres pimenta ???Em Quinta-feira, 12 de Outubro de 2017 9:03, Lucas Veiga escreveu: Dear Roman,First, thank you for the help. Unfortunaly, apparently your command not worked for me. I will try explain better my situation. I work with phytopathology and the fungus that I work affects different crops (I have put in my input file .csv the crops as my populations, different crops are different populations). Due the migration of genotypes of the fungus between the crops, inside of one group formed by DAPC there are genotypes obtained of different crops (populations) and for better viewing of this migration I want to plot the dots according of the hosts and not according of the groups formed by DAPC analysis. So, inside of one group there will are dots of different colors.?I hope have explain better my situation and that you can help me. Best regards,Lucas Veiga Ayres pimenta ???Em Quinta-feira, 12 de Outubro de 2017 5:49, Roman Lu?trik escreveu: Map `grp` argument to your desired grouping. Make sure that you pass `col` the correct number of colors which should match the number of groups you are specifying. By default, coloring is done on grouping (see here). See this example: library(adegenet) data(H3N2) pop(H3N2) <- factor(H3N2$other$epid) dapc1 <- dapc(H3N2, var.contrib=FALSE, scale=FALSE, n.pca=150, n.da=5) data.frame(dapc1$grp, pop(H3N2)) # they are matching Cheers,Roman ---- In god we trust, all others bring data. Zahtevaj IJZ na https://kurc.biolitika.si From: "Lucas Veiga" To: adegenet-forum at lists.r-forge.r-project.org Sent: Thursday, October 12, 2017 1:34:19 AM Subject: [adegenet-forum] Dots in the DAPC graphic Dear all,I would like to know what I can do for the dots in DAPC graph to be colored according to the populations and not according to the DAPC analysis groups? Best regards, Lucas Veiga Ayres Pimenta _______________________________________________ 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 -------------- next part -------------- An HTML attachment was scrubbed... URL: ------------------------------ Message: 3 Date: Fri, 13 Oct 2017 10:38:57 +0200 (CEST) From: Roman Lu?trik To: Lucas Veiga Cc: adegenet-forum at lists.r-forge.r-project.org Subject: Re: [adegenet-forum] Dots in the DAPC graphic Message-ID: <181441774.286421.1507883937636.JavaMail.zimbra at biolitika.si> Content-Type: text/plain; charset="utf-8" A-ha, I think I see where you're getting at. Right now I'm not sure it's possible to have DAPC groups with samples colored by some specific variable. Perhaps Thibaut will be able to chime in. If I'm right, this is something we could think about in the upcoming releases. In the mean time, you can construct your own plot, taking bits and pieces from https://github.com/thibautjombart/adegenet/blob/master/R/dapc.R#L539 Cheers, Roman ---- In god we trust, all others bring data. Zahtevaj IJZ na https://kurc.biolitika.si From: "Lucas Veiga" To: "Roman Lu?trik" Cc: adegenet-forum at lists.r-forge.r-project.org Sent: Thursday, October 12, 2017 2:03:35 PM Subject: Re: [adegenet-forum] Dots in the DAPC graphic Dear Roman, First, thank you for the help. Unfortunaly, apparently your command not worked for me. I will try explain better my situation. I work with phytopathology and the fungus that I work affects different crops (I have put in my input file .csv the crops as my populations, different crops are different populations). Due the migration of genotypes of the fungus between the crops, inside of one group formed by DAPC there are genotypes obtained of different crops (populations) and for better viewing of this migration I want to plot the dots according of the hosts and not according of the groups formed by DAPC analysis. So, inside of one group there will are dots of different colors. I hope have explain better my situation and that you can help me. Best regards, Lucas Veiga Ayres pimenta Em Quinta-feira, 12 de Outubro de 2017 5:49, Roman Lu?trik escreveu: Map `grp` argument to your desired grouping. Make sure that you pass `col` the correct number of colors which should match the number of groups you are specifying. By default, coloring is done on grouping ( see here ). See this example: library(adegenet) data(H3N2) pop(H3N2) <- factor(H3N2$other$epid) dapc1 <- dapc(H3N2, var.contrib=FALSE, scale=FALSE, n.pca=150, n.da=5) data.frame(dapc1$grp, pop(H3N2)) # they are matching Cheers, Roman ---- In god we trust, all others bring data. Zahtevaj IJZ na https://kurc.biolitika.si From: "Lucas Veiga" To: adegenet-forum at lists.r-forge.r-project.org Sent: Thursday, October 12, 2017 1:34:19 AM Subject: [adegenet-forum] Dots in the DAPC graphic Dear all, I would like to know what I can do for the dots in DAPC graph to be colored according to the populations and not according to the DAPC analysis groups? Best regards, Lucas Veiga Ayres Pimenta _______________________________________________ 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 -------------- next part -------------- An HTML attachment was scrubbed... URL: ------------------------------ _______________________________________________ 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 End of adegenet-forum Digest, Vol 110, Issue 11 *********************************************** _______________________________________________ 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 -------------- next part -------------- An HTML attachment was scrubbed... URL: From zkamvar at gmail.com Mon Oct 16 19:51:21 2017 From: zkamvar at gmail.com (Zhian Kamvar) Date: Mon, 16 Oct 2017 12:51:21 -0500 Subject: [adegenet-forum] Dots in the DAPC graphic In-Reply-To: <1729769391.894921.1508173849615@mail.yahoo.com> References: <75BA3AB8-1E37-4185-B7AC-B026ECC071A8@gmail.com> <1729769391.894921.1508173849615@mail.yahoo.com> Message-ID: <5AFD9D53-02A0-4360-843F-770E97D11CFA@gmail.com> Hi Lucas, You are free to change the function around as you see fit (i.e. you can change the geom_text to geom_point and use a different variable for color). There, unfortunately, is no current out of the box solution, we can only show you examples to get you part of the way there. What I would recommend is that you play around with plotting (either ggplot2 or base graphics) and see what fits your needs better. Both are flexible enough to do what you need. For example, here's a minimal solution to plot both color and shape: library("adegenet") data(microbov) strata(microbov) <- as.data.frame(other(microbov)) setPop(microbov) <- ~spe/breed mdapc <- dapc(microbov, n.pca = 20, n.da = 40) plot(mdapc$ind.coord[, 1:2], col = seasun(length(levels(mdapc$grp)))[mdapc$grp], pch = as.integer(strata(microbov)$spe) + 15) Again, it won't get you completely to your final product, but hopefully it starts you off in understanding where the elements of the plot are coming from. Best, Zhian ----- Zhian N. Kamvar, Ph. D. Postdoctoral Researcher (Everhart Lab) Department of Plant Pathology University of Nebraska-Lincoln ORCID: 0000-0003-1458-7108 > On Oct 16, 2017, at 12:10 , Lucas Veiga wrote: > > Dear All (Kamvar, Jombart and Roman), > First, I would like to thank you all for spending a little of your time on my problem. Unfortunely, it was not possible to do what I want with commands that you showed me. I think that I will have to write very carefully my work to explain my groups and my dots (haployd individuals) inside of the groups formed by DAPC analysis. > Obs: Kamvar, your command is very useful, but it was not possible to have dots with different colors or forms inside of the same group. > > > Best regards, > Lucas Veiga Ayres Pimenta > > > Em Sexta-feira, 13 de Outubro de 2017 12:48, Zhian Kamvar escreveu: > > > Hi, > > The individual coordinates are in the @ind.coord slot of the DAPC object. You can use those to plot and color them with your desired population factor. > > I have recently come up with a ggplot2 solution for this: https://github.com/everhartlab/sclerotinia-366/blame/v1.0/results/by-year.md#L508-L558 , the results of which look like so: https://github.com/everhartlab/sclerotinia-366/blob/v1.0/results/figures/by-year/dapc_plot-2.png > > Hope that helps, > Zhian > > ----- > Zhian N. Kamvar, Ph. D. > Postdoctoral Researcher (Everhart Lab) > Department of Plant Pathology > University of Nebraska-Lincoln > ORCID: 0000-0003-1458-7108 > > > > >> On Oct 13, 2017, at 03:39 , adegenet-forum-request at lists.r-forge.r-project.org wrote: >> >> Send adegenet-forum mailing list submissions to >> adegenet-forum at lists.r-forge.r-project.org >> >> To subscribe or unsubscribe via the World Wide Web, visit >> https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/adegenet-forum >> >> or, via email, send a message with subject or body 'help' to >> adegenet-forum-request at lists.r-forge.r-project.org >> >> You can reach the person managing the list at >> adegenet-forum-owner at lists.r-forge.r-project.org >> >> When replying, please edit your Subject line so it is more specific >> than "Re: Contents of adegenet-forum digest..." >> >> >> Today's Topics: >> >> 1. Re: Dots in the DAPC graphic (Lucas Veiga) >> 2. Re: Dots in the DAPC graphic (Lucas Veiga) >> 3. Re: Dots in the DAPC graphic (Roman Lu?trik) >> >> >> ---------------------------------------------------------------------- >> >> Message: 1 >> Date: Thu, 12 Oct 2017 12:03:35 +0000 (UTC) >> From: Lucas Veiga >> To: Roman Lu?trik >> Cc: "adegenet-forum at lists.r-forge.r-project.org" >> >> Subject: Re: [adegenet-forum] Dots in the DAPC graphic >> Message-ID: <1994389766.433362.1507809815326 at mail.yahoo.com> >> Content-Type: text/plain; charset="utf-8" >> >> Dear Roman,First, thank you for the help. Unfortunaly, apparently your command not worked for me. I will try explain better my situation. I work with phytopathology and the fungus that I work affects different crops (I have put in my input file .csv the crops as my populations, different crops are different populations). Due the migration of genotypes of the fungus between the crops, inside of one group formed by DAPC there are genotypes obtained of different crops (populations) and for better viewing of this migration I want to plot the dots according of the hosts and not according of the groups formed by DAPC analysis. So, inside of one group there will are dots of different colors.?I hope have explain better my situation and that you can help me. >> Best regards,Lucas Veiga Ayres pimenta >> >> Em Quinta-feira, 12 de Outubro de 2017 5:49, Roman Lu?trik escreveu: >> >> >> Map `grp` argument to your desired grouping. Make sure that you pass `col` the correct number of colors which should match the number of groups you are specifying. >> By default, coloring is done on grouping (see here). See this example: >> library(adegenet) >> >> data(H3N2) >> pop(H3N2) <- factor(H3N2$other$epid) >> dapc1 <- dapc(H3N2, var.contrib=FALSE, scale=FALSE, n.pca=150, n.da=5) >> >> data.frame(dapc1$grp, pop(H3N2)) # they are matching >> >> Cheers,Roman >> >> >> ---- >> In god we trust, all others bring data. >>> Zahtevaj IJZ na https://kurc.biolitika.si >> From: "Lucas Veiga" >> To: adegenet-forum at lists.r-forge.r-project.org >> Sent: Thursday, October 12, 2017 1:34:19 AM >> Subject: [adegenet-forum] Dots in the DAPC graphic >> >> Dear all,I would like to know what I can do for the dots in DAPC graph to be colored according to the populations and not according to the DAPC analysis groups? >> >> Best regards, >> Lucas Veiga Ayres Pimenta >> _______________________________________________ >> 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 >> >> >> >> -------------- next part -------------- >> An HTML attachment was scrubbed... >> URL: >> >> ------------------------------ >> >> Message: 2 >> Date: Thu, 12 Oct 2017 12:10:28 +0000 (UTC) >> From: Lucas Veiga >> To: Roman Lu?trik >> Cc: "adegenet-forum at lists.r-forge.r-project.org" >> >> Subject: Re: [adegenet-forum] Dots in the DAPC graphic >> Message-ID: <342879047.415645.1507810228644 at mail.yahoo.com> >> Content-Type: text/plain; charset="utf-8" >> >> Dear Roman,First, thank you for the help. Unfortunaly, apparently your command not worked for me. I will try explain better my situation. I work with phytopathology and the fungus that I work affects different crops (I have put in my input file .csv the crops as my populations, different crops are different populations). Due the migration of genotypes of the fungus between the crops, inside of one group formed by DAPC there are genotypes obtained of different crops (populations) and for better viewing of this migration I want to plot the dots according to the hosts and not according to the groups formed by DAPC analysis. So, inside of one group there will are dots of different colors.?I hope I have explained better my situation and that you can help me. >> Best regards,Lucas Veiga Ayres pimenta >> >> Em Quinta-feira, 12 de Outubro de 2017 9:03, Lucas Veiga escreveu: >> >> >> Dear Roman,First, thank you for the help. Unfortunaly, apparently your command not worked for me. I will try explain better my situation. I work with phytopathology and the fungus that I work affects different crops (I have put in my input file .csv the crops as my populations, different crops are different populations). Due the migration of genotypes of the fungus between the crops, inside of one group formed by DAPC there are genotypes obtained of different crops (populations) and for better viewing of this migration I want to plot the dots according of the hosts and not according of the groups formed by DAPC analysis. So, inside of one group there will are dots of different colors.?I hope have explain better my situation and that you can help me. >> Best regards,Lucas Veiga Ayres pimenta >> >> Em Quinta-feira, 12 de Outubro de 2017 5:49, Roman Lu?trik escreveu: >> >> >> Map `grp` argument to your desired grouping. Make sure that you pass `col` the correct number of colors which should match the number of groups you are specifying. >> By default, coloring is done on grouping (see here). See this example: >> library(adegenet) >> >> data(H3N2) >> pop(H3N2) <- factor(H3N2$other$epid) >> dapc1 <- dapc(H3N2, var.contrib=FALSE, scale=FALSE, n.pca=150, n.da=5) >> >> data.frame(dapc1$grp, pop(H3N2)) # they are matching >> >> Cheers,Roman >> >> >> ---- >> In god we trust, all others bring data. >>> Zahtevaj IJZ na https://kurc.biolitika.si >> From: "Lucas Veiga" >> To: adegenet-forum at lists.r-forge.r-project.org >> Sent: Thursday, October 12, 2017 1:34:19 AM >> Subject: [adegenet-forum] Dots in the DAPC graphic >> >> Dear all,I would like to know what I can do for the dots in DAPC graph to be colored according to the populations and not according to the DAPC analysis groups? >> >> Best regards, >> Lucas Veiga Ayres Pimenta >> _______________________________________________ >> 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 >> >> >> >> >> >> -------------- next part -------------- >> An HTML attachment was scrubbed... >> URL: >> >> ------------------------------ >> >> Message: 3 >> Date: Fri, 13 Oct 2017 10:38:57 +0200 (CEST) >> From: Roman Lu?trik >> To: Lucas Veiga >> Cc: adegenet-forum at lists.r-forge.r-project.org >> Subject: Re: [adegenet-forum] Dots in the DAPC graphic >> Message-ID: >> <181441774.286421.1507883937636.JavaMail.zimbra at biolitika.si> >> Content-Type: text/plain; charset="utf-8" >> >> A-ha, I think I see where you're getting at. Right now I'm not sure it's possible to have DAPC groups with samples colored by some specific variable. Perhaps Thibaut will be able to chime in. If I'm right, this is something we could think about in the upcoming releases. >> >> In the mean time, you can construct your own plot, taking bits and pieces from https://github.com/thibautjombart/adegenet/blob/master/R/dapc.R#L539 >> >> >> >> Cheers, >> Roman >> >> ---- >> In god we trust, all others bring data. >>> Zahtevaj IJZ na https://kurc.biolitika.si >> >> >> From: "Lucas Veiga" >> To: "Roman Lu?trik" >> Cc: adegenet-forum at lists.r-forge.r-project.org >> Sent: Thursday, October 12, 2017 2:03:35 PM >> Subject: Re: [adegenet-forum] Dots in the DAPC graphic >> >> Dear Roman, >> First, thank you for the help. Unfortunaly, apparently your command not worked for me. I will try explain better my situation. I work with phytopathology and the fungus that I work affects different crops (I have put in my input file .csv the crops as my populations, different crops are different populations). Due the migration of genotypes of the fungus between the crops, inside of one group formed by DAPC there are genotypes obtained of different crops (populations) and for better viewing of this migration I want to plot the dots according of the hosts and not according of the groups formed by DAPC analysis. So, inside of one group there will are dots of different colors. >> I hope have explain better my situation and that you can help me. >> >> Best regards, >> Lucas Veiga Ayres pimenta >> >> >> Em Quinta-feira, 12 de Outubro de 2017 5:49, Roman Lu?trik escreveu: >> >> >> Map `grp` argument to your desired grouping. Make sure that you pass `col` the correct number of colors which should match the number of groups you are specifying. >> By default, coloring is done on grouping ( see here ). See this example: >> >> library(adegenet) >> >> data(H3N2) >> pop(H3N2) <- factor(H3N2$other$epid) >> dapc1 <- dapc(H3N2, var.contrib=FALSE, scale=FALSE, n.pca=150, n.da=5) >> >> data.frame(dapc1$grp, pop(H3N2)) # they are matching >> >> Cheers, >> Roman >> >> >> >> ---- >> In god we trust, all others bring data. >>> Zahtevaj IJZ na https://kurc.biolitika.si >> >> >> From: "Lucas Veiga" >> To: adegenet-forum at lists.r-forge.r-project.org >> Sent: Thursday, October 12, 2017 1:34:19 AM >> Subject: [adegenet-forum] Dots in the DAPC graphic >> >> Dear all, >> I would like to know what I can do for the dots in DAPC graph to be colored according to the populations and not according to the DAPC analysis groups? >> >> Best regards, >> Lucas Veiga Ayres Pimenta >> >> _______________________________________________ >> 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 >> >> >> >> -------------- next part -------------- >> An HTML attachment was scrubbed... >> URL: >> >> ------------------------------ >> >> _______________________________________________ >> 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 >> >> End of adegenet-forum Digest, Vol 110, Issue 11 >> *********************************************** > > _______________________________________________ > 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 > -------------- next part -------------- An HTML attachment was scrubbed... URL: From shannon.j.oleary at gmail.com Mon Oct 16 21:29:04 2017 From: shannon.j.oleary at gmail.com (Shannon O'Leary) Date: Mon, 16 Oct 2017 14:29:04 -0500 Subject: [adegenet-forum] Dots in the DAPC graphic (Lucas Veiga) Message-ID: Hi Lucas, Try this on for size: >From your description it looks like you have a data set for which you have the following information: SAMPLE-ID | POPULATION (CROP) | GENOTYPES you read in the genotypes as a genind object (gen) and your can read in your sample information as a dataframe containing Sample_ID and POP information (SampleInfo) You then ran k-means clustering/DAPC on your data set, something like this grp <- find.clusters.genind(gen, n.pca = 200, stat = "BIC", choose.n.clust = FALSE, criterion = "min", max.n.clust = 40) dapc <-dapc(gen, grp$grp, n.pca = 50, n.da = 2) You can pull the information on which sample was assigned to which cluster like so: clusters <- as.data.frame(grp$grp) %>% rownames_to_column("SAMPLE_ID") %>% rename(CLUSTER = `grp$grp`) You can add this information to your SampleInfo dataframe using dplyr::left_join() SampleInfo <- left_join(SampleInfo, clusters, by = "SAMPLE_ID") resulting in a dataframe with 3 columns: SAMPLE_ID | CROP | CLUSTER. Now you can pull the coordinates from the dapc and also add them to that data frame as well: DAPC_Ind <- as.data.frame(dapc$ind.coord) %>% rownames_to_column("SAMPLE_ID") SampleInfo <- left_join(SampleInfo, DAPC_Ind, by = "SAMPLE_ID") Now you have a data frame that should look something like this SAMPLE_ID | CROP | CLUSTER | LD1 | LD2 ... Now you can plot your data using ggplot and you can adjust the shape and color of your data points as you please, for example: ggplot(SampleInfo, aes(x = LD1, y = LD2), color = CROP, shape = CLUSTER) + geom_point() Is this what you are trying to achieve? You'll have to tweak the "code" I've thrown in here to fit your data (column names etc). Shannon ><(((j?> ><(((j?> ><(((j?> ><(((j?> ><(((j?> ><(((j?> ><(((j?> Shannon J. O'Leary Postdoctoral Research Associate Marine Genomics Lab Life Science Department Texas A&M Corpus Christi On Mon, Oct 16, 2017 at 12:11 PM, < adegenet-forum-request at lists.r-forge.r-project.org> wrote: > Send adegenet-forum mailing list submissions to > adegenet-forum at lists.r-forge.r-project.org > > To subscribe or unsubscribe via the World Wide Web, visit > https://lists.r-forge.r-project.org/cgi-bin/mailman/ > listinfo/adegenet-forum > > or, via email, send a message with subject or body 'help' to > adegenet-forum-request at lists.r-forge.r-project.org > > You can reach the person managing the list at > adegenet-forum-owner at lists.r-forge.r-project.org > > When replying, please edit your Subject line so it is more specific > than "Re: Contents of adegenet-forum digest..." > > > Today's Topics: > > 1. Re: Dots in the DAPC graphic (Lucas Veiga) > > > ---------------------------------------------------------------------- > > Message: 1 > Date: Mon, 16 Oct 2017 17:10:49 +0000 (UTC) > From: Lucas Veiga > To: Zhian Kamvar , > "adegenet-forum at lists.r-forge.r-project.org" > > Subject: Re: [adegenet-forum] Dots in the DAPC graphic > Message-ID: <1729769391.894921.1508173849615 at mail.yahoo.com> > Content-Type: text/plain; charset="utf-8" > > Dear All (Kamvar, Jombart and Roman),First, I would like to thank you all > for spending a little of your time on my problem. Unfortunely, it was not > possible to do what I want with commands that you showed me. I think that I > will have to write very? carefully my work to explain my groups and my dots > (haployd individuals) inside of the groups formed by DAPC analysis.?Obs: > Kamvar, your command is very useful, but it was not possible to have dots > with different colors or forms inside of the same group. > > Best regards,Lucas Veiga Ayres Pimenta > > Em Sexta-feira, 13 de Outubro de 2017 12:48, Zhian Kamvar < > zkamvar at gmail.com> escreveu: > > > Hi, > The individual coordinates are in the @ind.coord slot of the DAPC object. > You can use those to plot and color them with your desired population > factor. > I have recently come up with a ggplot2 solution for this:? > https://github.com/everhartlab/sclerotinia-366/ > blame/v1.0/results/by-year.md#L508-L558, the results of which look like > so:?https://github.com/everhartlab/sclerotinia-366/ > blob/v1.0/results/figures/by-year/dapc_plot-2.png > Hope that helps,Zhian > -----Zhian N. Kamvar, Ph. D.Postdoctoral Researcher (Everhart > Lab)Department of Plant PathologyUniversity of Nebraska-LincolnORCID:?0000- > 0003-1458-7108 > > > > > On Oct 13, 2017, at 03:39 , adegenet-forum-request at lists. > r-forge.r-project.org wrote: > Send adegenet-forum mailing list submissions to > adegenet-forum at lists.r-forge.r-project.org > > To subscribe or unsubscribe via the World Wide Web, visit > https://lists.r-forge.r-project.org/cgi-bin/mailman/ > listinfo/adegenet-forum > > or, via email, send a message with subject or body 'help' to > adegenet-forum-request at lists.r-forge.r-project.org > > You can reach the person managing the list at > adegenet-forum-owner at lists.r-forge.r-project.org > > When replying, please edit your Subject line so it is more specific > than "Re: Contents of adegenet-forum digest..." > > > Today's Topics: > > ??1. Re: Dots in the DAPC graphic (Lucas Veiga) > ??2. Re: Dots in the DAPC graphic (Lucas Veiga) > ??3. Re: Dots in the DAPC graphic (Roman Lu?trik) > > > ---------------------------------------------------------------------- > > Message: 1 > Date: Thu, 12 Oct 2017 12:03:35 +0000 (UTC) > From: Lucas Veiga > To: Roman Lu?trik > Cc: "adegenet-forum at lists.r-forge.r-project.org" > > Subject: Re: [adegenet-forum] Dots in the DAPC graphic > Message-ID: <1994389766.433362.1507809815326 at mail.yahoo.com> > Content-Type: text/plain; charset="utf-8" > > Dear Roman,First, thank you for the help. Unfortunaly, apparently your > command not worked for me. I will try explain better my situation. I work > with phytopathology and the fungus that I work affects different crops (I > have put in my input file .csv the crops as my populations, different crops > are different populations). Due the migration of genotypes of the fungus > between the crops, inside of one group formed by DAPC there are genotypes > obtained of different crops (populations) and for better viewing of this > migration I want to plot the dots according of the hosts and not according > of the groups formed by DAPC analysis. So, inside of one group there will > are dots of different colors.?I hope have explain better my situation and > that you can help me. > Best regards,Lucas Veiga Ayres pimenta > > ???Em Quinta-feira, 12 de Outubro de 2017 5:49, Roman Lu?trik < > roman.lustrik at biolitika.si> escreveu: > > > Map `grp` argument to your desired grouping. Make sure that you pass > `col` the correct number of colors which should match the number of groups > you are specifying. > By default, coloring is done on grouping (see here). See this example: > library(adegenet) > > data(H3N2) > pop(H3N2) <- factor(H3N2$other$epid) > dapc1 <- dapc(H3N2, var.contrib=FALSE, scale=FALSE, n.pca=150, n.da=5) > > data.frame(dapc1$grp, pop(H3N2)) # they are matching > > Cheers,Roman > > > ---- > In god we trust, all others bring data. > > Zahtevaj IJZ na https://kurc.biolitika.si > > From: "Lucas Veiga" > To: adegenet-forum at lists.r-forge.r-project.org > Sent: Thursday, October 12, 2017 1:34:19 AM > Subject: [adegenet-forum] Dots in the DAPC graphic > > Dear all,I would like to know what I can do for the dots in DAPC graph to > be colored according to the populations and not according to the DAPC > analysis groups? > > Best regards, > Lucas Veiga Ayres Pimenta > _______________________________________________ > 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 > > > > -------------- next part -------------- > An HTML attachment was scrubbed... > URL: adegenet-forum/attachments/20171012/c5b29746/attachment-0001.html> > > ------------------------------ > > Message: 2 > Date: Thu, 12 Oct 2017 12:10:28 +0000 (UTC) > From: Lucas Veiga > To: Roman Lu?trik > Cc: "adegenet-forum at lists.r-forge.r-project.org" > > Subject: Re: [adegenet-forum] Dots in the DAPC graphic > Message-ID: <342879047.415645.1507810228644 at mail.yahoo.com> > Content-Type: text/plain; charset="utf-8" > > Dear Roman,First, thank you for the help. Unfortunaly, apparently your > command not worked for me. I will try explain better my situation. I work > with phytopathology and the fungus that I work affects different crops (I > have put in my input file .csv the crops as my populations, different crops > are different populations). Due the migration of genotypes of the fungus > between the crops, inside of one group formed by DAPC there are genotypes > obtained of different crops (populations) and for better viewing of this > migration I want to plot the dots according to the hosts and not according > to the groups formed by DAPC analysis. So, inside of one group there will > are dots of different colors.?I hope I have explained better my situation > and that you can help me. > Best regards,Lucas Veiga Ayres pimenta > > ???Em Quinta-feira, 12 de Outubro de 2017 9:03, Lucas Veiga < > lucasfip at yahoo.com.br> escreveu: > > > Dear Roman,First, thank you for the help. Unfortunaly, apparently your > command not worked for me. I will try explain better my situation. I work > with phytopathology and the fungus that I work affects different crops (I > have put in my input file .csv the crops as my populations, different crops > are different populations). Due the migration of genotypes of the fungus > between the crops, inside of one group formed by DAPC there are genotypes > obtained of different crops (populations) and for better viewing of this > migration I want to plot the dots according of the hosts and not according > of the groups formed by DAPC analysis. So, inside of one group there will > are dots of different colors.?I hope have explain better my situation and > that you can help me. > Best regards,Lucas Veiga Ayres pimenta > > ???Em Quinta-feira, 12 de Outubro de 2017 5:49, Roman Lu?trik < > roman.lustrik at biolitika.si> escreveu: > > > Map `grp` argument to your desired grouping. Make sure that you pass > `col` the correct number of colors which should match the number of groups > you are specifying. > By default, coloring is done on grouping (see here). See this example: > library(adegenet) > > data(H3N2) > pop(H3N2) <- factor(H3N2$other$epid) > dapc1 <- dapc(H3N2, var.contrib=FALSE, scale=FALSE, n.pca=150, n.da=5) > > data.frame(dapc1$grp, pop(H3N2)) # they are matching > > Cheers,Roman > > > ---- > In god we trust, all others bring data. > > Zahtevaj IJZ na https://kurc.biolitika.si > > From: "Lucas Veiga" > To: adegenet-forum at lists.r-forge.r-project.org > Sent: Thursday, October 12, 2017 1:34:19 AM > Subject: [adegenet-forum] Dots in the DAPC graphic > > Dear all,I would like to know what I can do for the dots in DAPC graph to > be colored according to the populations and not according to the DAPC > analysis groups? > > Best regards, > Lucas Veiga Ayres Pimenta > _______________________________________________ > 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 > > > > > > -------------- next part -------------- > An HTML attachment was scrubbed... > URL: adegenet-forum/attachments/20171012/32d4d4d6/attachment-0001.html> > > ------------------------------ > > Message: 3 > Date: Fri, 13 Oct 2017 10:38:57 +0200 (CEST) > From: Roman Lu?trik > To: Lucas Veiga > Cc: adegenet-forum at lists.r-forge.r-project.org > Subject: Re: [adegenet-forum] Dots in the DAPC graphic > Message-ID: > <181441774.286421.1507883937636.JavaMail.zimbra at biolitika.si> > Content-Type: text/plain; charset="utf-8" > > A-ha, I think I see where you're getting at. Right now I'm not sure it's > possible to have DAPC groups with samples colored by some specific > variable. Perhaps Thibaut will be able to chime in. If I'm right, this is > something we could think about in the upcoming releases. > > In the mean time, you can construct your own plot, taking bits and pieces > from https://github.com/thibautjombart/adegenet/blob/master/R/dapc.R#L539 > > > > Cheers, > Roman > > ---- > In god we trust, all others bring data. > > Zahtevaj IJZ na https://kurc.biolitika.si > > > > From: "Lucas Veiga" > To: "Roman Lu?trik" > Cc: adegenet-forum at lists.r-forge.r-project.org > Sent: Thursday, October 12, 2017 2:03:35 PM > Subject: Re: [adegenet-forum] Dots in the DAPC graphic > > Dear Roman, > First, thank you for the help. Unfortunaly, apparently your command not > worked for me. I will try explain better my situation. I work with > phytopathology and the fungus that I work affects different crops (I have > put in my input file .csv the crops as my populations, different crops are > different populations). Due the migration of genotypes of the fungus > between the crops, inside of one group formed by DAPC there are genotypes > obtained of different crops (populations) and for better viewing of this > migration I want to plot the dots according of the hosts and not according > of the groups formed by DAPC analysis. So, inside of one group there will > are dots of different colors. > I hope have explain better my situation and that you can help me. > > Best regards, > Lucas Veiga Ayres pimenta > > > Em Quinta-feira, 12 de Outubro de 2017 5:49, Roman Lu?trik < > roman.lustrik at biolitika.si> escreveu: > > > Map `grp` argument to your desired grouping. Make sure that you pass `col` > the correct number of colors which should match the number of groups you > are specifying. > By default, coloring is done on grouping ( see here ). See this example: > > library(adegenet) > > data(H3N2) > pop(H3N2) <- factor(H3N2$other$epid) > dapc1 <- dapc(H3N2, var.contrib=FALSE, scale=FALSE, n.pca=150, n.da=5) > > data.frame(dapc1$grp, pop(H3N2)) # they are matching > > Cheers, > Roman > > > > ---- > In god we trust, all others bring data. > > Zahtevaj IJZ na https://kurc.biolitika.si > > > > From: "Lucas Veiga" > To: adegenet-forum at lists.r-forge.r-project.org > Sent: Thursday, October 12, 2017 1:34:19 AM > Subject: [adegenet-forum] Dots in the DAPC graphic > > Dear all, > I would like to know what I can do for the dots in DAPC graph to be > colored according to the populations and not according to the DAPC analysis > groups? > > Best regards, > Lucas Veiga Ayres Pimenta > > _______________________________________________ > 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 > > > > -------------- next part -------------- > An HTML attachment was scrubbed... > URL: adegenet-forum/attachments/20171013/aedaf8eb/attachment.html> > > ------------------------------ > > _______________________________________________ > 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 > > End of adegenet-forum Digest, Vol 110, Issue 11 > *********************************************** > > > _______________________________________________ > 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 > > > -------------- next part -------------- > An HTML attachment was scrubbed... > URL: adegenet-forum/attachments/20171016/4437dedc/attachment.html> > > ------------------------------ > > _______________________________________________ > 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 > > End of adegenet-forum Digest, Vol 110, Issue 13 > *********************************************** > -------------- next part -------------- An HTML attachment was scrubbed... URL: From lucasfip at yahoo.com.br Thu Oct 19 01:54:58 2017 From: lucasfip at yahoo.com.br (Lucas Veiga) Date: Wed, 18 Oct 2017 23:54:58 +0000 (UTC) Subject: [adegenet-forum] Dots in the DAPC graphic (Lucas Veiga) In-Reply-To: <1070780090.500563.1508353627696@mail.yahoo.com> References: <1070780090.500563.1508353627696@mail.yahoo.com> Message-ID: <1027832374.705372.1508370898452@mail.yahoo.com> Dear all, Good news!! I did it making a little change in the s.class command. Oliver, your tip helped me a lot. Thanks all. Best regards, Lucas Veiga Ayres Pimenta | | Livre de v?rus. www.avg.com. | Em Ter?a-feira, 17 de Outubro de 2017 8:23, Shannon O'Leary escreveu: Hi Lucas, Try this on for size:? >From your description it looks like you have a data set for which you have the following information: SAMPLE-ID | POPULATION (CROP) | GENOTYPES you read in the genotypes as a genind object (gen) and your can read in your sample information as a dataframe containing Sample_ID and POP information (SampleInfo) You then ran k-means clustering/DAPC on your data set, something like this grp <- find.clusters.genind(gen, n.pca = 200,? ? ? ? ? ? ? ? ? ? ? ? ? ? stat = "BIC", choose.n.clust = FALSE, criterion = "min",? ? ? ? ? ? ? ? ? ? ? ? ? ? max.n.clust = 40) dapc <-dapc(gen, grp$grp, n.pca = 50, n.da = 2) You can pull the information on which sample was assigned to which cluster like so: clusters <- as.data.frame(grp$grp) %>%? rownames_to_column("SAMPLE_ID") %>%? rename(CLUSTER = `grp$grp`) You can add this information to your SampleInfo dataframe using dplyr::left_join() SampleInfo <- left_join(SampleInfo, clusters, by = "SAMPLE_ID") resulting in a dataframe with 3 columns: SAMPLE_ID | CROP | CLUSTER. Now you can pull the coordinates from the dapc and also add them to that data frame as well: DAPC_Ind <- as.data.frame(dapc$ind.coord) %>%? rownames_to_column("SAMPLE_ID") SampleInfo <- left_join(SampleInfo, DAPC_Ind, by = "SAMPLE_ID") Now you have a data frame that should look something like this SAMPLE_ID | CROP | CLUSTER | LD1 | LD2 ... Now you can plot your data using ggplot and you can adjust the shape and color of your data points as you please, for example: ggplot(SampleInfo, aes(x = LD1, y = LD2), color = CROP, shape = CLUSTER) +geom_point() Is this what you are trying to achieve? You'll have to tweak the "code" I've thrown in here to fit your data (column names etc). Shannon ><(((j?> ??><(((j?> ?><(((j?> ??><(((j?> ??><(((j?> ?><(((j?> ??><(((j?>? Shannon J. O'Leary Postdoctoral Research AssociateMarine Genomics LabLife Science DepartmentTexas A&M Corpus Christi On Mon, Oct 16, 2017 at 12:11 PM, wrote: Send adegenet-forum mailing list submissions to ? ? ? ? adegenet-forum at lists.r-forge. r-project.org To subscribe or unsubscribe via the World Wide Web, visit ? ? ? ? https://lists.r-forge.r- project.org/cgi-bin/mailman/ listinfo/adegenet-forum or, via email, send a message with subject or body 'help' to ? ? ? ? adegenet-forum-request at lists. r-forge.r-project.org You can reach the person managing the list at ? ? ? ? adegenet-forum-owner at lists.r- forge.r-project.org When replying, please edit your Subject line so it is more specific than "Re: Contents of adegenet-forum digest..." Today's Topics: ? ?1. Re: Dots in the DAPC graphic (Lucas Veiga) ------------------------------ ------------------------------ ---------- Message: 1 Date: Mon, 16 Oct 2017 17:10:49 +0000 (UTC) From: Lucas Veiga To: Zhian Kamvar , ? ? ? ? "adegenet-forum at lists.r-forge. r-project.org" ? ? ? ? Subject: Re: [adegenet-forum] Dots in the DAPC graphic Message-ID: <1729769391.894921. 1508173849615 at mail.yahoo.com> Content-Type: text/plain; charset="utf-8" Dear All (Kamvar, Jombart and Roman),First, I would like to thank you all for spending a little of your time on my problem. Unfortunely, it was not possible to do what I want with commands that you showed me. I think that I will have to write very? carefully my work to explain my groups and my dots (haployd individuals) inside of the groups formed by DAPC analysis.?Obs: Kamvar, your command is very useful, but it was not possible to have dots with different colors or forms inside of the same group. Best regards,Lucas Veiga Ayres Pimenta ? ? Em Sexta-feira, 13 de Outubro de 2017 12:48, Zhian Kamvar escreveu: ?Hi, The individual coordinates are in the @ind.coord slot of the DAPC object. You can use those to plot and color them with your desired population factor. I have recently come up with a ggplot2 solution for this:?https://github.com/ everhartlab/sclerotinia-366/ blame/v1.0/results/by-year.md# L508-L558, the results of which look like so:?https://github.com/ everhartlab/sclerotinia-366/ blob/v1.0/results/figures/by- year/dapc_plot-2.png Hope that helps,Zhian -----Zhian N. Kamvar, Ph. D.Postdoctoral Researcher (Everhart Lab)Department of Plant PathologyUniversity of Nebraska-LincolnORCID:?0000- 0003-1458-7108 On Oct 13, 2017, at 03:39 , adegenet-forum-request at lists. r-forge.r-project.org wrote: Send adegenet-forum mailing list submissions to ?adegenet-forum at lists.r-forge. r-project.org To subscribe or unsubscribe via the World Wide Web, visit ?https://lists.r-forge.r- project.org/cgi-bin/mailman/ listinfo/adegenet-forum or, via email, send a message with subject or body 'help' to ?adegenet-forum-request at lists. r-forge.r-project.org You can reach the person managing the list at ?adegenet-forum-owner at lists.r- forge.r-project.org When replying, please edit your Subject line so it is more specific than "Re: Contents of adegenet-forum digest..." Today's Topics: ???1. Re: Dots in the DAPC graphic (Lucas Veiga) ???2. Re: Dots in the DAPC graphic (Lucas Veiga) ???3. Re: Dots in the DAPC graphic (Roman Lu?trik) ------------------------------ ------------------------------ ---------- Message: 1 Date: Thu, 12 Oct 2017 12:03:35 +0000 (UTC) From: Lucas Veiga To: Roman Lu?trik Cc: "adegenet-forum at lists.r-forge. r-project.org" ? Subject: Re: [adegenet-forum] Dots in the DAPC graphic Message-ID: <1994389766.433362. 1507809815326 at mail.yahoo.com> Content-Type: text/plain; charset="utf-8" Dear Roman,First, thank you for the help. Unfortunaly, apparently your command not worked for me. I will try explain better my situation. I work with phytopathology and the fungus that I work affects different crops (I have put in my input file .csv the crops as my populations, different crops are different populations). Due the migration of genotypes of the fungus between the crops, inside of one group formed by DAPC there are genotypes obtained of different crops (populations) and for better viewing of this migration I want to plot the dots according of the hosts and not according of the groups formed by DAPC analysis. So, inside of one group there will are dots of different colors.?I hope have explain better my situation and that you can help me. Best regards,Lucas Veiga Ayres pimenta ????Em Quinta-feira, 12 de Outubro de 2017 5:49, Roman Lu?trik escreveu: ?Map `grp` argument to your desired grouping. Make sure that you pass `col` the correct number of colors which should match the number of groups you are specifying. By default, coloring is done on grouping (see here). See this example: library(adegenet) data(H3N2) pop(H3N2) <- factor(H3N2$other$epid) dapc1 <- dapc(H3N2, var.contrib=FALSE, scale=FALSE, n.pca=150, n.da=5) data.frame(dapc1$grp, pop(H3N2)) # they are matching Cheers,Roman ---- In god we trust, all others bring data. Zahtevaj IJZ na https://kurc.biolitika.si From: "Lucas Veiga" To: adegenet-forum at lists.r-forge. r-project.org Sent: Thursday, October 12, 2017 1:34:19 AM Subject: [adegenet-forum] Dots in the DAPC graphic Dear all,I would like to know what I can do for the dots in DAPC graph to be colored according to the populations and not according to the DAPC analysis groups? Best regards, Lucas Veiga Ayres Pimenta ______________________________ _________________ 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 -------------- next part -------------- An HTML attachment was scrubbed... URL: ------------------------------ Message: 2 Date: Thu, 12 Oct 2017 12:10:28 +0000 (UTC) From: Lucas Veiga To: Roman Lu?trik Cc: "adegenet-forum at lists.r-forge. r-project.org" ? Subject: Re: [adegenet-forum] Dots in the DAPC graphic Message-ID: <342879047.415645. 1507810228644 at mail.yahoo.com> Content-Type: text/plain; charset="utf-8" Dear Roman,First, thank you for the help. Unfortunaly, apparently your command not worked for me. I will try explain better my situation. I work with phytopathology and the fungus that I work affects different crops (I have put in my input file .csv the crops as my populations, different crops are different populations). Due the migration of genotypes of the fungus between the crops, inside of one group formed by DAPC there are genotypes obtained of different crops (populations) and for better viewing of this migration I want to plot the dots according to the hosts and not according to the groups formed by DAPC analysis. So, inside of one group there will are dots of different colors.?I hope I have explained better my situation and that you can help me. Best regards,Lucas Veiga Ayres pimenta ????Em Quinta-feira, 12 de Outubro de 2017 9:03, Lucas Veiga escreveu: ?Dear Roman,First, thank you for the help. Unfortunaly, apparently your command not worked for me. I will try explain better my situation. I work with phytopathology and the fungus that I work affects different crops (I have put in my input file .csv the crops as my populations, different crops are different populations). Due the migration of genotypes of the fungus between the crops, inside of one group formed by DAPC there are genotypes obtained of different crops (populations) and for better viewing of this migration I want to plot the dots according of the hosts and not according of the groups formed by DAPC analysis. So, inside of one group there will are dots of different colors.?I hope have explain better my situation and that you can help me. Best regards,Lucas Veiga Ayres pimenta ????Em Quinta-feira, 12 de Outubro de 2017 5:49, Roman Lu?trik escreveu: ?Map `grp` argument to your desired grouping. Make sure that you pass `col` the correct number of colors which should match the number of groups you are specifying. By default, coloring is done on grouping (see here). See this example: library(adegenet) data(H3N2) pop(H3N2) <- factor(H3N2$other$epid) dapc1 <- dapc(H3N2, var.contrib=FALSE, scale=FALSE, n.pca=150, n.da=5) data.frame(dapc1$grp, pop(H3N2)) # they are matching Cheers,Roman ---- In god we trust, all others bring data. Zahtevaj IJZ na https://kurc.biolitika.si From: "Lucas Veiga" To: adegenet-forum at lists.r-forge. r-project.org Sent: Thursday, October 12, 2017 1:34:19 AM Subject: [adegenet-forum] Dots in the DAPC graphic Dear all,I would like to know what I can do for the dots in DAPC graph to be colored according to the populations and not according to the DAPC analysis groups? Best regards, Lucas Veiga Ayres Pimenta ______________________________ _________________ 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 -------------- next part -------------- An HTML attachment was scrubbed... URL: ------------------------------ Message: 3 Date: Fri, 13 Oct 2017 10:38:57 +0200 (CEST) From: Roman Lu?trik To: Lucas Veiga Cc: adegenet-forum at lists.r-forge. r-project.org Subject: Re: [adegenet-forum] Dots in the DAPC graphic Message-ID: ?<181441774.286421. 1507883937636.JavaMail.zimbra@ biolitika.si> Content-Type: text/plain; charset="utf-8" A-ha, I think I see where you're getting at. Right now I'm not sure it's possible to have DAPC groups with samples colored by some specific variable. Perhaps Thibaut will be able to chime in. If I'm right, this is something we could think about in the upcoming releases. In the mean time, you can construct your own plot, taking bits and pieces from https://github.com/ thibautjombart/adegenet/blob/ master/R/dapc.R#L539 Cheers, Roman ---- In god we trust, all others bring data. Zahtevaj IJZ na https://kurc.biolitika.si From: "Lucas Veiga" To: "Roman Lu?trik" Cc: adegenet-forum at lists.r-forge. r-project.org Sent: Thursday, October 12, 2017 2:03:35 PM Subject: Re: [adegenet-forum] Dots in the DAPC graphic Dear Roman, First, thank you for the help. Unfortunaly, apparently your command not worked for me. I will try explain better my situation. I work with phytopathology and the fungus that I work affects different crops (I have put in my input file .csv the crops as my populations, different crops are different populations). Due the migration of genotypes of the fungus between the crops, inside of one group formed by DAPC there are genotypes obtained of different crops (populations) and for better viewing of this migration I want to plot the dots according of the hosts and not according of the groups formed by DAPC analysis. So, inside of one group there will are dots of different colors. I hope have explain better my situation and that you can help me. Best regards, Lucas Veiga Ayres pimenta Em Quinta-feira, 12 de Outubro de 2017 5:49, Roman Lu?trik escreveu: Map `grp` argument to your desired grouping. Make sure that you pass `col` the correct number of colors which should match the number of groups you are specifying. By default, coloring is done on grouping ( see here ). See this example: library(adegenet) data(H3N2) pop(H3N2) <- factor(H3N2$other$epid) dapc1 <- dapc(H3N2, var.contrib=FALSE, scale=FALSE, n.pca=150, n.da=5) data.frame(dapc1$grp, pop(H3N2)) # they are matching Cheers, Roman ---- In god we trust, all others bring data. Zahtevaj IJZ na https://kurc.biolitika.si From: "Lucas Veiga" To: adegenet-forum at lists.r-forge. r-project.org Sent: Thursday, October 12, 2017 1:34:19 AM Subject: [adegenet-forum] Dots in the DAPC graphic Dear all, I would like to know what I can do for the dots in DAPC graph to be colored according to the populations and not according to the DAPC analysis groups? Best regards, Lucas Veiga Ayres Pimenta ______________________________ _________________ 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 -------------- next part -------------- An HTML attachment was scrubbed... URL: ------------------------------ ______________________________ _________________ 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 End of adegenet-forum Digest, Vol 110, Issue 11 ****************************** ***************** ______________________________ _________________ 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 -------------- next part -------------- An HTML attachment was scrubbed... URL: ------------------------------ ______________________________ _________________ 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 End of adegenet-forum Digest, Vol 110, Issue 13 ****************************** ***************** _______________________________________________ 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 -------------- next part -------------- An HTML attachment was scrubbed... URL: From Oliver.Berry at csiro.au Thu Oct 19 02:39:39 2017 From: Oliver.Berry at csiro.au (Oliver.Berry at csiro.au) Date: Thu, 19 Oct 2017 00:39:39 +0000 Subject: [adegenet-forum] Dots in the DAPC graphic (Lucas Veiga) In-Reply-To: <1027832374.705372.1508370898452@mail.yahoo.com> References: <1070780090.500563.1508353627696@mail.yahoo.com> <1027832374.705372.1508370898452@mail.yahoo.com> Message-ID: Hi, That?s great news Lucas. I wonder whether you would mind posting a version of your solution so others can make use of it in the future? Cheers, Olly [28C2BBB154C648CDB6B4DCEDD3B0DD15] Oliver Berry Leader, Environomics Future Science Platform CSIRO National Collections and Marine Infrastructure Indian Ocean Marine Research Centre The University of Western Australia, M097, 35 Stirling Highway Crawley, W.A., 6009, Australia P: +61-8-9333-6584 F: +61-8-9333-6555 E: Oliver.Berry at csiro.au W: Environomics This e-mail message (and attachments) is confidential, and / or privileged and is intended for the use of the addressee only. If you are not the intended recipient of this e-mail you must not copy, distribute, take any action in reliance on it or disclose it to anyone. Any confidentiality or privilege is not waived or lost by reason of mistaken delivery to you. CSIRO is not responsible for any information not related to the business of CSIRO. If you have received this e-mail in error please destroy the original and notify the sender. From: Lucas Veiga [mailto:lucasfip at yahoo.com.br] Sent: Thursday, 19 October 2017 7:55 AM To: adegenet-forum at lists.r-forge.r-project.org; Berry, Olly (NCMI, IOMRC Crawley) Subject: Re: [adegenet-forum] Dots in the DAPC graphic (Lucas Veiga) Dear all, Good news!! I did it making a little change in the s.class command. Oliver, your tip helped me a lot. Thanks all. Best regards, Lucas Veiga Ayres Pimenta [https://ipmcdn.avast.com/images/icons/icon-envelope-tick-green-avg-v1.png] Livre de v?rus. www.avg.com. Em Ter?a-feira, 17 de Outubro de 2017 8:23, Shannon O'Leary > escreveu: Hi Lucas, Try this on for size: From your description it looks like you have a data set for which you have the following information: SAMPLE-ID | POPULATION (CROP) | GENOTYPES you read in the genotypes as a genind object (gen) and your can read in your sample information as a dataframe containing Sample_ID and POP information (SampleInfo) You then ran k-means clustering/DAPC on your data set, something like this grp <- find.clusters.genind(gen, n.pca = 200, stat = "BIC", choose.n.clust = FALSE, criterion = "min", max.n.clust = 40) dapc <-dapc(gen, grp$grp, n.pca = 50, n.da = 2) You can pull the information on which sample was assigned to which cluster like so: clusters <- as.data.frame(grp$grp) %>% rownames_to_column("SAMPLE_ID") %>% rename(CLUSTER = `grp$grp`) You can add this information to your SampleInfo dataframe using dplyr::left_join() SampleInfo <- left_join(SampleInfo, clusters, by = "SAMPLE_ID") resulting in a dataframe with 3 columns: SAMPLE_ID | CROP | CLUSTER. Now you can pull the coordinates from the dapc and also add them to that data frame as well: DAPC_Ind <- as.data.frame(dapc$ind.coord) %>% rownames_to_column("SAMPLE_ID") SampleInfo <- left_join(SampleInfo, DAPC_Ind, by = "SAMPLE_ID") Now you have a data frame that should look something like this SAMPLE_ID | CROP | CLUSTER | LD1 | LD2 ... Now you can plot your data using ggplot and you can adjust the shape and color of your data points as you please, for example: ggplot(SampleInfo, aes(x = LD1, y = LD2), color = CROP, shape = CLUSTER) + geom_point() Is this what you are trying to achieve? You'll have to tweak the "code" I've thrown in here to fit your data (column names etc). Shannon ><(((j?> ><(((j?> ><(((j?> ><(((j?> ><(((j?> ><(((j?> ><(((j?> Shannon J. O'Leary Postdoctoral Research Associate Marine Genomics Lab Life Science Department Texas A&M Corpus Christi On Mon, Oct 16, 2017 at 12:11 PM, > wrote: Send adegenet-forum mailing list submissions to adegenet-forum at lists.r-forge. r-project.org To subscribe or unsubscribe via the World Wide Web, visit https://lists.r-forge.r- project.org/cgi-bin/mailman/ listinfo/adegenet-forum or, via email, send a message with subject or body 'help' to adegenet-forum-request at lists. r-forge.r-project.org You can reach the person managing the list at adegenet-forum-owner at lists.r- forge.r-project.org When replying, please edit your Subject line so it is more specific than "Re: Contents of adegenet-forum digest..." Today's Topics: 1. Re: Dots in the DAPC graphic (Lucas Veiga) ------------------------------ ------------------------------ ---------- Message: 1 Date: Mon, 16 Oct 2017 17:10:49 +0000 (UTC) From: Lucas Veiga > To: Zhian Kamvar >, "adegenet-forum at lists.r-forge. r-project.org" > Subject: Re: [adegenet-forum] Dots in the DAPC graphic Message-ID: <1729769391.894921. 1508173849615 at mail.yahoo.com> Content-Type: text/plain; charset="utf-8" Dear All (Kamvar, Jombart and Roman),First, I would like to thank you all for spending a little of your time on my problem. Unfortunely, it was not possible to do what I want with commands that you showed me. I think that I will have to write very? carefully my work to explain my groups and my dots (haployd individuals) inside of the groups formed by DAPC analysis.?Obs: Kamvar, your command is very useful, but it was not possible to have dots with different colors or forms inside of the same group. Best regards,Lucas Veiga Ayres Pimenta Em Sexta-feira, 13 de Outubro de 2017 12:48, Zhian Kamvar > escreveu: Hi, The individual coordinates are in the @ind.coord slot of the DAPC object. You can use those to plot and color them with your desired population factor. I have recently come up with a ggplot2 solution for this:?https://github.com/ everhartlab/sclerotinia-366/ blame/v1.0/results/by-year.md# L508-L558, the results of which look like so:?https://github.com/ everhartlab/sclerotinia-366/ blob/v1.0/results/figures/by- year/dapc_plot-2.png Hope that helps,Zhian -----Zhian N. Kamvar, Ph. D.Postdoctoral Researcher (Everhart Lab)Department of Plant PathologyUniversity of Nebraska-LincolnORCID:?0000- 0003-1458-7108 On Oct 13, 2017, at 03:39 , adegenet-forum-request at lists. r-forge.r-project.org wrote: Send adegenet-forum mailing list submissions to adegenet-forum at lists.r-forge. r-project.org To subscribe or unsubscribe via the World Wide Web, visit https://lists.r-forge.r- project.org/cgi-bin/mailman/ listinfo/adegenet-forum or, via email, send a message with subject or body 'help' to adegenet-forum-request at lists. r-forge.r-project.org You can reach the person managing the list at adegenet-forum-owner at lists.r- forge.r-project.org When replying, please edit your Subject line so it is more specific than "Re: Contents of adegenet-forum digest..." Today's Topics: ??1. Re: Dots in the DAPC graphic (Lucas Veiga) ??2. Re: Dots in the DAPC graphic (Lucas Veiga) ??3. Re: Dots in the DAPC graphic (Roman Lu?trik) ------------------------------ ------------------------------ ---------- Message: 1 Date: Thu, 12 Oct 2017 12:03:35 +0000 (UTC) From: Lucas Veiga > To: Roman Lu?trik > Cc: "adegenet-forum at lists.r-forge. r-project.org" > Subject: Re: [adegenet-forum] Dots in the DAPC graphic Message-ID: <1994389766.433362. 1507809815326 at mail.yahoo.com> Content-Type: text/plain; charset="utf-8" Dear Roman,First, thank you for the help. Unfortunaly, apparently your command not worked for me. I will try explain better my situation. I work with phytopathology and the fungus that I work affects different crops (I have put in my input file .csv the crops as my populations, different crops are different populations). Due the migration of genotypes of the fungus between the crops, inside of one group formed by DAPC there are genotypes obtained of different crops (populations) and for better viewing of this migration I want to plot the dots according of the hosts and not according of the groups formed by DAPC analysis. So, inside of one group there will are dots of different colors.?I hope have explain better my situation and that you can help me. Best regards,Lucas Veiga Ayres pimenta ???Em Quinta-feira, 12 de Outubro de 2017 5:49, Roman Lu?trik > escreveu: Map `grp` argument to your desired grouping. Make sure that you pass `col` the correct number of colors which should match the number of groups you are specifying. By default, coloring is done on grouping (see here). See this example: library(adegenet) data(H3N2) pop(H3N2) <- factor(H3N2$other$epid) dapc1 <- dapc(H3N2, var.contrib=FALSE, scale=FALSE, n.pca=150, n.da=5) data.frame(dapc1$grp, pop(H3N2)) # they are matching Cheers,Roman ---- In god we trust, all others bring data. Zahtevaj IJZ na https://kurc.biolitika.si From: "Lucas Veiga" > To: adegenet-forum at lists.r-forge. r-project.org Sent: Thursday, October 12, 2017 1:34:19 AM Subject: [adegenet-forum] Dots in the DAPC graphic Dear all,I would like to know what I can do for the dots in DAPC graph to be colored according to the populations and not according to the DAPC analysis groups? Best regards, Lucas Veiga Ayres Pimenta ______________________________ _________________ 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 -------------- next part -------------- An HTML attachment was scrubbed... URL: > ------------------------------ Message: 2 Date: Thu, 12 Oct 2017 12:10:28 +0000 (UTC) From: Lucas Veiga > To: Roman Lu?trik > Cc: "adegenet-forum at lists.r-forge. r-project.org" > Subject: Re: [adegenet-forum] Dots in the DAPC graphic Message-ID: <342879047.415645. 1507810228644 at mail.yahoo.com> Content-Type: text/plain; charset="utf-8" Dear Roman,First, thank you for the help. Unfortunaly, apparently your command not worked for me. I will try explain better my situation. I work with phytopathology and the fungus that I work affects different crops (I have put in my input file .csv the crops as my populations, different crops are different populations). Due the migration of genotypes of the fungus between the crops, inside of one group formed by DAPC there are genotypes obtained of different crops (populations) and for better viewing of this migration I want to plot the dots according to the hosts and not according to the groups formed by DAPC analysis. So, inside of one group there will are dots of different colors.?I hope I have explained better my situation and that you can help me. Best regards,Lucas Veiga Ayres pimenta ???Em Quinta-feira, 12 de Outubro de 2017 9:03, Lucas Veiga > escreveu: Dear Roman,First, thank you for the help. Unfortunaly, apparently your command not worked for me. I will try explain better my situation. I work with phytopathology and the fungus that I work affects different crops (I have put in my input file .csv the crops as my populations, different crops are different populations). Due the migration of genotypes of the fungus between the crops, inside of one group formed by DAPC there are genotypes obtained of different crops (populations) and for better viewing of this migration I want to plot the dots according of the hosts and not according of the groups formed by DAPC analysis. So, inside of one group there will are dots of different colors.?I hope have explain better my situation and that you can help me. Best regards,Lucas Veiga Ayres pimenta ???Em Quinta-feira, 12 de Outubro de 2017 5:49, Roman Lu?trik > escreveu: Map `grp` argument to your desired grouping. Make sure that you pass `col` the correct number of colors which should match the number of groups you are specifying. By default, coloring is done on grouping (see here). See this example: library(adegenet) data(H3N2) pop(H3N2) <- factor(H3N2$other$epid) dapc1 <- dapc(H3N2, var.contrib=FALSE, scale=FALSE, n.pca=150, n.da=5) data.frame(dapc1$grp, pop(H3N2)) # they are matching Cheers,Roman ---- In god we trust, all others bring data. Zahtevaj IJZ na https://kurc.biolitika.si From: "Lucas Veiga" > To: adegenet-forum at lists.r-forge. r-project.org Sent: Thursday, October 12, 2017 1:34:19 AM Subject: [adegenet-forum] Dots in the DAPC graphic Dear all,I would like to know what I can do for the dots in DAPC graph to be colored according to the populations and not according to the DAPC analysis groups? Best regards, Lucas Veiga Ayres Pimenta ______________________________ _________________ 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 -------------- next part -------------- An HTML attachment was scrubbed... URL: > ------------------------------ Message: 3 Date: Fri, 13 Oct 2017 10:38:57 +0200 (CEST) From: Roman Lu?trik > To: Lucas Veiga > Cc: adegenet-forum at lists.r-forge. r-project.org Subject: Re: [adegenet-forum] Dots in the DAPC graphic Message-ID: <181441774.286421. 1507883937636.JavaMail.zimbra@ biolitika.si> Content-Type: text/plain; charset="utf-8" A-ha, I think I see where you're getting at. Right now I'm not sure it's possible to have DAPC groups with samples colored by some specific variable. Perhaps Thibaut will be able to chime in. If I'm right, this is something we could think about in the upcoming releases. In the mean time, you can construct your own plot, taking bits and pieces from https://github.com/ thibautjombart/adegenet/blob/ master/R/dapc.R#L539 Cheers, Roman ---- In god we trust, all others bring data. Zahtevaj IJZ na https://kurc.biolitika.si From: "Lucas Veiga" > To: "Roman Lu?trik" > Cc: adegenet-forum at lists.r-forge. r-project.org Sent: Thursday, October 12, 2017 2:03:35 PM Subject: Re: [adegenet-forum] Dots in the DAPC graphic Dear Roman, First, thank you for the help. Unfortunaly, apparently your command not worked for me. I will try explain better my situation. I work with phytopathology and the fungus that I work affects different crops (I have put in my input file .csv the crops as my populations, different crops are different populations). Due the migration of genotypes of the fungus between the crops, inside of one group formed by DAPC there are genotypes obtained of different crops (populations) and for better viewing of this migration I want to plot the dots according of the hosts and not according of the groups formed by DAPC analysis. So, inside of one group there will are dots of different colors. I hope have explain better my situation and that you can help me. Best regards, Lucas Veiga Ayres pimenta Em Quinta-feira, 12 de Outubro de 2017 5:49, Roman Lu?trik > escreveu: Map `grp` argument to your desired grouping. Make sure that you pass `col` the correct number of colors which should match the number of groups you are specifying. By default, coloring is done on grouping ( see here ). See this example: library(adegenet) data(H3N2) pop(H3N2) <- factor(H3N2$other$epid) dapc1 <- dapc(H3N2, var.contrib=FALSE, scale=FALSE, n.pca=150, n.da=5) data.frame(dapc1$grp, pop(H3N2)) # they are matching Cheers, Roman ---- In god we trust, all others bring data. Zahtevaj IJZ na https://kurc.biolitika.si From: "Lucas Veiga" > To: adegenet-forum at lists.r-forge. r-project.org Sent: Thursday, October 12, 2017 1:34:19 AM Subject: [adegenet-forum] Dots in the DAPC graphic Dear all, I would like to know what I can do for the dots in DAPC graph to be colored according to the populations and not according to the DAPC analysis groups? Best regards, Lucas Veiga Ayres Pimenta ______________________________ _________________ 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 -------------- next part -------------- An HTML attachment was scrubbed... URL: > ------------------------------ ______________________________ _________________ 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 End of adegenet-forum Digest, Vol 110, Issue 11 ****************************** ***************** ______________________________ _________________ 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 -------------- next part -------------- An HTML attachment was scrubbed... URL: > ------------------------------ ______________________________ _________________ 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 End of adegenet-forum Digest, Vol 110, Issue 13 ****************************** ***************** _______________________________________________ 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 -------------- next part -------------- An HTML attachment was scrubbed... URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: image001.jpg Type: image/jpeg Size: 810 bytes Desc: image001.jpg URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: image002.jpg Type: image/jpeg Size: 5458 bytes Desc: image002.jpg URL: From lucasfip at yahoo.com.br Tue Oct 24 14:39:55 2017 From: lucasfip at yahoo.com.br (Lucas Veiga) Date: Tue, 24 Oct 2017 12:39:55 +0000 (UTC) Subject: [adegenet-forum] Dots in the DAPC graphic (Lucas Veiga) In-Reply-To: References: <1070780090.500563.1508353627696@mail.yahoo.com> <1027832374.705372.1508370898452@mail.yahoo.com> Message-ID: <392221592.3614591.1508848796525@mail.yahoo.com> Oliver, sorry my delay. I solved my problem with this command: mycol = c("darkblue","black","red")#### s.class(dapc_cerato$ind.coord, pop(cerato), pch = 18, cstar=1, cellipse=0.95, cpoint=1, clabel = 0.6, grid=FALSE, xlim=NULL, ylim=NULL, origin = c(0,0), axesell=FALSE, addaxes=TRUE, col = mycol)####legend(xy.coords(x = c(-30,10), y = c(24,-10)), pch=19, cex=1.5, pt.cex=1.5,bty="n", levels(pop(cerato)), ncol=6, y.intersp=0.5, x.intersp=0.5, col= seasun(length(levels(dapc_cerato$grp)))) The result is in the attached file. Best regards, Lucas Veiga Ayres Pimenta Em Quarta-feira, 18 de Outubro de 2017 22:39, "Oliver.Berry at csiro.au" escreveu: #yiv0717832304 #yiv0717832304 -- _filtered #yiv0717832304 {font-family:Helvetica;panose-1:2 11 6 4 2 2 2 2 2 4;} _filtered #yiv0717832304 {panose-1:2 4 5 3 5 4 6 3 2 4;} _filtered #yiv0717832304 {font-family:Calibri;panose-1:2 15 5 2 2 2 4 3 2 4;} _filtered #yiv0717832304 {panose-1:2 11 5 2 2 2 2 2 2 4;}#yiv0717832304 #yiv0717832304 p.yiv0717832304MsoNormal, #yiv0717832304 li.yiv0717832304MsoNormal, #yiv0717832304 div.yiv0717832304MsoNormal {margin:0cm;margin-bottom:.0001pt;font-size:12.0pt;}#yiv0717832304 a:link, #yiv0717832304 span.yiv0717832304MsoHyperlink {color:blue;text-decoration:underline;}#yiv0717832304 a:visited, #yiv0717832304 span.yiv0717832304MsoHyperlinkFollowed {color:purple;text-decoration:underline;}#yiv0717832304 span.yiv0717832304EmailStyle17 {color:#1F497D;}#yiv0717832304 .yiv0717832304MsoChpDefault {font-size:10.0pt;} _filtered #yiv0717832304 {margin:72.0pt 72.0pt 72.0pt 72.0pt;}#yiv0717832304 div.yiv0717832304WordSection1 {}#yiv0717832304 Hi, ? That?s great news Lucas. ? I wonder whether you would mind posting a version of your solution so others can make use of it in the future? ? Cheers, ? Olly ? ? | | | | Oliver Berry Leader, Environomics Future Science Platform CSIRO National Collections and Marine Infrastructure Indian Ocean Marine Research Centre The University of Western Australia, M097, 35 Stirling Highway Crawley, W.A., 6009, Australia P: +61-8-9333-6584?F: +61-8-9333-6555?E:Oliver.Berry at csiro.au ??W: Environomics This e-mail message (and attachments) is confidential, and / or privileged and is intended for the use of the addressee only. If you are not the intended recipient of this e-mail you must not copy, distribute, take any action in reliance on it or disclose it to anyone. Any confidentiality or privilege is not waived or lost by reason of mistaken delivery to you. CSIRO is not?responsible for any information not related to the business of CSIRO. If you have received this e-mail in error please destroy the original and notify the sender. ? ? | ? ? ? ? From: Lucas Veiga [mailto:lucasfip at yahoo.com.br] Sent: Thursday, 19 October 2017 7:55 AM To: adegenet-forum at lists.r-forge.r-project.org; Berry, Olly (NCMI, IOMRC Crawley) Subject: Re: [adegenet-forum] Dots in the DAPC graphic (Lucas Veiga) ? Dear all, Good news!! I did it making a little change in the s.class command. Oliver, your tip helped me a lot. Thanks all. Best regards, Lucas Veiga Ayres Pimenta ? | | Livre de v?rus.www.avg.com. | Em Ter?a-feira, 17 de Outubro de 2017 8:23, Shannon O'Leary escreveu: ? Hi Lucas, ? Try this on for size:? ? From your description it looks like you have a data set for which you have the following information: ? SAMPLE-ID | POPULATION (CROP) | GENOTYPES ? you read in the genotypes as a genind object (gen) and your can read in your sample information as a dataframe containing Sample_ID and POP information (SampleInfo) ? You then ran k-means clustering/DAPC on your data set, something like this ? grp <- find.clusters.genind(gen, n.pca = 200, ? ? ? ? ? ? ? ? ? ? ? ? ? ? stat = "BIC", choose.n.clust = FALSE, criterion = "min", ? ? ? ? ? ? ? ? ? ? ? ? ? ? max.n.clust = 40) ? dapc <-dapc(gen, grp$grp, n.pca = 50, n.da = 2) ? You can pull the information on which sample was assigned to which cluster like so: ? clusters <- as.data.frame(grp$grp) %>% ? rownames_to_column("SAMPLE_ID") %>% ? rename(CLUSTER = `grp$grp`) ? You can add this information to your SampleInfo dataframe using dplyr::left_join() ? SampleInfo <- left_join(SampleInfo, clusters, by = "SAMPLE_ID") ? resulting in a dataframe with 3 columns: SAMPLE_ID | CROP | CLUSTER. ? Now you can pull the coordinates from the dapc and also add them to that data frame as well: ? DAPC_Ind <- as.data.frame(dapc$ind.coord) %>% ? rownames_to_column("SAMPLE_ID") ? SampleInfo <- left_join(SampleInfo, DAPC_Ind, by = "SAMPLE_ID") ? Now you have a data frame that should look something like this ? SAMPLE_ID | CROP | CLUSTER | LD1 | LD2 ... ? Now you can plot your data using ggplot and you can adjust the shape and color of your data points as you please, for example: ? ggplot(SampleInfo, aes(x = LD1, y = LD2), color = CROP, shape = CLUSTER) + geom_point() ? Is this what you are trying to achieve? You'll have to tweak the "code" I've thrown in here to fit your data (column names etc). ? ? Shannon ><(((j?> ??><(((j?> ?><(((j?> ??><(((j?> ??><(((j?> ?><(((j?> ??><(((j?>? ? Shannon J. O'Leary Postdoctoral Research Associate Marine Genomics Lab Life Science Department Texas A&M Corpus Christi ? On Mon, Oct 16, 2017 at 12:11 PM, wrote: Send adegenet-forum mailing list submissions to ? ? ? ? adegenet-forum at lists.r-forge. r-project.org To subscribe or unsubscribe via the World Wide Web, visit ? ? ? ? https://lists.r-forge.r- project.org/cgi-bin/mailman/ listinfo/adegenet-forum or, via email, send a message with subject or body 'help' to ? ? ? ? adegenet-forum-request at lists. r-forge.r-project.org You can reach the person managing the list at ? ? ? ? adegenet-forum-owner at lists.r- forge.r-project.org When replying, please edit your Subject line so it is more specific than "Re: Contents of adegenet-forum digest..." Today's Topics: ? ?1. Re: Dots in the DAPC graphic (Lucas Veiga) ------------------------------ ------------------------------ ---------- Message: 1 Date: Mon, 16 Oct 2017 17:10:49 +0000 (UTC) From: Lucas Veiga To: Zhian Kamvar , ? ? ? ? "adegenet-forum at lists.r-forge. r-project.org" ? ? ? ? Subject: Re: [adegenet-forum] Dots in the DAPC graphic Message-ID: <1729769391.894921. 1508173849615 at mail.yahoo.com> Content-Type: text/plain; charset="utf-8" Dear All (Kamvar, Jombart and Roman),First, I would like to thank you all for spending a little of your time on my problem. Unfortunely, it was not possible to do what I want with commands that you showed me. I think that I will have to write very? carefully my work to explain my groups and my dots (haployd individuals) inside of the groups formed by DAPC analysis.?Obs: Kamvar, your command is very useful, but it was not possible to have dots with different colors or forms inside of the same group. Best regards,Lucas Veiga Ayres Pimenta ? ? Em Sexta-feira, 13 de Outubro de 2017 12:48, Zhian Kamvar escreveu: ?Hi, The individual coordinates are in the @ind.coord slot of the DAPC object. You can use those to plot and color them with your desired population factor. I have recently come up with a ggplot2 solution for this:?https://github.com/ everhartlab/sclerotinia-366/ blame/v1.0/results/by-year.md# L508-L558, the results of which look like so:?https://github.com/ everhartlab/sclerotinia-366/ blob/v1.0/results/figures/by- year/dapc_plot-2.png Hope that helps,Zhian -----Zhian N. Kamvar, Ph. D.Postdoctoral Researcher (Everhart Lab)Department of Plant PathologyUniversity of Nebraska-LincolnORCID:?0000- 0003-1458-7108 On Oct 13, 2017, at 03:39 , adegenet-forum-request at lists. r-forge.r-project.org wrote: Send adegenet-forum mailing list submissions to ?adegenet-forum at lists.r-forge. r-project.org To subscribe or unsubscribe via the World Wide Web, visit ?https://lists.r-forge.r- project.org/cgi-bin/mailman/ listinfo/adegenet-forum or, via email, send a message with subject or body 'help' to ?adegenet-forum-request at lists. r-forge.r-project.org You can reach the person managing the list at ?adegenet-forum-owner at lists.r- forge.r-project.org When replying, please edit your Subject line so it is more specific than "Re: Contents of adegenet-forum digest..." Today's Topics: ???1. Re: Dots in the DAPC graphic (Lucas Veiga) ???2. Re: Dots in the DAPC graphic (Lucas Veiga) ???3. Re: Dots in the DAPC graphic (Roman Lu?trik) ------------------------------ ------------------------------ ---------- Message: 1 Date: Thu, 12 Oct 2017 12:03:35 +0000 (UTC) From: Lucas Veiga To: Roman Lu?trik Cc: "adegenet-forum at lists.r-forge. r-project.org" ? Subject: Re: [adegenet-forum] Dots in the DAPC graphic Message-ID: <1994389766.433362. 1507809815326 at mail.yahoo.com> Content-Type: text/plain; charset="utf-8" Dear Roman,First, thank you for the help. Unfortunaly, apparently your command not worked for me. I will try explain better my situation. I work with phytopathology and the fungus that I work affects different crops (I have put in my input file .csv the crops as my populations, different crops are different populations). Due the migration of genotypes of the fungus between the crops, inside of one group formed by DAPC there are genotypes obtained of different crops (populations) and for better viewing of this migration I want to plot the dots according of the hosts and not according of the groups formed by DAPC analysis. So, inside of one group there will are dots of different colors.?I hope have explain better my situation and that you can help me. Best regards,Lucas Veiga Ayres pimenta ????Em Quinta-feira, 12 de Outubro de 2017 5:49, Roman Lu?trik escreveu: ?Map `grp` argument to your desired grouping. Make sure that you pass `col` the correct number of colors which should match the number of groups you are specifying. By default, coloring is done on grouping (see here). See this example: library(adegenet) data(H3N2) pop(H3N2) <- factor(H3N2$other$epid) dapc1 <- dapc(H3N2, var.contrib=FALSE, scale=FALSE, n.pca=150, n.da=5) data.frame(dapc1$grp, pop(H3N2)) # they are matching Cheers,Roman ---- In god we trust, all others bring data. Zahtevaj IJZ na https://kurc.biolitika.si From: "Lucas Veiga" To: adegenet-forum at lists.r-forge. r-project.org Sent: Thursday, October 12, 2017 1:34:19 AM Subject: [adegenet-forum] Dots in the DAPC graphic Dear all,I would like to know what I can do for the dots in DAPC graph to be colored according to the populations and not according to the DAPC analysis groups? Best regards, Lucas Veiga Ayres Pimenta ______________________________ _________________ 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 -------------- next part -------------- An HTML attachment was scrubbed... URL: ------------------------------ Message: 2 Date: Thu, 12 Oct 2017 12:10:28 +0000 (UTC) From: Lucas Veiga To: Roman Lu?trik Cc: "adegenet-forum at lists.r-forge. r-project.org" ? Subject: Re: [adegenet-forum] Dots in the DAPC graphic Message-ID: <342879047.415645. 1507810228644 at mail.yahoo.com> Content-Type: text/plain; charset="utf-8" Dear Roman,First, thank you for the help. Unfortunaly, apparently your command not worked for me. I will try explain better my situation. I work with phytopathology and the fungus that I work affects different crops (I have put in my input file .csv the crops as my populations, different crops are different populations). Due the migration of genotypes of the fungus between the crops, inside of one group formed by DAPC there are genotypes obtained of different crops (populations) and for better viewing of this migration I want to plot the dots according to the hosts and not according to the groups formed by DAPC analysis. So, inside of one group there will are dots of different colors.?I hope I have explained better my situation and that you can help me. Best regards,Lucas Veiga Ayres pimenta ????Em Quinta-feira, 12 de Outubro de 2017 9:03, Lucas Veiga escreveu: ?Dear Roman,First, thank you for the help. Unfortunaly, apparently your command not worked for me. I will try explain better my situation. I work with phytopathology and the fungus that I work affects different crops (I have put in my input file .csv the crops as my populations, different crops are different populations). Due the migration of genotypes of the fungus between the crops, inside of one group formed by DAPC there are genotypes obtained of different crops (populations) and for better viewing of this migration I want to plot the dots according of the hosts and not according of the groups formed by DAPC analysis. So, inside of one group there will are dots of different colors.?I hope have explain better my situation and that you can help me. Best regards,Lucas Veiga Ayres pimenta ????Em Quinta-feira, 12 de Outubro de 2017 5:49, Roman Lu?trik escreveu: ?Map `grp` argument to your desired grouping. Make sure that you pass `col` the correct number of colors which should match the number of groups you are specifying. By default, coloring is done on grouping (see here). See this example: library(adegenet) data(H3N2) pop(H3N2) <- factor(H3N2$other$epid) dapc1 <- dapc(H3N2, var.contrib=FALSE, scale=FALSE, n.pca=150, n.da=5) data.frame(dapc1$grp, pop(H3N2)) # they are matching Cheers,Roman ---- In god we trust, all others bring data. Zahtevaj IJZ na https://kurc.biolitika.si From: "Lucas Veiga" To: adegenet-forum at lists.r-forge. r-project.org Sent: Thursday, October 12, 2017 1:34:19 AM Subject: [adegenet-forum] Dots in the DAPC graphic Dear all,I would like to know what I can do for the dots in DAPC graph to be colored according to the populations and not according to the DAPC analysis groups? Best regards, Lucas Veiga Ayres Pimenta ______________________________ _________________ 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 -------------- next part -------------- An HTML attachment was scrubbed... URL: ------------------------------ Message: 3 Date: Fri, 13 Oct 2017 10:38:57 +0200 (CEST) From: Roman Lu?trik To: Lucas Veiga Cc: adegenet-forum at lists.r-forge. r-project.org Subject: Re: [adegenet-forum] Dots in the DAPC graphic Message-ID: ?<181441774.286421. 1507883937636.JavaMail.zimbra@ biolitika.si> Content-Type: text/plain; charset="utf-8" A-ha, I think I see where you're getting at. Right now I'm not sure it's possible to have DAPC groups with samples colored by some specific variable. Perhaps Thibaut will be able to chime in. If I'm right, this is something we could think about in the upcoming releases. In the mean time, you can construct your own plot, taking bits and pieces from https://github.com/ thibautjombart/adegenet/blob/ master/R/dapc.R#L539 Cheers, Roman ---- In god we trust, all others bring data. Zahtevaj IJZ na https://kurc.biolitika.si From: "Lucas Veiga" To: "Roman Lu?trik" Cc: adegenet-forum at lists.r-forge. r-project.org Sent: Thursday, October 12, 2017 2:03:35 PM Subject: Re: [adegenet-forum] Dots in the DAPC graphic Dear Roman, First, thank you for the help. Unfortunaly, apparently your command not worked for me. I will try explain better my situation. I work with phytopathology and the fungus that I work affects different crops (I have put in my input file .csv the crops as my populations, different crops are different populations). Due the migration of genotypes of the fungus between the crops, inside of one group formed by DAPC there are genotypes obtained of different crops (populations) and for better viewing of this migration I want to plot the dots according of the hosts and not according of the groups formed by DAPC analysis. So, inside of one group there will are dots of different colors. I hope have explain better my situation and that you can help me. Best regards, Lucas Veiga Ayres pimenta Em Quinta-feira, 12 de Outubro de 2017 5:49, Roman Lu?trik escreveu: Map `grp` argument to your desired grouping. Make sure that you pass `col` the correct number of colors which should match the number of groups you are specifying. By default, coloring is done on grouping ( see here ). See this example: library(adegenet) data(H3N2) pop(H3N2) <- factor(H3N2$other$epid) dapc1 <- dapc(H3N2, var.contrib=FALSE, scale=FALSE, n.pca=150, n.da=5) data.frame(dapc1$grp, pop(H3N2)) # they are matching Cheers, Roman ---- In god we trust, all others bring data. Zahtevaj IJZ na https://kurc.biolitika.si From: "Lucas Veiga" To: adegenet-forum at lists.r-forge. r-project.org Sent: Thursday, October 12, 2017 1:34:19 AM Subject: [adegenet-forum] Dots in the DAPC graphic Dear all, I would like to know what I can do for the dots in DAPC graph to be colored according to the populations and not according to the DAPC analysis groups? Best regards, Lucas Veiga Ayres Pimenta ______________________________ _________________ 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 -------------- next part -------------- An HTML attachment was scrubbed... URL: ------------------------------ ______________________________ _________________ 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 End of adegenet-forum Digest, Vol 110, Issue 11 ****************************** ***************** ______________________________ _________________ 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 -------------- next part -------------- An HTML attachment was scrubbed... URL: ------------------------------ ______________________________ _________________ 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 End of adegenet-forum Digest, Vol 110, Issue 13 ****************************** ***************** ? _______________________________________________ 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 -------------- next part -------------- An HTML attachment was scrubbed... URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: image001.jpg Type: image/jpeg Size: 810 bytes Desc: not available URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: image002.jpg Type: image/jpeg Size: 5458 bytes Desc: not available URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: forum.tiff Type: image/tiff Size: 2656040 bytes Desc: not available URL: From walter.durka at ufz.de Fri Oct 27 11:10:35 2017 From: walter.durka at ufz.de (Walter Durka) Date: Fri, 27 Oct 2017 11:10:35 +0200 Subject: [adegenet-forum] s.class: how to avoid box around plotting area Message-ID: Hi, I use the standard plot command to display results of PCoA and s.class to add the stars and elypses; and I combine two plots for axes 1+2 and 1+3. However, s.class adds a box around the full plotting area, which? looks nasty, in particular as I combined two plots (see file attached). How can I avoid that s.class adds these boxes? regards Walter ####################################### pco1<-dudi.pco(d.dist,scannf=F,nf=6) ?par(mfrow=c(2,1), mar=c(2,4,2,2)+0.1,mgp=c(3,1,0)) ?par( mar=c(.5,4,2,2)+0.1) ? ## basic plot ?plot(pco1$tab[,1:2], col=myCol, cex=2, pch=myPch, xaxt='n',yaxt='n', ????? xlab=paste("PCoA1 (",format(PCO1_exV,digits=2),"%)",sep=""),ylab=paste("PCoA2 (",format(PCO2_exV,digits=2),"%)",sep=""), ????? mgp=c(1,.5,0)) ?mtext("A",3,at=min(pco1$tab[,1]) - (max(pco1$tab[,1])-min(pco1$tab[,1]))/9,cex=1.5,font=2) ?# groups ?s.class(pco1$tab[,1:3],xax=1,yax=2,fac =d.pop$pop,addaxes=T,col=popc, ???????? cpoint=0.5, grid=F, cstar=1,axesell=F, sub="",possub="topleft",add.plot=T) ?par( mar=c(2,4,.5,2)+0.1) ?plot(pco1$tab[,3]~pco1$tab[,1], col=myCol, cex=2, pch=myPch, xaxt='n',yaxt='n', ????? xlab=paste("PCoA1 (",format(PCO1_exV,digits=2),"%)",sep=""),ylab=paste("PCoA2 (",format(PCO2_exV,digits=2),"%)",sep=""), ????? mgp=c(1,.5,0)) ?mtext("B",3,at=min(pco1$tab[,1]) - (max(pco1$tab[,1])-min(pco1$tab[,1]))/9,cex=1.5,font=2) ?#? groups ?s.class(pco1$tab[,1:3],xax=1,yax=3,fac =d.pop$pop,addaxes=T,col=popc,#funky(9), ???????? cpoint=0.5, grid=F, cstar=1,axesell=F, sub="",possub="topleft",add.plot=T) ? #################################################### -- ***** Dr. Walter Durka Department Bioz?noseforschung Department of community ecology Helmholtz-Zentrum f?r Umweltforschung GmbH - UFZ Helmholtz Centre for Environmental Research - UFZ Theodor-Lieser-Str. 4 / 06120 Halle / Germany walter.durka at ufz.de / http://www.ufz.de/index.php?en=798 phone +49 345 558 5314 / Fax +49 345 558 5329 -------------------------------------------------------------------------------------------- Sitz der Gesellschaft: Leipzig Registergericht: Amtsgericht Leipzig Handelsregister Nr. B 4703 Vorsitzender des Aufsichtsrats: MinDirig Wilfried Kraus Wissenschaftlicher Gesch?ftsf?hrer: Prof. Dr. Georg Teutsch (Scientific Managing Director) Administrative Gesch?ftsf?hrerin: Dr. Heike Gra?mann (Administratve Managing Director) -------------------------------------------------------------------------------------------- -------------- next part -------------- A non-text attachment was scrubbed... Name: Rplot1.pdf Type: application/pdf Size: 45465 bytes Desc: not available URL: From apfuentes at Dal.Ca Mon Oct 30 16:24:08 2017 From: apfuentes at Dal.Ca (Angela Fuentes Pardo) Date: Mon, 30 Oct 2017 15:24:08 +0000 Subject: [adegenet-forum] Could adegenet be modified to accept allele frequencies as input data? Message-ID: Hi there, My dataset consists of allele frequencies of millions of SNPs for >10 populations (I don't have individual genotype data). adegenet requires individual genotypes as input data, but considering many population genetic tests are based on allele frequencies, I wanted to ask if there is any possibility that adegenet could have a function that accepts population allele frequencies as input data. I am mostly interested on conducting PCA and DAPC tests. Thanks -- Angela P. Fuentes-Pardo. Biologist, Ph.D. candidate Ruzzante Lab, Department of Biology Dalhousie University, Halifax, Canada, B3H 4R2 http://fuentespardo.weebly.com -------------- next part -------------- An HTML attachment was scrubbed... URL: From Mark.Coulson.ic at uhi.ac.uk Tue Oct 31 10:24:45 2017 From: Mark.Coulson.ic at uhi.ac.uk (Mark Coulson) Date: Tue, 31 Oct 2017 09:24:45 +0000 Subject: [adegenet-forum] Could adegenet be modified to accept allele frequencies as input data? In-Reply-To: References: Message-ID: Hi Angela, I've done something similar with a data set for ~900,000 SNPs where I only had allele frequencies per each of my 'populations'. I simply imported this as a matrix where each value was the 'A' allele frequency and did my dapc etc from there. Not sure if this will work well given the much larger number of SNPs you have but worth a try. Mark From: adegenet-forum-bounces at lists.r-forge.r-project.org [mailto:adegenet-forum-bounces at lists.r-forge.r-project.org] On Behalf Of Angela Fuentes Pardo Sent: 30 October 2017 15:24 To: adegenet-forum at lists.r-forge.r-project.org Subject: [adegenet-forum] Could adegenet be modified to accept allele frequencies as input data? Hi there, My dataset consists of allele frequencies of millions of SNPs for >10 populations (I don't have individual genotype data). adegenet requires individual genotypes as input data, but considering many population genetic tests are based on allele frequencies, I wanted to ask if there is any possibility that adegenet could have a function that accepts population allele frequencies as input data. I am mostly interested on conducting PCA and DAPC tests. Thanks -- Angela P. Fuentes-Pardo. Biologist, Ph.D. candidate Ruzzante Lab, Department of Biology Dalhousie University, Halifax, Canada, B3H 4R2 http://fuentespardo.weebly.com Inverness College UHI, a partner in the University of the Highlands and Islands www.inverness.uhi.ac.uk Board of Management of Inverness College (known as Inverness College UHI), Scottish Charity No SC021197. -------------- next part -------------- An HTML attachment was scrubbed... URL: From thibautjombart at gmail.com Tue Oct 31 13:02:40 2017 From: thibautjombart at gmail.com (Thibaut Jombart) Date: Tue, 31 Oct 2017 12:02:40 +0000 Subject: [adegenet-forum] Could adegenet be modified to accept allele frequencies as input data? In-Reply-To: References: Message-ID: Hello, you can create a genpop object from a matrix of allele counts, so this should be fairly straightforward. It is documented in section 4.7 of the basics tutorial. 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 31 October 2017 at 09:24, Mark Coulson wrote: > Hi Angela, > > > > I?ve done something similar with a data set for ~900,000 SNPs where I only > had allele frequencies per each of my ?populations?. I simply imported this > as a matrix where each value was the ?A? allele frequency and did my dapc > etc from there. Not sure if this will work well given the much larger number > of SNPs you have but worth a try. > > > > Mark > > > > > > From: adegenet-forum-bounces at lists.r-forge.r-project.org > [mailto:adegenet-forum-bounces at lists.r-forge.r-project.org] On Behalf Of > Angela Fuentes Pardo > Sent: 30 October 2017 15:24 > To: adegenet-forum at lists.r-forge.r-project.org > Subject: [adegenet-forum] Could adegenet be modified to accept allele > frequencies as input data? > > > > Hi there, > > > > My dataset consists of allele frequencies of millions of SNPs for >10 > populations (I don't have individual genotype data). adegenet requires > individual genotypes as input data, but considering many population genetic > tests are based on allele frequencies, I wanted to ask if there is any > possibility that adegenet could have a function that accepts population > allele frequencies as input data. I am mostly interested on conducting PCA > and DAPC tests. > > > > Thanks > > > > -- > Angela P. Fuentes-Pardo. Biologist, Ph.D. candidate > Ruzzante Lab, Department of Biology > Dalhousie University, Halifax, Canada, B3H 4R2 > http://fuentespardo.weebly.com > > Inverness College UHI, a partner in the University of the Highlands and > Islands www.inverness.uhi.ac.uk Board of Management of Inverness College > (known as Inverness College UHI), Scottish Charity No SC021197. > > _______________________________________________ > 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 Tue Oct 31 13:04:41 2017 From: thibautjombart at gmail.com (Thibaut Jombart) Date: Tue, 31 Oct 2017 12:04:41 +0000 Subject: [adegenet-forum] s.class: how to avoid box around plotting area In-Reply-To: References: Message-ID: Hello, it is documented in ?s.class - see cellipse argument. 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 27 October 2017 at 10:10, Walter Durka wrote: > Hi, > > I use the standard plot command to display results of PCoA and s.class to > add the stars and elypses; and I combine two plots for axes 1+2 and 1+3. > However, s.class adds a box around the full plotting area, which looks > nasty, in particular as I combined two plots (see file attached). > > How can I avoid that s.class adds these boxes? > > regards > > Walter > > ####################################### > > pco1<-dudi.pco(d.dist,scannf=F,nf=6) > > par(mfrow=c(2,1), mar=c(2,4,2,2)+0.1,mgp=c(3,1,0)) > par( mar=c(.5,4,2,2)+0.1) > > ## basic plot > plot(pco1$tab[,1:2], col=myCol, cex=2, pch=myPch, xaxt='n',yaxt='n', > xlab=paste("PCoA1 > (",format(PCO1_exV,digits=2),"%)",sep=""),ylab=paste("PCoA2 > (",format(PCO2_exV,digits=2),"%)",sep=""), > mgp=c(1,.5,0)) > mtext("A",3,at=min(pco1$tab[,1]) - > (max(pco1$tab[,1])-min(pco1$tab[,1]))/9,cex=1.5,font=2) > # groups > s.class(pco1$tab[,1:3],xax=1,yax=2,fac =d.pop$pop,addaxes=T,col=popc, > cpoint=0.5, grid=F, cstar=1,axesell=F, > sub="",possub="topleft",add.plot=T) > > par( mar=c(2,4,.5,2)+0.1) > plot(pco1$tab[,3]~pco1$tab[,1], col=myCol, cex=2, pch=myPch, > xaxt='n',yaxt='n', > xlab=paste("PCoA1 > (",format(PCO1_exV,digits=2),"%)",sep=""),ylab=paste("PCoA2 > (",format(PCO2_exV,digits=2),"%)",sep=""), > mgp=c(1,.5,0)) > mtext("B",3,at=min(pco1$tab[,1]) - > (max(pco1$tab[,1])-min(pco1$tab[,1]))/9,cex=1.5,font=2) > # groups > s.class(pco1$tab[,1:3],xax=1,yax=3,fac > =d.pop$pop,addaxes=T,col=popc,#funky(9), > cpoint=0.5, grid=F, cstar=1,axesell=F, > sub="",possub="topleft",add.plot=T) > #################################################### > > > > -- > > ***** > Dr. Walter Durka > Department Bioz?noseforschung > Department of community ecology > > Helmholtz-Zentrum f?r Umweltforschung GmbH - UFZ > Helmholtz Centre for Environmental Research - UFZ > Theodor-Lieser-Str. 4 / 06120 Halle / Germany > > walter.durka at ufz.de / http://www.ufz.de/index.php?en=798 > phone +49 345 558 5314 / Fax +49 345 558 5329 > > -------------------------------------------------------------------------------------------- > > Sitz der Gesellschaft: Leipzig > Registergericht: Amtsgericht Leipzig > Handelsregister Nr. B 4703 > Vorsitzender des Aufsichtsrats: MinDirig Wilfried Kraus > Wissenschaftlicher Gesch?ftsf?hrer: Prof. Dr. Georg Teutsch > (Scientific Managing Director) > Administrative Gesch?ftsf?hrerin: Dr. Heike Gra?mann > (Administratve Managing Director) > > -------------------------------------------------------------------------------------------- > > > _______________________________________________ > 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