Average data from the same growth stage for each gene
MGcols <- geneFrame[, grepl("MG", colnames(geneFrame))]
average_MG <- rowMeans(MGcols)
Brcols <- geneFrame[, grepl("Br", colnames(geneFrame))]
average_Br <- rowMeans(Brcols)
Ripecols <- geneFrame[, grepl("Ripe", colnames(geneFrame))]
average_Ripe <- rowMeans(Ripecols)
dpacols <- geneFrame[, grepl("21dpa", colnames(geneFrame))]
average_dpa <- rowMeans(dpacols)
averaged_geneFrame <- data.frame(Gene = geneFrame$Gene, '21dpa' = average_dpa, MG = average_MG, Br = average_Br, Ripe = average_Ripe)
row.names(averaged_geneFrame) <- averaged_geneFrame$Gene
averaged_geneFrame <- averaged_geneFrame[, 2:5]
rmarkdown::paged_table(averaged_geneFrame)
Plot differentially expressed genes with similar trends during
growth stages
averaged_geneFrame$GeneName <- rownames(averaged_geneFrame)
# Plot genes that increase over the course of the growth stages
increasingrows <- c("Slym06g191830.1", "Slym07g223360.1", "Slym03g082980.1", "Slym01g005070.1", "Slym01g039200.1", "Slym07g227100.1", "Slym06g190140.1", "Slym02g074010.1", "Slym03g106340.1", "Slym09g282730.1", "Slym03g085230.1", "Slym03g082360.1", "Slym04g119590.1", "Slym01g043690.1", "Slym02g079170.1")
averaged_geneFrameincreasing <- averaged_geneFrame[increasingrows, ]
geneFrame_long_increasing <- melt(averaged_geneFrameincreasing, id.vars = "GeneName", variable.name = "Stage", value.name = "Log2FoldChange")
## Warning in melt(averaged_geneFrameincreasing, id.vars = "GeneName",
## variable.name = "Stage", : The melt generic in data.table has been passed a
## data.frame and will attempt to redirect to the relevant reshape2 method; please
## note that reshape2 is deprecated, and this redirection is now deprecated as
## well. To continue using melt methods from reshape2 while both libraries are
## attached, e.g. melt.list, you can prepend the namespace like
## reshape2::melt(averaged_geneFrameincreasing). In the next version, this warning
## will become an error.
# View(geneFrame_long)
ggplot(geneFrame_long_increasing, aes(x = Stage, y = Log2FoldChange, group = GeneName, color = GeneName)) +
geom_line()

# Plot genes that peak during the MG and Br stages but are expressed less during the 21dpa and Ripe stages
downparabolarows <- c("Slym04g148720.1", "Slym09g287180.1", "Slym12g368490.1", "Slym02g076790.1", "Slym07g231950.1", "Slym07g229870.1")
averaged_geneFramedownparabola <- averaged_geneFrame[downparabolarows, ]
geneFrame_long_downparabola <- melt(averaged_geneFramedownparabola, id.vars = "GeneName", variable.name = "Stage", value.name = "Log2FoldChange")
## Warning in melt(averaged_geneFramedownparabola, id.vars = "GeneName",
## variable.name = "Stage", : The melt generic in data.table has been passed a
## data.frame and will attempt to redirect to the relevant reshape2 method; please
## note that reshape2 is deprecated, and this redirection is now deprecated as
## well. To continue using melt methods from reshape2 while both libraries are
## attached, e.g. melt.list, you can prepend the namespace like
## reshape2::melt(averaged_geneFramedownparabola). In the next version, this
## warning will become an error.
ggplot(geneFrame_long_downparabola, aes(x = Stage, y = Log2FoldChange, group = GeneName, color = GeneName)) +
geom_line()

# Plot genes that peak during the 21dpa and Ripe stages but are expressed less during the MG and Br stages
upparabolarows <- c("Slym01g029610.1", "Slym12g366580.1","Slym11g344500.1","Slym06g191990.1")
averaged_geneFrameupparabola <- averaged_geneFrame[upparabolarows, ]
geneFrame_long_upparabola <- melt(averaged_geneFrameupparabola, id.vars = "GeneName", variable.name = "Stage", value.name = "Log2FoldChange")
## Warning in melt(averaged_geneFrameupparabola, id.vars = "GeneName",
## variable.name = "Stage", : The melt generic in data.table has been passed a
## data.frame and will attempt to redirect to the relevant reshape2 method; please
## note that reshape2 is deprecated, and this redirection is now deprecated as
## well. To continue using melt methods from reshape2 while both libraries are
## attached, e.g. melt.list, you can prepend the namespace like
## reshape2::melt(averaged_geneFrameupparabola). In the next version, this warning
## will become an error.
ggplot(geneFrame_long_upparabola, aes(x = Stage, y = Log2FoldChange, group = GeneName, color = GeneName)) +
geom_line()

Heatmap
corrgeneframe <- geneFrame[, -(2:3)]
corrgeneframe <- corrgeneframe[, -(13)]
row.names(corrgeneframe) <- corrgeneframe$Gene
corrgeneframe <- corrgeneframe[, -(1)]
corrgeneframe <- t(corrgeneframe)
correlation_matrix <- cor(as.matrix(corrgeneframe))
heatmap <- Heatmap(correlation_matrix, name = "Correlation", col = colorRamp2(c(-1, 0, 1), c("blue", "white", "red")), show_row_names = TRUE, show_column_names = TRUE, column_names_gp = grid::gpar(fontsize = 8),
row_names_gp = grid::gpar(fontsize = 8))
draw(heatmap)
