Scatterplots In R
1
0
Entering edit mode
11.2 years ago
deschisandy ▴ 60

I would like to compare two datasets of the same length using scatterplots and then colour the differentially expressed genes based on the list of genes with specified p-values. To be more specific it looks something like below :

enter image description here

Replacing the x-axis with data A and y-axis with data B and Significant P value <0.05) probes are shown in blue.

### data A

probes     AG1      AG2      LR1       LR2
  901  4.991648  6.289011 5.556497 5.698004
  902  5.465736  6.036498 7.126263 7.004082
  903  8.559740  9.833907 8.567032 8.433505
  904  7.068298  6.156696 6.436085 6.793267
  905  5.388158  4.911885 5.642148 5.914592
  906  3.479966 3.558568 3.546799  3.689476  
  907  7.625593 7.257528 6.435133  6.657421  
  908  5.402257 5.585819 5.376026  5.926565  
  909  4.031072 4.190055 3.867168  4.096824  
  910  5.467766 5.891490 5.427065  5.105108  

### data A (p-value)
    901           902          903          904          905
 8.705207e-01 2.084426e-05 2.313093e-03 2.027818e-01 1.273762e-01 


### data B

    probes  AG1    AG2      LR1     LR2
     901 4.562965 4.917767 4.636715 5.223545
     902 4.662215 4.845352 4.893514 5.139439
     903 5.206248 4.396288 4.274906 5.458326
     904 6.027329 6.169694 6.350698 6.317571
     905 4.981953 4.980007 4.948762 5.118272
     906 4.348615 4.686512 4.359645  4.429090 
     907 5.402996 5.047972 4.929584  4.838130  
     908 3.939867 4.037690 3.707080  4.085406  
     909 5.402257 5.585819 5.376026  5.926565
     910 6.083009 6.294913 6.436085  6.168885 

### data B(p-value)
   901           902          903          904          905
 3.225798e-01 2.205045e-01 3.957011e-01 7.262735e-01 9.253321e-01

I tried to reproduce the same kind of plot by first producing a normal scatterplot but do not understand how to colour the DEG's. The data I originally have is for 15000 probes.

r data visualization • 4.8k views
ADD COMMENT
4
Entering edit mode
11.2 years ago
Michael 55k
A = rnorm(100)
B = rnorm(100)
p = rnorm(100)
# got some data

col = rep('black', length(A))
col[p< 0.05] <- 'blue'
plot(A, B, col=col)
ADD COMMENT

Login before adding your answer.

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