Align-GVGD scores for SNP values
1
0
Entering edit mode
9.5 years ago
garimav89 • 0

How to plot Align-GVGD scores for SNPs in Gene by using ggplot2?

I want to construct a map for values(EXAMPLE) below:

id  gv_scores(X) gd_scores(Y)     class
1   0            44.5             C45
2   0            92.5             C65
3   0            82.3             C65

Help will be appreciated

SNP R • 2.4k views
ADD COMMENT
0
Entering edit mode
So do you want an x-y scatter plot separated by color? Or separate scatter plots for each class? Or something else? There is a lot you can do with ggplot2.
ADD REPLY
0
Entering edit mode

I want an x-y scatter plot separated by colour. Actually my X values are always 0 for every id so now I want to represent my data from a new table (example lies below)

id(y)   pos(x)    gd         class
1       35        94.3       C65
2       67        45.6       C15
3       79        83.9       C65

I want tile plot in which my gd values are written inside tiles of colours according to class.

Somewhat like the map below

ADD REPLY
1
Entering edit mode
9.5 years ago
Steven Lakin ★ 1.8k

Based on what you've said above, this should work:

library(ggplot2)
g <- ggplot(data=yourDataFrame, aes(pos, id))
g + geom_tile(aes(fill=class)) + geom_text(aes(label=gd))

So for example:

testDataFrame <- data.frame("id" = c(1,2,3), "pos" = c(35,67,79), "gd" = c(94.3,45.6,83.9), "class" = c("C65", "C15", "C65"))
g <- ggplot(data=testDataFrame, aes(pos, id))
g + geom_tile(aes(fill=class)) + geom_text(aes(label=gd))

That will give you a heatmap similar to what you described above while using your x/y values.

Edit: changed text label to gd

ADD COMMENT
0
Entering edit mode

Thank you Steven, it worked

But I need a colour gradient for class column and also a defined limits for x-axis

I'm using following code:

g <- g+ scale_fill_gradient (low = "white" , high = "red")

This is not working. Please help me

ADD REPLY
0
Entering edit mode

If you could accept the answer using the buttons on the left of my post, that'd be great. The site works best when answered questions are marked.

ADD REPLY

Login before adding your answer.

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