Introduction

TODO.

suppressPackageStartupMessages({
  library("dplyr")
  library("ggplot2")
  library("plyr")
  library("Seurat")
  library("hdf5r")
  library("SingleCellExperiment")
  library("parallel")
  library("stringi")
  library("beeswarm")
  library("muscat")
  library("DESeq2")
  library("mitch")
  library("harmony")
  library("celldex")
  library("SingleR")
})

Load data

Load the h5 matrices.

flw3 <- Read10X_h5("FLW3/outs/filtered_feature_bc_matrix.h5")
## Genome matrix has multiple modalities, returning a list of matrices for this genome
flw3 <- flw3[[1]]
colnames(flw3) <- paste("flw3",colnames(flw3))
flw3_metadata <- data.frame(colnames(flw3))

flw5 <-  Read10X_h5("FLW5/outs/filtered_feature_bc_matrix.h5")
## Genome matrix has multiple modalities, returning a list of matrices for this genome
flw5 <- flw5[[1]]
colnames(flw5) <- paste("flw5",colnames(flw5))

Analyse the data for quality. Look at the depth of quantification per cell.

dim(flw3)
## [1] 36611  8438
summary(colSums(flw3))
##    Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
##      49    1454    2184    3913    3830  103443
sum(flw3)
## [1] 33020506
dim(flw5)
## [1] 36611  3844
summary(colSums(flw5))
##    Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
##      61    1822    2650    5628    4412  854439
sum(flw5)
## [1] 21634457

FLW3 has 8k cells and FLW5 has 4k. Median seq depth is also significantly higher for FLW5. FLW1 has 50% more reads as compared to FLW5.

Filter to remove cells with fewer than 100 reads.

flw3 <- flw3[,colSums(flw3)>=100]
flw5 <- flw5[,colSums(flw5)>=100]

Rename cells by sample origin, and join.

comb <- cbind(flw3,flw5)

cellmetadata <- as.data.frame(colnames(comb))
colnames(cellmetadata) = "cell_id"
cellmetadata$library <-sapply(strsplit(cellmetadata[,1]," "),"[[",1)

Normalise scRNA-seq data.

comb <- CreateSeuratObject(comb, project = "bcell", assay = "RNA", meta.data = cellmetadata)
## Warning: Feature names cannot have underscores ('_'), replacing with dashes
## ('-')
comb <- NormalizeData(comb)
## Normalizing layer: counts
comb <- FindVariableFeatures(comb, selection.method = "vst", nfeatures = 2000)
## Finding variable features for layer counts
comb <- ScaleData(comb)
## Centering and scaling data matrix
comb <- RunPCA(comb, features = VariableFeatures(object = comb))
## PC_ 1 
## Positive:  FCN1, TNFAIP2, NEAT1, LYN, FOS, PRAM1, FGR, SAT1, ITGAX, SPI1 
##     LYZ, TYMP, HK3, KLF10, LILRB2, PLXNB2, STAB1, P2RX1, COTL1, TCF7L2 
##     PSAP, KLF4, IFI30, CSF1R, CD14, SCO2, TGFBI, GLUL, ARRB2, DUSP1 
## Negative:  B2M, RPL13A, RPS27, RPL13, RPL19, RPL23A, RPL28, RPS15, RPL10, RPLP2 
##     RPS18, EEF1A1, RPS3, RPL18A, RPL27A, HLA-C, RPS6, RPL32, RPS25, RPS4X 
##     RPS19, TMSB4X, IL32, RPS12, RPSA, RPS14, HLA-E, RPL30, TRAC, RPS8 
## PC_ 2 
## Positive:  NEAT1, FCN1, TCF7L2, SAT1, PSAP, LYZ, ITGAX, COTL1, IFI30, TNFAIP2 
##     SPRED1, FOS, FGR, CSF1R, TYMP, SPI1, CST3, PRAM1, TYROBP, LST1 
##     FTH1, FCER1G, LILRB2, PLXNB2, SERPINA1, ANXA1, FCGR3A, P2RX1, VIM, KLF4 
## Negative:  BANK1, MS4A1, EBF1, OSBPL10, IGHM, CD79A, PLEKHG1, CD22, IGHD, IGKC 
##     NIBAN3, STEAP1B, CD79B, LARGE1, ANGPTL1, GNG7, LIX1-AS1, SLC38A11, DENND5B, PCDH9 
##     GPM6A, FCMR, IGLC2, HLA-DOB, RGS7, P2RX5, SOX5, POU2AF1, CCSER1, KCNH8 
## PC_ 3 
## Positive:  BANK1, CD74, MS4A1, EBF1, HLA-DRA, OSBPL10, HLA-DRB1, TCF4, IGHM, HLA-DQB1 
##     NIBAN3, CCSER1, CD79A, LYN, PLEKHG1, CD22, HLA-DPA1, HLA-DPB1, DENND5B, CD79B 
##     GNG7, STEAP1B, IGHD, RHEX, ANGPTL1, IGKC, CD83, GPM6A, SOX5, LIX1-AS1 
## Negative:  TRAC, IL32, NKG7, CCL5, B2M, GZMA, PRF1, KLRK1, CD3E, CTSW 
##     ZAP70, LCK, TRBC2, KLRD1, CD7, TRBC1, SPOCK2, GZMM, PZP, LAT 
##     CST7, IL2RB, GZMH, FGFBP2, TRGC2, CD8A, ADGRG1, SPON2, KLRB1, PCED1B-AS1 
## PC_ 4 
## Positive:  LINC01478, CUX2, LINC01374, EPHB1, COL24A1, FAM160A1, NRP1, LINC00996, PTPRS, AC023590.1 
##     BX284613.2, CLEC4C, PLXNA4, SCN9A, SCN1A-AS1, COL26A1, SLC7A11, PHEX, RHEX, TNFRSF21 
##     P3H2, MROH9, DNASE1L3, PACSIN1, CYYR1, SLC41A2, AC007381.1, DACH1, AL139340.1, GZMB 
## Negative:  MS4A1, BANK1, EBF1, CD79A, IGHM, OSBPL10, FTL, HLA-DRB1, CD79B, HLA-DRA 
##     TPT1, RPS12, S100A9, LYZ, CD22, IGHD, RPL32, COTL1, RPS3A, RPL26 
##     PLEKHG1, RPS27, FTH1, RPL21, STEAP1B, RPL31, RPL37, RPS15A, RPS8, AIF1 
## PC_ 5 
## Positive:  LINC01478, RPS3A, RPL32, RPS12, LINC01374, RPS27, CUX2, TPT1, EPHB1, COL24A1 
##     SCN9A, FAM160A1, RPL31, RPL37, RPS8, RPS29, RPL21, AC023590.1, RPL39, NRP1 
##     RPL26, RPS15A, CLEC4C, SCN1A-AS1, PTPRS, RPS25, RPL23, RPS20, EEF1A1, RPL28 
## Negative:  NKG7, KLRD1, PRF1, FGFBP2, IL2RB, SPON2, ADGRG1, GZMA, CTSW, CST7 
##     CCL5, NCAM1, GZMH, FCGR3A, KLRK1, TTC38, LINGO2, GZMB, GZMM, TBX21 
##     IL18RAP, CCL4, AGAP1, FCRL3, SGCD, EFHD2, ZAP70, TRGC2, ZMAT4, CD300A
DimHeatmap(comb, dims = 1, cells = 500, balanced = TRUE)

ElbowPlot(comb)

