dtm2451 / dittoSeq

Color blindness friendly visualization of single-cell and bulk RNA-sequencing data
MIT License
188 stars 18 forks source link

`adjustment` not applied when metadata used as `var` in `dittoSeq` and friends #156

Open j-andrews7 opened 3 weeks ago

j-andrews7 commented 3 weeks ago

This is in the dev version, so Bioc 3.20:

example(importDittoBulk, echo = FALSE)
myRNA

# Basic dittoplot, with jitter behind a vlnplot (looks better with more cells)
dittoPlot(object = myRNA, var = "score2", group.by = "timepoint", adjustment = NULL)

image

Looks identical with z-score adjustment (or relative.to.max).

dittoPlot(object = myRNA, var = "score2", group.by = "timepoint", adjustment = "z-score")

image

Works fine for genes though:

dittoPlot(object = myRNA, var = "gene1", group.by = "timepoint", adjustment = NULL)

image

dittoPlot(object = myRNA, var = "gene1", group.by = "timepoint", adjustment = "z-score")

image

Note that it is still applied to genes when both metadata variable and genes are provided, e.g.:

multi_dittoPlot(myRNA,
                vars = c("score1", "score2", "gene3", "gene4"),
                group.by = "clustering", adjustment = "z-score")

image

Probably won't have any time to chase this one myself for at least a few weeks.

dtm2451 commented 3 weeks ago

Not a deep one... it's just how it has always been. The docs for adjustment in ?dittoPlot:

When plotting gene expression / feature counts, should that data be used directly (default) or should it be adjusted to be
  - "z-score": scaled with the scale() function to produce a relative-to-mean z-score representation
  - "relative.to.max": divided by the maximum expression value to give percent of max values between [0,1]
j-andrews7 commented 3 weeks ago

Huh, I totally thought it used to apply to metadata too. Well, that's on me then.

On Tue, Sep 24, 2024, 9:09 AM Daniel Bunis @.***> wrote:

Not a deep one... it's just how it has always been. The docs for adjustment in ?dittoPlot:

When plotting gene expression / feature counts, should that data be used directly (default) or should it be adjusted to be

  • "z-score": scaled with the scale() function to produce a relative-to-mean z-score representation
  • "relative.to.max": divided by the maximum expression value to give percent of max values between [0,1]

— Reply to this email directly, view it on GitHub https://github.com/dtm2451/dittoSeq/issues/156#issuecomment-2371416120, or unsubscribe https://github.com/notifications/unsubscribe-auth/ACOAQNGYR6QTERUUTNJHRV3ZYFXDJAVCNFSM6AAAAABOXBB6I6VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDGNZRGQYTMMJSGA . You are receiving this because you authored the thread.Message ID: @.***>

dtm2451 commented 3 weeks ago

Easy enough to update.

Most of the machinery was put in place a while ago, but I stopped short of the final connection from an uncertainty of whether to make the change + my tendency to not change default behaviors without adding a level of control to recreate old behavior.

Just gotta think a bit on if an extra control should be added and if that control should default to 'on' or 'off'.