Crates.io | netview |
lib.rs | netview |
version | 0.4.0 |
source | src |
created_at | 2024-09-22 22:29:49.637531 |
updated_at | 2024-09-24 21:25:31.316854 |
description | Netview: mutual nearest neighbor graphs for genome-wide, fine-scale population structure determination and visualization |
homepage | https://github.com/esteinig/netviewr |
repository | https://github.com/esteinig/netviewr |
max_upload_size | |
id | 1383359 |
size | 143,073 |
The netviewr
package offers a set of operators and functions that make
working with data-driven plots of igraph
objects more pleasant by:
Netviewr
is built with its original application in mind, which is the visualization of genetic population structure and associated meta data from genome-wide single nucleotide polymorphisms (SNPs) for both eukaryotic and prokaryotic species. While it is not a suitable package for determining population structure, it can be used to effectively visualize data (traits, phenotypes, genotypes...) across population structures; it should be used in conjunction with other statistically more sophisticated tools like DAPC or Admixture.
Netviewr implements the same tasks and methods as the published version of NetView - except in modern R. If the new syntax feels weird, you can use all functions in base syntax, or if you need backward compatibility, the old version is still accessible.
If you are using netviewr
for research applications, for now please cite:
Steinig et al. (2016) - Netview P: a network visualization tool to unravel complex population structure using genome‐wide SNPs - Molecular Ecology Resources 16 (1), 216-227
If you have trouble accessing the paper, have a look in the documentation folder.
v2.1.0
# Install netviewr (not on CRAN yet)
# install.packages("netviewr")
# Development version from GitHub:
# install.packages("devtools")
devtools::install_github("esteinig/netviewr")
Build and plot a mutual k-nearest-neighbor graph from a (genetic) distance matrix.
matrix(rnorm(900), nrow=30) %>% netviewr::netview(k=20) %>% netviewr::plot_netview()
Base syntax is also supported.
dist_matrix <- matrix(rnorm(900), nrow=30)
g <- netviewr::netview(dist_matrix, k=20)
netviewr::plot_netview(g)
Annotate a graph with data and plot the graph.
library(netviewr)
node_data <- tibble::tibble(x=letters[1:10], y=1:10) # generate 10 x 2 node data tibble
g <- igraph::sample_gnm(n=10, m=15) %@% # generate random graph with 10 nodes
node_data %@% # decorate graph with node data tibble
node_color(data='x', palette='BuGn') %@% # decorate nodes with colors paletted by x
node_size(data='y', min=5, max=8) # decorate nodes with values rescaled by y
g %>% plot_netview() # plot decorated graph from magrittr pipe
We welcome any and all suggestions or pull requests. Please feel free to open an issue in the repository on GitHub
.