sample.msa: Sample columns from an MSA

Description Usage Arguments Value Note Author(s) Examples

View source: R/msa.R

Description

Sample columns from an MSA

Usage

1
2
3
## S3 method for class '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

Note

This function is implemented using R's sample function in conjunction with "[.msa". It will not alter the value of x even if it is stored as a pointer.

Author(s)

Melissa J. Hubisz and Adam Siepel

Examples

1
2
3
4
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))

rphast documentation built on May 1, 2019, 9:26 p.m.