Question: How to recreate this dot plot?
1
gravatar for Ron
11 months ago by
Ron990
United States
Ron990 wrote:

Hi all,

Does somebody know which package can be used for plots like this?

Commercial Photography

The dot plots illustrates the number of detected fusion transcripts per megabase per sample normalized by the sequencing coverage. Tumor types were sorted according to the fraction of samples with fusions.

I am trying to recreate this plot from the gene fusions paper. https://www.ncbi.nlm.nih.gov/pmc/articles/PMC4468049/

The data is present here: https://www.ncbi.nlm.nih.gov/pmc/articles/PMC4468049/bin/NIHMS632238-supplement-2.xlsx (Table S1) and using only columns "Cancer, FileName,FusionPair"

I have tried a couple of options from ggplot package but these are different plots. http://www.sthda.com/english/wiki/ggplot2-dot-plot-quick-start-guide-r-software-and-data-visualization

Thanks

Ron

rna-seq next-gen R • 479 views
ADD COMMENTlink modified 11 months ago by zx87549.0k • written 11 months ago by Ron990

This post needs a better title and more relevant tags. At first sight, this post can likely be dismissed as a pure R question but you're looking to recreate a certain type of plot in R depicting gene fusion events across TCGA cancer datasets. Please add such information in there to make your post more relevant to bioinformatics.

ADD REPLYlink written 11 months ago by RamRS25k

It is possible to do them in ggplot2; I'll try and find the code. You setup your plot to use the disease-factor as x and number of mutations as y; I think you need an ordering variable nested within each disease-value (from -0.5 to 0.5) that dictates the x-offset for each point.

ADD REPLYlink written 11 months ago by russhh5.1k

Or a facet, maybe? (Unless I'm missing something)

ADD REPLYlink written 11 months ago by RamRS25k

facets would generate several graphs, perfectly fine for exploration. Here they want a single graph.

ADD REPLYlink written 11 months ago by russhh5.1k

It still produces one graphical entity. By several graphs, do you mean repeat the axes several times? That can be controlled.

ADD REPLYlink written 11 months ago by RamRS25k

Could you post some example data, please?

ADD REPLYlink written 11 months ago by russhh5.1k

I posted the link to the data and the paper.

ADD REPLYlink written 11 months ago by Ron990

Related post: How to generate a stripplot like this in Python or R?

ADD REPLYlink written 11 months ago by zx87549.0k
4
gravatar for zx8754
11 months ago by
zx87549.0k
London
zx87549.0k wrote:

Here is the start:

library(ggplot2)

#dummy data
mydat <- mtcars[ , c("cyl", "mpg")]
mydat$Cancer <- paste0("cancer_", mydat$cyl)

#Order by cancer and mpg (number of fusions per megabase)
mydat <- mydat[ order(mydat$Cancer, mydat$mpg), ]
mydat$x <- seq(nrow(mydat))

# make pretty x labels one per cancer
mydat$xlabel <- c(1, diff(as.numeric(as.factor(mydat$Cancer))))
mydat$xlabel <- ifelse(mydat$xlabel == 1, mydat$Cancer, NA)

# plot
ggplot(mydat, aes(x, mpg, col = Cancer)) +
  geom_point() +
  scale_x_continuous(breaks = which(!is.na(mydat$xlabel)), 
                     labels = mydat$xlabel[ !is.na(mydat$xlabel)])

ADD COMMENTlink written 11 months ago by zx87549.0k

I think this would answer this post : C: How to generate a stripplot like this in Python or R?

ADD REPLYlink written 11 months ago by cpad011212k
Please log in to add an answer.

Help
Access

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.
Powered by Biostar version 2.3.0
Traffic: 1605 users visited in the last hour