square-bracket-assign-msa: Replace subsets of an alignment

Description Usage Arguments Value Note Author(s) Examples

Description

Replace subsets of an alignment

Usage

1
2
## S3 replacement method for class 'msa'
x[rows, cols] <- value

Arguments

x

An object of type msa

rows

A numeric vector of sequence indices, character vector (containing sequence names), or logical vector. If logical vector, it will be recycled as necessary to the length of nrow.msa(x). If not provided, all rows are selected.

cols

A numeric vector of alignment columns, or a logical vector. If logical vector it will be recycled to the same length as ncol.msa(x). Note that these are coordinates with respect to the entire alignment. x$idx.offset is ignored here. If cols is not provided, all columns are selected.

value

The value to replace in the indicated rows/columns. Should be a character representing a base (ie, "A", "C", "G", "T", "N", "-"). Can be a single value or a vector of values which match number of selected cells. This value will be recycled to the necessary length, and an error produced if the necessary length is not an even multiple of length(value). Can also give a single character string, in which case it will be expanded into a vector using strsplit.

Value

An object of type msa with the chosen rows/columns replaced by value.

Note

If x is stored as a pointer, x will be changed to the return value.

Author(s)

Melissa J. Hubisz

Examples

1
2
3
4
5
6
m <- msa(seqs=c("ACGTAT", "AGGTAA", "AGGTAG"),
         names=c("human", "mouse", "rat"))
m[1:2,4:6] <- "G"
m[1,] <- "A"
m[,4:5] <- "-"
m["rat",] <- "ABCDEF"

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