Learn R Programming

apex (version 1.0.6)

initialize,multidna-method: multidna constructor

Description

New multidna objects can be created using new("multidna", ...) where "..." are arguments documented below. The main input is a list of DNAbin matrices. The constructor ensures that all matrices will be reordered in the same way, and as an option (setting add.gaps=TRUE, gap-only sequences ("...-----...") will be added wherever sequences are missing.

Usage

# S4 method for multidna
initialize(.Object, dna = NULL, ind.info = NULL,
  gene.info = NULL, add.gaps = TRUE, quiet = FALSE, ...)

Value

an object of class multidna containing alignments.

Arguments

.Object

the object skeleton, automatically generated when calling new.

dna

a list of DNAbin matrices (1 per gene); rows should be labelled and indicate individuals, but different individuals and different orders can be used in different matrices.

ind.info

an optional data.frame containing information on the individuals, where individuals are in rows.

gene.info

an optional data.frame containing information on the genes, where genes are in rows.

add.gaps

a logical indicating if gap-only sequences should be used where sequences are missing; defaults to TRUE.

quiet

a logical indicating if messages should be shown; defaults to FALSE.

...

further arguments to be passed to other methods

Author

Thibaut Jombart t.jombart@imperial.ac.uk

See Also

  • the multidna class

  • read.multidna and read.multidna

Examples

Run this code

## empty object
new("multidna")

## simple conversion with nicely ordered output
data(woodmouse)
genes <- list(gene1=woodmouse[,1:500], gene2=woodmouse[,501:965])
x <- new("multidna", genes)
x
image(woodmouse)
image(x@dna[[1]])
image(x@dna[[2]])

## trickier conversion with missing sequences / wrong order
genes <- list(gene1=woodmouse[,1:500], gene2=woodmouse[c(5:1,14:15),501:965])
x <- new("multidna", genes)
x
image(x@dna[[1]])
image(x@dna[[2]])

Run the code above in your browser using DataLab