How to recreate this dot plot?
1
1
Entering edit mode
5.0 years ago
Ron ★ 1.2k

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

R next-gen RNA-Seq • 1.8k views
ADD COMMENT
0
Entering edit mode

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 REPLY
0
Entering edit mode

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 REPLY
0
Entering edit mode

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

ADD REPLY
0
Entering edit mode

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

ADD REPLY
0
Entering edit mode

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

ADD REPLY
0
Entering edit mode

Could you post some example data, please?

ADD REPLY
0
Entering edit mode

I posted the link to the data and the paper.

ADD REPLY
0
Entering edit mode
ADD REPLY
4
Entering edit mode
5.0 years ago
zx8754 11k

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 COMMENT
0
Entering edit mode

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

ADD REPLY

Login before adding your answer.

Traffic: 2520 users visited in the last hour
Help About
FAQ
Access RSS
API
Stats

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6