Skip to content

Commit

Permalink
fix issue of site level report in over representation test
Browse files Browse the repository at this point in the history
  • Loading branch information
hsiaoyi0504 committed Feb 16, 2025
1 parent 565d4a3 commit d08b9a0
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
6 changes: 3 additions & 3 deletions R/enrichment.R
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ or_test <- function(se, database="GO Biological Process", backend="enrichr", dir
genes <- unique(significant$Gene)
} else if (metadata(dep)$level == "protein" | metadata(dep)$level == "gene") {
genes <- significant$name
} else if (metadata(dep)$level == "peptide") {
} else if (metadata(dep)$level %in% c("peptide", "site")) {
genes <- unique(significant$Gene)
}

Expand Down Expand Up @@ -446,7 +446,7 @@ test_ora_mod <- function(dep,
background <- unique(row_data$ID)
} else if (metadata(dep)$level == "protein") {
background <- unique(gsub("[.].*", "", row_data$name))
} else if (metadata(dep)$level == "peptide") {
} else if (metadata(dep)$level %in% c("peptide", "site")) {
background <- unique(row_data$Gene)
}

Expand Down Expand Up @@ -495,7 +495,7 @@ test_ora_mod <- function(dep,
genes <- unique(significant$ID)
} else if (metadata(dep)$level == "protein") {
genes <- significant$name
} else if (metadata(dep)$level == "peptide") {
} else if (metadata(dep)$level %in% c("peptide", "site")) {
genes <- unique(significant$Gene)
}

Expand Down
6 changes: 4 additions & 2 deletions R/io.R
Original file line number Diff line number Diff line change
Expand Up @@ -307,11 +307,13 @@ make_se_from_files <- function(quant_table_path, exp_anno_path, type = "TMT", le
"Gene", "ProteinID", "Peptide", "SequenceWindow", additional_cols)))
}
# test_match_DIA_column_design(data_unique, selected_cols, exp_design)
data_se <- make_se_customized(data_unique, selected_cols, exp_design, log2transform=log2transform, exp="DIA", level="peptide")
data_se <- make_se_customized(data_unique, selected_cols, exp_design, log2transform=log2transform, exp="DIA", level=level)
dimnames(data_se) <- list(dimnames(data_se)[[1]], colData(data_se)$sample_name)
colData(data_se)$label <- colData(data_se)$sample_name
}
rowData(data_se)$Gene <- rowData(data_se)$Genes
if (level == "peptide") {
rowData(data_se)$Gene <- rowData(data_se)$Genes
}
} else { # TMT
temp_exp_design <- exp_design
# sample without specified condition will be removed
Expand Down

0 comments on commit d08b9a0

Please sign in to comment.