[adegenet-forum] Dots in the DAPC graphic (Lucas Veiga)

Lucas Veiga lucasfip at yahoo.com.br
Tue Oct 24 14:39:55 CEST 2017


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" <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) <Oliver.Berry at csiro.au>
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 <shannon.j.oleary at gmail.com> 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, <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 <lucasfip at yahoo.com.br>
To: Zhian Kamvar <zkamvar at gmail.com>,
        "adegenet-forum at lists.r-forge. r-project.org"
        <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 <lucasfip at yahoo.com.br>
To: Roman Lu?trik <roman.lustrik at biolitika.si>
Cc: "adegenet-forum at lists.r-forge. r-project.org"
 <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" <lucasfip at yahoo.com.br>
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: <http://lists.r-forge.r- project.org/pipermail/ adegenet-forum/attachments/ 20171012/c5b29746/attachment- 0001.html>

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

Message: 2
Date: Thu, 12 Oct 2017 12:10:28 +0000 (UTC)
From: Lucas Veiga <lucasfip at yahoo.com.br>
To: Roman Lu?trik <roman.lustrik at biolitika.si>
Cc: "adegenet-forum at lists.r-forge. r-project.org"
 <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" <lucasfip at yahoo.com.br>
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: <http://lists.r-forge.r- project.org/pipermail/ adegenet-forum/attachments/ 20171012/32d4d4d6/attachment- 0001.html>

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

Message: 3
Date: Fri, 13 Oct 2017 10:38:57 +0200 (CEST)
From: Roman Lu?trik <roman.lustrik at biolitika.si>
To: Lucas Veiga <lucasfip at yahoo.com.br>
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" <lucasfip at yahoo.com.br>
To: "Roman Lu?trik" <roman.lustrik at biolitika.si>
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" <lucasfip at yahoo.com.br>
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: <http://lists.r-forge.r- project.org/pipermail/ 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: <http://lists.r-forge.r- project.org/pipermail/ 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
****************************** ***************** 
   _______________________________________________
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: <http://lists.r-forge.r-project.org/pipermail/adegenet-forum/attachments/20171024/c29c6ea3/attachment-0001.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: image001.jpg
Type: image/jpeg
Size: 810 bytes
Desc: not available
URL: <http://lists.r-forge.r-project.org/pipermail/adegenet-forum/attachments/20171024/c29c6ea3/attachment-0002.jpg>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: image002.jpg
Type: image/jpeg
Size: 5458 bytes
Desc: not available
URL: <http://lists.r-forge.r-project.org/pipermail/adegenet-forum/attachments/20171024/c29c6ea3/attachment-0003.jpg>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: forum.tiff
Type: image/tiff
Size: 2656040 bytes
Desc: not available
URL: <http://lists.r-forge.r-project.org/pipermail/adegenet-forum/attachments/20171024/c29c6ea3/attachment-0001.tiff>


More information about the adegenet-forum mailing list