Skip to contents

Combines 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.

Usage

join_DEG_DET(deg_table, det_table, logfc_cut, pval_cut)

Arguments

deg_table

A data.frame or tibble containing gene-level differential expression results, including gene_id, gene_name, log2FC, and pvalue columns.

det_table

A data.frame or tibble containing transcript-level differential expression results, including transcript_id, transcript_name, transcript_type, log2FC, and pvalue columns.

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_table <- 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_table <- 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
deg_det_table <- join_DEG_DET(
  deg_table = deg_table,
  det_table = det_table,
  logfc_cut = 1,
  pval_cut = 0.05
)

# View the result
print(deg_det_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