Commit 89dfaf48 authored by Chaos's avatar Chaos
Browse files

update

parent b1f7ff47
Loading
Loading
Loading
Loading
+16 −15
Original line number Diff line number Diff line
@@ -163,8 +163,8 @@ volcano_plot <- function(
					top_gene_number = 10,
					fold_change = 1.5,
					p_value = 0.05,
					special.gene = NULL,
					special.label = "special",
					special_gene = NULL,
					special_label = "special",
					show_p = TRUE,
					show_fc = TRUE,
					show_gene_number = TRUE,
@@ -238,49 +238,49 @@ volcano_plot <- function(
		gene_name %in% top.genes$down,
		label_down := gene_name
	][
		gene_name %in% special.gene,
		gene_name %in% special_gene,
		label_special := gene_name
	]

	if(!is.null(special.gene)){
		special.gene <- special.gene %>% .[. %in% dt$gene_name]
	if(!is.null(special_gene)){
		special_gene <- special_gene %>% .[. %in% dt$gene_name]
		
		dt[
			label_special %in% special.gene, 
			color := special.label
			label_special %in% special_gene, 
			color := special_label
		]
	}

	if(is.null(special.gene)){
	if(is.null(special_gene)){
		label_all <- c("Down","Not significant","Up")
		color_all <- c(color_down,color_ns,color_up)
	}else{
		label_all <- c("Down","Not significant",special.label,"Up")
		color_all <- c(color_down,color_ns,color_special,color_up)
		label_all <- c(special_label,"Down","Not significant","Up")
		color_all <- c(color_special,color_down,color_ns,color_up)
	}

	plot <-	ggplot() + 
			geom_point(
				data = dt[color == "not_sig"],
				aes(log2FC,log10P,color = color),
				aes(log2FC,log10P,color = color_ns),
				size = 0.8,
				show.legend = show_legend
			) +
			geom_point(
				data = dt[color == "up"],
				aes(log2FC,log10P,color = color),
				aes(log2FC,log10P,color = color_up),
				size = 0.8,
				show.legend = show_legend
			) +
			geom_point(
					data = dt[color == "down"],
					aes(log2FC,log10P,color = color),
					aes(log2FC,log10P,color = color_down),
					size = 0.8,
					show.legend = show_legend
			) +
			geom_point(
					data = dt[color == special.label],
					aes(log2FC,log10P,color = color),
					data = dt[color == special_label],
					aes(log2FC,log10P,color = color_special),
					size = 0.8,
					show.legend = show_legend
			) +
@@ -451,6 +451,7 @@ volcano_plot <- function(
	plot
}


simple_ego <- 	function(
					.data,
					regulation,