library(isoformic)
library(dplyr)
data_dir <- "data/preeclampsia"
abundance <- read_parquet(fs::path(data_dir, "pe_abundance.parquet"))
col_data <- read_parquet(fs::path(data_dir, "pe_col_data.parquet"))
det <- read_parquet(fs::path(data_dir, "pe_det.parquet"))
deg <- read_parquet(fs::path(data_dir, "pe_deg.parquet"))
annot_dir <- prepare_isoformic_annotation(download_reference(version = "50", file_type = "gff"))Every analysis in the other articles is a method of the IsoformicExperiment object, and each has a table-based counterpart for data that does not fit in the object, for example results already joined in a spreadsheet or a single gene exported from another tool. This article shows those counterparts on the tables of the introduction.
Transcript-to-gene table
make_tx_to_gene() builds the transcript-to-gene table from an annotation directory, a GENCODE transcript FASTA or a GFF3 file.
tx2gene <- make_tx_to_gene(annot_dir)
head(tx2gene)
#> # A tibble: 6 × 8
#> transcript_id gene_id havana_gene_id havana_transcript_id transcript_name
#> <chr> <chr> <chr> <chr> <chr>
#> 1 ENST00000741402.1 ENSG000… <NA> <NA> ENST00000741402
#> 2 ENST00000741407.1 ENSG000… <NA> <NA> ENST00000741407
#> 3 ENST00000741435.1 ENSG000… <NA> <NA> ENST00000741435
#> 4 ENST00000741404.1 ENSG000… <NA> <NA> ENST00000741404
#> 5 ENST00000741436.1 ENSG000… <NA> <NA> ENST00000741436
#> 6 ENST00000741437.1 ENSG000… <NA> <NA> ENST00000741437
#> # ℹ 3 more variables: gene_name <chr>, tx_length <int>, transcript_type <chr>Differential expression tables
join_DEG_DET() builds the long table that plot_log2fc() consumes from gene-level and transcript-level results, and is_deg_sig() flags significance with the same cutoffs the object uses.
de_long <- join_DEG_DET(
deg_table = left_join(deg, distinct(tx2gene, gene_id, gene_name), by = "gene_id"),
det_table = left_join(det, tx2gene, by = "transcript_id"),
logfc_cut = 1,
pval_cut = 0.05
)
head(de_long)
#> # A tibble: 6 × 9
#> feature_id feature_name feature_type gene_id gene_name log2FC pvalue qvalue
#> <chr> <chr> <chr> <chr> <chr> <dbl> <dbl> <dbl>
#> 1 ENSG0000000… TSPAN6 gene ENSG00… TSPAN6 -0.0865 0.608 0.791
#> 2 ENSG0000000… TNMD gene ENSG00… TNMD 0.471 0.111 0.305
#> 3 ENSG0000000… DPM1 gene ENSG00… DPM1 0.0415 0.423 0.652
#> 4 ENSG0000000… SCYL3 gene ENSG00… SCYL3 0.193 0.0884 0.266
#> 5 ENSG0000000… FIRRM gene ENSG00… FIRRM 0.198 0.134 0.342
#> 6 ENSG0000000… FGR gene ENSG00… FGR -0.154 0.186 0.411
#> # ℹ 1 more variable: is_de <chr>
plot_log2fc(de_long, feature = "RBPJ")
Expression profiles
prepare_profile_data() builds the table for plot_tx_expr() from the abundance table, the sample metadata and the transcript-to-gene table.
profile <- prepare_profile_data(
txi_transcript = abundance,
sample_metadata = col_data,
tx_to_gene = tx2gene,
de_result_gene = deg,
de_result_transcript = det,
var = "condition",
gene_name = "RBPJ"
)
head(profile)
#> # A tibble: 6 × 10
#> feature_id feature_name feature_type gene_id gene_name group mean_expr sd_expr
#> <chr> <chr> <chr> <chr> <chr> <fct> <dbl> <dbl>
#> 1 ENSG00000… RBPJ gene ENSG00… RBPJ pree… 27.7 8.81
#> 2 ENSG00000… RBPJ gene ENSG00… RBPJ cont… 33.3 5.27
#> 3 ENST00000… RBPJ-201 protein_cod… ENSG00… RBPJ pree… 0.116 0.148
#> 4 ENST00000… RBPJ-201 protein_cod… ENSG00… RBPJ cont… 0.125 0.160
#> 5 ENST00000… RBPJ-202 protein_cod… ENSG00… RBPJ pree… 0 0
#> 6 ENST00000… RBPJ-202 protein_cod… ENSG00… RBPJ cont… 0.952 1.39
#> # ℹ 2 more variables: n_samples <int>, is_de <chr>
plot_tx_expr(profile, gene_name = "RBPJ", group = "condition")
Exon structures
prepare_exon_annotation() extracts the exon table of a set of genes from a GFF3 or GTF file for plot_genomic_context(); here from the small GFF3 bundled with the package.
gff <- fs::path_package("isoformic", "extdata", "example.gff3.gz")
exons <- prepare_exon_annotation("RBPJ", gff, output_path = tempdir())
#> ℹ Parsing 'example.gff3.gz' (GFF) into '/tmp/RtmpUCorRQ/example_gff3'.
head(exons)
#> # A tibble: 6 × 12
#> gene_id gene_name transcript_id transcript_name transcript_type haplotype
#> <chr> <chr> <chr> <chr> <chr> <chr>
#> 1 ENSG0000016… RBPJ ENST00000342… RBPJ-201 protein_coding <NA>
#> 2 ENSG0000016… RBPJ ENST00000342… RBPJ-201 protein_coding <NA>
#> 3 ENSG0000016… RBPJ ENST00000342… RBPJ-201 protein_coding <NA>
#> 4 ENSG0000016… RBPJ ENST00000342… RBPJ-201 protein_coding <NA>
#> 5 ENSG0000016… RBPJ ENST00000342… RBPJ-201 protein_coding <NA>
#> 6 ENSG0000016… RBPJ ENST00000342… RBPJ-201 protein_coding <NA>
#> # ℹ 6 more variables: exon_id <chr>, exon_number <int>, seqid <chr>,
#> # start_pos <int>, end_pos <int>, strand <chr>
plot_genomic_context(exons, gene_name = "RBPJ")
Structural features and enrichment
transcript_features(), splicing_events(), transcript_orfs(), coding_potential() and splice_site_strength() accept an annotation directory in place of the object and then report every transcript of the annotation. run_enrichment() accepts a transcript table together with a tx_to_gene table, and run_productivity_enrichment() and run_apa_enrichment() accept the gene tables of productive_fraction() and apa_usage().
feats <- transcript_features(annot_dir, gene_name = "RBPJ")
feats[, c("transcript_name", "orf_length", "utr3_length", "nmd_predicted", "tss_group")]
#> # A tibble: 65 × 5
#> transcript_name orf_length utr3_length nmd_predicted tss_group
#> <chr> <int> <dbl> <lgl> <int>
#> 1 RBPJ-222 283 0 FALSE 1
#> 2 RBPJ-247 177 936 TRUE 1
#> 3 RBPJ-243 NA NA FALSE 2
#> 4 RBPJ-201 1503 4124 FALSE 3
#> 5 RBPJ-213 291 0 FALSE 3
#> 6 RBPJ-223 1503 4124 FALSE 3
#> 7 RBPJ-203 1398 4124 FALSE 3
#> 8 RBPJ-206 1503 0 FALSE 4
#> 9 RBPJ-225 NA NA FALSE 5
#> 10 RBPJ-229 145 0 FALSE 6
#> # ℹ 55 more rowsCiting isoformic
If you use isoformic in publications, please cite Mamede et al. (2025); citation("isoformic") prints the reference.
Session information
sessionInfo()
#> R version 4.6.2 (2026-10-29)
#> Platform: x86_64-pc-linux-gnu
#> Running under: Ubuntu 26.04.1 LTS
#>
#> Matrix products: default
#> BLAS: /usr/lib/x86_64-linux-gnu/openblas-pthread/libblas.so.3
#> LAPACK: /usr/lib/x86_64-linux-gnu/openblas-pthread/libopenblasp-r0.3.32.so; LAPACK version 3.12.0
#>
#> locale:
#> [1] LC_CTYPE=C.UTF-8 LC_NUMERIC=C LC_TIME=C.UTF-8
#> [4] LC_COLLATE=C.UTF-8 LC_MONETARY=C.UTF-8 LC_MESSAGES=C.UTF-8
#> [7] LC_PAPER=C.UTF-8 LC_NAME=C LC_ADDRESS=C
#> [10] LC_TELEPHONE=C LC_MEASUREMENT=C.UTF-8 LC_IDENTIFICATION=C
#>
#> time zone: UTC
#> tzcode source: system (glibc)
#>
#> attached base packages:
#> [1] stats graphics grDevices utils datasets methods base
#>
#> other attached packages:
#> [1] dplyr_1.2.1 isoformic_0.1.3
#>
#> loaded via a namespace (and not attached):
#> [1] gtable_0.3.6 jsonlite_2.0.0 compiler_4.6.2 Rcpp_1.1.2
#> [5] tidyselect_1.2.1 parallel_4.6.2 scales_1.4.0 yaml_2.3.12
#> [9] fastmap_1.2.0 ggplot2_4.0.4 R6_2.6.1 labeling_0.4.3
#> [13] generics_0.1.4 knitr_1.52 ggrepel_0.9.8 tibble_3.3.1
#> [17] DBI_1.3.0 pillar_1.11.1 RColorBrewer_1.1-3 rlang_1.3.0
#> [21] utf8_1.2.6 xfun_0.62 fs_2.1.0 S7_1.0.0
#> [25] otel_0.3.0 cli_3.6.6 withr_3.0.3 magrittr_2.0.5
#> [29] digest_0.6.39 grid_4.6.2 lifecycle_1.0.5 vctrs_0.7.3
#> [33] evaluate_1.0.5 glue_1.8.1 farver_2.1.2 duckdb_2.0.1
#> [37] rmarkdown_2.32 tools_4.6.2 pkgconfig_2.0.3 htmltools_0.5.9