Learn R Programming

adegenet (version 1.4-2)

gengraph: Genetic transitive graphs

Description

These functions are under development. Please email the author before using them for published work. The function gengraph generates graphs based on genetic distances, so that pairs of entities (individuals or populations) are connected if and only if they are distant by less than a given threshold distance. Graph algorithms and classes from the igraph package are used. gengraph is a generic function with methods for the following types of objects: - matrix (only numeric data) - dist - genind objects (genetic markers, individuals) - genpop objects (genetic markers, populations) - DNAbin objects (DNA sequences)

Usage

gengraph(x, ...)

## S3 method for class 'matrix': gengraph(x, cutoff=NULL, ngrp=NULL, computeAll=FALSE, plot=TRUE, show.graph=TRUE, col.pal=funky, truenames=TRUE, \dots)

## S3 method for class 'dist': gengraph(x, cutoff=NULL, ngrp=NULL, computeAll=FALSE, plot=TRUE, show.graph=TRUE, col.pal=funky, truenames=TRUE, \dots)

## S3 method for class 'genind': gengraph(x, cutoff=NULL, ngrp=NULL, computeAll=FALSE, plot=TRUE, show.graph=TRUE, col.pal=funky, truenames=TRUE, \dots)

## S3 method for class 'genpop': gengraph(x, cutoff=NULL, ngrp=NULL, computeAll=FALSE, plot=TRUE, show.graph=TRUE, col.pal=funky, method=1, truenames=TRUE, \dots)

## S3 method for class 'DNAbin': gengraph(x, cutoff=NULL, ngrp=NULL, computeAll=FALSE, plot=TRUE, show.graph=TRUE, col.pal=funky, truenames=TRUE, \dots)

Arguments

x
a matrix, dist, genind, genpop, or DNAbin object. For matrix and dist, the object represents pairwise
cutoff
a numeric value indicating the cutoff point, i.e. the distance at which two entities are no longer connected in the garph produced by the method.
ngrp
an integer indicating the number of groups to be looked for. A message is issued if this exact number could not be found.
computeAll
a logical stating whether to investigate solutions for every (integer) cutoff point; defaults to FALSE.
plot
a logical indicating whether plots should be drawn; defaults to TRUE; this operation can take time for large, highly-connected graphs.
show.graph
a logical indicating whether the found graph should be drawn, only used in the interactive mode; this operation can take time for large, highly-connected graphs; defaults to FALSE.
col.pal
a color palette used to define group colors.
method
an integer ranging from 1 to 6 indicating the type of method to be used to derive a matrix of pairwise distances between populations; values from 1 to 5 are passed to the function dist.genpop; 6 corresponds to pairwis
truenames
a logical indicating whether original labels should be used for plotting (TRUE), as opposed to indices of sequences (FALSE).
...
further arguments to be used by other functions; currently not used.

Value

  • The class gengraph is a list with the following components:
  • grapha graph of class igraph.
  • clusta list containing group information: $membership: an integer giving group membership; $csize: the size of each cluster; $no: the number of clusters
  • cutoffthe value used as a cutoff point
  • colthe color used to plot each group.

encoding

UTF-8

See Also

The igraph package.

Examples

Run this code
dat <- haploGen()
res <- gengraph(dat$seq, ngrp=1)
plot(res$graph)

Run the code above in your browser using DataLab