[Bioc-devel] Add an IRanges:::showAsCell, XStringSet function to Biostrings?

Steve Lianoglou mailinglist.honeypot at gmail.com
Thu Jan 19 19:51:53 CET 2012


Hi,

I recently stuffed a DNAStringSet into a column of a GRanges object
(for the purposes of xferring data to someone, I know there better
ways to store (or not) such data).

I tried to `show` the GRanges object to make sure everything was feng
shui and a good deal of pain ensued as some of the DNAStrings in the
set are quite long and the show method tried to print them in their
entirety.

I loaded up a hack like below so that only the first 10NT of the
dnastrings showed in the GRanges object's values():

setMethod(IRanges:::showAsCell, "XStringSet", function(object) {
 out <- substring(object, 1, 10)
 out <- ifelse(nchar(out > 10), paste(out, "...", sep=""), out)
})

I'm guessing there's a better way to do it, but it does the trick for
me now -- was thinking something like that would be handy to roll into
Biostrings though (I'm on R-devel and Biostrings 2.23.4)

-steve

-- 
Steve Lianoglou
Graduate Student: Computational Systems Biology
 | Memorial Sloan-Kettering Cancer Center
 | Weill Medical College of Cornell University
Contact Info: http://cbio.mskcc.org/~lianos/contact



More information about the Bioc-devel mailing list