0
$\begingroup$

I have dataset from which I derived cdc15 time course experiment. My goal is

dput(cdc15)

    "YPR177C", "YPR178W", "YPR179C", "YPR180W", "YPR181C", "YPR182W", 
"YPR183W", "YPR184W", "YPR185W", "YPR186C", "YPR187W", "YPR188C", 
"YPR189W", "YPR190C", "YPR191W", "YPR192W", "YPR193C", "YPR194C", 
"YPR195C", "YPR196W", "YPR197C", "YPR198W", "YPR199C", "YPR200C", 
"YPR201W", "YPR202W", "YPR203W", "YPR204W"))
        cdc15_10 cdc15_30 cdc15_50 cdc15_70 cdc15_80 cdc15_90 cdc15_100
YAL001C    -0.16     0.09    -0.23     0.03    -0.04    -0.12     -0.28
YAL002W       NA       NA       NA    -0.58     0.23    -0.23      0.08
YAL003W    -0.37    -0.22    -0.16     0.04     0.53    -0.25      0.08
YAL004W       NA       NA       NA    -1.50    -0.03    -1.20     -0.06
YAL005C    -0.43    -1.33    -1.53    -1.53    -0.37    -1.65     -0.71
YAL007C       NA       NA       NA     0.14     0.58     0.25      0.03
        cdc15_110 cdc15_120 cdc15_130 cdc15_140 cdc15_150 cdc15_160
YAL001C     -0.44     -0.09      0.12      0.06     -0.04      0.31
YAL002W     -0.62      0.55     -0.32      0.03     -0.56      0.47
YAL003W     -0.24      0.37     -0.22      0.16     -0.21      0.03
YAL004W     -1.78      0.14     -1.13     -0.13     -1.27     -0.27
YAL005C     -1.53     -0.10     -1.15     -0.33     -1.15     -0.19
YAL007C     -1.00      0.00     -0.41      0.10      0.14      0.40
        cdc15_170 cdc15_180 cdc15_190 cdc15_200 cdc15_210 cdc15_220
YAL001C      0.59      0.34     -0.28     -0.09     -0.44      0.31
YAL002W     -0.15      0.49        NA      0.23     -0.49      0.33
YAL003W      0.03      0.48        NA      0.22     -0.06      0.08
YAL004W     -0.94      0.14        NA      1.04      0.48      1.94
YAL005C     -0.84      0.52        NA      1.18      0.88      1.80
YAL007C      0.20      0.24        NA      0.26     -0.39      0.43
        cdc15_230 cdc15_240 cdc15_250 cdc15_270 cdc15_290
YAL001C      0.03      0.57      0.00      0.02     -0.26
YAL002W      0.18      0.65     -0.29        NA        NA
YAL003W      0.56      0.48     -0.47     -0.45     -0.41
YAL004W      1.62      1.73      1.22        NA        NA
YAL005C      2.24      2.34      1.43      1.27      1.18
YAL007C     -0.26     -0.33     -0.37        NA        NA

My current code:

library(ggplot2)
library(cowplot)
library(ggpubr)

cdc15 <- dat[,23:46]
mat <- as.matrix(cdc15)
x <- min(mat[,1])
y <- max(mat[,2])

    for (x in colnames(mat)[-1]){
  cor.test(x = mat[, 1], y = mat[, 2], method = "pearson", 
           use = "pairwise.complete.obs")
  
  ggscatter(cdc15, x = mat[, 1], y = mat[, 2], fill = "time", shape = 21, add = "reg.line", 
            title = "Correlation matrix between time points of 
          cdc15 temperature-sensitive mutant", conf.int = TRUE, cor.coef = TRUE, 
            cor.method = "pearson")
  axis(1, xaxt="n", labels=mat[,1]) 
  axis(2, yaxt="n", labels=mat[,2])
}



 # Generate a profile plot of YAL002W gene.
VPS8 <- cdc15["YAL002W",]
names(VPS8) <- str_remove(names(VPS8), 'cdc15_')
plot(c(1, ncol(VPS8), range(na.omit(as.numeric(VPS8[1,]))), 
       type="n", xlab="", 
       ylab="log2(intensity)", 
       main="VPS8 expression in yeast S. cerevisiae 
       cdc15 mutant during different time points of cell cycle arrest", 
       axes=FALSE
       ))
lines(c(1:ncol(dat)), as.numeric(dat[VPs8]), lwd=2, col="blue")
grid()
axis(1, at=c(1:ncol(dat)), dimnames(dat)[[2]], las=2, cex.lab=0.7)
axis(2)

Desired outcome: (1) Calculation of the correlation matrix between the time points using Pearson's correlation. The plot should have a legend of the color gradient. The x and y axes should be labelled based on the gene name. (2) Generate a profile plot of YAL002W gene (VPS8)

New contributor
mellio is a new contributor to this site. Take care in asking for clarification, commenting, and answering. Check out our Code of Conduct.
$\endgroup$