Commit ff9ece64 authored by fc-ibb105's avatar fc-ibb105
Browse files

modified RNA-seq.R in R

parent 83d2355c
Loading
Loading
Loading
Loading
+19 −5
Original line number Diff line number Diff line
@@ -313,8 +313,20 @@ c.volcano <- function(
					font = "serif",
					extend_size = 3
){
	if(is.null(sub_gene)){sub_gene <- .data$gene_name}
	if(is.null(sub_id)){sub_id <- .data$gene_id}
	n_compare <- .data$compare |> unique() |> length()

	sub_dt <-	rbind(
					.data[gene_name %in% sub_gene],
					.data[gene_id %in% sub_id]
				) |>
				unique()
	sub_gene <- sub_dt$gene_name
	sub_id <- sub_dt$gene_id

	if(length(sub_id) == 0){
		sub_gene <- .data$gene_name
		sub_id <- .data$gene_id
	}

	special_gene <-	special_gene %>% .[. %in% .data$gene_name]

@@ -336,10 +348,12 @@ c.volcano <- function(
			]

	stat <- merge(
				dt[,.(main = .N),regulation],
				dt[,.(sub = .N),sub_regulation] |>
				setnames("sub_regulation","regulation")
				dt[,.(main = .N),.(compare,regulation)],
				dt[,.(sub = .N),.(compare,regulation = sub_regulation)],
				all = T
			)[
				,sub := nafill(sub,fill = 0)
			][
				,label := 	fifelse(
								main == sub, 
								paste0("N = ",main),