
Merge Gene and Transcript Level Differential Expression Tables
Source:R/join_DEG_DET.R
join_DEG_DET.RdCombines gene-level and transcript-level differential expression results into a single table, annotates the combined data with significance labels based on specified cutoffs, and filters transcripts based on their types.
Arguments
- DEG_tab
A
data.frameortibblecontaining gene-level differential expression results, includinggene_id,gene_name,log2FC, andpvaluecolumns.- DET_final_tab
A
data.frameortibblecontaining transcript-level differential expression results, includingtranscript_id,transcript_name,transcript_type,log2FC, andpvaluecolumns.- logfc_cut
A numeric value specifying the absolute log2 fold-change cutoff for significance.
- pval_cut
A numeric value specifying the p-value cutoff for significance.
Value
A tibble combining gene and transcript differential expression results, with additional columns:
id: gene or transcript ID.name: gene or transcript name.transcript_type: type of transcript or"gene"for gene-level entries.abs_log2FC: absolute value of log2 fold-change.significance:"sig"if significant based on cutoffs,"not_sig"otherwise.
Examples
# Sample gene-level data
DEG_tab <- data.frame(
gene_id = c("gene1", "gene2"),
gene_name = c("GeneA", "GeneB"),
log2FC = c(1.5, -2.0),
pvalue = c(0.01, 0.04)
)
# Sample transcript-level data
DET_final_tab <- data.frame(
transcript_id = c("tx1", "tx2", "tx3"),
transcript_name = c("Transcript1", "Transcript2", "Transcript3"),
transcript_type = c("protein_coding", "lncRNA", "processed_transcript"),
log2FC = c(1.2, -1.8, 0.5),
pvalue = c(0.02, 0.03, 0.2)
)
# Merge and annotate differential expression results
DEGs_DETs_table <- join_DEG_DET(
DEG_tab = DEG_tab,
DET_final_tab = DET_final_tab,
logfc_cut = 1,
pval_cut = 0.05
)
# View the result
print(DEGs_DETs_table)
#> feature_id feature_name log2FC pvalue feature_type significance is_de
#> 1 gene1 GeneA 1.5 0.01 gene sig yes
#> 2 gene2 GeneB -2.0 0.04 gene sig yes
#> 3 tx1 Transcript1 1.2 0.02 protein_coding sig yes
#> 4 tx2 Transcript2 -1.8 0.03 lncRNA sig yes
#> 5 tx3 Transcript3 0.5 0.20 processed_transcript not_sig no