Skip to content

Commit

Permalink
Add is_gencode parameter to the getDegTx()
Browse files Browse the repository at this point in the history
  • Loading branch information
HediaTnani committed Jan 4, 2024
1 parent e8e1440 commit fb91268
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions R/getDegTx.R
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
#' @examples
#' getDegTx(covComb_tx_deg)
#' stopifnot(mean(rowMeans(assays(covComb_tx_deg)$tpm)) > 1)
getDegTx <- function(rse_tx, type = c("cell_component", "standard", "top1500"), sig_transcripts = select_transcripts(type), assayname = "tpm") {
getDegTx <- function(rse_tx, type = c("cell_component", "standard", "top1500"), sig_transcripts = select_transcripts(type), assayname = "tpm", is_gencode = TRUE) {

type = arg_match(type)

Expand All @@ -44,7 +44,14 @@ getDegTx <- function(rse_tx, type = c("cell_component", "standard", "top1500"),
if (!all(grepl("^ENST", rownames(rse_tx)))) {
stop("Error: Some rownames do not start with 'ENST'.")
}
rse_tx <- rse_tx[rownames(rse_tx) %in% sig_transcripts, , drop = FALSE]

if (is_gencode) {
rse_tx <- rse_tx[rownames(rse_tx) %in% sig_transcripts, , drop = FALSE]
}else{
new_transcripts <- gsub("\\..*", "", sig_transcripts)
rse_tx <- rse_tx[rownames(rse_tx) %in% new_transcripts, , drop = FALSE]
}

if (mean(rowMeans(assays(rse_tx)[[assayname]])) < 1) {
warning("The transcripts selected are lowly expressed in your dataset. This can impact downstream analysis.")
}
Expand Down

0 comments on commit fb91268

Please sign in to comment.