Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
custom
LetteraScala_Ageing
bulk_RNAseq
Commits
4560b203
You need to sign in or sign up before continuing.
Commit
4560b203
authored
Apr 21, 2023
by
Teresa Tavella
Browse files
add data and script
parent
e777651b
Changes
2
Show whitespace changes
Inline
Side-by-side
Paper_figures.Rmd
View file @
4560b203
---
title: "geing GSEA reactome plot divided by category"
author:
""
pdf_document: default
author:
''
output:
html_document:
html_document:
null
df_print: paged
pdf_document: default
word_document: default
pdf_document: default
title: "geing GSEA reactome plot divided by category"
---
...
...
@@ -243,7 +244,7 @@ doHeatmap3 <- function(df, sinfo, num_row_clu = 2, high_genes = NULL, top_annot
width = 10, height = 10,
heatmap_legend_param = list(
title = "Z-score",
at = c(round(min(hm_matrix)),0,round(max(hm_matrix))),
#
at = c(round(min(hm_matrix)),0,round(max(hm_matrix))),
legend_direction = "horizontal",
legend_width = unit(4, "cm")),
)
...
...
@@ -286,9 +287,9 @@ mat_gg <- as.data.frame(dimicco$deseq$rlog)[unique(gg), ]
annocat_signif <- annotcat[rownames(mat_gg),]
mat_gg_scaled <- t(scale(t(mat_gg)))
dimicco_hm <- doHeatmap2(df = t(mat_gg_scaled), sinfo = sinfo, high_genes =unique(gg))
rorder <- row_order(dimicco_hm)
mat_gg_scaled_names <- mat_gg_scaled[rorder,]
#
dimicco_hm <- doHeatmap2(df = t(mat_gg_scaled), sinfo = sinfo, high_genes =unique(gg))
#
rorder <- row_order(dimicco_hm)
#
mat_gg_scaled_names <- mat_gg_scaled[rorder,]
annocat_signif <- annocat_signif[,dt$Description]
annocat_signif <- annocat_signif[rownames(mat_gg_scaled ),] # order automatically
...
...
@@ -304,13 +305,13 @@ for (i in dt$Description) {
cn <- dt[dt$Description == i, 'Category']
colors[i] <- my_cols[[cn]]
}
ht3 = Heatmap(as.matrix(annocat_signif), name = " ",show_column_names = TRUE,
show_row_names =FALSE,
border = TRUE,row_names_gp = gpar(fontsize = 4),
column_names_gp = gpar(fontsize = 6, rot = 90),
rect_gp = gpar(col = "black", lwd = 0.5),
col = colors ,na_col = "white",
heatmap_legend_param = list(labels = dt$Category ))#c(rep('', dim(annocat_signif)[2]))) )
#
ht3 = Heatmap(as.matrix(annocat_signif), name = " ",show_column_names = TRUE,
#
show_row_names =FALSE,
#
border = TRUE,row_names_gp = gpar(fontsize = 4),
#
column_names_gp = gpar(fontsize = 6, rot = 90),
#
rect_gp = gpar(col = "black", lwd = 0.5),
#
col = colors ,na_col = "white",
#
heatmap_legend_param = list(labels = dt$Category ))#c(rep('', dim(annocat_signif)[2]))) )
## hm of gene in core enrichment and also signif all categories
# svg(filename=paste(plot.dir, paste0("HM_full_categories", "_ON_Old_vs_Young.svg"), sep = "/"),
...
...
@@ -342,17 +343,18 @@ annocat_signif <- annotcat[rownames(mat_gg),]
#annocat_signif <- annocat_signif[,dt$Category]
#annocat_signif <- annocat_signif[rownames(mat_gg_scaled ),] # order automatically
table(rownames(annocat_signif ) == rownames(mat_gg_scaled))
my_cols <- c(hue_pal()(length(levels(dt$Category))))
names(my_cols) <- levels(dt$Category)
ht3 = Heatmap(as.matrix(annocat_signif), name = " ",show_column_names = TRUE,
show_row_names =FALSE,
border = TRUE,row_names_gp = gpar(fontsize = 12),
column_names_gp = gpar(fontsize = 12, rot = 90),
rect_gp = gpar(col = "black", lwd = 0.5),
col = my_cols ,na_col = "white",
heatmap_legend_param = list(labels = levels(dt$Category) ))#c(rep('', dim(annocat_signif)[2]))) )
#
ht3 = Heatmap(as.matrix(annocat_signif), name = " ",show_column_names = TRUE,
#
show_row_names =FALSE,
#
border = TRUE,row_names_gp = gpar(fontsize = 12),
#
column_names_gp = gpar(fontsize = 12, rot = 90),
#
rect_gp = gpar(col = "black", lwd = 0.5),
#
col = my_cols ,na_col = "white",
#
heatmap_legend_param = list(labels = levels(dt$Category) ))#c(rep('', dim(annocat_signif)[2]))) )
# svg(filename=paste(plot.dir, paste0("HM_reduced_categories", "_ON_Old_vs_Young.svg"), sep = "/"),
# width=12,
...
...
@@ -394,52 +396,52 @@ dev.off()
##### HM of genes in the core enrichment and also signif single HM
```{r echo=FALSE,echo=FALSE, warning=FALSE,message=FALSE}
#######################################################
for (y in unique(dt$Category)) { ## for each macro category
gg <- c()
for (n in names(real_sig)) {
if (n %in% dt[dt$Category == y,'Description']){
print(n)
#gg <- rownames(real_sig[[n]])
gg <- append(gg,rownames(real_sig[[n]]))
}
}
gx <- unique(gg)
mat_gg <- as.data.frame(dimicco$deseq$rlog)[gx, ]
mat_gg_scaled <- t(scale(t(mat_gg)))
dimicco_hm <- doHeatmap2(df = mat_gg_scaled, sinfo = sinfo)
str(sinfo)
n <- gsub(' ','_',gsub('/','_',n))
# svg(filename=paste(plot.dir, paste0("HM_", y, "_ON_Old_vs_Young.svg"), sep = "/"),
# width=6,
# height=6,
# pointsize=12)
# draw(dimicco_hm)
# dev.off()
#
if (length(gx) > 39) {
png(filename=paste(plot.dir, paste0("HM_", y, "_ON_Old_vs_Young.png"), sep = "/"),
units = "in", width = 8, height = 25, res = 300)
draw(dimicco_hm, merge_legend = TRUE,heatmap_legend_side = 'top',column_title =y)
dev.off()
} else if (length(gx) > 22) {
png(filename=paste(plot.dir, paste0("HM_", y, "_ON_Old_vs_Young.png"), sep = "/"),
units = "in", width = 5, height = 8, res = 300)
draw(dimicco_hm, merge_legend = TRUE,heatmap_legend_side = 'top',column_title =y)
dev.off()
} else if (length(gx) > 10) {
png(filename=paste(plot.dir, paste0("HM_", y, "_ON_Old_vs_Young.png"), sep = "/"),
units = "in", width = 5, height = 6, res = 300)
draw(dimicco_hm, merge_legend = TRUE,heatmap_legend_side = 'top',column_title =y)
dev.off()
} else {
png(filename=paste(plot.dir, paste0("HM_", y, "_ON_Old_vs_Young.png"), sep = "/"),
units = "in", width = 4, height = 4, res = 300)
draw(dimicco_hm, merge_legend = TRUE,heatmap_legend_side = 'top',column_title =y)
dev.off()
}
}
#
#
for (y in unique(dt$Category)) { ## for each macro category
#
gg <- c()
#
for (n in names(real_sig)) {
#
if (n %in% dt[dt$Category == y,'Description']){
#
print(n)
#
#gg <- rownames(real_sig[[n]])
#
gg <- append(gg,rownames(real_sig[[n]]))
#
}
#
}
#
gx <- unique(gg)
#
mat_gg <- as.data.frame(dimicco$deseq$rlog)[gx, ]
#
mat_gg_scaled <- t(scale(t(mat_gg)))
#
dimicco_hm <- doHeatmap2(df = mat_gg_scaled, sinfo = sinfo)
#
#
str(sinfo)
#
n <- gsub(' ','_',gsub('/','_',n))
#
# svg(filename=paste(plot.dir, paste0("HM_", y, "_ON_Old_vs_Young.svg"), sep = "/"),
#
# width=6,
#
# height=6,
#
# pointsize=12)
#
# draw(dimicco_hm)
#
# dev.off()
#
#
#
if (length(gx) > 39) {
#
png(filename=paste(plot.dir, paste0("HM_", y, "_ON_Old_vs_Young.png"), sep = "/"),
#
units = "in", width = 8, height = 25, res = 300)
#
draw(dimicco_hm, merge_legend = TRUE,heatmap_legend_side = 'top',column_title =y)
#
dev.off()
#
} else if (length(gx) > 22) {
#
png(filename=paste(plot.dir, paste0("HM_", y, "_ON_Old_vs_Young.png"), sep = "/"),
#
units = "in", width = 5, height = 8, res = 300)
#
draw(dimicco_hm, merge_legend = TRUE,heatmap_legend_side = 'top',column_title =y)
#
dev.off()
#
} else if (length(gx) > 10) {
#
png(filename=paste(plot.dir, paste0("HM_", y, "_ON_Old_vs_Young.png"), sep = "/"),
#
units = "in", width = 5, height = 6, res = 300)
#
draw(dimicco_hm, merge_legend = TRUE,heatmap_legend_side = 'top',column_title =y)
#
dev.off()
#
} else {
#
png(filename=paste(plot.dir, paste0("HM_", y, "_ON_Old_vs_Young.png"), sep = "/"),
#
units = "in", width = 4, height = 4, res = 300)
#
draw(dimicco_hm, merge_legend = TRUE,heatmap_legend_side = 'top',column_title =y)
#
dev.off()
#
}
#
}
```
data/HM_reduced_categories_reverse_ON_Old_vs_Young_v1.svg
View file @
4560b203
This source diff could not be displayed because it is too large. You can
view the blob
instead.
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment