xscat: Concatenate sequences contained in XString, XStringSet and/or...

Description Usage Arguments Value Author(s) See Also Examples

View source: R/xscat.R

Description

This function mimics the semantic of paste(..., sep="") but accepts XString, XStringSet or XStringViews arguments and returns an XString or XStringSet object.

Usage

1

Arguments

...

One or more character vectors (with no NAs), XString, XStringSet or XStringViews objects.

Value

An XString object if all the arguments are either XString objects or character strings. An XStringSet object otherwise.

Author(s)

H. Pagès

See Also

XString-class, XStringSet-class, XStringViews-class, paste

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
## Return a BString object:
xscat(BString("abc"), BString("EF"))
xscat(BString("abc"), "EF")
xscat("abc", "EF")

## Return a BStringSet object:
xscat(BStringSet("abc"), "EF")

## Return a DNAStringSet object:
xscat(c("t", "a"), DNAString("N"))

## Arguments are recycled to the length of the longest argument:
res1a <- xscat("x", LETTERS, c("3", "44", "555")) 
res1b <- paste0("x", LETTERS, c("3", "44", "555"))
stopifnot(identical(as.character(res1a), as.character(res1b)))

## Concatenating big XStringSet objects:
library(drosophila2probe)
probes <- DNAStringSet(drosophila2probe)
mm <- complement(narrow(probes, start=13, end=13))
left <- narrow(probes, end=12)
right <- narrow(probes, start=14)
xscat(left, mm, right)

## Collapsing an XStringSet (or XStringViews) object with a small
## number of elements:
probes1000 <- as.list(probes[1:1000])
y1 <- do.call(xscat, probes1000)
y2 <- do.call(c, probes1000)  # slightly faster than the above
y1 == y2  # TRUE
## Note that this method won't be efficient when the number of
## elements to collapse is big (> 10000) so we need to provide a
## collapse() (or xscollapse()) function in Biostrings that will be
## efficient at doing this. Please request this on the Bioconductor
## mailing list (http://bioconductor.org/help/mailing-list/) if you
## need it.

anandhupresannan/biostrings documentation built on Nov. 2, 2019, 1:47 p.m.