Learn R Programming

rphast (version 1.6.9)

sample.msa: Sample columns from an MSA

Description

Sample columns from an MSA

Usage

# S3 method for msa
sample(x, size, replace = FALSE, prob = NULL,
  pointer.only = FALSE)

Arguments

x

An object of type msa

size

The number of columns to sample

replace

Whether to sample with replacement

prob

A vector of probability weights for sampling each column; prob=NULL implies equal probability for all columns. Probabilities need not sum to one but should be non-negative and can not all be zero.

pointer.only

If TRUE, return only a pointer to an alignment object stored in C (useful for large objects; advanced use only).

Value

An object of type msa with columns randomly re-sampled from the original

Examples

Run this code
# NOT RUN {
m <- msa(seqs=c("AAAAAAAAAACCCCCGGT", "GGGGGGGGGGTTTTTCCA", "CCCCCCCCCCAAAAAGGA"),
         names=c("human", "mouse", "rat"))
sample.msa(m, 10, replace=TRUE)
sample.msa(m, 10, replace=TRUE, prob=c(rep(1, 10), rep(2, 5), rep(5, 2), 10))
# }

Run the code above in your browser using DataLab