#comb <- JackStraw(comb, num.replicate = 100)
comb <- FindNeighbors(comb, dims = 1:5)
## Computing nearest neighbor graph
## Computing SNN
comb <- FindClusters(comb, algorithm = 3, resolution = 0.35, verbose = FALSE)
comb <- RunUMAP(comb, dims = 1:5)
## 21:38:34 UMAP embedding parameters a = 0.9922 b = 1.112
## 21:38:34 Read 12268 rows and found 5 numeric columns
## 21:38:34 Using Annoy for neighbor search, n_neighbors = 30
## 21:38:34 Building Annoy index with metric = cosine, n_trees = 50
## 0%   10   20   30   40   50   60   70   80   90   100%
## [----|----|----|----|----|----|----|----|----|----|
## **************************************************|
## 21:38:35 Writing NN index file to temp file /tmp/RtmpGBdcpW/file278aaf721476b0
## 21:38:35 Searching Annoy index using 1 thread, search_k = 3000
## 21:38:38 Annoy recall = 100%
## 21:38:39 Commencing smooth kNN distance calibration using 1 thread with target n_neighbors = 30
## 21:38:40 Initializing from normalized Laplacian + noise (using RSpectra)
## 21:38:41 Commencing optimization for 200 epochs, with 454472 positive edges
## 21:38:44 Optimization finished
DimPlot(comb, reduction = "umap")

#comb <- FindNeighbors(comb, dims = 1:10)
#comb <- FindClusters(comb, algorithm = 3, resolution = 0.5, verbose = FALSE)
#comb <- RunUMAP(comb, dims = 1:10)
#DimPlot(comb, reduction = "umap")

Look at the prominent cell markers.

message("Naive CD4+ T") # 1,3,5,6,7
## Naive CD4+ T
VlnPlot(comb, features = c("IL7R", "CCR7"))

message("CD14+ Mono")
## CD14+ Mono
VlnPlot(comb, features = c("CD14", "LYZ"))

message("Memory CD4+")
## Memory CD4+
VlnPlot(comb, features = c("IL7R", "S100A4"))

message("B") # 3,4
## B
VlnPlot(comb, features = c("MS4A1"))

message("CD8+ T") #2
## CD8+ T
VlnPlot(comb, features = c("CD8A"))

message("FCGR3A+ Mono") #?
## FCGR3A+ Mono
VlnPlot(comb, features = c("FCGR3A", "MS4A7"))

message("NK") # 2,5,6,7?
## NK
VlnPlot(comb, features = c("GNLY", "NKG7"))

message("DC") # 7?
## DC
VlnPlot(comb, features = c("FCER1A", "CST3"))

message("Platelet") #6
## Platelet
VlnPlot(comb, features = c("PPBP"))

new.cluster.ids <- c("Naive CD4 T", "CD14+ Mono", "Memory CD4 T", "B", "CD8 T", "FCGR3A+ Mono",
    "NK", "DC", "Platelet")

FeaturePlot(comb, features = c("IL7R","CCR7","CD14","LYZ","S100A4","MS4A1", "CD8A" ,
  "FCGR3A", "MS4A7", "GNLY", "NKG7", "FCER1A", "CST3", "PPBP","CD3E" , "CD19"))

# b calls
FeaturePlot(comb, features = c("CD19","CD27","CD38","CD24","CR2", "CD34", "MME", "IGH", "MS4A1"))
## Warning: The following requested variables were not found: IGH

#names(new.cluster.ids) <- levels(comb)

Cell Type Annotation

From Turner Lab: Create a reference using the monaco immune database. The Monaco reference consists of bulk RNA-seq samples of sorted immune cell populations from GSE107011 (Monaco et al. 2019). (from the CellDex documentation)

ref <- celldex::MonacoImmuneData()

DefaultAssay(comb) <- "RNA"
comb2 <- as.SingleCellExperiment(comb)

lc <- logcounts(comb2)

pred_imm_broad <- SingleR(test=comb2, ref=ref,
                          labels=ref$label.main)

head(pred_imm_broad)
## DataFrame with 6 rows and 4 columns
##                                                   scores       labels
##                                                 <matrix>  <character>
## flw3 AAACAGCCACATTAAC-1 0.1820259:0.180603:0.0727895:...    Monocytes
## flw3 AAACATGCACCGGTAT-1 0.2122461:0.180249:0.3923174:... CD4+ T cells
## flw3 AAACATGCATAATGTC-1 0.1270878:0.108664:0.2250859:... CD4+ T cells
## flw3 AAACATGCATACTCCT-1 0.2997265:0.200016:0.3719988:...      T cells
## flw3 AAACATGCATTATGGT-1 0.0879645:0.057035:0.1971177:... CD8+ T cells
## flw3 AAACCAACAATTAAGG-1 0.1432284:0.130935:0.2549445:...      T cells
##                         delta.next pruned.labels
##                          <numeric>   <character>
## flw3 AAACAGCCACATTAAC-1  0.0881583     Monocytes
## flw3 AAACATGCACCGGTAT-1  0.0660860  CD4+ T cells
## flw3 AAACATGCATAATGTC-1  0.0287451  CD4+ T cells
## flw3 AAACATGCATACTCCT-1  0.0167671       T cells
## flw3 AAACATGCATTATGGT-1  0.0727470  CD8+ T cells
## flw3 AAACCAACAATTAAGG-1  0.0324285       T cells
table(pred_imm_broad$pruned.labels)
## 
##         B cells       Basophils    CD4+ T cells    CD8+ T cells Dendritic cells 
##            1532              17            2213             660             781 
##       Monocytes     Neutrophils        NK cells     Progenitors         T cells 
##            3626               1            1116              58            2016
cellmetadata$label <- pred_imm_broad$pruned.labels

pred_imm_fine <- SingleR(test=comb2, ref=ref,
                          labels=ref$label.fine)
head(pred_imm_fine)
## DataFrame with 6 rows and 4 columns
##                                                  scores                 labels
##                                                <matrix>            <character>
## flw3 AAACAGCCACATTAAC-1 0.102446:0.2857514:0.101863:...    Classical monocytes
## flw3 AAACATGCACCGGTAT-1 0.341267:0.1765065:0.302618:...      Naive CD4 T cells
## flw3 AAACATGCATAATGTC-1 0.192675:0.0999070:0.186491:...              Th1 cells
## flw3 AAACATGCATACTCCT-1 0.355826:0.1991776:0.339087:... Central memory CD8 T..
## flw3 AAACATGCATTATGGT-1 0.195946:0.0798246:0.163111:...      Naive CD8 T cells
## flw3 AAACCAACAATTAAGG-1 0.224371:0.1166921:0.221881:...         Vd2 gd T cells
##                         delta.next          pruned.labels
##                          <numeric>            <character>
## flw3 AAACAGCCACATTAAC-1 0.06717359    Classical monocytes
## flw3 AAACATGCACCGGTAT-1 0.00385822      Naive CD4 T cells
## flw3 AAACATGCATAATGTC-1 0.00665070              Th1 cells
## flw3 AAACATGCATACTCCT-1 0.00600520 Central memory CD8 T..
## flw3 AAACATGCATTATGGT-1 0.08584850      Naive CD8 T cells
## flw3 AAACCAACAATTAAGG-1 0.00618026         Vd2 gd T cells
table(pred_imm_fine$pruned.labels)
## 
##    Central memory CD8 T cells           Classical monocytes 
##                           284                          2786 
##   Effector memory CD8 T cells             Exhausted B cells 
##                            26                            68 
##     Follicular helper T cells        Intermediate monocytes 
##                           151                           757 
##         Low-density basophils       Low-density neutrophils 
##                            17                             1 
##                    MAIT cells       Myeloid dendritic cells 
##                           336                           462 
##                 Naive B cells             Naive CD4 T cells 
##                           912                          1406 
##             Naive CD8 T cells          Natural killer cells 
##                           622                           956 
##       Non classical monocytes   Non-switched memory B cells 
##                           340                           443 
##            Non-Vd2 gd T cells                  Plasmablasts 
##                           594                             4 
##  Plasmacytoid dendritic cells              Progenitor cells 
##                            94                            60 
##       Switched memory B cells            T regulatory cells 
##                           206                           237 
## Terminal effector CD4 T cells Terminal effector CD8 T cells 
##                            54                            78 
##                     Th1 cells                Th1/Th17 cells 
##                           461                           169 
##                    Th17 cells                     Th2 cells 
##                           126                           104 
##                Vd2 gd T cells 
##                           341
cellmetadata$finelabel <- pred_imm_fine$pruned.labels

