Skip to content
Prev 9657 / 21312 Next

[Bioc-devel] BStringSet Documentation

Hi,
On 09/01/2016 12:00 AM, Dario Strbenac wrote:
Why? Because they both have "str" in their name?

It sounds that you are expecting that every string manipulation function
defined in base R should work on a BStringSet object. Well that's not
the case and I don't think that's ever going to happen. Some of them
work and some of them don't. We can add more if needed (e.g. strsplit)
but there are things like the grep family that BStringSet objects will
probably never support.

If you need to strsplit() an XStringSet object, you can use this:

   strsplitXStringSet <- function(x, split)
   {
       m <- vmatchPattern(split, x)
       at <- gaps(IRangesList(start=start(m),
                  end=end(m)), start=1L, end=width(x))
       extractAt(x, at)
   }

It's going to behave like strsplit(x, split, fixed=TRUE) except when
there is a match at the beginning or end of one of the sequences (in
which case strsplit() has a questionable behavior). Also, unlike
strsplit(), strsplitXStringSet() doesn't support an empty split
pattern.

Note that BStringSet objects have supported the reverse operation
for a while. See ?unstrsplit

I'll add strsplitXStringSet() to Biostrings, as the "strsplit" method
for XStringSet objects.

H.