rtracklayer 'track' method, a viewLimits parameter?
2
0
Entering edit mode
Paul Shannon ★ 1.1k
@paul-shannon-578
Last seen 9.6 years ago
I have a specific rtracklayer question, and a general S4/help question. The specific question: Michael helpfully suggested the 'viewLimits' parameter to the rtracklayer track method, saying This is another track line parameter, called viewLimits. See class?GraphTrackLine. track (session, "wiggle", viewLimits = c(0, 100)) <- wiggle Indeed, class?GraphTrackLine mentions that parameter. But when I call this method (or what I *think* is this method), I get this: unused argument(s) (viewLimits = c(80, 100)) That's my specific question. How do I supply viewLimits information to the track method? The general question is: how do I navigate the help system, with S4 objects and methods, so I can figure this stuff out for myself? With R functions, I can type args (track) or simply track and see, respectively, the parameters and the contents of the body of the function. But with generics, args (track) gets me function (object, ...) NULL and then, looking for the definition, I do this (knowing, of course that it won't work): > track standardGeneric for "track" defined from package "rtracklayer" function (object, ...) standardGeneric("track") <environment: 0x10b69b340=""> Methods may be defined for arguments: object Use showMethods("track") for currently available ones. > showMethods ('track') Function: track (package rtracklayer) object="UCSCSession" object="UCSCTableQuery" Is there something like this I should call? args (track (object='UCSCSession')) Better yet -- is there a 'R help for S4 classes, objects and methods' tutorial somewhere? Thanks! - Paul
rtracklayer rtracklayer • 1.3k views
ADD COMMENT
0
Entering edit mode
@michael-lawrence-3846
Last seen 2.4 years ago
United States
On Thu, Oct 28, 2010 at 1:21 PM, Paul Shannon <pshannon@systemsbiology.org>wrote: > I have a specific rtracklayer question, and a general S4/help question. > > The specific question: Michael helpfully suggested the 'viewLimits' > parameter to the rtracklayer track method, saying > > This is another track line parameter, called viewLimits. See > class?GraphTrackLine. > track (session, "wiggle", viewLimits = c(0, 100)) <- wiggle > > Indeed, class?GraphTrackLine mentions that parameter. > > But when I call this method (or what I *think* is this method), I get this: > > unused argument(s) (viewLimits = c(80, 100)) > > That's my specific question. How do I supply viewLimits information to > the track method? > > Could you please provide a reproducible example? I cannot reproduce with a simple test, and really the arguments are not interpreted in a way that would result in that error. > The general question is: how do I navigate the help system, with S4 > objects and methods, so I can figure this stuff out for myself? > > With R functions, I can type > > args (track) > > Note that this is not the same function that is called in the code listed above. There is a difference between track and track<-. One gets, the other sets/replaces. > or simply > > track > > and see, respectively, the parameters and the contents of the body of the > function. > > But with generics, args (track) gets me > > function (object, ...) > NULL > > and then, looking for the definition, I do this (knowing, of course that it > won't work): > > > track > standardGeneric for "track" defined from package "rtracklayer" > function (object, ...) > standardGeneric("track") > <environment: 0x10b69b340=""> > Methods may be defined for arguments: object > Use showMethods("track") for currently available ones. > > > showMethods ('track') > Function: track (package rtracklayer) > object="UCSCSession" > object="UCSCTableQuery" > > > Is there something like this I should call? > > args (track (object='UCSCSession')) > > Better yet -- is there a 'R help for S4 classes, objects and methods' > tutorial somewhere? > > Not really. But selectMethod() is useful, as it will return the method that would be invoked for a given signature. It's a little more convenient than getMethod(), mentioned by Vince, because selectMethod() considers inheritance. Same basic usage though. Thanks! > > - Paul > > _______________________________________________ > Bioconductor mailing list > Bioconductor@stat.math.ethz.ch > https://stat.ethz.ch/mailman/listinfo/bioconductor > Search the archives: > http://news.gmane.org/gmane.science.biology.informatics.conductor > [[alternative HTML version deleted]]
ADD COMMENT
0
Entering edit mode
Hi Michael, In creating a minimal script to demonstrate my track<- viewLimits problem, I got past the 'unused argument' but stuck at the next step. In other programs I have written, I do not see *this* particular problem. Something nondeterministic seems to be going on for me. Maybe you can see what I am doing wrong. Here is the 14-line script. I'll be grateful for any help you can give. library (rtracklayer) library (GenomicFeatures) score <- c (80.3, 99.5) chrom.names <- c ('chr1', 'chr1') feature.locs <- IRanges (c (201491492, 201491528), c (201491520, 201491607)) strand <- c ('+', '+') name = Rle (c ('feature-1', 'feature-2')) feature.grange <- GRangesForUCSCGenome ('hg18', chrom.names, feature.locs, strand, name, score) view.range <- GRanges (seqnames='chr1', range=c(201491480, 20149120)) # slightly larger than the region covered by the features session <- browserSession ('UCSC') track.name <- 'demoFeatures' track (session, track.name, viewLimits=c(80,100)) <- feature.grange stopifnot track.name %in% names (trackNames (session))) view <- browserView (session, view.range, full='cytoBand', dense=c ('ruler', 'chainNetPanTro2', 'chainNetMm9'), hide=trackNames (session)) ---- sessionInfo R version 2.12.0 (2010-10-15) Platform: x86_64-apple-darwin9.8.0/x86_64 (64-bit) locale: [1] en_US.utf-8/en_US.utf-8/C/C/en_US.utf-8/en_US.utf-8 attached base packages: [1] stats graphics grDevices utils datasets methods base other attached packages: [1] GenomicFeatures_1.1.11 GenomicRanges_1.2.0 IRanges_1.8.0 rtracklayer_1.10.2 RCurl_1.4-3 bitops_1.0-4.1 loaded via a namespace (and not attached): [1] Biobase_2.10.0 biomaRt_2.6.0 Biostrings_2.18.0 BSgenome_1.17.5 DBI_0.2-5 RSQLite_0.9-2 XML_3.2-0 On Oct 28, 2010, at 4:03 PM, Michael Lawrence wrote: > > On Thu, Oct 28, 2010 at 1:21 PM, Paul Shannon <pshannon at="" systemsbiology.org=""> wrote: > I have a specific rtracklayer question, and a general S4/help question. > > The specific question: Michael helpfully suggested the 'viewLimits' parameter to the rtracklayer track method, saying > > This is another track line parameter, called viewLimits. See class?GraphTrackLine. > track (session, "wiggle", viewLimits = c(0, 100)) <- wiggle > > Indeed, class?GraphTrackLine mentions that parameter. > > But when I call this method (or what I *think* is this method), I get this: > > unused argument(s) (viewLimits = c(80, 100)) > > That's my specific question. How do I supply viewLimits information to the track method? > > > Could you please provide a reproducible example? I cannot reproduce with a simple test, and really the arguments are not interpreted in a way that would result in that error. >
ADD REPLY
0
Entering edit mode
I've fixed this in both release and devel, to come with 1.10(11).3. The problem was not related to the viewLimits. Export of WIG was broken whenever there were chromosomes in the seqlengths that had no actual ranges. Obviously a major bug. Thanks for the report, Michael On Fri, Oct 29, 2010 at 9:44 AM, Paul Shannon <pshannon@systemsbiology.org>wrote: > Hi Michael, > > In creating a minimal script to demonstrate my track<- viewLimits problem, > I got past the 'unused argument' but stuck at the next step. In other > programs I have written, I do not see *this* particular problem. Something > nondeterministic seems to be going on for me. Maybe you can see what I am > doing wrong. > > Here is the 14-line script. I'll be grateful for any help you can give. > > library (rtracklayer) > library (GenomicFeatures) > > score <- c (80.3, 99.5) > chrom.names <- c ('chr1', 'chr1') > feature.locs <- IRanges (c (201491492, 201491528), c (201491520, > 201491607)) > strand <- c ('+', '+') > name = Rle (c ('feature-1', 'feature-2')) > feature.grange <- GRangesForUCSCGenome ('hg18', chrom.names, feature.locs, > strand, name, score) > view.range <- GRanges (seqnames='chr1', range=c(201491480, 20149120)) # > slightly larger than the region covered by the features > session <- browserSession ('UCSC') > track.name <- 'demoFeatures' > track (session, track.name, viewLimits=c(80,100)) <- feature.grange > stopifnot track.name %in% names (trackNames (session))) > view <- browserView (session, view.range, full='cytoBand', dense=c > ('ruler', 'chainNetPanTro2', 'chainNetMm9'), hide=trackNames (session)) > > ---- sessionInfo > > R version 2.12.0 (2010-10-15) > Platform: x86_64-apple-darwin9.8.0/x86_64 (64-bit) > > locale: > [1] en_US.utf-8/en_US.utf-8/C/C/en_US.utf-8/en_US.utf-8 > > attached base packages: > [1] stats graphics grDevices utils datasets methods base > > other attached packages: > [1] GenomicFeatures_1.1.11 GenomicRanges_1.2.0 IRanges_1.8.0 > rtracklayer_1.10.2 RCurl_1.4-3 bitops_1.0-4.1 > > loaded via a namespace (and not attached): > [1] Biobase_2.10.0 biomaRt_2.6.0 Biostrings_2.18.0 BSgenome_1.17.5 > DBI_0.2-5 RSQLite_0.9-2 XML_3.2-0 > > > > > > On Oct 28, 2010, at 4:03 PM, Michael Lawrence wrote: > > > > > On Thu, Oct 28, 2010 at 1:21 PM, Paul Shannon < > pshannon@systemsbiology.org> wrote: > > I have a specific rtracklayer question, and a general S4/help question. > > > > The specific question: Michael helpfully suggested the 'viewLimits' > parameter to the rtracklayer track method, saying > > > > This is another track line parameter, called viewLimits. See > class?GraphTrackLine. > > track (session, "wiggle", viewLimits = c(0, 100)) <- wiggle > > > > Indeed, class?GraphTrackLine mentions that parameter. > > > > But when I call this method (or what I *think* is this method), I get > this: > > > > unused argument(s) (viewLimits = c(80, 100)) > > > > That's my specific question. How do I supply viewLimits information to > the track method? > > > > > > Could you please provide a reproducible example? I cannot reproduce with > a simple test, and really the arguments are not interpreted in a way that > would result in that error. > > > > [[alternative HTML version deleted]]
ADD REPLY
0
Entering edit mode
@vincent-j-carey-jr-4
Last seen 5 weeks ago
United States
On Thu, Oct 28, 2010 at 4:21 PM, Paul Shannon <pshannon at="" systemsbiology.org=""> wrote: [snip] > The general question is: ?how do I navigate the help system, with S4 objects and methods, so I can figure this stuff out for myself? > > With R functions, I can type > > ? args (track) > > or simply > > ? track > > and see, respectively, the parameters and the contents of the body of the function. > > But with generics, args (track) gets me > > ? function (object, ...) > ? NULL getMethod("track", [signature]) will get a view of the source for the method you are interested in, and getMethods("track") will get them all -- can be a long dump depending on how many signatures are active. > ? args (track (object='UCSCSession')) > > Better yet -- is there a 'R help for S4 classes, objects and methods' tutorial somewhere? I think it is pretty well-recognized that the many possible ways of documenting R classes and methods make resource discovery and use somewhat challenging. help.search("track", agrep=FALSE) returns useful information on my installation in the late 1990s i wrote a javadoc-like class/method crawler for Splus, when S4 started to be introduced through the green book. an example of the output is at http://www.biostat.harvard.edu/~carey/old_public_html/polynomout.html i have often wondered whether such a thing should be dusted off for use with R. there are probably relevant developments in the roxygen area and elsewhere... but no magic bullet, i suspect -- the real challenge is to keep the doc current at a fine-grained level with evolving code structures ... not easy with such limited resources > > Thanks! > > ?- Paul > > _______________________________________________ > Bioconductor mailing list > Bioconductor at stat.math.ethz.ch > https://stat.ethz.ch/mailman/listinfo/bioconductor > Search the archives: http://news.gmane.org/gmane.science.biology.informatics.conductor >
ADD COMMENT

Login before adding your answer.

Traffic: 571 users visited in the last hour
Help About
FAQ
Access RSS
API
Stats

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6