col_pal <- c('#e31a1c', '#ff7f00', "#999900", '#cc00ff', '#1f78b4', '#fdbf6f',
             '#33a02c', '#fb9a99', "#a6cee3", "#cc6699", "#b2df8a", "#99004d", "#66ff99",
             "#669999", "#006600", "#9966ff", "#cc9900", "#e6ccff", "#3399ff", "#ff66cc",
             "#ffcc66", "#003399")

annot_df <- data.frame(
  barcodes = rownames(pred_imm_broad),
  monaco_broad_annotation = pred_imm_broad$labels,
  monaco_broad_pruned_labels = pred_imm_broad$pruned.labels,
  monaco_fine_annotation = pred_imm_fine$labels,
  monaco_fine_pruned_labels = pred_imm_fine$pruned.labels
)

meta_inf <- comb@meta.data
meta_inf$cell_barcode <- colnames(comb)

meta_inf <- meta_inf %>% dplyr::left_join(y = annot_df,
                                          by = c("cell_barcode" = "barcodes"))
rownames(meta_inf) <- colnames(lc)

comb@meta.data <- meta_inf

DimPlot(comb, label=TRUE, group.by = "monaco_broad_annotation", reduction = "umap",
  cols = col_pal, pt.size = 0.7) + ggtitle("Annotation With the Monaco Reference Database")

Extract B cells

bcells <- comb[,which(meta_inf$monaco_broad_annotation == "B cells")]

bcells_metainf <- meta_inf[which(meta_inf$monaco_broad_annotation == "B cells"),]

# remove non bcells
bcells_metainf <- bcells_metainf[grep("B cells",bcells_metainf$monaco_fine_annotation),]
bcells <- bcells[,which(colnames(bcells) %in% rownames(bcells_metainf))]

