Skip to content

Commit

Permalink
Only_ruv parameter
Browse files Browse the repository at this point in the history
Radicals Sundevil NORAD SGI Rootkit Gunfight AGT. AMME Geraldton
Screening Social media terrorist M72750 red noise Stuck AMTRAK
  • Loading branch information
benjamin-james committed Jun 11, 2024
1 parent 2b95d44 commit b2472f6
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 2 deletions.
4 changes: 2 additions & 2 deletions R/deg.R
Original file line number Diff line number Diff line change
Expand Up @@ -216,7 +216,7 @@ deg.prepare <- function(se, pathology, case, control, sample.col, filter_only_ca
deg <- function(se, pathology, case, control, covariates,
method, output=NULL,
sample.col="Sample", cpm.cutoff=10,
filter_only_case_control=TRUE, NRUV=0,
filter_only_case_control=TRUE, NRUV=0, only_ruv=TRUE,
min.total.counts.per.sample=100, IQR.factor=1.5,
outlier.covariates=c("log1p_total_counts", "n_genes_by_counts", "pct_counts_mt", "pct_counts_ribo"),
verbose=TRUE,
Expand All @@ -237,7 +237,7 @@ deg <- function(se, pathology, case, control, covariates,
se = deg.ruvseq(se, pathology=pathology, covariates=covariates, sample.col=sample.col, NRUV=NRUV, verbose=verbose)
covariates = c(covariates, paste0("RUV_", 1:NRUV))
covariates = covariates[covariates %in% names(SummarizedExperiment::colData(se))]
if (length(covariates) > 0) {
if ((length(covariates) > 0) && only_ruv) {
covariates = covariates[grep("^RUV_[0-9]+$", covariates)]
}
}
Expand Down
12 changes: 12 additions & 0 deletions scripts/deg.R
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ get_args <- function(args) {
params$min.total.counts.per.sample = 100
params$ncores = as.integer(Sys.getenv("OMP_NUM_THREADS", getOption("mc.cores", 2)))
params$genes = NULL
params$only_ruv = TRUE
i = 1
help = function() {
cat("deg.R [options]
Expand All @@ -64,6 +65,8 @@ options:
-g, --genes File containing genes to use, one per line
--cpm-cutoff Counts per million cutoff for filtering genes.
--min-total-counts Number of total counts required per cell
--keep-covariates After RUV, keep the original covariates (not enabled by default)
--only-ruv After RUV, remove original covariates (enabled by default)
--iqr-factor Number of IQR above 75% away from outlier covariates to be a bad sample.
--outlier-covariates Covariates (in colData/.obs) to be used as covariates for pseudobulk outlier detection. If not present, or not calculated by benj::calculate_qc_metrics, will be thrown out.
")
Expand Down Expand Up @@ -115,6 +118,14 @@ options:
i = i + 1
params$case = args[[i]]
i = i + 1
} else if (arg == "--keep-covariates") {
i = i + 1
params$only_ruv = FALSE
i = i + 1
} else if (arg == "--only-ruv") {
i = i + 1
params$only_ruv = TRUE
i = i + 1
} else if (arg == "--control") {
i = i + 1
params$control = args[[i]]
Expand Down Expand Up @@ -215,4 +226,5 @@ adata = benj::deg(adata,
verbose=params$verbose,
min.total.counts.per.sample=params$min.total.counts.per.sample,
IQR.factor=params$IQR.factor,
only_ruv=params$only_ruv,
outlier.covariates=params$outlier.covariates)

0 comments on commit b2472f6

Please sign in to comment.