Code Monkey home page Code Monkey logo

Comments (14)

benjjneb avatar benjjneb commented on August 28, 2024

I think leaving the "uniques" class as a named integer vector might be fine?

However, a class for the object returned by derepFastq (list of uniques,
quals, map) could be useful. Class "derep"?

And dada return should have a class. Class "dada".

On Tue, Jun 16, 2015 at 10:57 AM, Paul J. McMurdie <[email protected]

wrote:

Please comment your preferences on the class names O:-)... I was thinking
"uniques" and "dada" would work.

This solves at least two problems:

  • Make sure user understands what their uniques list or dada list is,
    control some aspects about what to do with it
  • When these objects get printed to screen, it currently "explodes"
    the console because there's so much good stuff in there. Need to summarize
    that good stuff in a useful way


Reply to this email directly or view it on GitHub
#20.

from dada2.

joey711 avatar joey711 commented on August 28, 2024

Sounds good. The list returned by derepFastq is what I meant. "derep" is fine with me. I agree, no reason to define a class for the "uniques" vector at the moment.

from dada2.

benjjneb avatar benjjneb commented on August 28, 2024

dada return is classed "dada", derepFastq is classed "derep"

Joey, how do we implement print.dada and print.derep?

from dada2.

joey711 avatar joey711 commented on August 28, 2024

Great, so I assume this means these have formal class definitions now?
print.derep is the old "S3" way of doing it, which BioC won't like.
We'll need to define new "print" and "show" S4 methods that extend the S4 base generics for same.

from dada2.

benjjneb avatar benjjneb commented on August 28, 2024

No just S3 style (class(return.val) <- dada).

Will BioC accept S3 classes even if it doesn't like them?

On Thu, Aug 6, 2015 at 12:33 PM, Paul J. McMurdie [email protected]
wrote:

Great, so I assume this means these have formal class definitions now?
print.derep is the old "S3" way of doing it, which BioC won't like.
We'll need to define new "print" and "show" S4 methods that extend the S4
base generics for same.


Reply to this email directly or view it on GitHub
#20 (comment).

from dada2.

joey711 avatar joey711 commented on August 28, 2024

If there is a standard S4 approach, and there is in this case, then they would kick it back and ask you to change it. I can tackle this. I'll migrate whatever you have currently for printing to the S4 method.

from dada2.

benjjneb avatar benjjneb commented on August 28, 2024

I added nothing except class(dada.return) <- "dada" and
class(derepFastq.return) <- "derep"

Adding a stub print function would be great, can fill in later.

On Thu, Aug 6, 2015 at 2:06 PM, Paul J. McMurdie [email protected]
wrote:

If there is a standard S4 approach, and there is in this case, then they
would kick it back and ask you to change it. I can tackle this. I'll
migrate whatever you have currently for printing to the S4 method.


Reply to this email directly or view it on GitHub
#20 (comment).

from dada2.

joey711 avatar joey711 commented on August 28, 2024

Yeah, those are not S4 classes either. No worries. I can get this up to snuff.

from dada2.

benjjneb avatar benjjneb commented on August 28, 2024

How difficult is basic inspection and use of S4 classes going to be?

One of the nice things about these objects is that they are a simple
inspectable list. S4 classes seem to be more unwieldy generally.

On Thu, Aug 6, 2015 at 2:14 PM, Paul J. McMurdie [email protected]
wrote:

Yeah, those are not S4 classes either. No worries. I can get this up to
snuff.


Reply to this email directly or view it on GitHub
#20 (comment).

from dada2.

spholmes avatar spholmes commented on August 28, 2024

inspection?
function
str
is a workaround
otherwise you need to know the slots....

On Thu, Aug 6, 2015 at 4:34 PM, benjjneb [email protected] wrote:

How difficult is basic inspection and use of S4 classes going to be?

One of the nice things about these objects is that they are a simple
inspectable list. S4 classes seem to be more unwieldy generally.

On Thu, Aug 6, 2015 at 2:14 PM, Paul J. McMurdie <[email protected]

wrote:

Yeah, those are not S4 classes either. No worries. I can get this up to
snuff.


Reply to this email directly or view it on GitHub
#20 (comment).


Reply to this email directly or view it on GitHub
#20 (comment).

Susan Holmes
Professor, Statistics and BioX
John Henry Fellow in Undergraduate Education
Sequoia Hall,
390 Serra Mall
Stanford, CA 94305
http://www-stat.stanford.edu/~susan/

from dada2.

benjjneb avatar benjjneb commented on August 28, 2024

I would rather not add S4 structure if we don't have to.

The only things we want from classing these returns is (1) being able to
pass them to dada2 functions, and (2) being able to have a generic print
function that doesn't spam the user to death.

On Thu, Aug 6, 2015 at 4:44 PM, spholmes [email protected] wrote:

inspection?
function
str
is a workaround
otherwise you need to know the slots....

On Thu, Aug 6, 2015 at 4:34 PM, benjjneb [email protected] wrote:

How difficult is basic inspection and use of S4 classes going to be?

One of the nice things about these objects is that they are a simple
inspectable list. S4 classes seem to be more unwieldy generally.

On Thu, Aug 6, 2015 at 2:14 PM, Paul J. McMurdie <
[email protected]

wrote:

Yeah, those are not S4 classes either. No worries. I can get this up to
snuff.


Reply to this email directly or view it on GitHub
#20 (comment).


Reply to this email directly or view it on GitHub
#20 (comment).

Susan Holmes
Professor, Statistics and BioX
John Henry Fellow in Undergraduate Education
Sequoia Hall,
390 Serra Mall
Stanford, CA 94305
http://www-stat.stanford.edu/~susan/


Reply to this email directly or view it on GitHub
#20 (comment).

from dada2.

joey711 avatar joey711 commented on August 28, 2024

I agree, let's avoid killing users via accidental spam.

It's straightforward to extend the "list" class as a new S4 object. Since downstream functions interact with the typical $ operator, I don't think it would require any other code changes.

I agree that converting each top-level list element to a formal slot feels like overkill in this case, and I'll try to do what I just proposed as a simple lightweight workaround.

from dada2.

joey711 avatar joey711 commented on August 28, 2024

@benjjneb The "S4-migrate" branch linked above shows this very light-weight S4 method. I also narrowed the namespace to @importFrom pacakge method in all cases except ggplot2.

To focus on the show method, look at the show-methods.R file, and also the allClasses.R file.
The derepFastq and dada functions were trivially modified to return the respective S4 object (which is really just a list, but don't tell BioC ;-) )

from dada2.

joey711 avatar joey711 commented on August 28, 2024

p.s. let me know if you like this and I'll merge into the master (or you can). Feel free to modify the show method further. I didn't really do anything to summarize the "dada" object yet. The "derep" object has a pretty nice summary though.

from dada2.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.