bcells <- FindVariableFeatures(bcells, selection.method = "vst", nfeatures = 2000)
## Finding variable features for layer counts
## Warning in simpleLoess(y, x, w, span, degree = degree, parametric = parametric,
## : pseudoinverse used at -2.8698
## Warning in simpleLoess(y, x, w, span, degree = degree, parametric = parametric,
## : neighborhood radius 0.30103
## Warning in simpleLoess(y, x, w, span, degree = degree, parametric = parametric,
## : reciprocal condition number 9.7553e-15
bcells <- RunPCA(bcells, features = VariableFeatures(object = bcells))
## Warning: The following 121 features requested have zero variance; running
## reduction without them: IGLC1, DLGAP1, PDE3B, MSR1, IGKC, MAML2, AKAP6, CHODL,
## TOX, TMEM232, LINC01013, AC137810.1, AL445928.2, FNDC3B, PLPP3, AC073475.1,
## SCOC-AS1, IGHV1-18, PARP8, RORB, ST8SIA1, NRG1, MIR99AHG, CRPPA, FOXP1,
## AC008945.2, TRIM9, TRAC, KCNJ3, ATP1B1, LINC01374, NDFIP1, DOCK10, EEPD1,
## AC104170.1, AL049780.2, ESYT2, DOCK9, AC096741.1, RTN4RL1, SLC44A3, PDZD7,
## ZNF730, GRAMD1C, WASF1, AC025569.1, AL139317.5, F5, PSMA1, S100Z, LINC00299,
## ADGRE3, KLF5, TLCD4, NPSR1-AS1, BCL2L15, AC016405.1, AC019131.1, LIN7A,
## GRPEL2-AS1, CA3-AS1, AC104248.1, PVALB, BEX5, KLHL14, WDFY3, AL031595.2,
## AP002026.1, MBNL1, PGM2L1, MND1, CSTF3-DT, SNHG31, LPCAT2, AC132219.1,
## AL358781.2, AQP3, AC104825.1, AC034238.1, PCDHGA12, AC127526.1, AURKB,
## AC138470.2, AC021851.2, CCSER2, NUP35, ENOX2, AC008014.1, C2CD4D-AS1, MYOCOS,
## EXO1, ADAMTS12, USP49, FAAP24, MACC1, POT1-AS1, AL079338.1, RSPH3, FRMD4A,
## RALGAPA2, KIAA1841, TBC1D4, CYB561, ACTB, AL050309.1, ICOS, NINJ2, SRBD1,
## EFCAB12, MINPP1, UBXN8, ZC3HC1, SLC16A1, PTPN7, AC096711.2, TMEM144, ZBED3,
## TSKS, PLAC1, CDHR3, RCAN3
## Warning in PrepDR5(object = object, features = features, layer = layer, : The
## following features were not available: LEF1, CAMK4, BCL11B, AC105402.3,
## LINC01934, AL589693.1, TSHZ2, FAM13A, INPP4B, PRKCA, PLCL1, THEMIS, FYB1,
## NELL2, ZNF804A, EDA, TAFA1, PRKCH, TC2N, PLCB1, ITK, SOX2-OT, AC139720.1,
## LRMDA, FHIT, CD247, PRKCQ, IL7R, AOAH, TXK, PITPNC1, SERINC5, LRRC4C, PLXDC2,
## DLG2, PDE4D, RORA, SNX32, MLLT3, MAN1A1, SDK1, AAK1, A2M, ATP10A, AL590807.1,
## CADM2, TCF7, SLC8A1, AK5, GNAQ, APBA2, SKAP1, CD96, PCSK5, GLCCI1, LINC01320,
## TNIK, MAN1C1, CCDC102B, CSF3R, DISC1FP1, ANK3, VCAN, C1orf189, SPANXA2-OT1,
## SLC16A10, NCALD, STAT4, PID1, RAB39A, CD6, LINC01876, PAG1, NAV2, RASGRF2,
## MGAT4A, TFEC, FYN, AC114930.1, DIO1, AL359644.1, IL20RB-AS1, CDC14A, ROR2,
## AC002429.2, SGO1-AS1, IQGAP2, PPP2R2B, CD38, NIPAL1, AF165147.1, EPHA4,
## LINC01811, AL596218.1, AC092164.1, ADAMTS17, IKZF2, SLC26A7, BNC2, CTNNA3,
## ARHGAP6, AC011246.1, DPYD, NRCAM, C8orf88, LINC00861, AL163932.1, WNK3,
## LINC00298, EVA1C, PHACTR2, GPRIN3, SYNE2, AL109930.1, AL392086.3, NLRP3,
## ZNF112, AC105180.2, SSPN, IGF1R, SLFN12L, ATXN1, OXNAD1, SLCO3A1, SAMD12,
## CCDC113, SAMHD1, UBASH3B, BCAT1, CFAP44-AS1, PRDM1, LINC01550, FIRRE, ITGA6,
## TEX9, ASAP3, PLSCR2, AC008758.2, LINC01692, AC002460.2, IL6ST, LINC01505,
## TRERF1, AC008474.1, RNASE4, PDGFD, AL031602.2, PTPN13, GLIS3, MTRNR2L12, TRPA1,
## AL138716.1, RNLS, FGD6, PCAT1, ITGB1, LEF1-AS1, LINC01725, PRKCQ-AS1, EML6,
## JAZF1-AS1, TIMP3, FRY, CDK6, AL589740.1, ME3, LRRC7, FMN1, RGS1, WDR49, CEP128,
## DPP4, SEMA3A, ARHGAP20, AP003110.1, TPRG1, DTHD1, AC092546.1, ANKRD55, ERN1,
## IPCEF1, ARHGAP26, LGALSL-DT, SCIN, ZYG11A, STAP2, TMC4, KLHL13, WDR64,
## PRICKLE2, SATB1-AS1, PROX1, PCED1B, FKBP5, EPHA1-AS1, NIBAN1, MYO1D, STPG2,
## SUSD4, KCNMB2-AS1, AXDND1, ZNF662, AC091938.1, AL024498.1, ASMT, AC008691.1,
## SPATA21, AC093865.1, SUPT3H, PF4V1, AC006206.2, HSP90B1, CLEC12A, SNX11, SNTG2,
## MPP6, DGKH, SOBP, AC122697.1, AC068234.2, NPHP4, AC024382.1, CRADD, FRRS1,
## ADTRP, MYO5B, RETREG1, RHPN2, EGLN3, LRRC8C, AL450352.1, LINC00649, F13A1,
## ATXN7L1, TMEM163, RBMS1, TGFBR3, AC078881.1, NUDT7, AC091946.1, AL359232.1,
## PTPRJ, UPP2, CCND3, GRAP2, ZEB1-AS1, DEC1, ACTN1, SLC22A15, RHOBTB1, AMDHD1,
## TRABD2A, MAP4K3, AC079142.1, DENND2C, AC036176.1, ACSL1, SH3RF3, AC004158.1,
## POLE2, AL358937.1, MAP2, AC064834.1, TMTC2, RNF144A, PTPRM, KCNIP4, CD28, RTN1,
## LRGUK, AL596214.1, DLEU7, BTBD8, SORL1, AL359317.1, AC104850.2, LINC02246,
## OPRM1, NR3C2, CSGALNACT1, PCBP3, MAP4K3-DT, TESPA1, TSPAN9, IGKV3-11, THSD7B,
## AC095057.4, KCTD16, PLAC8L1, HKDC1, GIPR, KIAA0825, HIVEP3, EFCAB5, OSTN,
## LINC02725, FCRL5, CCDC30, JHY, SPATA7, LCP2, CHRM3-AS2, DAAM1, ZC2HC1B,
## AP001347.1, CERS6, CHODL-AS1, KIAA0319, AL353151.2, NTN1, TNIP3, RAB23, NRG3,
## FAM20A, BTBD3, KIF1B, DST, TTC28, ROPN1B, AL033523.1, RLN2, AL354989.1, ZNF462,
## AC006581.1, TMPRSS12, AL442636.1, AC007611.1, HLF, LINC00334, AC108879.1,
## NAALADL2-AS2, TLN2, SYTL3, EPS8, DPH6, AC016074.2, FRMD3, SYTL2, RASA3,
## LINC01353, CNGA1, PHYHD1, TNKS1BP1, CFAP54, AC090125.1, RTKN2, LINC01572,
## IMMP2L, AL365295.1, MYBL1, BTBD11, BRIP1, PAM, PRKD1, UACA, MAML3, GRAMD1B,
## RASGRP1, AC099560.1, SCGB2B2, MIR31HG, WNT2B, AC051619.5, CHAD, LRIG1,
## AC025211.1, KLF12, SPART-AS1, PYHIN1, IL6R, LEPROTL1, ARHGAP32, NAALADL2,
## PLEKHG5, ZSCAN31, AC004540.1, LINC01446, RAD51, AC090844.2, APCDD1, SGSM1,
## MPP7, INPP4A, CMTM8, NR6A1, AC073052.2, ZSCAN2, TTC39C, CTDSPL, CLIP4,
## LINC02234, AC026341.1, ARHGEF3, EEF1AKMT1, LINC02384, EDN1, AC016168.2, NRSN2,
## RASSF4, NDFIP2, AL163541.1, TEX29, AL161757.5, DPP9-AS1, MAST4, CACNB4, EXT1,
## CENPP, RUNX2, DISC1, BDNF-AS, WWC1, U91328.2, ST8SIA6, MSC-AS1, PROCR, SPAG16,
## ABLIM1, AL512288.1, AC007563.2, STK32B, AC092611.1, AL096854.1, KLRC2,
## AC018926.2, AC079336.4, COLEC12, AC090376.1, ZNF497, PPEF1, VSIG4, TPTE2, TLL2,
## CA3, KLHL32, DMXL2, AL590652.1, TNR, DTL, AC073050.1, STXBP4, PSTPIP2, TBXAS1,
## AL353660.1, PRKCA-AS1, CD2, TAFA2, WWC2, ADORA2A-AS1, AC055733.2, MACROD2,
## AC009975.1, ZCCHC24, CDR2, DIAPH2-AS1, SUMF1, PDGFC, WWTR1, ADD3-AS1, ARHGEF10,
## LINC00663, DHRS3, AC007262.2, FAAH2, LINC02391, MDFIC, NETO2, RBM47, FSD1L,
## LINC01619, SLFN5, LDLRAD4, CAMKMT, SCML4, KIF13A, AC108718.1, HIBADH, TENT5A,
## ITPKB, DAPK2, NME7, FRMPD3, TMEM135, NEXMIF, NFIA, SLC35E3, STK3, ANKRD53,
## TUBA4B, AL096712.2, GNAI1, AC007610.1, PDE6G, AC009005.1, AL096701.4,
## AC104459.1, RFX8, LNP1, AC024022.1, VWA3A, AC020558.1, SEMA4D, MCTP1, ACVR1,
## IL12RB2, EXPH5, AL158832.2, AC069029.1, FGF12, SLC36A3, CASC11, LINC02641,
## AC087280.2, ANKLE1, ZNF616, HCK, NETO1, CORO2B, MEF2C-AS1, RAP2C-AS1, BCL2,
## MAL, AL139020.1, SRSF12, RETN, TEX41, CCR9, ITPRIPL2, AC092802.1, ZNF2,
## GUCY1A1, NEDD4, AC011477.9, AC068643.1, SUFU, AVEN, DOK6, ITGAM, ALCAM, GTSCR1,
## AC092142.1, AC105001.1, GALNT14, CD226, PAK1, CC2D2A, IGHG4, TTLL1, TACR1,
## ARHGAP10, AFF2, C1orf216, FAAH, AC135803.1, AC095030.1, PIFO, TMIGD3,
## AL391069.2, AL589765.7, AC079779.2, TRAPPC12-AS1, CCDC85A, LINC01873,
## BOLA3-AS1, REEP1, AC010680.1, LINC01821, GRIP2, NT5DC2, PROK2, GRK7, PFN2,
## CLDN11, LINC02028, FGF2, AC106897.1, ARHGAP26-AS1, AL357054.5, LINC01276,
## AL109615.2, AL357141.1, AL512283.2, AC079760.2, ANKRD7, AC015983.2, ADGRA2,
## AC012349.1, LINC00968, AL162253.1, MAMDC2-AS1, BAAT, PTGR1, PAPPA, ST8SIA6-AS1,
## AC069549.1, VSTM4, AC131971.1, AC104383.2, KDM4D, AP001977.1, CLEC1A, GUCY2C,
## TSPAN11, LINC02471, CCDC38, AC073912.1, AL353648.1, AL356966.1, CCDC175, ESRRB,
## AC023906.5, AC015914.1, C16orf96, C16orf89, AC136624.2, AC099518.5, FKBP10,
## AC004477.1, MRC2, S1PR5, AC005785.1, HPN-AS1, PVR, AC006116.8, AL121772.3,
## AP001437.2, H1F0, AR, SLC16A2, U52111.1, AL078459.1, PPM1L, CNTLN, ALDH1L2,
## TSHZ3, RGL1, AC073332.1, MCF2, AC104123.1, TENM1, TMEM38A, TEX53, PRKN, IL7,
## PTPRE, RAB3C, RBL2, HLCS, ZEB2, CATSPERE, AL512658.2, MICAL2, AGBL4,
## SUCLG2-AS1, FOXN3, FNBP1L, LINC01362, SOX4, ANXA10, FSIP2, ANKDD1B, AC114763.1,
## MBNL1-AS1, AC068051.1, RPS6KA6, MVB12B, AGTPBP1, SMYD2, BCAS3, SVIL, ZDHHC14,
## TANC2, LYPLAL1-DT, SEC22A, MAP2K6, GPR155, ADAMTS6, C20orf194, LINC01933,
## PCCA-AS1, LEPR, AP001831.1, AC010148.1, ZNF213, CEP85L, DNAH3, LINC00662,
## ARL13B, LAMA2, KIAA1671, MID1, TFR2, TTC23, CDKL5, KANK1, LINC02240, KDM2B-DT,
## AC128687.3, SMYD4, PPARA, C12orf74, HERC5, MORN3, CORO2A, TRAF3IP1, SLC9A2,
## NECTIN3-AS1, HIST1H3C, AC019257.1, ESCO2, CABCOCO1, AC025263.1, ATP2C2,
## LINC02080, LHFPL1, SPATA13, TFDP2, PKD2, FANCC, C1orf105, SUSD5, SLC4A4, DDX43,
## PFKFB1, LSM11, ANO5, AP002498.1, AL391097.3, AC100800.1, DIXDC1, H2AFX,
## ACTN1-AS1, AC004034.1, LINC01376, CENPK, ABCC4, DCP1B, SPATA6, LMTK2, PVT1,
## WWOX, ZC4H2, FGD4, ACSM3, UBTD2, AIG1, SCN3A, ATF7IP2, EFCAB11, MZT1, PKIA-AS1,
## PTPN4, TRAT1, DOCK3, C4orf33, GK-AS1, AL135978.2, CHEK2, KIZ-AS1, MAGI3,
## SUCLG2, ALG14, AC005062.1, SGO2, BMPR1A, FAM241A, NOS1AP, HSD11B1, MARC2,
## KCNK12, ABCA12, AC024028.1, SPTY2D1OS, AC079174.2, AL132712.1, AC015908.3,
## PPM1E, DLGAP1-AS5, AC068473.1, ZNF554, SNAP25-AS1, MOXD1, EOGT, AC092674.1,
## MEIKIN, GNAZ, LONRF3, SH2D3A, SLC2A13, ST7-AS2, SOX6, DNAJC5B, ALPK1, BLZF1,
## NARS2, CA6, RPL34-AS1, HULC, SEMA3D, HIPK2, AMPH, ZNF883, EHMT2-AS1, SCART1,
## KCTD1, MAP3K13, ADAM29, HDAC4-AS1, ERVMER61-1, LIMS1, ESR1, LINC00243,
## LARS2-AS1, IFT46, C20orf96, AC010275.1, KCNQ5, CNIH3, DRAM1, FAM169A, HIVEP2,
## TBC1D19, LYPLAL1, PPP2R5C, GDAP1, SGK1, ZNF609, DGKG, ELL2, RORA-AS1, TNRC6C,
## MCC, PIP4P2, AC092650.1, CPQ, TTN, RBL1, PITPNA, GAS7, SAMD3, GAB1, L3MBTL4,
## C1orf21, NCOA7-AS1, AC004083.1, ZRANB2-AS2, BCL2L2, LINC01284, AL590006.1,
## TRG-AS1, LINC01435, AP000829.1, IRAK3, THRB, EFCAB2, AC117834.1, RBMS3, PATJ,
## VSIR, FRG1-DT, FAM102A, KCNN3, AC117383.1, KCNMB2, SOGA3, COL28A1, FBXL22,
## AL590101.1, KBTBD7, RFPL1S, TCF7L1, FRMPD3-AS1, AC090825.1, FUCA2, SNHG22,
## ABHD3, DDAH1, SIRPG, NLK, SLC16A1-AS1, TRPS1, CLEC7A, AC005884.1, PXN, MEGF9,
## HADH, PARM1, FBXO32, EDAR, RNF207, UTS2, TTLL7, ARHGAP29-AS1, FLG-AS1,
## LINC01350, WNT3A, AC009486.2, AC008170.1, SULT1C4, FAP, AOX1, AC108066.1,
## AC019211.1, SH3BP4, RAMP1, AC026167.1, AC099332.2, CADM2-AS2, GPR15, LINC01206,
## LINC01983, AMBN, ODAPH, AC021087.1, MIR5689HG, AL358777.1, GNMT, SCAT8, FAXC,
## LINC02526, STRIP2, CLEC5A, GDA, AL512634.1, AL353742.1, AL157829.1,
## PPP1R26-AS1, AL450322.1, AC069544.1, C10orf67, AL157394.3, AL139124.1,
## AL139123.1, AP001160.2, JRKL-AS1, AC068792.1, IL22, AC010201.1, AC089985.1,
## WASF3-AS1, AL157813.1
## PC_ 1 
## Positive:  STEAP1B, GPM6A, CCSER1, AC007368.1, SOX5, AL355076.2, LARGE1, RGS7, SLC38A11, GALNTL6 
##     LIX1-AS1, AL592429.2, IGLC2, PCDH9, RHEX, KCNH8, LINC02550, GEN1, IGLC3, JCHAIN 
##     SYN3, TCL1A, IGHG1, ANK2, NTNG1, PTCHD1-AS, SYT1, MZB1, IGHG3, IFNG-AS1 
## Negative:  NEAT1, ITGAX, IL32, CCL5, FOS, ZAP70, LCK, PZP, TRBC1, TRBC2 
##     HK3, XBP1, CD8A, DACH1, AGAP1, STAB1, NCAM1, AL136456.1, PLEKHA5, GZMK 
##     CD8B, FAM153A, SGCD, SLC4A10, LIPC, FLT3, HIP1, NRGN, FAM160A1, ACTG1 
## PC_ 2 
## Positive:  SOX5, AL355076.2, AC007368.1, GALNTL6, RHEX, GPM6A, GEN1, AL592429.2, ANK2, SYT1 
##     PTCHD1-AS, IGHG1, NEAT1, IGHA1, IGHA2, MZB1, TENM4, DNAH8, PTPRG, MIR3681HG 
##     JCHAIN, NTNG1, IGLC3, IGHGP, AC018742.1, RASSF6, FA2H, SNED1, ITGAX, AC246817.1 
## Negative:  LIX1-AS1, SYN3, TCL1A, LARGE1, KCNH8, PCDH9, SLC38A11, LINC02550, STEAP1B, PLD5 
##     IFNG-AS1, LINC01340, RAPGEF5, CCSER1, LINC02161, CHL1, SLCO5A1, AL133346.1, SAXO2, DCLK2 
##     TXNDC5, USP53, PPP1R9A, SLC9C1, LYPD6B, BX284613.2, APBB2, NCKAP5, DIRC3, NCAM2 
## PC_ 3 
## Positive:  AC007368.1, RGS7, SLC38A11, GALNTL6, STEAP1B, CCSER1, GPM6A, TENM4, NTNG1, PTPRG 
##     PTCHD1-AS, DCLK2, IL32, TUBB1, AL136962.1, CCL5, AC107223.1, GP1BB, LCK, SAXO2 
##     ZAP70, TRBC1, XACT, CHL1, PF4, AC018695.2, CD8A, NCKAP5, AC005699.1, TRBC2 
## Negative:  SOX5, PCDH9, SYT1, IGHG3, IGHA2, LARGE1, IGHA1, AL355076.2, MIR3681HG, IGHG1 
##     DNAH8, KCNH8, PPP1R9A, IGHGP, RASSF6, AL592429.2, SYN3, IGLC2, TP63, TCL1A 
##     IFNG-AS1, GEN1, JCHAIN, CLNK, HSPB1, MZB1, TXNDC5, SLCO5A1, EPB41L4A, RAPGEF5 
## PC_ 4 
## Positive:  PCDH9, SOX5, SYT1, ANK2, GALNTL6, SYN3, GEN1, MIR3681HG, AC007368.1, TCL1A 
##     SMOC2, IGHG3, HSPB1, EPB41L4A, PTCHD1-AS, AC108169.1, LINC02227, NLGN4X, AC007100.1, AC079298.3 
##     AC018742.1, AC112206.2, ROR1, MZB1, ITGAX, XACT, AC034195.1, PHEX, AL136456.1, AC013652.1 
## Negative:  IGHA2, JCHAIN, IGHA1, AL355076.2, RASSF6, DNAH8, IFNG-AS1, SLCO5A1, TP63, SNED1 
##     NTNG1, RHEX, PTPRG, CCSER1, AL592429.2, KCNH8, AC109492.1, ATRNL1, DCLK2, PPP1R9A 
##     CLNK, SLC38A11, IGHG1, MARK1, FA2H, AC246817.1, TXNDC5, LIX1-AS1, KCNMA1, AC023590.1 
## PC_ 5 
## Positive:  IGHA2, IGHA1, LINC02550, GPM6A, SOX5, RASSF6, RHEX, LIX1-AS1, PPP1R9A, ANK2 
##     PCDH9, TCL1A, PTPRG, BX284613.2, CHL1, DCLK2, PLD5, MZB1, ROR1, TP63 
##     JCHAIN, AC109492.1, PTCHD1-AS, GEN1, FA2H, AC246817.1, SYN3, AL355076.2, EPB41L4A, MROH9 
## Negative:  IGHG1, NTNG1, IGHG3, IGHGP, SLCO5A1, KCNH8, IFNG-AS1, AC007368.1, RAPGEF5, IGLC3 
##     SLC9C1, RGS7, MIR3681HG, TXNDC5, MARK1, STEAP1B, SLC38A11, CA8, SNED1, IGLC2 
##     RPS27, AC107223.1, RPS12, RPS3A, AL136962.1, IGHV3-7, CENPE, IFI44L, EEF1A1, APBB2
DimHeatmap(bcells, dims = 1:2, cells = 500, balanced = TRUE)

