Git Product home page Git Product logo

Comments (4)

zkamvar avatar zkamvar commented on June 26, 2024

If you would like to visualise the MLGs and their relationships across or between populations, you can use the mlg.table() function with the option color = TRUE (and/or background = TRUE if you want a separate plot for each population)

library(poppr)
#> Loading required package: adegenet
#> Loading required package: ade4
#> 
#>    /// adegenet 2.1.5 is loaded ////////////
#> 
#>    > overview: '?adegenet'
#>    > tutorials/doc/questions: 'adegenetWeb()' 
#>    > bug reports/feature requests: adegenetIssues()
#> Registered S3 method overwritten by 'pegas':
#>   method      from
#>   print.amova ade4
#> This is poppr version 2.9.3. To get started, type package?poppr
#> OMP parallel support: available
data(Aeut)
mlg.table(Aeut, plot = TRUE, color = TRUE)

#>            MLG.1 MLG.2 MLG.3 MLG.4 MLG.5 MLG.6 MLG.7 MLG.8 MLG.9 MLG.10 MLG.11
#> Athena         1     0     0     0     0     0     1     1     1      1      1
#> Mt. Vernon     0     2     1     1     1     1     0     0     0      0      0
#>            MLG.12 MLG.13 MLG.14 MLG.15 MLG.16 MLG.17 MLG.18 MLG.19 MLG.20
#> Athena          1      2      3      1      2      2      1      1      9
#> Mt. Vernon      0      0      0      0      0      0      0      0      0
#>            MLG.21 MLG.22 MLG.23 MLG.24 MLG.25 MLG.26 MLG.27 MLG.28 MLG.29
#> Athena          1      1      2      2      1      1      1      1      1
#> Mt. Vernon      0      0      0      0      0      0      0      0      0
#>            MLG.30 MLG.31 MLG.32 MLG.33 MLG.34 MLG.35 MLG.36 MLG.37 MLG.38
#> Athena          1      2      2      1      1      3      2      1      1
#> Mt. Vernon      0      0      0      0      0      0      0      0      0
#>            MLG.39 MLG.40 MLG.41 MLG.42 MLG.43 MLG.44 MLG.45 MLG.46 MLG.47
#> Athena          1      1      1      1      1      1      1      1      1
#> Mt. Vernon      0      0      0      0      0      0      0      0      0
#>            MLG.48 MLG.49 MLG.50 MLG.51 MLG.52 MLG.53 MLG.54 MLG.55 MLG.56
#> Athena          1      1      1      1      2      1      0      0      0
#> Mt. Vernon      0      0      0      0      0      0      1      1      1
#>            MLG.57 MLG.58 MLG.59 MLG.60 MLG.61 MLG.62 MLG.63 MLG.64 MLG.65
#> Athena          1      0      1      2      1      1      2      1      1
#> Mt. Vernon      0      1      1      0      0      0      0      0      0
#>            MLG.66 MLG.67 MLG.68 MLG.69 MLG.70 MLG.71 MLG.72 MLG.73 MLG.74
#> Athena          5      1      1      0      0      0      0      0      0
#> Mt. Vernon      0      0      0      4      5      1      2      1      3
#>            MLG.75 MLG.76 MLG.77 MLG.78 MLG.79 MLG.80 MLG.81 MLG.82 MLG.83
#> Athena          0      0      0      0      0      0      0      0      0
#> Mt. Vernon      5      2      3      2      1     10      2      1      1
#>            MLG.84 MLG.85 MLG.86 MLG.87 MLG.88 MLG.89 MLG.90 MLG.91 MLG.92
#> Athena          0      0      0      0      0      0      0      0      0
#> Mt. Vernon      1      1      1      2      2      1      2      2      1
#>            MLG.93 MLG.94 MLG.95 MLG.96 MLG.97 MLG.98 MLG.99 MLG.100 MLG.101
#> Athena          1      1      0      0      0      0      0       0       0
#> Mt. Vernon      0      0      1      2      4      1      2       1       2
#>            MLG.102 MLG.103 MLG.104 MLG.105 MLG.106 MLG.107 MLG.108 MLG.109
#> Athena           0       0       0       0       0       0       1       1
#> Mt. Vernon       1       2       1       1       1       1       0       0
#>            MLG.110 MLG.111 MLG.112 MLG.113 MLG.114 MLG.115 MLG.116 MLG.117
#> Athena           1       1       1       1       1       0       0       0
#> Mt. Vernon       0       0       0       0       0       1       1       1
#>            MLG.118 MLG.119
#> Athena           1       1
#> Mt. Vernon       0       0

Created on 2022-02-07 by the reprex package (v2.0.1)

Additionally, if you want to visualise the genetic relationships between the MLGs along with their population assignments, then you can create a minimum spanning network: https://grunwaldlab.github.io/Population_Genetics_in_R/Minimum_Spanning_Networks.html

from poppr.

dionnecargy avatar dionnecargy commented on June 26, 2024

Hi, thank you for that explanation. I clarify, however, that I want to subset the data to only visualise MLG counts greater than or equal to 2.

i.e.:
68747470733a2f2f692e696d6775722e636f6d2f705475627246632e706e67

Thanks.

from poppr.

zkamvar avatar zkamvar commented on June 26, 2024

Since mlg.id() will return a list with the IDs per MLG, you can use that list to subset your data by filtering on the length of the list item and then flattening that list with unlist()

library(poppr)
#> Loading required package: adegenet
#> Loading required package: ade4
#> 
#>    /// adegenet 2.1.5 is loaded ////////////
#> 
#>    > overview: '?adegenet'
#>    > tutorials/doc/questions: 'adegenetWeb()' 
#>    > bug reports/feature requests: adegenetIssues()
#> Registered S3 method overwritten by 'pegas':
#>   method      from
#>   print.amova ade4
#> This is poppr version 2.9.3. To get started, type package?poppr
#> OMP parallel support: available
data(Aeut)
ids <- mlg.id(Aeut)
only_clones <- unlist(ids[lengths(ids) > 1])
mlg.table(Aeut[only_clones], color = TRUE, plot = TRUE)

#>            MLG.1 MLG.2 MLG.3 MLG.4 MLG.5 MLG.6 MLG.7 MLG.8 MLG.9 MLG.10 MLG.11
#> Athena         0     2     3     2     2     9     2     2     2      2      3
#> Mt. Vernon     2     0     0     0     0     0     0     0     0      0      0
#>            MLG.12 MLG.13 MLG.14 MLG.15 MLG.16 MLG.17 MLG.18 MLG.19 MLG.20
#> Athena          2      2      1      2      2      5      0      0      0
#> Mt. Vernon      0      0      1      0      0      0      4      5      2
#>            MLG.21 MLG.22 MLG.23 MLG.24 MLG.25 MLG.26 MLG.27 MLG.28 MLG.29
#> Athena          0      0      0      0      0      0      0      0      0
#> Mt. Vernon      3      5      2      3      2     10      2      2      2
#>            MLG.30 MLG.31 MLG.32 MLG.33 MLG.34 MLG.35 MLG.36
#> Athena          0      0      0      0      0      0      0
#> Mt. Vernon      2      2      2      4      2      2      2

Created on 2022-02-08 by the reprex package (v2.0.1)

from poppr.

dionnecargy avatar dionnecargy commented on June 26, 2024

Thank you so much! This works perfectly!

from poppr.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.