plot_line <- function(dat, name, x_max, y_max, zero, cutoff) {
ggplot(data=dat, aes(x=kmer_multiplicity, y=Count, group=dat[,1], colour=dat[,1])) +
geom_line() +
scale_color_manual(values = merqury_brw(dat[,1]), name="k-mer") +
plot_zero_line(zero=zero) +
plot_zero_fill(zero=zero) +
plot_cutoff(cutoff) +
theme_bw() +
format_theme() +
scale_y_continuous(labels=fancy_scientific) +
coord_cartesian(xlim=c(0,x_max), ylim=c(0,y_max))
}
plot_fill <- function(dat, name, x_max, y_max, zero, cutoff) {
ggplot(data=dat, aes(x=kmer_multiplicity, y=Count)) +
geom_ribbon(aes(ymin=0, ymax=pmax(Count,0), fill=dat[,1], colour=dat[,1]), alpha=ALPHA, linetype=1) +
plot_zero_fill(zero=zero) +
plot_cutoff(cutoff) +
theme_bw() +
format_theme() +
scale_color_manual(values = merqury_brw(dat[,1]), name="k-mer") +
scale_fill_manual(values = merqury_brw(dat[,1]), name="k-mer") +
scale_y_continuous(labels=fancy_scientific) +
coord_cartesian(xlim=c(0,x_max), ylim=c(0,y_max))
}
plot_stack <- function(dat, name, x_max, y_max, zero, cutoff) {
dat[,1]=factor(dat[,1], levels=rev(levels(dat[,1]))) #[c(4,3,2,1)] reverse the order to stack from read-only
ggplot(data=dat, aes(x=kmer_multiplicity, y=Count, fill=dat[,1], colour=dat[,1])) +
geom_area(size=LINE_SIZE , alpha=ALPHA) +
plot_zero_stack(zero=zero) +
plot_cutoff(cutoff) +
theme_bw() +
format_theme() +
scale_color_manual(values = merqury_brw(dat[,1], direction=1), name="k-mer", breaks=rev(levels(dat[,1]))) +
scale_fill_manual(values = merqury_brw(dat[,1], direction=1), name="k-mer", breaks=rev(levels(dat[,1]))) +
scale_y_continuous(labels=fancy_scientific) +
coord_cartesian(xlim=c(0,x_max), ylim=c(0,y_max))
}
*.fl.png,*.ln.pngand*.st.pngplots have different palette orders and colour:value combinations for both thespectra-cnandspectra-asmplots. Below are examples for thespectra-cnplots:Compare the
scale_*_manualarguments between theplot_line/plot_fillandplot_stackfunctions inplot_spectra_cn.R, which I think it causing it:Similar cause for the
spectra-asmplots I imagine.