Code Monkey home page Code Monkey logo

Comments (13)

dtm2451 avatar dtm2451 commented on June 7, 2024 1

I've finally put together a version of how this could work, and within the base dittoPlot instead of multi_dittoPlot. BiocManager::install("dtm2451/dittoSeq@multivar-dittoPlot") if you want to try!

from dittoseq.

dtm2451 avatar dtm2451 commented on June 7, 2024

Hmmm, do A-G represent genes, or sets of genes?, here and treatment is a sample grouping?

from dittoseq.

j-andrews7 avatar j-andrews7 commented on June 7, 2024

A-G would be genes. The treatment would be a sample grouping, sorry, I could have clarified better in the OP.

from dittoseq.

dtm2451 avatar dtm2451 commented on June 7, 2024

No worries! Just wanted to clarify =). I like the idea and will ponder on how best to implement. Potentially could be an alternate plotting functionality in the back-end, but accessible with just multi_dittoPlot(..., group.by = "vars").

from dittoseq.

j-andrews7 avatar j-andrews7 commented on June 7, 2024

Ohh, very nice, thanks for the addition!

from dittoseq.

vivianschu avatar vivianschu commented on June 7, 2024

Is there a way to produce the dittobarplot similar to the figure above, i.e. the group-by is plotted within one axis and not split between different graphs?

from dittoseq.

dtm2451 avatar dtm2451 commented on June 7, 2024

Yep! You can't do it in the "release" version yet, but you can if you install from github.

It'll be available from dittoSeq 1.10 after the next Bioconductor release in November.

In v1.9.2 or higher, you would give the desired set of vars to var (can be any metadata or genes of the object).
Customization Details: You can use multivar.aes to switch between displaying those vars in faceting/splitting, color, or x-axis groupings. And when using splitting, and split.by = "<something_else>", you can use multivar.split.dir to control which direction the var data goes .

Install with:

if (!requireNamespace("remotes")) { install.packages("remotes") }
remotes::install_github("dtm2451/dittoSeq")

Usage = any of these:

library(dittoSeq)
example("importDittoBulk", echo = FALSE)
dittoPlot(object = myRNA, var = c("gene1", "gene2", "gene3"), group.by = "timepoint") # default: `multivar.aes = "split"`
dittoPlot(object = myRNA, var = c("gene1", "gene2", "gene3"), group.by = "timepoint", multivar.aes = "group")
dittoPlot(object = myRNA, var = c("gene1", "gene2", "gene3"), group.by = "timepoint", multivar.aes = "color")

image
image
image

# Or with extra split.by variable:
dittoPlot(object = myRNA, var = c("gene1", "gene2", "gene3"), group.by = "timepoint",
    split.by = "clustering") # default: `multivar.split.dir = "col"`
dittoPlot(object = myRNA, var = c("gene1", "gene2", "gene3"), group.by = "timepoint",
    split.by = "clustering", multivar.split.dir = "row")

image
image

from dittoseq.

dtm2451 avatar dtm2451 commented on June 7, 2024

Is there a way to produce the dittobarplot similar to the figure above, i.e. the group-by is plotted within one axis and not split between different graphs?

Oops, on re-read, noticing you asked about dittoBarPlot(). Can you clarify how you mean, @vivianschu?

Stab#2... dittoFreqPlot() splits the var-levels / cell types of a dittoBarPlot() up, so if you mean like a dittoFreqPlot() with the cell types all side-by-side: I hadn't thought to build multivar.aes-like control for that function, but you could achieve a similar feel by giving split.nrow = 1...

dittoFreqPlot(myRNA, "clustering", group.by = "groups", sample.by = "sample",
    split.nrow = 1)

image

from dittoseq.

vivianschu avatar vivianschu commented on June 7, 2024

My bad! I meant dittoBoxPlot, not dittoBarPlot.

I tested out your suggestions on how to produce those plots (particularly interested in how to reproduce the last one), however they generate the same result with box plots stacked instead of in one row.

image

I am trying to illustrate a gene's expression level among each cluster, comparing the control samples to the treatment, where grey = control and blue = treatment.

Here is my pseudoscript below, which produce the image above:

if (!requireNamespace("remotes")) { install.packages("remotes") }
remotes::install_github("dtm2451/dittoSeq")

library(dittoSeq)

dittoBoxPlot(seurat_object, "Gene", group.by = "condition", split.by = "cluster", multivar.split.dir = "row") 

Any suggestions on how to modify this to create the box plots in one row? Was my installation of the new dittoPlot version incorrect?

from dittoseq.

dtm2451 avatar dtm2451 commented on June 7, 2024

Ohhhh! You don't need the new version unless you wanted to do something like:

dittoBoxPlot(seurat_object, c("Gene1", "Gene2"), ...)

This issue was about plotting results for multiple genes / vars in a single plot.

If you are just trying to put all your split.by = "cluster" facets in a single row, all you need to do is to add split.nrow = 1!

(And fyi, syntax for dittoBoxPlot is exactly the same as for dittoPlot. So as you may already have noticed, you can modify any example code that uses dittoPlot by just adding in the "Box". The ONLY difference between the two lies in their default values for the 'plots' input.)

from dittoseq.

vivianschu avatar vivianschu commented on June 7, 2024

Wonderful!! Thank you so much - I didn't realize the solution was so simple.

Last question -- is there a method to place the group.by labels on the bottom instead of the top?
image

from dittoseq.

dtm2451 avatar dtm2451 commented on June 7, 2024

Yup! The documentation path is a bit hard to follow, but I tried to describe in the docs for the 'split.adjust' input how you can use it to pass tweaks into the faceting functions. Since you're only giving one variable to 'split.by', you'd follow ?facet_wrap for options. And looking there, I see a 'strip.position' input. Try adding: split.adjust = list(strip.position = "bottom")

from dittoseq.

vivianschu avatar vivianschu commented on June 7, 2024

Thanks so much!!

from dittoseq.

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.