####---- Most Differential Genes (Boxplots) ----####

plot_height = 350
plot_width = 300
box_transparency = 0.75
box_width = 0.75
box_line_thickness = 0.5
box_colours = default_sample_group_colours 	# note: changing this won't change the order the groups appear in the x axis. Merely what they are coloured as.
sample_labels = default_sample_group_labels	# note: changing this won't change the order the groups appear in the x axis. Merely what they are named as.
jitter_dot_size = 2
jitter_dot_colour = "black"
jitter_dot_width = 0.2
x_axis_label = ""
y_axis_label = "expression"
legend_position = "none"

top_10_genes = get_top_10_differential_genes(TRUE,"p") # upregulated, by p
for (gene_index in 1:10)
{
  gene = top_10_genes[gene_index]
  ggp = make_gene_expression_boxplot(ne_matrix, gene, box_transparency, box_width, box_line_thickness, box_colours, sample_labels, jitter_dot_size, jitter_dot_colour, jitter_dot_width,x_axis_label, y_axis_label, legend_position)
  save_plot(ggp,plot_height,plot_width,paste("<*path*>plots/most_differential_genes/most_upregulated_by_p_value/no.",gene_index,"_most_upregulated_gene.png<*/path*>",sep=""))
}

top_10_genes = get_top_10_differential_genes(FALSE,"p") # downregulated, by p
for (gene_index in 1:10)
{
  gene = top_10_genes[gene_index]
  ggp = make_gene_expression_boxplot(ne_matrix, gene, box_transparency, box_width, box_line_thickness, box_colours, sample_labels, jitter_dot_size, jitter_dot_colour, jitter_dot_width,x_axis_label, y_axis_label, legend_position)
  save_plot(ggp,plot_height,plot_width,paste("<*path*>plots/most_differential_genes/most_downregulated_by_p_value/no.",gene_index,"_most_downregulated_gene.png<*/path*>",sep=""))
}

top_10_genes = get_top_10_differential_genes(TRUE,"log2fold") # upregulated, by log2fold
for (gene_index in 1:10)
{
  gene = top_10_genes[gene_index]
  ggp = make_gene_expression_boxplot(ne_matrix, gene, box_transparency, box_width, box_line_thickness, box_colours, sample_labels, jitter_dot_size, jitter_dot_colour, jitter_dot_width,x_axis_label, y_axis_label, legend_position)
  save_plot(ggp,plot_height,plot_width,paste("<*path*>plots/most_differential_genes/most_upregulated_by_log2fold/no.",gene_index,"_most_upregulated_gene.png<*/path*>",sep=""))
}

top_10_genes = get_top_10_differential_genes(FALSE,"log2fold") # downregulated, by log2fold
for (gene_index in 1:10)
{
  gene = top_10_genes[gene_index]
  ggp = make_gene_expression_boxplot(ne_matrix, gene, box_transparency, box_width, box_line_thickness, box_colours, sample_labels, jitter_dot_size, jitter_dot_colour, jitter_dot_width,x_axis_label, y_axis_label, legend_position)
         save_plot(ggp,plot_height,plot_width,paste("<*path*>plots/most_differential_genes/most_downregulated_by_log2fold/no.",gene_index,"_most_downregulated_gene.png<*/path*>",sep=""))
}

