librtoDNA: Convert simulation objects to DNA sequences or Nexus/Fasta...

Description Usage Arguments Value Examples

View source: R/librtoDNA.R

Description

Creates a character string or matrix of nucleotides (C, A, G, T), output to vector, matrix or Nexus file.

Usage

1
2
librtoDNA(sampleID, libr, nuc, ref.strain, key, sampletime=NULL, 
          strings = FALSE, filename = NULL, format = "nexus")

Arguments

sampleID

Vector of sample IDs to output.

libr

Library object from simulation functions. A list in which each entry represents a unique genotype, and is a vector of mutated nucleotide positions relative to the reference sequence.

nuc

Nucleotide database from simulation functions. A list (corresponding to libr) in which each entry represents a unique genotype, and is a vector of mutated nucleotides relative to the reference sequence.

ref.strain

Reference strain to which the libr and nuc objects are compared (string of integers in 1,...,4).

key

Vector of sample IDs corresponding to the order of libr.

sampletime

Vector of sample times. If specified, incorporates sample times into genome name in Nexus file.

strings

If TRUE, returns a character vector, each element containing one genotype. Otherwise, returns a (number of genotypes)x(length of genome) character matrix.

filename

File to which sequence data should be written. Output format is Nexus. Not written out if NULL.

format

File format to be exported (if filename!=NULL). Options are "nexus" and "fasta".

Value

A character vector or matrix, depending on strings.

Examples

1
2
3
data(withinhost)
G <- librtoDNA(sampleID=withinhost$obs.strain, libr=withinhost$libr, nuc=withinhost$nuc, 
               ref.strain=withinhost$ref.strain, key=withinhost$librstrains, strings=TRUE)

Example output



seedy documentation built on May 29, 2017, 10:58 a.m.