addmask2string: addmask2string

View source: R/addmask2string.R

addmask2stringR Documentation

addmask2string

Description

This function adds mask information as an IRanges object, START and END information, to a DNAStringSet or an AAStringSet and puts them into the metadata information. This information can be used to restrict the distance calculation to specific regions of the DNAStringSet or the AAStringSet.

Usage

addmask2string(seq, mask = NULL, append = TRUE)

Arguments

seq

DNAStringSet or AAStringSet [mandatory]

mask

IRanges object [mandatory]

append

indicate if mask should be appended or overwritten [default: TRUE]

Value

An object of class DNAStringSet or AAStringSet

Author(s)

Kristian K Ullrich

See Also

addregion2string, addpop2string, addpos2string

Examples

## load example sequence data
data(iupac, package="MSA2dist")
iupac.aa <- iupac |> cds2aa(shorten = TRUE)
## create mask
mask1 <- IRanges::IRanges(start=c(1,41), end=c(20,50))
## add mask
iupac.aa <- iupac.aa |> addmask2string(mask=mask1)
#(iupac.aa |> slot("metadata"))$mask
iupac.aa |> getmask()
## append mask
mask2 <- IRanges::IRanges(start=c(21), end=c(30))
iupac.aa <- iupac.aa |> addmask2string(mask=mask2)
#(iupac.aa |> slot("metadata"))$mask
iupac.aa |> getmask()
## overwrite mask
iupac.aa <- iupac.aa |> addmask2string(mask=mask2, append=FALSE)
#(iupac.aa |> slot("metadata"))$mask
iupac.aa |> getmask()
## reduce by mask
#iupac.aa.region <- iupac.aa |> string2region(mask=
#    (iupac.aa |> slot("metadata"))$mask)
iupac.aa.region <- iupac.aa |> string2region(mask=
    getmask(iupac.aa))
#iupac.aa.region |> slot("metadata")
iupac.aa.region |> getmask()

kullrich/MSA2dist documentation built on Nov. 14, 2024, 5:39 p.m.