DimHeatmap(bcells, dims = 3:4, cells = 500, balanced = TRUE)

ElbowPlot(bcells)

#comb <- JackStraw(comb, num.replicate = 100)
bcells <- FindNeighbors(bcells, dims = 1:4)
## Computing nearest neighbor graph
## Computing SNN
bcells <- FindClusters(bcells, algorithm = 3, resolution = 0.3, verbose = FALSE)

bcells <- RunUMAP(bcells, dims = 1:4)
## 21:39:40 UMAP embedding parameters a = 0.9922 b = 1.112
## 21:39:40 Read 1482 rows and found 4 numeric columns
## 21:39:40 Using Annoy for neighbor search, n_neighbors = 30
## 21:39:40 Building Annoy index with metric = cosine, n_trees = 50
## 0%   10   20   30   40   50   60   70   80   90   100%
## [----|----|----|----|----|----|----|----|----|----|
## **************************************************|
## 21:39:40 Writing NN index file to temp file /tmp/RtmpGBdcpW/file278aaf2de75cb0
## 21:39:40 Searching Annoy index using 1 thread, search_k = 3000
## 21:39:40 Annoy recall = 100%
## 21:39:41 Commencing smooth kNN distance calibration using 1 thread with target n_neighbors = 30
## 21:39:43 Initializing from normalized Laplacian + noise (using RSpectra)
## 21:39:43 Commencing optimization for 500 epochs, with 52898 positive edges
## 21:39:44 Optimization finished
DimPlot(bcells, reduction = "umap", label=TRUE,)

