Paul, I don't think these are necessarily in conflict. If myigv represents the IGV session/state, then add_track(myigv, vcfobj) could call down to add_track(myigv,VariantTrack(vcf)) so you'd get the default behaviors. you could also support add_track(myigv, vcf, title = "bla", homVarColor = "whateverman") which would call down to add_track(myigv, VariantTrack(vcf, title = "bla", homVarColor = "whateverman"))
This is easy to do (I'm assume the IGVSession class name but replace it with whatever class add_track is endomorphic in...): setMethod("add_track", signature = c("IGVSession", "VCF"), function(igv, track, ...) add_track(igv, VariantTrack(track, ...))) setMethod("add_track", signature = c("IGVSession", "BAM", function(igv, track, ...) add_track(igv, AlignmentTrack(track, ...))) This would, as Michael points out, give you the default values of the parameter when you just call add_track(myigv, vcfobj) Does that make sense? ~G On Wed, Mar 14, 2018 at 12:40 PM, Paul Shannon < paul.thurmond.shan...@gmail.com> wrote: > Hi Michael, > > Set me straight if I got this wrong. You suggest: > > > There should be no need to explicitly construct a track; just rely on > dispatch and class semantics, i.e., passing a VCF object to add_track() > would create a variant track automatically. > > But wouldn’t > > displayTrack(vcf) > > preclude any easy specification of options - which vary across track types > - which are straightforward, easily managed and checked, by a set of track > constructors? > > Two examples: > > displayTrack(VariantTrack(vcf, title=“mef2c eqtl”, height=“300”, > homrefColor=“lightGray”, > homVarColor=“darkRed”, > hetVarColor=“lightRed”)) > > displayTrack(AlignmentTrack(x, title=“bam 32”, viewAsPairs=TRUE, > insertionColor=“black”)) > > > So I suggest that the visualization of tracks has lots of > track-type-specific settings which the user will want to control, and which > would be messy to handle with an open-ended set of optional “…” args to a > dispatch-capable single “displayTrack” method. > > - Paul > -- Gabriel Becker, Ph.D Scientist Bioinformatics and Computational Biology Genentech Research [[alternative HTML version deleted]] _______________________________________________ Bioc-devel@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/bioc-devel