Author: David Barrios, Angela Villaverde and Carlos Prieto
Date: 2026-04-28

# Interactive visualization of dimensional reduction, clustering and cell propoerties for scRNA-Seq data analysis

#### David Barrios, Angela Villaverde and Carlos Prieto

#### 2026-04-28

# Getting started

`looking4clusters` is an R package distributed as part of CRAN. To install the package, start R and enter:

    if (!require("BiocManager", quietly = TRUE))
        install.packages("BiocManager")
    BiocManager::install("looking4clusters")

Once `looking4clusters` is installed, it can be loaded by the following command.

    library("looking4clusters")

# Introduction

looking4clusters performs interactive data visualization to facilitate the analysis of scRNA-Seq. Input data are projected in two-dimensional representations by applying dimensionality reduction methods such as: PCA, MDS, t-SNE, UMAP, NMF. The representation of the data in the same interface with interconnected graphs gives different perspectives which enable an adequate cell classification. The package also integrates the application of unsupervised clustering techniques whose results can be viewed interactively in the graphical interface. As a result, the package generates an interactive web page developed with JavaScript that can be easily explored with a web browser. In addition to the visualization, this interface allows the manual selection of groups, labeling of cell entities based on processed meta-information, generation of new graphs that show gene expression values of each cell, sample identification, and visually comparison of samples and clusters. Interactive visualization can be performed from a numeric matrix or a Seurat Object.

# Interactive visualization from a numeric matrix

    # Load sample data from scRNAseq package
    library(scRNAseq)
    sce <- ReprocessedAllenData("tophat_counts")
    counts <- assay(sce, "tophat_counts")

    # Perform dimensional reduction and an automatic cluster identification
    obj <- looking4clusters(t(counts), groups=colData(sce)[,'dissection_s'])

    # Output interactive visualization
    l4chtml(obj)

Alternatively you can iniltialize an object and then add clusters and reductions

    # Create a new looking for cluster object
    obj <- looking4clusters(t(counts), running_all=FALSE)

    # Add a sample clasification from input data
    groups <- colData(sce)[,'dissection_s']
    obj <- addcluster(obj, groups, myGroups=TRUE)

    # Perform a PCA and TSNE and add to the object as a dimensional reduction layout
    libsizes <- colSums(counts)
    size.factors <- libsizes/mean(libsizes)
    logcounts(sce) <- log2(t(t(counts)/size.factors) + 1)

    pca_data <- prcomp(t(logcounts(sce)), rank=50)
    obj <- addreduction(obj, pca_data$x[,1:2], "PCA")

    library(Rtsne)
    tsne_data <- Rtsne(pca_data$x[,1:50], pca = FALSE)
    obj <- addreduction(obj, tsne_data$Y, "TSNE")

    # Output interactive visualization
    l4chtml(obj)

# Interactive visualization from a SingleCellExperiment Object

    # Adding PCA and TSNE to the object
    reducedDims(sce) <- list(PCA=pca_data$x, TSNE=tsne_data$Y)

    # Create a looking4clusters object from a SingleCellExperiment object
    obj <- looking4clusters(sce, groups="dissection_s")

    # Output interactive visualization
    l4chtml(obj)

# Interactive visualization from a Seurat Object

    library(Seurat)
    library(Matrix)

    # Load sample data from ZilionisLungData
    lung <- ZilionisLungData()
    immune <- lung$Used & lung$used_in_NSCLC_immune
    lung <- lung[,immune]
    lung <- lung[1:10000,1:1000]

    exp_mat <- Matrix(counts(lung),sparse = TRUE)
    colnames(exp_mat) <- paste0(colnames(exp_mat), seq(1,ncol(exp_mat)))

    # Create a new Seurat object
    seurat_object <- CreateSeuratObject(counts = exp_mat,
                                        project = "Zilionis_immune")

    # Seurat data processing steps
    seurat_object <- NormalizeData(seurat_object)
    seurat_object <- ScaleData(seurat_object, features = rownames(seurat_object))

    seurat_object <- FindVariableFeatures(seurat_object)
    seurat_object <- RunPCA(seurat_object,
        features = VariableFeatures(object = seurat_object))

    # Create a looking4clusters object from a Seurat object
    obj <- looking4clusters(seurat_object)

    # Output interactive visualization
    l4chtml(obj)