DimPlot(bcells, group.by="monaco_fine_annotation" , reduction = "umap", label=TRUE,)

bcells.markers <- FindAllMarkers(bcells, only.pos = TRUE)
## Calculating cluster 0
## Calculating cluster 1
## Calculating cluster 2
## Calculating cluster 3
## Calculating cluster 4
## Calculating cluster 5
bcells.markers %>%
    group_by(cluster) %>%
    dplyr::filter(avg_log2FC > 1)
## # A tibble: 1,723 × 7
## # Groups:   cluster [6]
##       p_val avg_log2FC pct.1 pct.2 p_val_adj cluster gene     
##       <dbl>      <dbl> <dbl> <dbl>     <dbl> <fct>   <chr>    
##  1 1.22e-42       1.42 0.591 0.236  4.48e-38 0       IL4R     
##  2 1.05e-35       1.19 0.798 0.562  3.85e-31 0       COL19A1  
##  3 9.21e-19       1.70 0.295 0.115  3.37e-14 0       FCER2    
##  4 9.60e-17       1.16 0.436 0.239  3.51e-12 0       TAPT1    
##  5 2.54e-14       1.61 0.244 0.099  9.31e-10 0       P2RY14   
##  6 2.63e-13       1.25 0.304 0.149  9.62e- 9 0       SATB1-AS1
##  7 7.40e-13       2.12 0.143 0.04   2.71e- 8 0       CD200    
##  8 2.94e-12       1.56 0.213 0.087  1.08e- 7 0       MAML3    
##  9 3.61e-12       1.06 0.333 0.181  1.32e- 7 0       ADARB1   
## 10 4.48e-12       1.50 0.225 0.096  1.64e- 7 0       SCN3A    
## # ℹ 1,713 more rows
bcells.markers %>%
    group_by(cluster) %>%
    dplyr::filter(avg_log2FC > 1) %>%
    slice_head(n = 10) %>%
    ungroup() -> top10
DoHeatmap(bcells, features = top10$gene) + NoLegend()
## Warning in DoHeatmap(bcells, features = top10$gene): The following features
## were omitted as they were not found in the scale.data slot for the RNA assay:
## SMIM31, AC092958.4, HYAL3, CDCP1, AC066580.1, LINC01143, PKLR, AL137798.2,
## ZEB2, LRMP, GAS7, SOX5-AS1, FGD4, FCRL5, ADK, BACH2, EPHA4, TEX9, HIPK2,
## C12orf74, SSPN, CSGALNACT1, CPED1, ARHGAP24, MAST4, PTPRJ, SCN3A, ADARB1,
## MAML3, CD200, SATB1-AS1, P2RY14, TAPT1, COL19A1, IL4R

Extract B cells 2

bcells_metainf <- meta_inf[which(meta_inf$monaco_broad_annotation == "B cells"),]

bcells2 <- comb[,(colnames(comb) %in% rownames(bcells_metainf))]

