Skip to content
Snippets Groups Projects

Figures valentina

Merged Susheel Busi requested to merge figures_valentina into master
3 files
+ 109
63
Compare changes
  • Side-by-side
  • Inline
Files
3
+ 49
41
@@ -23,51 +23,12 @@ stats <- read.csv(
check.names=FALSE
)
# reshape
stats_melted <- reshape2::melt(stats, id.vars=c("label", "type"), variable.name="tool", value.name="count")
stats_melted <- reshape2::melt(stats, id.vars=c("label", "col", "type"), variable.name="tool", value.name="count")
# change names
stats_melted$tool <- ASM_TOOL_NAMES[as.character(stats_melted$tool)]
## PLOT
plots <- list()
for(dtype in unique(stats_melted$type)){
dtype_df <- stats_melted[stats_melted$type == dtype,]
plots[[dtype]] <-
ggplot(data=dtype_df, aes(x=tool, y=count, fill=tool)) +
geom_col() +
scale_fill_manual(values=ASM_TOOL_COLORS$notmeth, guide=NULL) +
facet_wrap(vars(label), ncol=round(sqrt(length(unique(dtype_df$label)))), scales="free_y") +
labs(
# title="",
# subtitle="",
x="",
y=RGI_NAMES$type[dtype]
) +
theme_bw() +
theme(
# grid
panel.grid=element_blank(),
# strip
strip.background=element_rect(fill="white"),
strip.text=element_text(size=9, color="black"),
# axes
axis.title=element_text(size=12, color="black"),
axis.text.y=element_text(size=9, color="black"),
axis.text.x=element_text(size=9, color="black", angle=90, vjust=0.5, hjust=1)
)
}
# Total counts
stats_melted_aro <- stats_melted[stats_melted$type == dtype,]
stats_melted_aro <- aggregate(stats_melted_aro$count, by=list(tool=stats_melted_aro$tool), FUN=sum)
plots[["total"]] <-
ggplot(data=stats_melted_aro, aes(x=tool, y=x, fill=tool)) +
geom_col() +
scale_fill_manual(values=ASM_TOOL_COLORS$notmeth, guide=NULL) +
labs(
# title="",
# subtitle="",
x="",
y="Total hits"
) +
my_theme <-
theme_bw() +
theme(
# grid
@@ -81,6 +42,53 @@ plots[["total"]] <-
axis.text.x=element_text(size=9, color="black", angle=90, vjust=0.5, hjust=1)
)
plots <- list()
for(ctype in unique(stats_melted$type)){
# Counts per feature type
for(col in unique(stats_melted$col)){
df <- stats_melted[stats_melted$type == ctype & stats_melted$col == col,]
plots[[sprintf("%s_%s", ctype, col)]] <-
ggplot(data=df, aes(x=tool, y=count, fill=tool)) +
geom_col() +
scale_fill_manual(values=ASM_TOOL_COLORS$notmeth, guide=NULL) +
facet_wrap(vars(label), ncol=round(sqrt(length(unique(df$label)))), scales="free_y") +
labs(
# title="",
subtitle=sprintf("Hits: %s", ctype),
x="",
y=RGI_NAMES$col[col]
) +
my_theme
}
# Total counts
# df <- stats_melted[stats_melted$type == ctype,]
# df <- aggregate(df$count, by=list(tool=df$tool), FUN=sum)
# plots[[sprintf("%s_%s", ctype, "total")]] <-
# ggplot(data=df, aes(x=tool, y=x, fill=tool)) +
# geom_col() +
# scale_fill_manual(values=ASM_TOOL_COLORS$notmeth, guide=NULL) +
# labs(
# # title="",
# subtitle=sprintf("Hits: %s", ctype),
# x="",
# y="Total hits"
# ) +
# my_theme
}
# Total counts
df <- stats_melted[stats_melted$col == "ARO",]
df <- aggregate(df$count, by=list(tool=df$tool, type=df$type), FUN=sum)
plots[[sprintf("%s_%s", ctype, "total")]] <-
ggplot(data=df, aes(x=tool, y=x, fill=tool)) +
geom_col() +
scale_fill_manual(values=ASM_TOOL_COLORS$notmeth, guide=NULL) +
facet_wrap(vars(type), ncol=3) +
labs(
x="",
y="Total hits"
) +
my_theme
## PDF
pdf(snakemake@output$pdf, width=snakemake@params$width, height=snakemake@params$height)
for(pp in plots){ print(pp) }
Loading