# SessionInfo

    sessionInfo()

    ## R version 4.6.0 RC (2026-04-17 r89917)
    ## Platform: x86_64-pc-linux-gnu
    ## Running under: Ubuntu 24.04.4 LTS
    ##
    ## Matrix products: default
    ## BLAS:   /home/biocbuild/bbs-3.23-bioc/R/lib/libRblas.so
    ## LAPACK: /usr/lib/x86_64-linux-gnu/lapack/liblapack.so.3.12.0  LAPACK version 3.12.0
    ##
    ## locale:
    ##  [1] LC_CTYPE=en_US.UTF-8       LC_NUMERIC=C
    ##  [3] LC_TIME=en_GB              LC_COLLATE=C
    ##  [5] LC_MONETARY=en_US.UTF-8    LC_MESSAGES=en_US.UTF-8
    ##  [7] LC_PAPER=en_US.UTF-8       LC_NAME=C
    ##  [9] LC_ADDRESS=C               LC_TELEPHONE=C
    ## [11] LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=C
    ##
    ## time zone: America/New_York
    ## tzcode source: system (glibc)
    ##
    ## attached base packages:
    ## [1] stats4    stats     graphics  grDevices utils     datasets  methods
    ## [8] base
    ##
    ## other attached packages:
    ##  [1] Rtsne_0.17                  scRNAseq_2.25.0
    ##  [3] SingleCellExperiment_1.34.0 SummarizedExperiment_1.42.0
    ##  [5] Biobase_2.72.0              GenomicRanges_1.64.0
    ##  [7] Seqinfo_1.2.0               IRanges_2.46.0
    ##  [9] S4Vectors_0.50.0            BiocGenerics_0.58.0
    ## [11] generics_0.1.4              MatrixGenerics_1.24.0
    ## [13] matrixStats_1.5.0           looking4clusters_1.2.0
    ##
    ## loaded via a namespace (and not attached):
    ##   [1] RColorBrewer_1.1-3       jsonlite_2.0.0           magrittr_2.0.5
    ##   [4] modeltools_0.2-24        GenomicFeatures_1.64.0   gypsum_1.8.0
    ##   [7] farver_2.1.2             rmarkdown_2.31           BiocIO_1.22.0
    ##  [10] vctrs_0.7.3              memoise_2.0.1            Rsamtools_2.28.0
    ##  [13] RCurl_1.98-1.18          htmltools_0.5.9          S4Arrays_1.12.0
    ##  [16] AnnotationHub_4.2.0      curl_7.1.0               Rhdf5lib_2.0.0
    ##  [19] SparseArray_1.12.0       rhdf5_2.56.0             sass_0.4.10
    ##  [22] alabaster.base_1.12.0    bslib_0.10.0             alabaster.sce_1.12.0
    ##  [25] httr2_1.2.2              cachem_1.1.0             GenomicAlignments_1.48.0
    ##  [28] lifecycle_1.0.5          pkgconfig_2.0.3          Matrix_1.7-5
    ##  [31] R6_2.6.1                 fastmap_1.2.0            digest_0.6.39
    ##  [34] AnnotationDbi_1.74.0     RSpectra_0.16-2          ExperimentHub_3.2.0
    ##  [37] RSQLite_2.4.6            filelock_1.0.3           httr_1.4.8
    ##  [40] abind_1.4-8              compiler_4.6.0           bit64_4.8.0
    ##  [43] S7_0.2.2                 BiocParallel_1.46.0      viridis_0.6.5
    ##  [46] DBI_1.3.0                dendextend_1.19.1        HDF5Array_1.40.0
    ##  [49] alabaster.ranges_1.12.0  alabaster.schemas_1.12.0 MASS_7.3-65
    ##  [52] rappdirs_0.3.4           DelayedArray_0.38.0      rjson_0.2.23
    ##  [55] tools_4.6.0              otel_0.2.0               prabclus_2.3-5
    ##  [58] nnet_7.3-20              glue_1.8.1               h5mread_1.4.0
    ##  [61] restfulr_0.0.16          rhdf5filters_1.24.0      grid_4.6.0
    ##  [64] cluster_2.1.8.2          gtable_0.3.6             class_7.3-23
    ##  [67] ensembldb_2.36.0         XVector_0.52.0           flexmix_2.3-20
    ##  [70] BiocVersion_3.23.1       pillar_1.11.1            robustbase_0.99-7
    ##  [73] dplyr_1.2.1              BiocFileCache_3.2.0      lattice_0.22-9
    ##  [76] FNN_1.1.4.1              rtracklayer_1.72.0       bit_4.6.0
    ##  [79] tidyselect_1.2.1         Biostrings_2.80.0        knitr_1.51
    ##  [82] gridExtra_2.3            ProtGenerics_1.44.0      xfun_0.57
    ##  [85] diptest_0.77-2           DEoptimR_1.1-4           UCSC.utils_1.8.0
    ##  [88] lazyeval_0.2.3           yaml_2.3.12              evaluate_1.0.5
    ##  [91] codetools_0.2-20         cigarillo_1.2.0          kernlab_0.9-33
    ##  [94] tibble_3.3.1             alabaster.matrix_1.12.0  BiocManager_1.30.27
    ##  [97] cli_3.6.6                uwot_0.2.4               RcppParallel_5.1.11-2
    ## [100] jquerylib_0.1.4          dichromat_2.0-0.1        Rcpp_1.1.1-1.1
    ## [103] GenomeInfoDb_1.48.0      dbplyr_2.5.2             png_0.1-9
    ## [106] XML_3.99-0.23            parallel_4.6.0           ggplot2_4.0.3
    ## [109] blob_1.3.0               mclust_6.1.2             AnnotationFilter_1.36.0
    ## [112] parallelDist_0.2.7       bitops_1.0-9             viridisLite_0.4.3
    ## [115] alabaster.se_1.12.0      scales_1.4.0             crayon_1.5.3
    ## [118] fpc_2.2-14               rlang_1.2.0              KEGGREST_1.52.0