ggscatter, gene expression, correlation
0
0
Entering edit mode
3 days ago
Rob ▴ 120

enter code hereHey friends, The following code gives me a scatter plot of the correlation between gene expression (y-axis) & my continuous variable (x-axis). It gives me the R coefficient and p-value. I have two problems: 1) I need also to have a q-value (corrected p-value). what should I add to my code to have this? 2) I also want to rank the genes based on R and q-value? I mean I want the plots to be in the order of descending/ascending R & q-values. how is it possible?

ggscatter(ex, x = "variable", y = "Expression",
          add = "reg.line",                         
          add.params = list(color = "blue", fill = "lightgray"),
          color = "black", palette = "jco", fill = "lightgray",          
          #shape = "cyl",                            
          fullrange = TRUE,                       
          rug = TRUE, facet.by = "gene", cor.coef = T,
          title = "Correlation Plot",
          conf.int = TRUE, 
          cor.coeff.args = list(),
          cor.method = "spearman",
          cor.coef.coord = c(NULL, NULL),
          cor.coef.size = 4,                               
)+

  geom_vline(xintercept = 157, colour="red", linetype = "longdash")

here is the plot I get (with R & p-value for each gene) :

q-value

RNA-Seq plot scatter • 189 views
ADD COMMENT
1
Entering edit mode

I think you're reaching the limits of what ggscatter can do. I'd recommend calculating your own q vals, using pivot_longer, factor your gene names in whatever order you want, then switching to ggplot+geom_scatter. Maybe start with one gene until you optimize your plot then add in the facet_wrap.

ADD REPLY

Login before adding your answer.

Traffic: 1071 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