bcells2 <- FindVariableFeatures(bcells2, selection.method = "vst", nfeatures = 200)
## Finding variable features for layer counts
bcells2 <- RunPCA(bcells2, features = VariableFeatures(object = bcells2))
## Warning in PrepDR5(object = object, features = features, layer = layer, : The
## following features were not available: LRMDA, AC105402.3, CAMK4, LEF1, EDA,
## AL589693.1, BCL11B, FAM13A, TSHZ2, PRKCA, FYB1, INPP4B, PLCL1, MAN1A1, NRG1,
## THEMIS, NELL2, PDE3B, AOAH, PLCB1, TAFA1, PRKCH, SOX2-OT, TC2N, VCAN, ITK,
## IL7R, CD247, FHIT, AC139720.1, TXK, PID1, PRKCQ, SLC8A1, SERINC5, PITPNC1,
## HSP90B1, DLG2, AKAP6, FNDC3B, LRRC4C, SNX32, SDK1, MAML2, TOX, CSF3R,
## AL590807.1, GNAQ, BNC2, ITGB1, PDE4D, RORA, MLLT3, CADM2, ATP10A, STAT4, CD38,
## TNIK, TCF7, LINC01320, NCALD, SKAP1, PCSK5, GLCCI1, MAN1C1, AK5, CD96, APBA2,
## SPANXA2-OT1, DISC1FP1, RAB39A, DIO1, AC114930.1, CCDC102B, TFEC, TMEM232,
## CDC14A, ANK3, ROR2, EVA1C, CD6, PAG1, NAV2, FYN, AL359644.1, MGAT4A, SLC16A10,
## RGS18, LINC01876, NIPAL1, EEPD1, AC002429.2, IKZF2, DPYD, IL20RB-AS1, ITGB3,
## C1orf189, LINC01505, AL163541.1, IGF1R, NRCAM, PPP2R2B, RASGRF2, EPHA4,
## LINC01811, LINC00861, C8orf88, AF165147.1, IQGAP2, PDGFD, SAMD12, WNK3,
## LINC00298, AC011246.1, SLCO3A1, ADAMTS17.
## Warning in irlba(A = t(x = object), nv = npcs, ...): You're computing too large
## a percentage of total singular values, use a standard svd instead.
## PC_ 1 
## Positive:  PZP, XBP1, AL136456.1, SLC4A10, NRGN, FAM160A1, LINC02694, FMNL2, PRKAR2B, ITGA2B 
##     TUBB1, COL24A1, AC068633.1, GPC6, GP1BB, PPBP, AC011287.1, PF4, NCAM2, NCKAP5 
##     CENPE, CHODL, CAVIN2, LINC02161, GABRB2, AC246817.2, IGLC7, KCNMA1, MARK1, C5orf17 
## Negative:  SOX5, GPM6A, AC007368.1, GALNTL6, IGKC, IGLC2, ANK2, PCDH9, SYT1, IGHG1 
##     IGLC3, MZB1, PTCHD1-AS, IGLC1, IGHG3, NTNG1, PTPRG, MIR3681HG, IGHA1, IGHGP 
##     IGHA2, EPB41L4A, AC018742.1, XACT, ROR1, DLGAP1, DNAH8, BX284613.2, PPP1R9A, SMOC2 
## PC_ 2 
## Positive:  PCDH9, SOX5, IGHG3, IGHA2, SYT1, IGHA1, IGKC, PPP1R9A, MIR3681HG, DNAH8 
##     TP63, IGHG1, RASSF6, IGHGP, MZB1, IGLC2, DERL3, EPB41L4A, PLD5, KCNMA1 
##     SMOC2, MARK1, AC112206.2, CA8, LINC02161, IGLC1, AC106729.1, AC011287.1, CHODL, BX284613.2 
## Negative:  AC007368.1, GALNTL6, GPM6A, PTCHD1-AS, PTPRG, NTNG1, DLGAP1, MSR1, TUBB1, PZP 
##     GP1BB, PF4, ANK2, PPBP, PRKAR2B, AL136456.1, ROR1, SLC4A10, ITGA2B, NRGN 
##     LINC02694, OCA2, XACT, FAM160A1, AC246817.2, GABRB2, FMNL2, NCKAP5, C5orf17, AC018742.1 
## PC_ 3 
## Positive:  IGHA2, IGHA1, RASSF6, TP63, PTPRG, DNAH8, MZB1, PPP1R9A, IGLC1, NTNG1 
##     DERL3, IGLC2, KCNMA1, AC007368.1, IGHG1, MARK1, GPM6A, CHODL, MSR1, SLC44A5 
##     PPBP, PTCHD1-AS, XBP1, IGLC3, IGHGP, GP1BB, ERICH3, PF4, COL24A1, TUBB1 
## Negative:  PCDH9, SYT1, SOX5, ANK2, IGHG3, MIR3681HG, SMOC2, PLD5, ROR1, EPB41L4A 
##     LINC02161, AC112206.2, BX284613.2, XACT, IGKC, AL136456.1, GALNTL6, C5orf17, AC106729.1, AC018742.1 
##     NCAM2, LINC02694, GPC6, SLC4A10, CAVIN2, PZP, CA8, AC068633.1, AC246817.2, OCA2 
## PC_ 4 
## Positive:  IGHG1, IGHG3, NTNG1, IGHGP, IGLC3, IGLC2, MIR3681HG, DNAH8, MARK1, CHODL 
##     CA8, AC007368.1, XBP1, KCNMA1, DERL3, CENPE, GP1BB, NCKAP5, AC246817.2, AC106729.1 
##     PPBP, NRGN, PZP, COL24A1, ITGA2B, FMNL2, LINC02694, OCA2, AC018742.1, FAM160A1 
## Negative:  PCDH9, IGHA2, IGKC, GPM6A, IGHA1, ANK2, SOX5, BX284613.2, PLD5, PPP1R9A 
##     RASSF6, ROR1, MZB1, PTPRG, SYT1, TP63, EPB41L4A, GALNTL6, PTCHD1-AS, IGLC1 
##     LINC02161, SMOC2, SLC44A5, XACT, DLGAP1, MSR1, PRKAR2B, AC112206.2, CAVIN2, GABRB2 
## PC_ 5 
## Positive:  IGLC1, PCDH9, PLD5, IGKC, NTNG1, GPM6A, BX284613.2, PTPRG, MZB1, IGHG3 
##     IGHG1, DERL3, LINC02161, XACT, RASSF6, ROR1, PPP1R9A, IGHGP, EPB41L4A, CHODL 
##     NCAM2, NCKAP5, SLC44A5, AC246817.2, GABRB2, AC112206.2, PF4, COL24A1, MARK1, GP1BB 
## Negative:  SOX5, SYT1, ANK2, MIR3681HG, IGLC3, IGLC2, IGHA2, GALNTL6, SMOC2, PTCHD1-AS 
##     DNAH8, AC018742.1, IGHA1, AL136456.1, PZP, C5orf17, XBP1, LINC02694, DLGAP1, SLC4A10 
##     CA8, TP63, AC007368.1, AC106729.1, GPC6, AC068633.1, ERICH3, AC011287.1, FAM160A1, NRGN
DimHeatmap(bcells2, dims = 1:2, cells = 500, balanced = TRUE)

DimHeatmap(bcells2, dims = 3:4, cells = 500, balanced = TRUE)

Session information

