Skip to content

Commit

Permalink
Fix the annotation pattern for ENSEMBL and GENCODE
Browse files Browse the repository at this point in the history
Co-authored-by: Nick Eagles <[email protected]>
  • Loading branch information
HediaTnani and Nick-Eagles committed Jan 11, 2024
1 parent 6cf0e70 commit 060a2b9
Showing 1 changed file with 6 additions and 8 deletions.
14 changes: 6 additions & 8 deletions R/getDegTx.R
Original file line number Diff line number Diff line change
Expand Up @@ -53,17 +53,15 @@ getDegTx <- function(rse_tx, type = c("cell_component", "standard", "top1500"),
}

# Check patterns and perform operations based on the patterns
if (all(grepl("^ENST.*?\\.", rownames(rse_tx)))) {
# If all row names have the format 'ENST00000442987.3'
rse_tx <- rse_tx[rownames(rse_tx) %in% sig_transcripts, , drop = FALSE]
} else if (all(grepl("^ENST", rownames(rse_tx)))) {
# If all row names have the format 'ENST00000442987'
is_gencode = all(grepl("^ENST.*?\\.", rownames(rse_tx)))
is_ensembl = all(grepl("^ENST", rownames(rse_tx)) & !grepl("\\.", rownames(rse_tx)))
if (is_ensembl) {
sig_transcripts <- gsub("\\..*", "", sig_transcripts)
rse_tx <- rse_tx[rownames(rse_tx) %in% sig_transcripts, , drop = FALSE]
} else {
stop("Row names do not match the expected patterns.")
} else(!is_gencode) {
stop("Rownames must all be ENSEMBL or GENCODE transcript IDs.")
}

rse_tx <- rse_tx[rownames(rse_tx) %in% sig_transcripts, , drop = FALSE]

# Check if the row means is greater than 1
if (mean(rowMeans(assays(rse_tx)[[assayname]])) < 1) {
Expand Down

0 comments on commit 060a2b9

Please sign in to comment.