Commit 2007c727 authored by Chaos's avatar Chaos
Browse files

modified dturtle.R in R

parent e75cb3e2
Loading
Loading
Loading
Loading
+12 −8
Original line number Diff line number Diff line
@@ -28,12 +28,14 @@ tx2gene <- function(organism){

dtu <-	function(
			ctl_count_files,
			ctl_name,
			ctl,
			obs_count_files,
			obs_name,
			obs,
			result_dir,
			organism = "mouse"
){
	biocpar <- BiocParallel::MulticoreParam(getDTthreads())

	tx2gene <- tx2gene(organism)

	names(ctl_count_files) <-	gsub("/quant.sf","",ctl_count_files) |>
@@ -53,18 +55,18 @@ dtu <- function(
	pd <-	data.frame(
				id = colnames(cts),
				group = c(
							rep(ctl_name,length(ctl_count_files)),
							rep(obs_name,length(obs_count_files))
							rep(ctl,length(ctl_count_files)),
							rep(obs,length(obs_count_files))
						)
			)

	dturtle <-	cts |>
				run_drimseq(
					tx2gene = tx2gene, 
					tx2gene = data.frame(tx2gene), 
					pd = pd, 
					id_col = "id",
					cond_col = "group",
					cond_levels = c(obs_name,ctl_name),
					cond_levels = c(obs,ctl),
					filtering_strategy = "bulk", 
					BPPARAM = biocpar
				) |> 
@@ -73,7 +75,7 @@ dtu <- function(
					posthoc = 0.1
				)

	dturtle$dge_analysis <- files |> 
	dturtle$dge_analysis <- c(ctl_count_files,obs_count_files) |> 
							import_dge_counts(
								type = "salmon",
								tx2gene = tx2gene[,c("transcript_id", "gene_name")]
@@ -82,7 +84,7 @@ dtu <- function(
								pd = pd,
								id_col = "id",
								cond_col = "group",
								cond_levels = c(obs_name,ctl_name),
								cond_levels = c(obs,ctl),
								lfc_threshold = 0.5,
								sig_threshold = 0.01,
								dge_calling_strategy = "bulk",
@@ -99,4 +101,6 @@ dtu <- function(
					add_gene_metadata = list("chromosome"="seqnames"), 
					add_tx_metadata = list("tx_expr_in_max" = c("exp_in", max))
				)
	
	dturtle
}
 No newline at end of file