sessionInfo()
## R version 4.4.0 (2024-04-24)
## Platform: x86_64-pc-linux-gnu
## Running under: Ubuntu 22.04.4 LTS
## 
## Matrix products: default
## BLAS:   /usr/lib/x86_64-linux-gnu/blas/libblas.so.3.10.0 
## LAPACK: /usr/lib/x86_64-linux-gnu/lapack/liblapack.so.3.10.0
## 
## locale:
##  [1] LC_CTYPE=en_US.UTF-8       LC_NUMERIC=C              
##  [3] LC_TIME=en_US.UTF-8        LC_COLLATE=en_US.UTF-8    
##  [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: Australia/Melbourne
## tzcode source: system (glibc)
## 
## attached base packages:
## [1] parallel  stats4    stats     graphics  grDevices utils     datasets 
## [8] methods   base     
## 
## other attached packages:
##  [1] dplyr_1.1.4                 ggplot2_3.5.1              
##  [3] SingleR_2.6.0               celldex_1.14.0             
##  [5] harmony_1.2.0               Rcpp_1.0.12                
##  [7] mitch_1.16.0                DESeq2_1.44.0              
##  [9] muscat_1.18.0               beeswarm_0.4.0             
## [11] stringi_1.8.4               SingleCellExperiment_1.26.0
## [13] SummarizedExperiment_1.34.0 Biobase_2.64.0             
## [15] GenomicRanges_1.56.0        GenomeInfoDb_1.40.0        
## [17] IRanges_2.38.0              S4Vectors_0.42.0           
## [19] BiocGenerics_0.50.0         MatrixGenerics_1.16.0      
## [21] matrixStats_1.3.0           hdf5r_1.3.10               
## [23] Seurat_5.0.3                SeuratObject_5.0.2         
## [25] sp_2.1-4                    plyr_1.8.9                 
## 
## loaded via a namespace (and not attached):
##   [1] progress_1.2.3            goftest_1.2-3            
##   [3] Biostrings_2.72.0         HDF5Array_1.32.0         
##   [5] vctrs_0.6.5               spatstat.random_3.2-3    
##   [7] digest_0.6.35             png_0.1-8                
##   [9] corpcor_1.6.10            shape_1.4.6.1            
##  [11] gypsum_1.0.1              ggrepel_0.9.5            
##  [13] echarts4r_0.4.5           deldir_2.0-4             
##  [15] parallelly_1.37.1         MASS_7.3-60.2            
##  [17] reshape2_1.4.4            httpuv_1.6.15            
##  [19] foreach_1.5.2             withr_3.0.0              
##  [21] ggrastr_1.0.2             xfun_0.43                
##  [23] survival_3.6-4            memoise_2.0.1.9000       
##  [25] ggbeeswarm_0.7.2          systemfonts_1.0.6        
##  [27] zoo_1.8-12                GlobalOptions_0.1.2      
##  [29] gtools_3.9.5              pbapply_1.7-2            
##  [31] prettyunits_1.2.0         GGally_2.2.1             
##  [33] KEGGREST_1.44.0           promises_1.3.0           
##  [35] httr_1.4.7                globals_0.16.3           
##  [37] fitdistrplus_1.1-11       rhdf5filters_1.16.0      
##  [39] rhdf5_2.48.0              rstudioapi_0.16.0        
##  [41] UCSC.utils_1.0.0          miniUI_0.1.1.1           
##  [43] generics_0.1.3            curl_5.2.1               
##  [45] zlibbioc_1.50.0           ScaledMatrix_1.12.0      
##  [47] polyclip_1.10-6           GenomeInfoDbData_1.2.12  
##  [49] ExperimentHub_2.12.0      SparseArray_1.4.3        
##  [51] xtable_1.8-4              stringr_1.5.1            
##  [53] doParallel_1.0.17         evaluate_0.23            
##  [55] S4Arrays_1.4.0            BiocFileCache_2.12.0     
##  [57] hms_1.1.3                 irlba_2.3.5.1            
##  [59] colorspace_2.1-0          filelock_1.0.3           
##  [61] ROCR_1.0-11               reticulate_1.36.1        
##  [63] spatstat.data_3.0-4       magrittr_2.0.3           
##  [65] lmtest_0.9-40             later_1.3.2              
##  [67] viridis_0.6.5             lattice_0.22-6           
##  [69] spatstat.geom_3.2-9       future.apply_1.11.2      
##  [71] scattermore_1.2           scuttle_1.14.0           
##  [73] cowplot_1.1.3             RcppAnnoy_0.0.22         
##  [75] pillar_1.9.0              nlme_3.1-164             
##  [77] iterators_1.0.14          caTools_1.18.2           
##  [79] compiler_4.4.0            beachmat_2.20.0          
##  [81] RSpectra_0.16-1           tensor_1.5               
##  [83] minqa_1.2.6               crayon_1.5.2             
##  [85] abind_1.4-5               scater_1.32.0            
##  [87] blme_1.0-5                locfit_1.5-9.9           
##  [89] bit_4.0.5                 codetools_0.2-20         
##  [91] BiocSingular_1.20.0       bslib_0.7.0              
##  [93] alabaster.ranges_1.4.0    GetoptLong_1.0.5         
##  [95] plotly_4.10.4             remaCor_0.0.18           
##  [97] mime_0.12                 splines_4.4.0            
##  [99] circlize_0.4.16           fastDummies_1.7.3        
## [101] dbplyr_2.5.0              sparseMatrixStats_1.16.0 
## [103] knitr_1.46                blob_1.2.4               
## [105] utf8_1.2.4                clue_0.3-65              
## [107] BiocVersion_3.19.1        lme4_1.1-35.3            
## [109] listenv_0.9.1             DelayedMatrixStats_1.26.0
## [111] Rdpack_2.6                tibble_3.2.1             
## [113] Matrix_1.7-0              statmod_1.5.0            
## [115] svglite_2.1.3             fANCOVA_0.6-1            
## [117] pkgconfig_2.0.3           tools_4.4.0              
## [119] cachem_1.0.8              RhpcBLASctl_0.23-42      
## [121] rbibutils_2.2.16          RSQLite_2.3.6            
## [123] viridisLite_0.4.2         DBI_1.2.2                
## [125] numDeriv_2016.8-1.1       fastmap_1.1.1            
## [127] rmarkdown_2.26            scales_1.3.0             
## [129] grid_4.4.0                ica_1.0-3                
## [131] broom_1.0.5               AnnotationHub_3.12.0     
## [133] sass_0.4.9                patchwork_1.2.0          
## [135] BiocManager_1.30.23       ggstats_0.6.0            
## [137] dotCall64_1.1-1           RANN_2.6.1               
## [139] alabaster.schemas_1.4.0   farver_2.1.1             
## [141] aod_1.3.3                 mgcv_1.9-1               
## [143] yaml_2.3.8                cli_3.6.2                
## [145] purrr_1.0.2               leiden_0.4.3.1           
## [147] lifecycle_1.0.4           uwot_0.2.2               
## [149] glmmTMB_1.1.9             mvtnorm_1.2-4            
## [151] backports_1.4.1           BiocParallel_1.38.0      
## [153] gtable_0.3.5              rjson_0.2.21             
## [155] ggridges_0.5.6            progressr_0.14.0         
## [157] limma_3.60.0              jsonlite_1.8.8           
## [159] edgeR_4.2.0               RcppHNSW_0.6.0           
## [161] bitops_1.0-7              kableExtra_1.4.0         
## [163] bit64_4.0.5               Rtsne_0.17               
## [165] alabaster.matrix_1.4.0    spatstat.utils_3.0-4     
## [167] BiocNeighbors_1.22.0      highr_0.10               
## [169] jquerylib_0.1.4           alabaster.se_1.4.0       
## [171] pbkrtest_0.5.2            lazyeval_0.2.2           
## [173] alabaster.base_1.4.1      shiny_1.8.1.1            
## [175] htmltools_0.5.8.1         sctransform_0.4.1        
## [177] rappdirs_0.3.3            glue_1.7.0               
## [179] spam_2.10-0               httr2_1.0.1              
## [181] XVector_0.44.0            gridExtra_2.3            
## [183] EnvStats_2.8.1            boot_1.3-30              
## [185] igraph_2.0.3              variancePartition_1.34.0 
## [187] TMB_1.9.11                R6_2.5.1                 
## [189] tidyr_1.3.1               gplots_3.1.3.1           
## [191] labeling_0.4.3            cluster_2.1.6            
## [193] Rhdf5lib_1.26.0           nloptr_2.0.3             
## [195] DelayedArray_0.30.1       tidyselect_1.2.1         
## [197] vipor_0.4.7               xml2_1.3.6               
## [199] AnnotationDbi_1.66.0      future_1.33.2            
## [201] rsvd_1.0.5                munsell_0.5.1            
## [203] KernSmooth_2.23-22        data.table_1.15.4        
## [205] htmlwidgets_1.6.4         ComplexHeatmap_2.20.0    
## [207] RColorBrewer_1.1-3        rlang_1.1.3              
## [209] spatstat.sparse_3.0-3     spatstat.explore_3.2-7   
## [211] lmerTest_3.1-3            fansi_1.0.6