Gene repertoire

The typical Ig repertoire comprises one immunoglobulin heavy chain (IGH) and two light chains, κ (IGK) and λ (IGL). Immunoglobulins undergo diversification through somatic recombination, randomly combining variable (V), diversity (D), and joining (J) gene segments.

Table (Data format)

These are examples of a tables containing the necessary informations for gene repertoire visualizations. The tables includes mock data specifically generated for this purpose.

Table 1

Code
library(stringr)
library(data.table)
library(reactable)


c_s = fread("../inst/data/c_s.txt")

reactable(

  c_s,
  defaultPageSize = 5,
  theme = reactableTheme(
    backgroundColor  = "transparent"
  )
)

Table 2

Code
m = fread("../inst/data/m.txt") |> as.matrix()


reactable(

  m,
  defaultPageSize = 5,
  theme = reactableTheme(
    backgroundColor  = "transparent"
  )
)

Table 3

Code
r_s = fread("../inst/data/r_s.txt")


reactable(

  r_s,
  defaultPageSize = 5,
  theme = reactableTheme(
    backgroundColor  = "transparent"
  )
)

Heatmap

A heatmap is a graphical representation of data where the individual values contained in a matrix are represented as colors.

The heatmap() function is a built-in feature of R, providing a powerful tool for generating high-quality heatmaps from matrices. It includes statistical functionalities to normalize input data, perform clustering algorithms and visualize the results

Code
library(ComplexHeatmap)

library(data.table)
library(stringr)

col_ann = HeatmapAnnotation(
    "cell" = c_s$cell,
    simple_anno_size = unit(.75, "lines"),
    col = list(
        cell = c(
            "cell01" = "#358DB9", 
            "cell02" = "#CF4E9C", 
            "cell03" = "#2E2A2B"
        )
    )
)

row_ann = rowAnnotation(
    "Type" = r_s$type,
    simple_anno_size = unit(.75, "lines"),
    col = list(
        Type = c(
            "protein_coding" = "#358DB9", 
            "antisense" = "#CF4E9C", 
            "pseudogene" = "#2E2A2B",
            "others" = "#2F509E"
        )
    )
)


Heatmap(
    m, name = "Repertoire",
    
    border = TRUE,
    
    left_annotation = row_ann,
    top_annotation = col_ann,
    
    row_split = 3, column_split = 3,
    
    clustering_distance_rows = "euclidean", 
    clustering_distance_columns = "euclidean",
    
    clustering_method_rows = "ward.D2",
    clustering_method_columns = "ward.D2",
    
    row_names_gp = gpar(fontsize = 6)
    
) |> 
  draw(merge_legends = TRUE, background = "transparent")