addregion2string: addregion2string

Description Usage Arguments Value Author(s) See Also Examples

View source: R/addregion2string.R

Description

This function adds region 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

1

Arguments

seq

DNAStringSet or AAStringSet [mandatory]

region

IRanges object [mandatory]

append

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

Value

An object of class DNAStringSet or AAStringSet

Author(s)

Kristian K Ullrich

See Also

addmask2string, addpop2string, addpos2string

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
data(iupac, package="distSTRING")
iupac.aa <- iupac |> cds2aa(shorten = TRUE)
## create region
region1 <- IRanges::IRanges(start=c(1,41), end=c(20,50))
## add region
iupac.aa <- iupac.aa |> addregion2string(region=region1)
iupac.aa@metadata$region
## append region
region2 <- IRanges::IRanges(start=c(21), end=c(30))
iupac.aa <- iupac.aa |> addregion2string(region=region2)
iupac.aa@metadata$region
## overwrite region
iupac.aa <- iupac.aa |> addregion2string(region=region2, append=FALSE)
iupac.aa@metadata$region
## reduce by region
iupac.aa.region <- iupac.aa |> string2region(region=iupac.aa@metadata$region)
iupac.aa.region@metadata

kullrich/distSTRING documentation built on Dec. 21, 2021, 8:42 a.m.