string2region: string2region

Description Usage Arguments Value Author(s) See Also Examples

View source: R/string2region.R

Description

This function subsets a DNAStringSet or an AAStringSet by a mask and region given one or both options as IRanges.

Usage

1
string2region(seq, mask = NULL, region = NULL, add = TRUE)

Arguments

seq

DNAStringSet or AAStringSet [mandatory]

mask

IRanges object indicating masked sites [default: NULL]

region

IRanges object indicating region to use for dist calculation (by default all sites are used) [default: NULL]

add

indicate if mask and region should be added to metadata [default: TRUE]

Value

A list object with the following components:
DNAStringSet or AAStringSet
regionUsed

Author(s)

Kristian K Ullrich

See Also

dnastring2dist

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
## load example sequence data
data("hiv", package="distSTRING")
## create mask
mask1 <- IRanges::IRanges(start=c(11,41,71), end=c(20,50,80))
## use mask
hiv.region <- hiv |> cds2aa() |> string2region(mask=mask1)
hiv.region@metadata$regionUsed
## use region
region1 <- IRanges::IRanges(start=c(1,75), end=c(45,85))
hiv.region <- hiv |> cds2aa() |> string2region(region=region1)
hiv.region@metadata$regionUsed
## use mask and region
hiv.region <- hiv |> cds2aa() |> string2region(mask=mask1, region=region1)
hiv.region@metadata$regionUsed

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