Introduction

There are 3 samples.

  1. 1-17032023-GEX

  2. 2-09032023-GEX

  3. 3-13032023-GEX

I had to make a new custom reference genome with the HIV sequence.

suppressPackageStartupMessages({
  library("plyr")
  library("Seurat")
  library("hdf5r")
  library("SingleCellExperiment")
  library("parallel")
  library("stringi")
  library("beeswarm")
  library("muscat")
  library("DESeq2")
  library("mitch")
  library("limma")
  library("kableExtra")
  library("gplots")
})

Load data.

load("scanalyse1.Rdata")

Normalise data

cellmetadata <- data.frame(colnames(comb) ,sapply(strsplit(colnames(comb)," "),"[[",1))
colnames(cellmetadata) <- c("cell","patient")
comb <- CreateSeuratObject(comb, project = "nkmono", assay = "RNA", meta.data = cellmetadata)
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

PCA and Cluster

comb <- RunPCA(comb, features = VariableFeatures(object = comb))
## PC_ 1 
## Positive:  NAMPT, PLXDC2, FCN1, IRAK3, CYBB, CTSS, DMXL2, LYZ, LRMDA, FAM49A 
##     SLC8A1, DENND5A, KYNU, VCAN, GAB2, ACSL1, CST3, S100A9, GRK3, MCTP1 
##     IFI30, AIF1, HCK, RAB31, RBM47, TLR2, MNDA, LRRK2, CD83, UBE2E2 
## Negative:  SKAP1, CD247, NKG7, GNLY, GZMA, CCL5, GZMB, STAT4, RORA, FGFBP2 
##     IL32, NCALD, GZMH, TRBC2, CARD11, CD96, SPON2, C12orf75, KLRB1, YES1 
##     CD69, PPP2R2B, CLIC3, ISG20, BCL11B, TOX, TC2N, RHOH, KLRC3, PRSS23 
## PC_ 2 
## Positive:  DPYD, NEAT1, FNDC3B, S100A9, GBP2, SAMSN1, S100A8, ARHGAP26, GNLY, CCL5 
##     NKG7, CD247, FCGR3A, GZMA, FGFBP2, CCL4, ATP2B1, S100A12, PLCB1, FCN1 
##     AQP9, BCL2A1, TNFAIP3, C5AR1, CD14, MT2A, VCAN, GZMH, SKAP1, G0S2 
## Negative:  RHEX, LINC01374, CLEC4C, COBLL1, ITM2C, SERPINF1, LILRA4, NIBAN3, AC023590.1, FAM160A1 
##     CUX2, LINC01478, DERL3, TSPAN13, EPHB1, PLD4, SCT, RGS7, LRRC26, BLNK 
##     PTPRS, SPIB, P2RY14, SCAMP5, JCHAIN, SCN9A, TCF4, TPM2, NRP1, AC007381.1 
## PC_ 3 
## Positive:  TNFAIP3, TNFAIP6, PLCB1, CXCL8, AQP9, IL1B, CCL4, CLEC4E, IRAK2, NFKB1 
##     FNDC3B, CCL3, AZIN1-AS1, STEAP4, IVNS1ABP, SLC39A8, LIMK2, ACVR2A, PDE4D, STAT4 
##     ARHGAP26, S100A12, CD247, ACSL1, IER3, GZMB, EREG, SKAP1, LINC00910, CCL3L1 
## Negative:  CDKN1C, HES4, PAPSS2, CSF1R, SNED1, FMNL2, CKB, HLA-DPA1, AC104809.2, HMOX1 
##     MS4A7, LYPD2, CD86, CTSL, VMO1, SMIM25, AC020651.2, LST1, IFITM3, CCDC26 
##     AC005237.1, SPRED1, TIMP1, TMTC1, CD79B, HLA-DPB1, FAM20A, AIF1, MYOF, LINC02432 
## PC_ 4 
## Positive:  HBEGF, SLC2A3, S100A12, ADAM28, VEGFA, GPAT3, RNF24, FOS, FCER1A, S100A8 
##     VCAN, IL7R, AC020656.1, CAMK4, TMEM170B, LYZ, LGALS2, PLBD1, SDC2, SLC25A37 
##     FOLR3, INPP4B, S100A9, LMNA, CD1C, CAMK2A, ARSI, SNHG29, PADI4, CLEC10A 
## Negative:  FCGR3A, CCL4, MTSS1, AC020651.2, TCF7L2, CDKN1C, CCL3, IL1B, HES4, IFITM3 
##     GCH1, SETBP1, MS4A7, LINC02085, KCNJ2, ZEB2, AZIN1-AS1, FMNL2, CCL4L2, MIR3142HG 
##     MIR155HG, SMIM25, GBP2, CSF1R, SERPINB9, MGLL, CCL3L1, BATF3, TNF, IL1A 
## PC_ 5 
## Positive:  IL7R, CAMK4, LTB, INPP4B, BACH2, CD28, ZEB1, TRAC, NELL2, CD3D 
##     LEF1, CD3G, CD27, TNFAIP8, THEMIS, PATJ, ANK3, CCR7, MAL, BCL11B 
##     TRAF1, GPR183, GZMK, TNFAIP3, NR3C2, AQP3, FAAH2, SNHG29, IL1B, HLA-DQA1 
## Negative:  GZMB, FGFBP2, SPON2, CLIC3, FCGR3A, BNC2, PRSS23, GZMH, GNLY, NKG7 
##     S100A8, MEGF9, ZEB2, CLEC12A, S100A12, PPM1L, S100A9, PADI4, CYP1B1, RBP7 
##     LRRK2, DYSF, ARHGAP26, SLC15A4, KIF13A, ARHGAP24, GZMA, VCAN, CD36, LINGO2
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, resolution = 0.2)
## Modularity Optimizer version 1.3.0 by Ludo Waltman and Nees Jan van Eck
## 
## Number of nodes: 35603
## Number of edges: 1014624
## 
## Running Louvain algorithm...
## Maximum modularity in 10 random starts: 0.9460
## Number of communities: 9
## Elapsed time: 4 seconds

UMAP

comb <- RunUMAP(comb, dims = 1:8)
## Warning: The default method for RunUMAP has changed from calling Python UMAP via reticulate to the R-native UWOT using the cosine metric
## To use Python UMAP via reticulate, set umap.method to 'umap-learn' and metric to 'correlation'
## This message will be shown once per session
## 13:23:02 UMAP embedding parameters a = 0.9922 b = 1.112
## 13:23:02 Read 35603 rows and found 8 numeric columns
## 13:23:02 Using Annoy for neighbor search, n_neighbors = 30
## 13:23:02 Building Annoy index with metric = cosine, n_trees = 50
## 0%   10   20   30   40   50   60   70   80   90   100%
## [----|----|----|----|----|----|----|----|----|----|
## **************************************************|
## 13:23:04 Writing NN index file to temp file /tmp/RtmpydpsKt/file1a74911619b4bf
## 13:23:04 Searching Annoy index using 1 thread, search_k = 3000
## 13:23:15 Annoy recall = 100%
## 13:23:16 Commencing smooth kNN distance calibration using 1 thread with target n_neighbors = 30
## 13:23:18 Initializing from normalized Laplacian + noise (using RSpectra)
## 13:23:19 Commencing optimization for 200 epochs, with 1424968 positive edges
## 13:23:28 Optimization finished
DimPlot(comb, reduction = "umap")

Assign cell type with canonical markers

Cluster ID Markers Cell Type
0 IL7R, CCR7 Naive CD4+ T
1 CD14, LYZ CD14+ Mono
2 IL7R, S100A4 Memory CD4+
3 MS4A1 B
4 CD8A CD8+ T
5 FCGR3A, MS4A7 FCGR3A+ Mono
6 GNLY, NKG7 NK
7 FCER1A, CST3 DC
8 PPBP Platelet
message("Naive CD4+ T")
## Naive CD4+ T
VlnPlot(comb, features = c("IL7R", "CCR7"))

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

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

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

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

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

message("NK")
## NK
VlnPlot(comb, features = c("GNLY", "NKG7"))

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

message("Platelet")
## 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("MS4A1", "GNLY", "CD3E", "CD14", "FCER1A", "FCGR3A",
  "LYZ", "PPBP", "CD8A"))

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

Now get the marker genes for each cluster.

myvec <- unique(comb[["seurat_clusters"]][,1])

markers <- mclapply(myvec, function(i) { FindMarkers(comb, ident.1 = i ) } , mc.cores=16)

length(markers)
## [1] 9
# NK 1 (cluster 0)
head(markers[[1]],10)
##        p_val avg_log2FC pct.1 pct.2 p_val_adj
## FGFBP2     0   4.405845 0.941 0.124         0
## GZMB       0   3.657251 0.981 0.185         0
## GZMA       0   3.273408 0.964 0.190         0
## PRF1       0   3.928052 0.912 0.145         0
## CST7       0   3.653445 0.984 0.219         0
## KLRF1      0   3.727494 0.879 0.121         0
## KLRD1      0   3.136655 0.943 0.185         0
## SPON2      0   4.307448 0.864 0.135         0
## GZMH       0   3.278490 0.855 0.132         0
## TRDC       0   3.759667 0.813 0.093         0
# CD14+ monocytes 1 (cluster 1)
head(markers[[2]],10)
##           p_val avg_log2FC pct.1 pct.2 p_val_adj
## AQP9          0   3.475060 0.880 0.230         0
## IRAK2         0   3.748144 0.800 0.162         0
## IL1B          0   4.677256 0.886 0.271         0
## CLIC4         0   3.276105 0.868 0.255         0
## ICAM1         0   2.600262 0.903 0.308         0
## AZIN1-AS1     0   3.748872 0.764 0.170         0
## IER3          0   2.314379 0.880 0.291         0
## NLRP3         0   2.662558 0.942 0.359         0
## CLEC4E        0   2.614319 0.794 0.213         0
## TNFAIP6       0   4.602969 0.654 0.079         0
# NK 2 (cluster 2)
head(markers[[3]],10)
##        p_val avg_log2FC pct.1 pct.2 p_val_adj
## CDKN1C     0   5.941590 0.894 0.071         0
## HES4       0   4.745219 0.753 0.041         0
## SMIM25     0   3.438883 0.909 0.233         0
## CSF1R      0   3.324781 0.879 0.205         0
## SNED1      0   4.117990 0.752 0.094         0
## MS4A7      0   3.433621 0.940 0.295         0
## TCF7L2     0   3.316507 0.989 0.361         0
## LRRC25     0   2.829461 0.888 0.261         0
## HMOX1      0   2.799216 0.847 0.223         0
## FMNL2      0   4.785793 0.665 0.051         0
# CD14+ monocytes 2 (cluster 3)
head(markers[[4]],10)
##          p_val avg_log2FC pct.1 pct.2 p_val_adj
## SEPTIN7      0  -2.610204 0.061 0.925         0
## YWHAZ        0  -2.023444 0.105 0.967         0
## KMT2E        0  -2.396477 0.075 0.934         0
## CDC42SE2     0  -2.315329 0.105 0.962         0
## BTG1         0  -2.389523 0.103 0.959         0
## CDC42        0  -2.129717 0.104 0.958         0
## HNRNPC       0  -2.536145 0.085 0.939         0
## ANKRD12      0  -2.067971 0.090 0.944         0
## ARHGAP15     0  -2.592570 0.097 0.949         0
## JAK1         0  -2.050399 0.100 0.951         0
# FCGR3A+ monocytes (cluster 4)
head(markers[[5]],10)
##          p_val avg_log2FC pct.1 pct.2 p_val_adj
## FCER1A       0   6.647756 0.837 0.035         0
## ADAM28       0   3.356873 0.897 0.139         0
## AFF3         0   2.785053 0.882 0.147         0
## CLEC10A      0   5.910158 0.768 0.044         0
## CCSER1       0   5.031951 0.756 0.051         0
## HLA-DQA1     0   4.165148 0.989 0.300         0
## FLT3         0   3.322687 0.751 0.085         0
## CD1C         0   6.237336 0.690 0.025         0
## PHACTR1      0   2.008151 0.897 0.247         0
## CIITA        0   2.767178 0.849 0.199         0
# cluster 5 unknown - probably T cell
# IL7R = Naive T-cells
# CD3D = CD4+ T cells
# CD3E = T cells
head(markers[[6]],10)
##       p_val avg_log2FC pct.1 pct.2 p_val_adj
## IL7R      0   6.644805 0.695 0.023         0
## CD3D      0   3.830768 0.691 0.063         0
## CD3E      0   1.959087 0.801 0.194         0
## CD3G      0   3.706040 0.643 0.050         0
## IL32      0   1.870267 0.838 0.273         0
## TC2N      0   2.537292 0.727 0.167         0
## ZEB1      0   3.176193 0.661 0.123         0
## DOCK5     0  -2.521629 0.166 0.701         0
## TRAC      0   4.678234 0.578 0.043         0
## CAMK4     0   5.860070 0.555 0.022         0
# DC (cluster 6)
head(markers[[7]],10)
##            p_val avg_log2FC pct.1 pct.2 p_val_adj
## RHEX           0   9.021711 0.980 0.010         0
## ITM2C          0   6.923569 0.992 0.037         0
## LINC01374      0   9.073702 0.964 0.011         0
## AC023590.1     0   7.189649 0.983 0.038         0
## NIBAN3         0   7.336635 0.955 0.011         0
## SERPINF1       0   7.432269 0.969 0.029         0
## CLEC4C         0   9.443771 0.943 0.004         0
## JCHAIN         0   5.052743 0.969 0.035         0
## PTPRS          0   6.421687 0.980 0.047         0
## COBLL1         0   7.473471 0.941 0.013         0
# cluster 7 unknown - probably macrophage
# CD14 = macrophages
# S100A12 = macrophages and monocytes
# MS4A6A = macrophages and monocytes
head(markers[[8]],10)
##            p_val avg_log2FC pct.1 pct.2 p_val_adj
## CD14           0   2.590196 0.943 0.215         0
## S100A12        0   2.831699 0.937 0.213         0
## MS4A6A         0   2.339090 0.943 0.246         0
## CSF3R          0   2.403534 0.986 0.304         0
## WDFY3          0   2.299412 0.927 0.258         0
## VCAN           0   2.897514 0.996 0.328         0
## CSTA           0   2.178795 0.962 0.297         0
## SLC11A1        0   2.272561 0.952 0.291         0
## AC020656.1     0   2.608471 0.918 0.261         0
## RBM47          0   2.340318 0.960 0.304         0
# B cells (cluster 8)
head(markers[[9]],10)
##         p_val avg_log2FC pct.1 pct.2 p_val_adj
## STRBP       0   3.616973 0.819 0.104         0
## COBLL1      0   4.245510 0.621 0.024         0
## GNG7        0   4.335929 0.677 0.096         0
## DENND5B     0   4.280196 0.641 0.066         0
## CD79A       0   8.257984 0.552 0.009         0
## BANK1       0   6.899614 0.596 0.053         0
## OSBPL10     0   6.749382 0.554 0.019         0
## IGHM        0   7.730666 0.563 0.043         0
## RAB30       0   4.310501 0.565 0.050         0
## FAM30A      0   7.040820 0.518 0.010         0

As there are two CD14+ mono and NK clusters, it might be a good idea to look at their differences.

# find all NK markers distinguishing cluster 0 (case) from cluster 2 (ctrl)
nk0.markers <- FindMarkers(comb, ident.1 = 0, ident.2 = 2,only.pos=TRUE)
## For a (much!) faster implementation of the Wilcoxon Rank Sum Test,
## (default method for FindMarkers) please install the presto package
## --------------------------------------------
## install.packages('devtools')
## devtools::install_github('immunogenomics/presto')
## --------------------------------------------
## After installation of presto, Seurat will automatically use the more 
## efficient implementation (no further action necessary).
## This message will be shown once per session
head(nk0.markers, n = 10)
##        p_val avg_log2FC pct.1 pct.2 p_val_adj
## FCGR3A     0   2.745818 0.886 0.261         0
## FGFBP2     0   2.651611 0.941 0.317         0
## SPON2      0   3.045026 0.864 0.277         0
## KLRF1      0   1.891888 0.879 0.305         0
## GZMB       0   2.488239 0.981 0.409         0
## TRDC       0   1.766307 0.813 0.267         0
## BNC2       0   4.207183 0.575 0.058         0
## TYROBP     0   1.723822 0.954 0.446         0
## GZMH       0   1.259498 0.855 0.380         0
## PRF1       0   2.152961 0.912 0.438         0
nk2.markers <- FindMarkers(comb, ident.1 = 2, ident.2 = 0,only.pos=TRUE)
head(nk2.markers, n = 10)
##        p_val avg_log2FC pct.1 pct.2 p_val_adj
## IL7R       0   7.195133 0.695 0.018         0
## CD3D       0   2.458322 0.691 0.130         0
## CD3G       0   2.316037 0.643 0.105         0
## CAMK4      0   5.602151 0.555 0.023         0
## LTB        0   5.130821 0.608 0.082         0
## ZEB1       0   2.657739 0.661 0.160         0
## INPP4B     0   6.085176 0.512 0.018         0
## TRAC       0   3.473439 0.578 0.086         0
## CASK       0   2.261784 0.622 0.175         0
## BACH2      0   2.536058 0.610 0.189         0
# find all monocyte markers distinguishing cluster 1 (case) from cluster 3 (ctrl)
monocyte1.markers <- FindMarkers(comb, ident.1 = 1, ident.2 = 3, only.pos=TRUE)
head(monocyte1.markers, n = 10)
##                 p_val avg_log2FC pct.1 pct.2     p_val_adj
## MAP3K1   0.000000e+00  0.9131158 0.956 0.842  0.000000e+00
## FOS     2.870720e-253  0.7017975 0.994 0.964 1.050770e-248
## TXNIP   2.558514e-252  0.6061089 0.991 0.938 9.364930e-248
## CD86    4.906385e-239  0.9719702 0.867 0.717 1.795884e-234
## HBEGF   8.447570e-238  1.5986423 0.616 0.341 3.092064e-233
## S100A6  6.590490e-225  0.4338555 0.996 0.979 2.412317e-220
## CLEC12A 1.099567e-207  0.8335866 0.871 0.756 4.024747e-203
## MEF2C   3.078758e-202  0.7487670 0.914 0.805 1.126918e-197
## TUBA1A  1.429381e-199  1.0066707 0.771 0.571 5.231964e-195
## PICALM  3.080819e-183  0.4269503 0.999 0.987 1.127672e-178
monocyte3.markers <- FindMarkers(comb, ident.1 = 3, ident.2 = 1, only.pos=TRUE)
head(monocyte3.markers, n = 10)
##           p_val avg_log2FC pct.1 pct.2 p_val_adj
## CCL4          0   4.646652 0.684 0.140         0
## TNFAIP6       0   3.244527 0.654 0.197         0
## AZIN1-AS1     0   2.668943 0.764 0.313         0
## CCL3          0   3.026348 0.820 0.380         0
## SLC39A8       0   3.992489 0.509 0.093         0
## IRAK2         0   2.496833 0.800 0.387         0
## IL1B          0   3.840793 0.886 0.492         0
## CCL3L1        0   2.286813 0.606 0.231         0
## NOTCH2NLC     0   2.161316 0.695 0.337         0
## ACVR2A        0   2.670119 0.719 0.363         0

Assign names to clusters

  1. NK 1 (FCGR3A+)

  2. CD14+ monocytes

  3. NK 2 (IL7R+)

  4. CD14+ monocytes (CCL4+)

  5. FCGR3A+ monocytes

  6. T

  7. DC

  8. macrophages

  9. B

new.cluster.ids <- c("NK 1 (FCGRA3A+)", "CD14+ Mono", "NK 2 (IL7R+)", "CD14+ Mono (CCL4+)", "FCGR3A+ Mono", "T",
    "DC", "Macrophage", "B")

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

comb <- RenameIdents(comb, new.cluster.ids)

DimPlot(comb, reduction = "umap", label = TRUE, pt.size = 0.5) + NoLegend()

count cells by patient

Sample Plate HTO
CC0003 1 1
AH0018 1 3
PM008 1 4
PM017 1 5
PM0032 2 1
PM0028 2 2
AH0005 2 3
AH0015 2 4
PM0027 3 2
PM0020 3 3
PM001 3 4
CC0016 3 5
str(Idents(comb))
##  Factor w/ 9 levels "NK 1 (FCGRA3A+)",..: 1 4 4 1 4 1 4 1 1 1 ...
##  - attr(*, "names")= chr [1:35603] "CC0003 AAACCCAAGAATTTGG" "CC0003 AAACCCAAGCTAGTTC" "CC0003 AAACCCACATGGCCCA" "CC0003 AAACGAACACATTACG" ...
table(Idents(comb))
## 
##    NK 1 (FCGRA3A+)         CD14+ Mono       NK 2 (IL7R+) CD14+ Mono (CCL4+) 
##              10379               9021               5244               3761 
##       FCGR3A+ Mono                  T                 DC         Macrophage 
##               2819               1935               1441                644 
##                  B 
##                359
cells <- paste(Idents(comb),names(Idents(comb)))

cells2 <- strsplit((stringi::stri_reverse(cells)), " ")
cells2 <- lapply(cells2,function(x) { stringi::stri_reverse(paste(x[2:length(x)],collapse=" "))})
cells2 <- table(unlist(cells2))

cmx <- matrix(cells2,nrow=12)
colnames(cmx) <- unique(sapply(strsplit(gsub(" CC","@",gsub(" AH","@",gsub(" PM","@",names(cells2)))),"@"),"[[",1))

patient_id <- c("AH0005+","AH0015+","AH0018+","CC0003-","CC0016+","PM001+","PM0020-","PM0027-","PM0028-","PM0032-","PM008+","PM017+")
hiv_status <- c(1,1,1,0,1,1,0,0,0,0,1,1)
batch <- factor(c(2,2,1,1,3,3,3,3,2,2,1,1))
pat_df <- data.frame(patient_id,hiv_status,batch) # there were 3 chromium runs contianing multiple samples
pat_df
##    patient_id hiv_status batch
## 1     AH0005+          1     2
## 2     AH0015+          1     2
## 3     AH0018+          1     1
## 4     CC0003-          0     1
## 5     CC0016+          1     3
## 6      PM001+          1     3
## 7     PM0020-          0     3
## 8     PM0027-          0     3
## 9     PM0028-          0     2
## 10    PM0032-          0     2
## 11     PM008+          1     1
## 12     PM017+          1     1
rownames(cmx) <- patient_id

tcmx <- t(cmx)

tcmx |> kbl(caption="cell counts") |> kable_paper("hover", full_width = F)
cell counts
AH0005+ AH0015+ AH0018+ CC0003- CC0016+ PM001+ PM0020- PM0027- PM0028- PM0032- PM008+ PM017+
B 11 60 29 24 27 28 19 18 46 24 49 24
CD14+ Mono (CCL4+) 20 87 212 854 608 280 48 129 98 196 1032 197
CD14+ Mono 334 620 1356 29 114 1377 745 1625 935 1066 214 606
DC 59 102 96 74 103 184 54 327 135 89 128 90
FCGR3A+ Mono 114 159 487 156 293 208 328 206 244 120 320 184
Macrophage 12 16 15 100 52 81 20 69 41 71 90 77
NK 1 (FCGRA3A+) 1298 1049 251 1595 1083 563 972 80 475 264 1016 1733
NK 2 (IL7R+) 353 459 339 221 971 468 400 451 439 195 398 550
T 32 352 104 219 194 248 179 100 121 44 221 121
ntcmx <- apply(tcmx,2,function(x) { x/sum(x)*100 } )

ntcmx |> kbl(caption="cell proportions") |> kable_paper("hover", full_width = F)
cell proportions
AH0005+ AH0015+ AH0018+ CC0003- CC0016+ PM001+ PM0020- PM0027- PM0028- PM0032- PM008+ PM017+
B 0.4926108 2.0661157 1.0038075 0.7334963 0.7837446 0.814664 0.6871609 0.5990017 1.815312 1.159981 1.412918 0.6700168
CD14+ Mono (CCL4+) 0.8956561 2.9958678 7.3381793 26.1002445 17.6487663 8.146639 1.7359855 4.2928453 3.867403 9.473175 29.757786 5.4997208
CD14+ Mono 14.9574563 21.3498623 46.9366563 0.8863081 3.3091437 40.064009 26.9439421 54.0765391 36.898185 51.522475 6.170704 16.9179229
DC 2.6421854 3.5123967 3.3229491 2.2616137 2.9898403 5.353506 1.9529837 10.8818636 5.327545 4.301595 3.690888 2.5125628
FCGR3A+ Mono 5.1052396 5.4752066 16.8570440 4.7677262 8.5050798 6.051789 11.8625678 6.8552413 9.629045 5.799903 9.227220 5.1367951
Macrophage 0.5373936 0.5509642 0.5192108 3.0562347 1.5094340 2.356706 0.7233273 2.2961730 1.617995 3.431609 2.595156 2.1496371
NK 1 (FCGRA3A+) 58.1280788 36.1225895 8.6881274 48.7469438 31.4368650 16.380564 35.1537071 2.6622296 18.745067 12.759787 29.296425 48.3807929
NK 2 (IL7R+) 15.8083296 15.8057851 11.7341641 6.7542787 28.1857765 13.616526 14.4665461 15.0083195 17.324388 9.424843 11.476355 15.3545505
T 1.4330497 12.1212121 3.5998615 6.6931540 5.6313498 7.215595 6.4737794 3.3277870 4.775059 2.126631 6.372549 3.3780011
tntcmx <- t(ntcmx)

tntcmx |> kbl(caption="cell proportions") |> kable_paper("hover", full_width = F)
cell proportions
B CD14+ Mono (CCL4+) CD14+ Mono DC FCGR3A+ Mono Macrophage NK 1 (FCGRA3A+) NK 2 (IL7R+) T
AH0005+ 0.4926108 0.8956561 14.9574563 2.642185 5.105240 0.5373936 58.128079 15.808330 1.433050
AH0015+ 2.0661157 2.9958678 21.3498623 3.512397 5.475207 0.5509642 36.122589 15.805785 12.121212
AH0018+ 1.0038075 7.3381793 46.9366563 3.322949 16.857044 0.5192108 8.688127 11.734164 3.599861
CC0003- 0.7334963 26.1002445 0.8863081 2.261614 4.767726 3.0562347 48.746944 6.754279 6.693154
CC0016+ 0.7837446 17.6487663 3.3091437 2.989840 8.505080 1.5094340 31.436865 28.185776 5.631350
PM001+ 0.8146640 8.1466395 40.0640093 5.353506 6.051789 2.3567064 16.380564 13.616526 7.215595
PM0020- 0.6871609 1.7359855 26.9439421 1.952984 11.862568 0.7233273 35.153707 14.466546 6.473779
PM0027- 0.5990017 4.2928453 54.0765391 10.881864 6.855241 2.2961730 2.662230 15.008320 3.327787
PM0028- 1.8153118 3.8674033 36.8981847 5.327545 9.629045 1.6179953 18.745067 17.324388 4.775059
PM0032- 1.1599807 9.4731754 51.5224746 4.301595 5.799903 3.4316095 12.759787 9.424843 2.126631
PM008+ 1.4129181 29.7577855 6.1707036 3.690888 9.227220 2.5951557 29.296425 11.476355 6.372549
PM017+ 0.6700168 5.4997208 16.9179229 2.512563 5.136795 2.1496371 48.380793 15.354551 3.378001
tntcmx_pos <- tntcmx[grep("\\+",rownames(tntcmx)),]

tntcmx_neg <- tntcmx[grep("\\-",rownames(tntcmx)),]

par(mfrow=c(3,3))

lapply(1:ncol(cmx) , function(i) {
  cellname=colnames(tntcmx)[i]
  boxplot(tntcmx_neg[,i],tntcmx_pos[,i],col="white",main=cellname, names=c("HIV-","HIV+"))
  beeswarm(list(tntcmx_neg[,i],tntcmx_pos[,i]),add=TRUE,cex=1.5,col="gray",pch=19)
  tt <- t.test(tntcmx_neg[,i],tntcmx_pos[,i])
  mtext(paste("P=",signif(tt$p.value,3)),cex=0.8)
})

## [[1]]
## NULL
## 
## [[2]]
## NULL
## 
## [[3]]
## NULL
## 
## [[4]]
## NULL
## 
## [[5]]
## NULL
## 
## [[6]]
## NULL
## 
## [[7]]
## NULL
## 
## [[8]]
## NULL
## 
## [[9]]
## NULL
summary(tntcmx_neg)
##        B          CD14+ Mono (CCL4+)   CD14+ Mono            DC        
##  Min.   :0.5990   Min.   : 1.736     Min.   : 0.8863   Min.   : 1.953  
##  1st Qu.:0.6872   1st Qu.: 3.867     1st Qu.:26.9439   1st Qu.: 2.262  
##  Median :0.7335   Median : 4.293     Median :36.8982   Median : 4.302  
##  Mean   :0.9990   Mean   : 9.094     Mean   :34.0655   Mean   : 4.945  
##  3rd Qu.:1.1600   3rd Qu.: 9.473     3rd Qu.:51.5225   3rd Qu.: 5.328  
##  Max.   :1.8153   Max.   :26.100     Max.   :54.0765   Max.   :10.882  
##   FCGR3A+ Mono      Macrophage     NK 1 (FCGRA3A+)   NK 2 (IL7R+)   
##  Min.   : 4.768   Min.   :0.7233   Min.   : 2.662   Min.   : 6.754  
##  1st Qu.: 5.800   1st Qu.:1.6180   1st Qu.:12.760   1st Qu.: 9.425  
##  Median : 6.855   Median :2.2962   Median :18.745   Median :14.467  
##  Mean   : 7.783   Mean   :2.2251   Mean   :23.614   Mean   :12.596  
##  3rd Qu.: 9.629   3rd Qu.:3.0562   3rd Qu.:35.154   3rd Qu.:15.008  
##  Max.   :11.863   Max.   :3.4316   Max.   :48.747   Max.   :17.324  
##        T        
##  Min.   :2.127  
##  1st Qu.:3.328  
##  Median :4.775  
##  Mean   :4.679  
##  3rd Qu.:6.474  
##  Max.   :6.693
summary(tntcmx_pos)
##        B          CD14+ Mono (CCL4+)   CD14+ Mono           DC       
##  Min.   :0.4926   Min.   : 0.8957    Min.   : 3.309   Min.   :2.513  
##  1st Qu.:0.7269   1st Qu.: 4.2478    1st Qu.:10.564   1st Qu.:2.816  
##  Median :0.8147   Median : 7.3382    Median :16.918   Median :3.323  
##  Mean   :1.0348   Mean   :10.3261    Mean   :21.387   Mean   :3.432  
##  3rd Qu.:1.2084   3rd Qu.:12.8977    3rd Qu.:30.707   3rd Qu.:3.602  
##  Max.   :2.0661   Max.   :29.7578    Max.   :46.937   Max.   :5.354  
##   FCGR3A+ Mono      Macrophage     NK 1 (FCGRA3A+)   NK 2 (IL7R+)  
##  Min.   : 5.105   Min.   :0.5192   Min.   : 8.688   Min.   :11.48  
##  1st Qu.: 5.306   1st Qu.:0.5442   1st Qu.:22.838   1st Qu.:12.68  
##  Median : 6.052   Median :1.5094   Median :31.437   Median :15.35  
##  Mean   : 8.051   Mean   :1.4598   Mean   :32.633   Mean   :16.00  
##  3rd Qu.: 8.866   3rd Qu.:2.2532   3rd Qu.:42.252   3rd Qu.:15.81  
##  Max.   :16.857   Max.   :2.5952   Max.   :58.128   Max.   :28.19  
##        T         
##  Min.   : 1.433  
##  1st Qu.: 3.489  
##  Median : 5.631  
##  Mean   : 5.679  
##  3rd Qu.: 6.794  
##  Max.   :12.121
ttres <- lapply(1:ncol(cmx) , function(i) {
  t.test(tntcmx_neg[,i],tntcmx_pos[,i])
})
names(ttres) <- colnames(cmx)
ttres
## $B
## 
##  Welch Two Sample t-test
## 
## data:  tntcmx_neg[, i] and tntcmx_pos[, i]
## t = -0.11782, df = 9.1332, p-value = 0.9088
## alternative hypothesis: true difference in means is not equal to 0
## 95 percent confidence interval:
##  -0.7226046  0.6509059
## sample estimates:
## mean of x mean of y 
## 0.9989903 1.0348396 
## 
## 
## $`CD14+ Mono (CCL4+)`
## 
##  Welch Two Sample t-test
## 
## data:  tntcmx_neg[, i] and tntcmx_pos[, i]
## t = -0.21058, df = 8.8661, p-value = 0.838
## alternative hypothesis: true difference in means is not equal to 0
## 95 percent confidence interval:
##  -14.49917  12.03486
## sample estimates:
## mean of x mean of y 
##  9.093931 10.326088 
## 
## 
## $`CD14+ Mono`
## 
##  Welch Two Sample t-test
## 
## data:  tntcmx_neg[, i] and tntcmx_pos[, i]
## t = 1.1042, df = 7.1775, p-value = 0.3051
## alternative hypothesis: true difference in means is not equal to 0
## 95 percent confidence interval:
##  -14.33663  39.69453
## sample estimates:
## mean of x mean of y 
##  34.06549  21.38654 
## 
## 
## $DC
## 
##  Welch Two Sample t-test
## 
## data:  tntcmx_neg[, i] and tntcmx_pos[, i]
## t = 0.91617, df = 4.4017, p-value = 0.407
## alternative hypothesis: true difference in means is not equal to 0
## 95 percent confidence interval:
##  -2.911907  5.938054
## sample estimates:
## mean of x mean of y 
##  4.945120  3.432047 
## 
## 
## $`FCGR3A+ Mono`
## 
##  Welch Two Sample t-test
## 
## data:  tntcmx_neg[, i] and tntcmx_pos[, i]
## t = -0.13025, df = 10, p-value = 0.8989
## alternative hypothesis: true difference in means is not equal to 0
## 95 percent confidence interval:
##  -4.857908  4.321309
## sample estimates:
## mean of x mean of y 
##  7.782897  8.051196 
## 
## 
## $Macrophage
## 
##  Welch Two Sample t-test
## 
## data:  tntcmx_neg[, i] and tntcmx_pos[, i]
## t = 1.2737, df = 7.7835, p-value = 0.2395
## alternative hypothesis: true difference in means is not equal to 0
## 95 percent confidence interval:
##  -0.6269623  2.1575263
## sample estimates:
## mean of x mean of y 
##  2.225068  1.459786 
## 
## 
## $`NK 1 (FCGRA3A+)`
## 
##  Welch Two Sample t-test
## 
## data:  tntcmx_neg[, i] and tntcmx_pos[, i]
## t = -0.86324, df = 8.3708, p-value = 0.4121
## alternative hypothesis: true difference in means is not equal to 0
## 95 percent confidence interval:
##  -32.93015  14.89054
## sample estimates:
## mean of x mean of y 
##  23.61355  32.63335 
## 
## 
## $`NK 2 (IL7R+)`
## 
##  Welch Two Sample t-test
## 
## data:  tntcmx_neg[, i] and tntcmx_pos[, i]
## t = -1.174, df = 9.8896, p-value = 0.2679
## alternative hypothesis: true difference in means is not equal to 0
## 95 percent confidence interval:
##  -9.867640  3.064279
## sample estimates:
## mean of x mean of y 
##  12.59568  15.99736 
## 
## 
## $T
## 
##  Welch Two Sample t-test
## 
## data:  tntcmx_neg[, i] and tntcmx_pos[, i]
## t = -0.63272, df = 9.6951, p-value = 0.5415
## alternative hypothesis: true difference in means is not equal to 0
## 95 percent confidence interval:
##  -4.534393  2.535352
## sample estimates:
## mean of x mean of y 
##  4.679282  5.678803
par(mfrow=c(1,1))

There were no significant results of the cell counting, however there were some trends that might require further investigation. In particular relative counts of IL7R+ NK 2 cells were lower, CCL4+ CD14+ Monocytes were lower, while DCs were higher in HIV+ patients.

Differential expression

We are going to use muscat for pseudobulk analysis. First need to convert seurat obj to singlecellexperiment object. Then summarise counts to pseudobulk level.

sce <- Seurat::as.SingleCellExperiment(comb, assay = "RNA")

head(colData(sce),2)
## DataFrame with 2 rows and 8 columns
##                         orig.ident nCount_RNA nFeature_RNA
##                           <factor>  <numeric>    <integer>
## CC0003 AAACCCAAGAATTTGG     nkmono       7148         2886
## CC0003 AAACCCAAGCTAGTTC     nkmono      18524         3424
##                                           cell     patient RNA_snn_res.0.2
##                                    <character> <character>        <factor>
## CC0003 AAACCCAAGAATTTGG CC0003 AAACCCAAGAATT..      CC0003               0
## CC0003 AAACCCAAGCTAGTTC CC0003 AAACCCAAGCTAG..      CC0003               3
##                         seurat_clusters              ident
##                                <factor>           <factor>
## CC0003 AAACCCAAGAATTTGG               0 NK 1 (FCGRA3A+)   
## CC0003 AAACCCAAGCTAGTTC               3 CD14+ Mono (CCL4+)
colnames(colData(sce))
## [1] "orig.ident"      "nCount_RNA"      "nFeature_RNA"    "cell"           
## [5] "patient"         "RNA_snn_res.0.2" "seurat_clusters" "ident"
patient_id <- c("AH0005","AH0015","AH0018","CC0003","CC0016","PM001","PM0020","PM0027","PM0028","PM0032","PM008","PM017")
hiv_status <- c(1,1,1,0,1,1,0,0,0,0,1,1)

colData(sce)$sample_id <- colData(sce)$patient
colData(sce)$cluster_id <- colData(sce)$ident
colData(sce)$hiv <- pat_df[match(colData(sce)$patient,pat_df$patient_id),2]

#muscat library
pb <- aggregateData(sce,
    assay = "counts", fun = "sum",
    by = c("cluster_id", "sample_id"))

# one sheet per subpopulation
assayNames(pb)
## [1] "NK 1 (FCGRA3A+)"    "CD14+ Mono"         "NK 2 (IL7R+)"      
## [4] "CD14+ Mono (CCL4+)" "FCGR3A+ Mono"       "T"                 
## [7] "DC"                 "Macrophage"         "B"
t(head(assay(pb)))
##        gene-HIV1-1 gene-HIV1-2 MIR1302-2HG FAM138A OR4F5 AL627309.1
## AH0005           0           0           0       0     0          3
## AH0015           0           0           0       0     0          3
## AH0018           0           0           0       0     0          0
## CC0003           0           0           0       0     0          3
## CC0016           0           0           0       0     0          4
## PM001            0           0           0       0     0          0
## PM0020           0           0           0       0     0          0
## PM0027           0           0           0       0     0          0
## PM0028           0           0           0       0     0          0
## PM0032           0           0           0       0     0          0
## PM008            0           0           0       0     0          1
## PM017            0           0           0       0     0          4
plotMDS(assay(pb))

par(mfrow=c(3,3))

lapply(1:length(assays(pb)) , function(i) {
  cellname=names(assays(pb))[i]
  plotMDS(assays(pb)[[i]],cex=1.5,pch=19,col=hiv_status+1,main=paste(cellname))
  mtext("red=HIV+",cex=0.7)
})

## [[1]]
## NULL
## 
## [[2]]
## NULL
## 
## [[3]]
## NULL
## 
## [[4]]
## NULL
## 
## [[5]]
## NULL
## 
## [[6]]
## NULL
## 
## [[7]]
## NULL
## 
## [[8]]
## NULL
## 
## [[9]]
## NULL
par(mfrow=c(1,1))

lapply(1:length(assays(pb)) , function(i) {
  cellname=names(assays(pb))[i]
  plotMDS(assays(pb)[[i]],cex=1.5,pch=19,labels=patient_id,col=hiv_status+1,main=paste("MDS",cellname,"red=HIV+"))
})

## [[1]]
## An object of class MDS
## $eigen.values
##  [1] 1.179771e+09 1.660820e+07 3.764860e+06 2.606268e+06 1.042673e+06
##  [6] 9.765118e+05 6.110725e+05 2.549219e+05 1.341464e+05 6.281942e+04
## [11] 6.138144e+04 7.445078e-08
## 
## $eigen.vectors
##              [,1]        [,2]         [,3]        [,4]        [,5]         [,6]
##  [1,] -0.24499847  0.43932629 -0.202701765  0.69167619 -0.05516877  0.297270678
##  [2,] -0.08429061 -0.01776285 -0.330362269  0.07893745  0.41417513 -0.720759556
##  [3,]  0.34175183 -0.13471045  0.165176069 -0.09368173  0.03630105  0.003467323
##  [4,] -0.39868817 -0.76035801 -0.102308968  0.14436343 -0.33325109  0.014470883
##  [5,] -0.09192006  0.36239526 -0.170955792 -0.48710403 -0.50377630 -0.136098483
##  [6,]  0.19344373  0.03230844 -0.049743855  0.02224649  0.18287127 -0.078676470
##  [7,] -0.07497148  0.13740234 -0.162973756 -0.17703993 -0.30890560  0.008280558
##  [8,]  0.43034361 -0.07032515  0.237696298  0.05775455 -0.10988544  0.147779357
##  [9,]  0.22285106  0.07985959 -0.003332729  0.01536062  0.07020151 -0.010326365
## [10,]  0.31534239 -0.10756792  0.185729191  0.24258397 -0.11418859 -0.048321520
## [11,] -0.09709505 -0.11343899 -0.316343931 -0.37334285  0.50218429  0.582496802
## [12,] -0.51176878  0.15287146  0.750121507 -0.12175417  0.21944253 -0.059583208
##              [,7]        [,8]          [,9]       [,10]        [,11]     [,12]
##  [1,] -0.13342450  0.05590963 -0.0455733513  0.01226410  0.171936314 0.2886751
##  [2,] -0.17058906 -0.22681257 -0.0936631104 -0.11023172  0.037042354 0.2886751
##  [3,] -0.11940640  0.09141224 -0.0805790379  0.38600216  0.752483571 0.2886751
##  [4,] -0.02113199  0.14429607  0.0889191156 -0.08537691  0.023081265 0.2886751
##  [5,] -0.41170839  0.23962470  0.0299621647  0.01334934 -0.100387959 0.2886751
##  [6,]  0.43765483  0.72768914 -0.2619827277 -0.05237687 -0.207724768 0.2886751
##  [7,]  0.68086654 -0.47597659 -0.1918444521  0.05771280  0.092215546 0.2886751
##  [8,] -0.18843494 -0.20282337 -0.2476633341 -0.70275759 -0.030435931 0.2886751
##  [9,]  0.18715124  0.00226901  0.8959777647 -0.13233149 -0.005104892 0.2886751
## [10,] -0.14465466 -0.21609656 -0.0473848985  0.55520717 -0.564637622 0.2886751
## [11,] -0.14632104 -0.12062934 -0.0453255532  0.07292211 -0.141730496 0.2886751
## [12,]  0.02999838 -0.01886236 -0.0008425799 -0.01438308 -0.026737382 0.2886751
## 
## $var.explained
##  [1] 9.783373e-01 1.377253e-02 3.122050e-03 2.161275e-03 8.646474e-04
##  [6] 8.097826e-04 5.067383e-04 2.113966e-04 1.112423e-04 5.209366e-05
## [11] 5.090120e-05 6.173909e-17
## 
## $dim.plot
## [1] 1 2
## 
## $distance.matrix.squared
##            AH0005     AH0015     AH0018     CC0003     CC0016      PM001
## AH0005 -151050375  -48813681  200079599 -220109721  -56981074  111317748
## AH0015  -48813681  -19067220   68299114  -79735070  -18105937   38259986
## AH0018  200079599   68299114 -276549438  318307941   75695701 -155738705
## CC0003 -220109721  -79735070  318307941 -394692061  -77458330  182830938
## CC0016  -56981074  -18105937   75695701  -77458330  -26558984   41861547
## PM001   111317748   38259986 -155738705  182830938   41861547  -88961016
## PM0020  -44875493  -14801430   61315799  -67206686  -18492779   33952636
## PM0027  249830923   86340229 -347580777  403124887   94492640 -196049768
## PM0028  127656604   44339549 -179284919  211674554   47565249 -101873877
## PM0032  183280988   63000814 -254856789  293835942   70357523 -143597960
## PM008   -53909004  -19668912   77949713  -93827317  -20426494   44379165
## PM017  -296426514 -100047442  412362761 -476745077 -111949063  233619306
##           PM0020     PM0027     PM0028     PM0032      PM008      PM017
## AH0005 -44875493  249830923  127656604  183280988  -53909004 -296426514
## AH0015 -14801430   86340229   44339549   63000814  -19668912 -100047442
## AH0018  61315799 -347580777 -179284919 -254856789   77949713  412362761
## CC0003 -67206686  403124887  211674554  293835942  -93827317 -476745077
## CC0016 -18492779   94492640   47565249   70357523  -20426494 -111949063
## PM001   33952636 -196049768 -101873877 -143597960   44379165  233619306
## PM0020 -15145334   76820115   39004928   56721345  -16985648  -90307453
## PM0027  76820115 -437794696 -225987897 -320883814   98908925  518779234
## PM0028  39004928 -225987897 -117664995 -165475423   51361865  268684361
## PM0032  56721345 -320883814 -165475423 -235745198   72873964  380488610
## PM008  -16985648   98908925   51361865   72873964  -25377814 -115278444
## PM017  -90307453  518779234  268684361  380488610 -115278444 -623180278
## 
## $top
## [1] 500
## 
## $gene.selection
## [1] "pairwise"
## 
## $axislabel
## [1] "Leading logFC dim"
## 
## $x
##  [1]  -8415.157  -2895.196  11738.421 -13694.058  -3157.251   6644.365
##  [7]  -2575.105  14781.353   7654.442  10831.315  -3335.001 -17578.128
## 
## $y
##  [1]  1790.39350   -72.38924  -548.98768 -3098.69925  1476.87524   131.66709
##  [7]   559.95797  -286.59721   325.45308  -438.37328  -462.29976   622.99953
## 
## 
## [[2]]
## An object of class MDS
## $eigen.values
##  [1]  2.262292e+09  2.338745e+08  3.687864e+07  1.962398e+07  6.785555e+06
##  [6]  3.189939e+06  2.566050e+06  1.708646e+06  1.227233e+06  3.038702e+05
## [11]  6.074439e+04 -1.735721e-07
## 
## $eigen.vectors
##              [,1]        [,2]        [,3]        [,4]        [,5]         [,6]
##  [1,] -0.21099277  0.10587475 -0.02868638  0.06771672 -0.12901380  0.167378644
##  [2,] -0.08199674 -0.06345661 -0.13880812 -0.28712638 -0.09915371 -0.365195571
##  [3,]  0.29017169 -0.56077719 -0.39910871  0.55006766  0.18288245  0.122046287
##  [4,] -0.39562710  0.14951425 -0.05394657  0.06268717  0.15156046  0.301789109
##  [5,] -0.35529235  0.12244102 -0.03068457  0.02555451  0.15453341  0.219689304
##  [6,]  0.30519927 -0.22076871  0.06485829 -0.65421444  0.52724140  0.101485194
##  [7,] -0.02500655 -0.05094730  0.39255788  0.09859098 -0.01656440 -0.064229224
##  [8,]  0.57127801  0.73106446 -0.15820276  0.14920813  0.05152828  0.010950965
##  [9,]  0.21369170 -0.14261248  0.74140843  0.18292482 -0.20394264  0.043409735
## [10,]  0.10743988 -0.14169127 -0.26996331 -0.32173813 -0.74069849  0.245485819
## [11,] -0.30093007  0.08148308 -0.01649323  0.04219360  0.14651762 -0.003273051
## [12,] -0.11793498 -0.01012399 -0.10293096  0.08413534 -0.02489058 -0.779537212
##               [,7]        [,8]        [,9]         [,10]         [,11]
##  [1,]  0.094607124  0.83210905  0.29624111 -0.1430726201 -0.0358618215
##  [2,] -0.226474232 -0.26794839  0.73224556  0.0083073410  0.0408467339
##  [3,] -0.011155491 -0.03723853  0.07902480 -0.0010475826 -0.0059457573
##  [4,] -0.148322644 -0.11917497 -0.08974201  0.3945404085  0.6457446538
##  [5,] -0.081296273 -0.18090444 -0.06067394  0.2912823507 -0.7575232235
##  [6,]  0.027044462  0.17538694 -0.14949772  0.0140119259  0.0160466530
##  [7,]  0.822514681 -0.21125735  0.13111319  0.0623958551  0.0545902071
##  [8,] -0.001503039 -0.07053796  0.02828592 -0.0027754959 -0.0009649452
##  [9,] -0.471487781  0.01069135 -0.03733553  0.0102932834 -0.0111497775
## [10,]  0.081997770 -0.11066661 -0.28420493 -0.0009904231 -0.0031008347
## [11,] -0.065829705 -0.22765292 -0.20597199 -0.8334051320  0.0528189137
## [12,] -0.020094873  0.20719383 -0.43948446  0.2004600892  0.0044991981
##            [,12]
##  [1,] -0.2886751
##  [2,] -0.2886751
##  [3,] -0.2886751
##  [4,] -0.2886751
##  [5,] -0.2886751
##  [6,] -0.2886751
##  [7,] -0.2886751
##  [8,] -0.2886751
##  [9,] -0.2886751
## [10,] -0.2886751
## [11,] -0.2886751
## [12,] -0.2886751
## 
## $var.explained
##  [1] 8.807795e-01 9.105451e-02 1.435798e-02 7.640217e-03 2.641824e-03
##  [6] 1.241941e-03 9.990418e-04 6.652282e-04 4.777995e-04 1.183060e-04
## [11] 2.364965e-05 0.000000e+00
## 
## $dim.plot
## [1] 1 2
## 
## $distance.matrix.squared
##            AH0005     AH0015     AH0018     CC0003     CC0016      PM001
## AH0005 -209953787  -74109857  302722195 -384915941 -344721906  304581803
## AH0015  -74109857  -39770343   93463220 -141404472 -127634772  101374556
## AH0018  302722195   93463220 -552255450  555081231  496556338 -443907913
## CC0003 -384915941 -141404472  555081231 -720235946 -645638433  562403126
## CC0016 -344721906 -127634772  496556338 -645638433 -579165784  502918322
## PM001   304581803  101374556 -443907913  562403126  502918322 -465357532
## PM0020  -20629723   -5305188   28980904  -39173070  -36141044   30144103
## PM0027  508696487  233683516 -566303299  970341408  875817986 -709119692
## PM0028  211969924   84054493 -299635062  394963531  353350604 -307187019
## PM0032  108791238   29345089 -177532526  202955235  181674266 -164873438
## PM008  -290449691 -108641508  414715398 -544834811 -488855642  424161589
## PM017  -111980742  -45054734  148114964 -209541858 -188159935  164862096
##             PM0020      PM0027       PM0028     PM0032      PM008      PM017
## AH0005 -20629723.0   508696487  211969923.7  108791238 -290449691 -111980742
## AH0015  -5305188.2   233683516   84054493.0   29345089 -108641508  -45054734
## AH0018  28980904.4  -566303299 -299635062.2 -177532526  414715398  148114964
## CC0003 -39173070.0   970341408  394963530.9  202955235 -544834811 -209541858
## CC0016 -36141044.0   875817986  353350603.9  181674266 -488855642 -188159935
## PM001   30144102.8  -709119692 -307187019.2 -164873438  424161589  164862096
## PM0020 -19490565.4    86024217     586497.2   17440683  -31549768  -10887046
## PM0027  86024217.3 -1729403219 -495861186.8 -230029557  749394859  306758480
## PM0028    586497.2  -495861187 -259702384.0  -98200734  297235403  118425935
## PM0032  17440682.5  -230029557  -98200734.2  -79162355  153168499   56423602
## PM008  -31549767.8   749394859  297235402.5  153168499 -413954268 -160390060
## PM017  -10887045.7   306758480  118425935.2   56423602 -160390060  -68570703
## 
## $top
## [1] 500
## 
## $gene.selection
## [1] "pairwise"
## 
## $axislabel
## [1] "Leading logFC dim"
## 
## $x
##  [1] -10035.567  -3900.057  13801.598 -18817.432 -16898.968  14516.363
##  [7]  -1189.400  27172.014  10163.937   5110.223 -14313.305  -5609.407
## 
## $y
##  [1]  1619.1379  -970.4392 -8575.9413  2286.5150  1872.4852 -3376.2064
##  [7]  -779.1349 11180.1372 -2180.9665 -2166.8785  1246.1172  -154.8258
## 
## 
## [[3]]
## An object of class MDS
## $eigen.values
##  [1] 1.805114e+08 5.791190e+06 3.509207e+06 1.118331e+06 5.557315e+05
##  [6] 4.925769e+05 2.064478e+05 1.622386e+05 1.415559e+05 9.883636e+04
## [11] 4.096141e+04 1.060176e-08
## 
## $eigen.vectors
##              [,1]        [,2]        [,3]         [,4]         [,5]        [,6]
##  [1,]  0.13254933  0.06976093 -0.10138504 -0.381490607  0.563974080 -0.29041266
##  [2,] -0.03700583 -0.50538935  0.60302291  0.339417059  0.295429887  0.11731186
##  [3,]  0.17557043 -0.14552803 -0.26521723 -0.008786209 -0.399064503  0.45748267
##  [4,]  0.35079028 -0.05492723 -0.13105977 -0.011338461 -0.228623692 -0.01335748
##  [5,] -0.79519743 -0.09258790 -0.09225138 -0.348965045 -0.179198190 -0.05271741
##  [6,] -0.05359921 -0.06834056  0.12223761 -0.099552900 -0.004418229  0.41266568
##  [7,]  0.01136963  0.02590694  0.12456089  0.029514934 -0.237019731 -0.11053979
##  [8,] -0.03317872  0.81124839  0.27036020  0.264529034 -0.017123779  0.11675828
##  [9,] -0.02635616  0.13652737  0.24209348 -0.214127045 -0.040476307 -0.17120057
## [10,]  0.39319135 -0.04544415 -0.05723155 -0.388837507  0.104597440  0.03999745
## [11,]  0.06024086 -0.14977514 -0.12420381  0.367546055 -0.297738930 -0.66200783
## [12,] -0.17837453  0.01854873 -0.59092632  0.452090693  0.439661954  0.15601978
##              [,7]        [,8]        [,9]       [,10]       [,11]      [,12]
##  [1,]  0.20607293  0.15475878 -0.33015406  0.34594871  0.20226697 -0.2886751
##  [2,]  0.11195488  0.17059032  0.18449396  0.05758887  0.03174802 -0.2886751
##  [3,] -0.05421481  0.46846989 -0.10654360  0.43202108 -0.07284229 -0.2886751
##  [4,]  0.25753193 -0.01746251  0.17029887 -0.42612465  0.66605694 -0.2886751
##  [5,]  0.24165233  0.06973011  0.20672249 -0.06657784  0.01233785 -0.2886751
##  [6,]  0.03618495 -0.38372831 -0.66231241 -0.32815225 -0.13805671 -0.2886751
##  [7,] -0.19215553 -0.66419931  0.13802043  0.54765778  0.18444276 -0.2886751
##  [8,]  0.26067204  0.13379611  0.07570447  0.01642821 -0.09270142 -0.2886751
##  [9,] -0.79087853  0.27092303 -0.02233565 -0.23001230  0.09814282 -0.2886751
## [10,]  0.06796316 -0.15576480  0.46313904 -0.16104173 -0.56892680 -0.2886751
## [11,]  0.11545176  0.06927670 -0.26897963 -0.09444505 -0.33732375 -0.2886751
## [12,] -0.26023510 -0.11639002  0.15194610 -0.09329082  0.01485561 -0.2886751
## 
## $var.explained
##  [1] 9.370961e-01 3.006404e-02 1.821749e-02 5.805635e-03 2.884991e-03
##  [6] 2.557134e-03 1.071741e-03 8.422355e-04 7.348650e-04 5.130931e-04
## [11] 2.126446e-04 5.503737e-17
## 
## $dim.plot
## [1] 1 2
## 
## $distance.matrix.squared
##             AH0005      AH0015      AH0018    CC0003     CC0016       PM001
## AH0005  -7316729.3   2740971.8  -8156432.0 -16692561   37861109   2722000.1
## AH0015   2740971.8  -6398131.2   2678463.6   4988204  -10470585  -1545871.6
## AH0018  -8156432.0   2678463.6 -12363819.4 -22613043   50019981   3386185.1
## CC0003 -16692560.9   4988204.5 -22613043.5 -44747225  100466039   6864527.0
## CC0016  37861109.5 -10470585.2  50019980.8 100466039 -228797297 -15399139.4
## PM001    2722000.1  -1545871.6   3386185.1   6864527  -15399139  -1581447.2
## PM0020   -312147.4   -123707.1   -444710.7  -1323684    3375708    167660.9
## PM0027   1373046.1   2929184.4   3904495.3   4946381   -8304108   -193503.6
## PM0028   1182569.0   -356816.6   2367008.5   3691384   -7376408   -560360.7
## PM0032 -19139656.5   5470047.3 -25035285.4 -49872320  112480834   7568817.4
## PM008   -2565635.7    355830.2  -4138495.7  -7902145   17248125   1449728.8
## PM017    8303465.3   -267590.0  10395653.3  22194443  -51104259  -2878596.9
##            PM0020     PM0027     PM0028    PM0032      PM008       PM017
## AH0005  -312147.4  1373046.1  1182569.0 -19139657 -2565635.7   8303465.3
## AH0015  -123707.1  2929184.4  -356816.6   5470047   355830.2   -267590.0
## AH0018  -444710.7  3904495.3  2367008.5 -25035285 -4138495.7  10395653.3
## CC0003 -1323684.1  4946380.8  3691384.2 -49872320 -7902145.4  22194443.3
## CC0016  3375707.6 -8304108.5 -7376407.6 112480834 17248125.2 -51104258.9
## PM001    167660.9  -193503.6  -560360.7   7568817  1449728.8  -2878596.9
## PM0020  -465622.6  -306670.0  -139666.3  -1512927  -218616.1   1304383.2
## PM0027  -306670.0 -8739587.1 -1836966.0   5458527  2205667.6  -1436465.9
## PM0028  -139666.3 -1836966.0 -1304733.4   3771682  1100388.3   -538081.3
## PM0032 -1512927.3  5458526.9  3771681.9 -56314892 -8282822.1  25407995.9
## PM008   -218616.1  2205667.6  1100388.3  -8282822 -2549288.0   3297262.9
## PM017   1304383.2 -1436465.9  -538081.3  25407996  3297262.9 -14678210.8
## 
## $top
## [1] 500
## 
## $gene.selection
## [1] "pairwise"
## 
## $axislabel
## [1] "Leading logFC dim"
## 
## $x
##  [1]   1780.8603   -497.1901   2358.8684   4713.0265 -10683.8382   -720.1297
##  [7]    152.7562   -445.7712   -354.1070   5282.7042    809.3633  -2396.5427
## 
## $y
##  [1]   167.87892 -1216.21403  -350.21163  -132.18178  -222.81179  -164.46083
##  [7]    62.34477  1952.26052   328.55164  -109.36086  -360.43225    44.63732
## 
## 
## [[4]]
## An object of class MDS
## $eigen.values
##  [1]  9.439746e+08  1.384976e+07  5.807493e+06  3.337702e+06  1.330013e+06
##  [6]  5.507348e+05  2.728622e+05  1.836520e+05  1.164764e+05  5.233760e+04
## [11]  1.534511e+04 -7.806144e-09
## 
## $eigen.vectors
##              [,1]         [,2]        [,3]         [,4]        [,5]
##  [1,] -0.26472626 -0.170414555  0.26814178 -0.072268807  0.25387834
##  [2,] -0.20173024 -0.042368423  0.11450484 -0.005734423  0.02207535
##  [3,] -0.11681308  0.050090013  0.31172570 -0.040589527 -0.70549638
##  [4,]  0.53680059 -0.760521118 -0.15732652 -0.080967186 -0.10974061
##  [5,]  0.23344450  0.127603346  0.08956251  0.884534773  0.16981546
##  [6,] -0.01449653  0.309091943 -0.56178415  0.057551663 -0.34650307
##  [7,] -0.23539191 -0.106982165  0.15577710 -0.084633230  0.22285332
##  [8,] -0.13623204  0.062808885 -0.59855153 -0.164697187  0.32288500
##  [9,] -0.18844839 -0.020386399  0.11640330 -0.025837095  0.22792313
## [10,] -0.11847785  0.005327176 -0.05274178  0.036948322 -0.18564920
## [11,]  0.62796621  0.509186471  0.26007794 -0.388798397  0.18202391
## [12,] -0.12189499  0.036564826  0.05421081 -0.115508906 -0.05406525
##               [,6]        [,7]         [,8]         [,9]       [,10]
##  [1,] -0.148132804  0.07278886  0.072330582  0.185719103  0.54632772
##  [2,] -0.037747567  0.19769499  0.249965772  0.656696655 -0.56868480
##  [3,]  0.300846803 -0.32471294  0.295198785 -0.120286847  0.07551690
##  [4,] -0.066227514 -0.03606280 -0.011012285  0.004763446 -0.03027055
##  [5,]  0.130765865 -0.08005231 -0.005190058  0.016063837  0.05110008
##  [6,] -0.578668178 -0.06936489 -0.041838643  0.131352855  0.14445061
##  [7,] -0.198437665 -0.11050878  0.054726593 -0.055019425  0.28917778
##  [8,]  0.554860843 -0.16788901  0.250001311 -0.052231976  0.03391596
##  [9,] -0.328014663 -0.23261007  0.012918414 -0.587946537 -0.50623727
## [10,]  0.139789063  0.84310866 -0.072184572 -0.353889109  0.01843400
## [11,] -0.004360888  0.07223750  0.071053634  0.015600907  0.02409443
## [12,]  0.235326706 -0.16462921 -0.875969534  0.159177091 -0.07782486
##              [,11]      [,12]
##  [1,]  0.557251940 -0.2886751
##  [2,] -0.053860535 -0.2886751
##  [3,]  0.026560537 -0.2886751
##  [4,]  0.004714546 -0.2886751
##  [5,] -0.014931025 -0.2886751
##  [6,]  0.049013366 -0.2886751
##  [7,] -0.792138639 -0.2886751
##  [8,]  0.045632426 -0.2886751
##  [9,]  0.225270446 -0.2886751
## [10,] -0.053175887 -0.2886751
## [11,] -0.002643967 -0.2886751
## [12,]  0.008306792 -0.2886751
## 
## $var.explained
##  [1] 9.736806e-01 1.428560e-02 5.990249e-03 3.442737e-03 1.371867e-03
##  [6] 5.680659e-04 2.814489e-04 1.894314e-04 1.201418e-04 5.398462e-05
## [11] 1.582800e-05 0.000000e+00
## 
## $dim.plot
## [1] 1 2
## 
## $distance.matrix.squared
##            AH0005     AH0015    AH0018     CC0003     CC0016    PM001
## AH0005 -134231113 -101412618 -58604962  265214860  117329895 -3880091
## AH0015 -101412618  -77214044 -44761567  203763645   88978480 -4412794
## AH0018  -58604962  -44761567 -28487977  119798550   51483317 -2040002
## CC0003  265214860  203763645 119798550 -560411929 -233197348 20062836
## CC0016  117329895   88978480  51483317 -233197348 -108752738  5776676
## PM001    -3880091   -4412794  -2040002   20062836    5776676 -7428674
## PM0020 -118857997  -89976617 -51895909  236593397  104381895 -4403363
## PM0027  -66134129  -51012033 -27645383  138337620   61182265 -7458821
## PM0028  -94803814  -71894447 -41478903  190789830   83097805 -4195871
## PM0032  -58875003  -45057714 -26182697  120080220   52136395 -3687116
## PM008   315126660  239375638 137084788 -625367523 -276617479 14841518
## PM017   -60871686  -46375928 -27269255  124335842   54200839 -3174297
##            PM0020    PM0027    PM0028    PM0032      PM008     PM017
## AH0005 -118857997 -66134129 -94803814 -58875003  315126660 -60871686
## AH0015  -89976617 -51012033 -71894447 -45057714  239375638 -46375928
## AH0018  -51895909 -27645383 -41478903 -26182697  137084788 -27269255
## CC0003  236593397 138337620 190789830 120080220 -625367523 124335842
## CC0016  104381895  61182265  83097805  52136395 -276617479  54200839
## PM001    -4403363  -7458821  -4195871  -3687116   14841518  -3174297
## PM0020 -105468695 -59452401 -84241422 -52333894  279785339 -54130333
## PM0027  -59452401 -40145931 -47675913 -30654125  161853700 -31194848
## PM0028  -84241422 -47675913 -67614903 -41848175  223187625 -43321812
## PM0032  -52333894 -30654125 -41848175 -27075685  140704108 -27206314
## PM008   279785339 161853700 223187625 140704108 -753566229 143591855
## PM017   -54130333 -31194848 -43321812 -27206314  143591855 -28584062
## 
## $top
## [1] 500
## 
## $gene.selection
## [1] "pairwise"
## 
## $axislabel
## [1] "Leading logFC dim"
## 
## $x
##  [1] -8133.4945 -6197.9943 -3588.9850 16492.7525  7172.3884  -445.3939
##  [7] -7232.2209 -4185.6162 -5789.9205 -3640.1335 19293.7406 -3745.1225
## 
## $y
##  [1]  -634.20223  -157.67520   186.41130 -2830.29928   474.87920  1150.29377
##  [7]  -398.13693   233.74491   -75.86852    19.82523  1894.95080   136.07696
## 
## 
## [[5]]
## An object of class MDS
## $eigen.values
##  [1]  1.503535e+08  3.450944e+06  1.802376e+06  1.290274e+06  6.648787e+05
##  [6]  5.266068e+05  2.197101e+05  1.696696e+05  1.379904e+05  7.954587e+04
## [11]  5.173911e+04 -3.114308e-09
## 
## $eigen.vectors
##              [,1]        [,2]        [,3]        [,4]        [,5]        [,6]
##  [1,] -0.33642554 -0.18413004 -0.09263789  0.05915310  0.17039263  0.14877149
##  [2,] -0.21882848 -0.19882050 -0.14249871 -0.10604865  0.06082605 -0.07252855
##  [3,]  0.73404401 -0.36117409  0.18650217 -0.34300841  0.17218374  0.18601028
##  [4,] -0.20495868 -0.21431290  0.30411552  0.40811084  0.28445070  0.10746483
##  [5,]  0.07970053 -0.07319032 -0.26357421  0.17446638 -0.75367397  0.34019076
##  [6,] -0.03748048  0.04877688 -0.08369392 -0.34576872 -0.23924550 -0.22768980
##  [7,]  0.23772411  0.33267056 -0.52885006  0.33343404  0.37544129  0.29587800
##  [8,] -0.09356534  0.72523465  0.43485159 -0.25106930 -0.02971623  0.27345422
##  [9,]  0.02610530  0.18419739 -0.37641522 -0.19222193  0.13500207 -0.58682884
## [10,] -0.33589801 -0.24835178  0.01754668 -0.18781847 -0.07720061  0.08891278
## [11,]  0.24854782  0.06579653  0.33662474  0.54398754 -0.22325928 -0.49016616
## [12,] -0.09896525 -0.07669637  0.20802929 -0.09321639  0.12479910 -0.06346902
##              [,7]        [,8]        [,9]        [,10]       [,11]     [,12]
##  [1,] -0.03746002  0.59247649 -0.27881784 -0.195758173  0.48768934 0.2886751
##  [2,] -0.15561458  0.06676875  0.02615686  0.859558929 -0.14331461 0.2886751
##  [3,]  0.07385915  0.14583618  0.05898499  0.002492127  0.02248626 0.2886751
##  [4,]  0.22219896 -0.32896306  0.53097702 -0.027319243  0.19223679 0.2886751
##  [5,]  0.30919518 -0.10928185 -0.03503622  0.048615635  0.10078878 0.2886751
##  [6,] -0.60211703 -0.25887523  0.28869329 -0.192198137  0.35692537 0.2886751
##  [7,] -0.27808577 -0.11782618 -0.04191641 -0.076996088 -0.17670181 0.2886751
##  [8,]  0.11307303  0.15286233  0.06314419  0.117382095 -0.01538789 0.2886751
##  [9,]  0.56336729  0.03895518  0.11247917 -0.093495746  0.02306396 0.2886751
## [10,] -0.05768790  0.12011649  0.10827870 -0.389519789 -0.71519627 0.2886751
## [11,] -0.21539880  0.25960611 -0.12103020 -0.001732668 -0.15090378 0.2886751
## [12,]  0.06467051 -0.56167522 -0.71191357 -0.051028940  0.01831386 0.2886751
## 
## $var.explained
##  [1] 0.9471251725 0.0217386024 0.0113537450 0.0081278517 0.0041882841
##  [6] 0.0033172650 0.0013840244 0.0010688030 0.0008692456 0.0005010849
## [11] 0.0003259212 0.0000000000
## 
## $dim.plot
## [1] 1 2
## 
## $distance.matrix.squared
##           AH0005    AH0015     AH0018    CC0003      CC0016       PM001
## AH0005 -34542452 -22404357   73822820 -20949044   7993541.4 -3574676.26
## AH0015 -22404357 -14917150   47810408 -13502536   5162140.4 -2540877.70
## AH0018  73822820  47810408 -163442990  44777341 -17341688.5  8271234.24
## CC0003 -20949044 -13502536   44777341 -13972243   5116617.0 -1686054.42
## CC0016   7993541   5162140  -17341688   5116617  -3201141.8   913638.74
## PM001   -3574676  -2540878    8271234  -1686054    913638.7 -1127446.58
## PM0020  24135738  15903220  -51121363  15220036  -5876254.7  2819252.41
## PM0027  -8416084  -4996224   21887115  -4928348   2997395.9 -1292929.17
## PM0028   2846067   1718828   -5158205   2443830   -531674.5   -10833.17
## PM0032 -34251635 -22438123   73342626 -20856184   7940663.2 -3866543.36
## PM008   25327363  16726210  -54299687  14684692  -5857485.5  3158493.75
## PM017   -9987281  -6521539   21452390  -6348107   2684248.4 -1063258.49
##           PM0020     PM0027      PM0028    PM0032     PM008     PM017
## AH0005  24135738 -8416084.1  2846067.35 -34251635  25327363  -9987281
## AH0015  15903220 -4996224.3  1718827.99 -22438123  16726210  -6521539
## AH0018 -51121363 21887115.3 -5158205.38  73342626 -54299687  21452390
## CC0003  15220036 -4928348.3  2443830.42 -20856184  14684692  -6348107
## CC0016  -5876255  2997395.9  -531674.48   7940663  -5857486   2684248
## PM001    2819252 -1292929.2   -10833.17  -3866543   3158494  -1063258
## PM0020 -19375693  6019827.6 -2654818.34  24769057 -17500845   7661843
## PM0027   6019828 -7203791.3   422152.46  -8384590   6620001  -2724526
## PM0028  -2654818   422152.5 -1577046.14   2957248  -1517049   1061500
## PM0032  24769057 -8384589.9  2957248.27 -34548772  25459475 -10123221
## PM008  -17500845  6620001.4 -1517048.96  25459475 -20147471   7346303
## PM017    7661843 -2724525.7  1061499.96 -10123221   7346303  -3438351
## 
## $top
## [1] 500
## 
## $gene.selection
## [1] "pairwise"
## 
## $axislabel
## [1] "Leading logFC dim"
## 
## $x
##  [1] -4125.2073 -2683.2471  9000.7547 -2513.1774   977.2778  -459.5809
##  [7]  2914.9430 -1147.2864   320.0999 -4118.7388  3047.6619 -1213.4994
## 
## $y
##  [1] -342.05314 -369.34320 -670.94285 -398.12300 -135.96358   90.61143
##  [7]  617.99265 1347.24782  342.17826 -461.35605  122.22834 -142.47667
## 
## 
## [[6]]
## An object of class MDS
## $eigen.values
##  [1]  1.624726e+07  2.072002e+06  1.645040e+05  2.925670e+04  2.155713e+04
##  [6]  1.109050e+04  6.653763e+03  5.443311e+03  3.324356e+03  1.324308e+03
## [11]  3.782650e+02 -8.571726e-10
## 
## $eigen.vectors
##              [,1]        [,2]        [,3]        [,4]        [,5]        [,6]
##  [1,]  0.37157376  0.08677345  0.42852207 -0.12182975  0.14431841  0.20488888
##  [2,] -0.72252264 -0.18234450  0.35760872 -0.11125725  0.40137935 -0.17669701
##  [3,]  0.14393844 -0.05997944 -0.39396197 -0.01946928  0.03816285 -0.24424533
##  [4,] -0.08331470 -0.07496685 -0.58146735  0.16559247  0.31183676  0.38931016
##  [5,] -0.03924526 -0.15020547  0.16647570  0.71775492 -0.32490009 -0.11374361
##  [6,] -0.25499042 -0.16026624 -0.03687776 -0.43863959 -0.61710625  0.47189350
##  [7,] -0.05124569 -0.14233535 -0.15765020  0.10969210 -0.30090745 -0.34739067
##  [8,]  0.23101187 -0.04760474 -0.08843917 -0.46222290 -0.01431352 -0.54923326
##  [9,]  0.07983698 -0.10555497  0.08769768  0.08815619  0.10999634  0.08381449
## [10,]  0.34449873 -0.02689452  0.34177840  0.04110713 -0.02400581  0.13344227
## [11,] -0.18926594  0.92900927 -0.03661573  0.04534740 -0.07624131 -0.03052837
## [12,]  0.16972487 -0.06563064 -0.08707039 -0.01423144  0.35178071  0.17848895
##              [,7]         [,8]        [,9]       [,10]       [,11]     [,12]
##  [1,]  0.10604965  0.154172783 -0.01343462 -0.44657944 -0.52455658 0.2886751
##  [2,]  0.10392153  0.080940459 -0.09567866 -0.02211141  0.04236079 0.2886751
##  [3,]  0.27394470  0.252853155 -0.61442585  0.30084672 -0.26200247 0.2886751
##  [4,]  0.16792577 -0.185611406  0.06716224 -0.44179426  0.16562608 0.2886751
##  [5,]  0.34075567 -0.146538933  0.24546903  0.11806322 -0.13927948 0.2886751
##  [6,]  0.07102842 -0.002888953  0.02822330  0.13632533 -0.06525708 0.2886751
##  [7,] -0.56259267  0.404492838  0.04554268 -0.39832016  0.06936583 0.2886751
##  [8,]  0.22311259 -0.388765583  0.35060624 -0.05794957  0.10246768 0.2886751
##  [9,] -0.58194368 -0.622477560 -0.27214149  0.20200877 -0.15348979 0.2886751
## [10,]  0.09491110  0.106123346 -0.27764463  0.02487189  0.74993543 0.2886751
## [11,] -0.04278733 -0.020919003  0.01555772  0.06045865  0.03846264 0.2886751
## [12,] -0.19432574  0.368618857  0.52076403  0.52418026 -0.02363304 0.2886751
## 
## $var.explained
##  [1] 8.752594e-01 1.116213e-01 8.862026e-03 1.576093e-03 1.161309e-03
##  [6] 5.974585e-04 3.584462e-04 2.932377e-04 1.790871e-04 7.134206e-05
## [11] 2.037759e-05 0.000000e+00
## 
## $dim.plot
## [1] 1 2
## 
## $distance.matrix.squared
##            AH0005    AH0015     AH0018     CC0003      CC0016      PM001
## AH0005 -4581884.9   8736181 -1660697.2  1111982.1   511919.42  3140222.5
## AH0015  8736180.7 -17151906  3377708.6 -1947148.7 -1044813.98 -6093830.0
## AH0018 -1660697.2   3377709  -745107.1   298021.8   168580.27  1150843.8
## CC0003  1111982.1  -1947149   298021.8  -370560.7  -123678.62  -738709.4
## CC0016   511919.4  -1044814   168580.3  -123678.6  -189875.39  -412370.1
## PM001   3140222.5  -6093830  1150843.8  -738709.4  -412370.08 -2252425.9
## PM0020   696063.6  -1287168   184067.3  -205551.9  -151757.93  -521926.3
## PM0027 -2760044.6   5393472 -1105509.6   601596.2   285462.65  1874668.2
## PM0028  -936785.3   1784531  -385378.1   197488.5    31366.78   597285.8
## PM0032 -4198204.8   8028397 -1574511.8   988514.6   402400.82  2839742.8
## PM008   1957438.1  -3735704  1111648.8  -229828.7   335977.75  -952194.4
## PM017  -2016189.6   3940282  -819666.8   417874.9   186788.30  1368693.2
##             PM0020     PM0027     PM0028     PM0032      PM008      PM017
## AH0005   696063.62 -2760044.6 -936785.31 -4198204.8  1957438.1 -2016189.6
## AH0015 -1287168.04  5393472.3 1784530.93  8028396.9 -3735704.4  3940282.1
## AH0018   184067.34 -1105509.6 -385378.07 -1574511.8  1111648.8  -819666.8
## CC0003  -205551.94   601596.2  197488.48   988514.6  -229828.7   417874.9
## CC0016  -151757.93   285462.6   31366.78   402400.8   335977.8   186788.3
## PM001   -521926.26  1874668.2  597285.76  2839742.8  -952194.4  1368693.2
## PM0020  -191181.90   353774.2   75428.08   576291.8   229213.1   242747.8
## PM0027   353774.25 -1768426.0 -614333.47 -2577898.8  1603767.6 -1286528.7
## PM0028    75428.08  -614333.5 -266295.99  -914667.0   898141.3  -466781.6
## PM0032   576291.84 -2577898.8 -914666.97 -3899559.5  2226343.4 -1896848.5
## PM008    229213.09  1603767.6  898141.35  2226343.4 -4741396.8  1296594.1
## PM017    242747.84 -1286528.7 -466781.57 -1896848.5  1296594.1  -966965.4
## 
## $top
## [1] 500
## 
## $gene.selection
## [1] "pairwise"
## 
## $axislabel
## [1] "Leading logFC dim"
## 
## $x
##  [1]  1497.7354 -2912.3362   580.1855  -335.8240  -158.1893 -1027.8125
##  [7]  -206.5606   931.1601   321.8060  1388.6016  -762.8910   684.1251
## 
## $y
##  [1]  124.90562 -262.47490  -86.33711 -107.91066 -216.21253 -230.69445
##  [7] -204.88392  -68.52440 -151.94059  -38.71319 1337.25784  -94.47170
## 
## 
## [[7]]
## An object of class MDS
## $eigen.values
##  [1]  1.348388e+08  4.588740e+06  1.015494e+06  4.645206e+05  2.400461e+05
##  [6]  1.979490e+05  1.155072e+05  6.704047e+04  5.946306e+04  5.324812e+04
## [11]  3.721121e+04 -2.798162e-09
## 
## $eigen.vectors
##              [,1]        [,2]          [,3]        [,4]        [,5]        [,6]
##  [1,] -0.21656107  0.28974345  0.2457217173  0.03541434 -0.21228703  0.38997880
##  [2,] -0.05768345 -0.14532756  0.2934475272  0.06262777 -0.52176369 -0.03525894
##  [3,] -0.12749814 -0.06133246 -0.0661449295 -0.49275087  0.16117016 -0.68905364
##  [4,] -0.17104655  0.23725892 -0.3562205821 -0.20817516  0.04283207  0.26554714
##  [5,] -0.05757781 -0.07533413  0.0374990753  0.26832737  0.49371928  0.05064320
##  [6,]  0.20409763 -0.59718046  0.2214329018 -0.36116803  0.27120580  0.41591254
##  [7,] -0.26111394  0.36747378  0.0127718438  0.16288319  0.43104787  0.03750373
##  [8,]  0.86880857  0.39545336  0.0001832576 -0.02107581 -0.01334379 -0.05149579
##  [9,]  0.04560154 -0.26530049  0.0948432437  0.65986450  0.01046348 -0.30551608
## [10,] -0.11358371  0.02335053  0.3655950964 -0.13944649 -0.16459471 -0.10183638
## [11,]  0.02949311 -0.30346634 -0.7148007676  0.12592525 -0.24005972  0.10604319
## [12,] -0.14293618  0.13466139 -0.1343283840 -0.09242606 -0.25838972 -0.08246778
##              [,7]        [,8]         [,9]       [,10]       [,11]      [,12]
##  [1,]  0.23027389 -0.27062783  0.220659257 -0.08762147  0.58685654 -0.2886751
##  [2,] -0.30478331  0.08610737 -0.616438254 -0.21857323 -0.02504464 -0.2886751
##  [3,]  0.10581112 -0.08151260 -0.053534711 -0.11536226  0.33865202 -0.2886751
##  [4,]  0.13188425  0.67191718 -0.214630056  0.26527007  0.05690033 -0.2886751
##  [5,] -0.70419611  0.03755267  0.085055235  0.11345849  0.26558882 -0.2886751
##  [6,]  0.21263019 -0.13147723 -0.079711124  0.09415095 -0.12107642 -0.2886751
##  [7,]  0.19494529 -0.23978292 -0.251797189 -0.36977948 -0.45156190 -0.2886751
##  [8,] -0.01895670 -0.01186401 -0.006291623 -0.03852416  0.01253275 -0.2886751
##  [9,]  0.45939201  0.16757847  0.018951690  0.25138038  0.06051475 -0.2886751
## [10,] -0.10876279  0.36234254  0.626544566 -0.17274923 -0.38357678 -0.2886751
## [11,] -0.05725398 -0.13490838  0.224088512 -0.39427588 -0.02977328 -0.2886751
## [12,] -0.14098387 -0.45532526  0.047103696  0.67262582 -0.31001218 -0.2886751
## 
## $var.explained
##  [1] 0.9517270217 0.0323885098 0.0071676192 0.0032787068 0.0016943072
##  [6] 0.0013971754 0.0008152800 0.0004731889 0.0004197057 0.0003758390
## [11] 0.0002626463 0.0000000000
## 
## $dim.plot
## [1] 1 2
## 
## $distance.matrix.squared
##           AH0005     AH0015     AH0018    CC0003     CC0016     PM001    PM0020
## AH0005 -13677937 -3144038.9 -7134030.1 -10449323 -3121310.2  13364591 -16196428
## AH0015  -3144039 -1473655.2 -1963896.2  -2113421  -950377.2   2353840  -3491761
## AH0018  -7134030 -1963896.2 -4867013.3  -5817063 -1905771.8   6635379  -8720132
## CC0003 -10449323 -2113420.6 -5817062.9  -8811096 -2412418.9  10757055 -12795134
## CC0016  -3121310  -950377.2 -1905771.8  -2412419 -1256137.3   2794099  -3896009
## PM001   13364591  2353840.5  6635378.9  10757055  2794099.1 -14846680  16355897
## PM0020 -16196428 -3491760.8 -8720132.1 -12795134 -3896008.7  16355897 -19794554
## PM0027  49695339 14037083.4 30072042.2  39219087 13770477.0 -45648155  59850764
## PM0028   3328711   296734.3  1641555.0   2873330   426043.5  -3757649   4003082
## PM0032  -6856854 -1958830.5 -3903864.1  -5045379 -1715733.0   6222622  -8014117
## PM008    2831035   418801.4   849640.8   1553102   320417.0  -2902740   3136253
## PM017   -8639756 -2010480.2 -4886846.4  -6958741 -2053279.5   8671741 -10437862
##            PM0027     PM0028   PM0032      PM008     PM017
## AH0005   49695339  3328711.1 -6856854  2831034.8  -8639756
## AH0015   14037083   296734.3 -1958830   418801.4  -2010480
## AH0018   30072042  1641555.0 -3903864   849640.8  -4886846
## CC0003   39219087  2873329.9 -5045379  1553101.8  -6958741
## CC0016   13770477   426043.5 -1715733   320417.0  -2053280
## PM001   -45648155 -3757649.0  6222622 -2902740.3   8671741
## PM0020   59850764  4003081.7 -8014117  3136253.0 -10437862
## PM0027 -204997307 -9711521.6 26521933 -5807353.8  32997612
## PM0028   -9711522 -1726108.5  1465587 -1007759.2   2167995
## PM0032   26521933  1465587.5 -3871973  1481123.0  -4324515
## PM008    -5807354 -1007759.2  1481123 -2190103.0   1317585
## PM017    32997612  2167995.5 -4324515  1317584.6  -5843454
## 
## $top
## [1] 500
## 
## $gene.selection
## [1] "pairwise"
## 
## $axislabel
## [1] "Leading logFC dim"
## 
## $x
##  [1] -2514.7094  -669.8208 -1480.5098 -1986.1943  -668.5941  2369.9838
##  [7] -3032.0579 10088.6143   529.5256 -1318.9352   342.4743 -1659.7764
## 
## $y
##  [1]   620.66940  -311.31115  -131.38236   508.24048  -161.37584 -1279.24077
##  [7]   787.17820   847.11422  -568.30928    50.01998  -650.06567   288.46279
## 
## 
## [[8]]
## An object of class MDS
## $eigen.values
##  [1] 1.208371e+07 2.559413e+05 1.334695e+05 5.803010e+04 3.156240e+04
##  [6] 2.746692e+04 2.275065e+04 1.096778e+04 3.602062e+03 2.798498e+03
## [11] 1.764331e+03 3.386159e-10
## 
## $eigen.vectors
##              [,1]        [,2]         [,3]        [,4]        [,5]        [,6]
##  [1,]  0.40228618 -0.02776566 -0.037890160 -0.02865201 -0.05588595  0.12740053
##  [2,]  0.34684339 -0.04486574 -0.076054464  0.04308398  0.04480435 -0.01414464
##  [3,]  0.38035922 -0.19604628 -0.013813082 -0.05169892 -0.01389678  0.15624625
##  [4,] -0.35406178 -0.17350798 -0.181253130  0.53837284 -0.49042516  0.41674314
##  [5,] -0.01090287 -0.07326353  0.119111836  0.10582489  0.15899783 -0.23666285
##  [6,] -0.16349354  0.03499592  0.577000908  0.09253604  0.55296172  0.41748102
##  [7,]  0.32912902 -0.07036515 -0.140592531 -0.01319490 -0.03746638  0.06050215
##  [8,] -0.13393869  0.80737412 -0.191125152 -0.33850304 -0.11137747  0.24132766
##  [9,]  0.06924709  0.02615668  0.006223225 -0.10159593 -0.13119906 -0.40812729
## [10,] -0.16895123  0.09404652  0.569322420  0.02383472 -0.41854719 -0.41781498
## [11,] -0.44523937 -0.49233499 -0.186777720 -0.64634648  0.03783911  0.04455359
## [12,] -0.25127741  0.11557608 -0.444152150  0.37633881  0.46419498 -0.38750456
##              [,7]         [,8]        [,9]         [,10]       [,11]      [,12]
##  [1,]  0.19282070  0.100108844  0.12077578  8.936055e-02  0.81404983 -0.2886751
##  [2,]  0.04661615  0.001573572 -0.22563273  7.864107e-01 -0.33612178 -0.2886751
##  [3,]  0.05521746 -0.080402005  0.68478268 -2.579926e-01 -0.40135873 -0.2886751
##  [4,] -0.12352274 -0.083662532 -0.01869846  3.786864e-02  0.01646988 -0.2886751
##  [5,] -0.71153517  0.538050213  0.07157003 -2.879003e-02  0.05265575 -0.2886751
##  [6,]  0.02988155 -0.228445128 -0.11273292 -2.883938e-02  0.02326533 -0.2886751
##  [7,]  0.13098973  0.161712620 -0.64378333 -5.358289e-01 -0.18304667 -0.2886751
##  [8,] -0.08865230  0.081082481  0.07125521  3.485128e-03 -0.07479278 -0.2886751
##  [9,] -0.35768868 -0.748534010 -0.09243394 -8.316673e-02  0.11550197 -0.2886751
## [10,]  0.39940977  0.193433765  0.04473844 -1.308521e-05 -0.07670636 -0.2886751
## [11,]  0.08725042  0.066183787 -0.02834035  7.847867e-02  0.03183261 -0.2886751
## [12,]  0.33921312 -0.001101607  0.12849958 -6.097301e-02  0.01825095 -0.2886751
## 
## $var.explained
##  [1] 9.565904e-01 2.026124e-02 1.056592e-02 4.593872e-03 2.498593e-03
##  [6] 2.174380e-03 1.801023e-03 8.682493e-04 2.851522e-04 2.215392e-04
## [11] 1.396708e-04 2.680606e-17
## 
## $dim.plot
## [1] 1 2
## 
## $distance.matrix.squared
##            AH0005      AH0015      AH0018      CC0003      CC0016       PM001
## AH0005 -3917477.3 -3372739.05 -3701799.20  3436329.11  113594.817  1595475.72
## AH0015 -3372739.1 -2914603.06 -3190995.22  2959298.18   92760.356  1381185.41
## AH0018 -3701799.2 -3190995.22 -3522365.53  3236119.45   98531.886  1506048.24
## CC0003  3436329.1  2959298.18  3236119.45 -3113024.56  -93308.329 -1366432.52
## CC0016   113594.8    92760.36    98531.89   -93308.33  -44818.126   -57659.35
## PM001   1595475.7  1381185.41  1506048.24 -1366432.52  -57659.345  -766650.76
## PM0020 -3203037.5 -2762302.22 -3031566.05  2802577.01   92491.596  1323475.64
## PM0027  1309267.0  1139770.11  1307235.80 -1071779.56    5626.634  -511666.31
## PM0028  -666173.1  -578024.39  -631036.09   603399.33   13554.794   283851.28
## PM0032  1647455.6  1429788.11  1566958.48 -1412048.13  -49977.122  -732532.60
## PM008   4316485.0  3719655.15  4038648.17 -3821444.59 -119640.159 -1716851.02
## PM017   2442618.8  2096206.64  2324220.06 -2159685.39  -51157.001  -938243.75
##            PM0020       PM0027     PM0028      PM0032      PM008      PM017
## AH0005 -3203037.5  1309266.985 -666173.05  1647455.65  4316485.0  2442618.8
## AH0015 -2762302.2  1139770.107 -578024.39  1429788.11  3719655.1  2096206.6
## AH0018 -3031566.1  1307235.802 -631036.09  1566958.48  4038648.2  2324220.1
## CC0003  2802577.0 -1071779.564  603399.33 -1412048.13 -3821444.6 -2159685.4
## CC0016    92491.6     5626.634   13554.79   -49977.12  -119640.2   -51157.0
## PM001   1323475.6  -511666.307  283851.28  -732532.60 -1716851.0  -938243.8
## PM0020 -2632144.8  1086232.622 -544555.43  1366152.55  3515102.2  1987574.4
## PM0027  1086232.6  -794815.738  214121.89  -551952.22 -1272737.6  -859302.6
## PM0028  -544555.4   214121.890 -145941.35   277723.88   748223.5   424855.7
## PM0032  1366152.6  -551952.221  277723.88  -809726.14 -1763915.9  -967926.5
## PM008   3515102.2 -1272737.625  748223.46 -1763915.94 -4973466.0 -2670058.7
## PM017   1987574.4  -859302.585  424855.68  -967926.52 -2670058.7 -1629101.6
## 
## $top
## [1] 500
## 
## $gene.selection
## [1] "pairwise"
## 
## $axislabel
## [1] "Leading logFC dim"
## 
## $x
##  [1]  1398.41261  1205.68439  1322.19092 -1230.77672   -37.90017  -568.33030
##  [7]  1144.10636  -465.59282   240.71421  -587.30214 -1547.72493  -873.48141
## 
## $y
##  [1]  -14.04682  -22.69786  -99.18107  -87.77880  -37.06449   17.70466
##  [7]  -35.59818  408.45574   13.23283   47.57874 -249.07543   58.47068
## 
## 
## [[9]]
## An object of class MDS
## $eigen.values
##  [1]  2.705127e+07  1.874315e+06  8.069168e+05  1.686456e+05  6.331511e+04
##  [6]  3.321878e+04  2.150973e+04  1.587891e+04  1.035439e+04  4.486565e+03
## [11]  3.341495e+03 -1.159923e-09
## 
## $eigen.vectors
##              [,1]         [,2]         [,3]        [,4]         [,5]
##  [1,]  0.16231973  0.285341234  0.175381387  0.01090552  0.332647027
##  [2,] -0.90872962  0.217840186  0.007105863 -0.10839728  0.048366303
##  [3,]  0.16277096 -0.005801096 -0.110885781 -0.12662349 -0.107229356
##  [4,]  0.11765224  0.100122499 -0.107796661  0.14580899  0.341270474
##  [5,]  0.17821126  0.050356747 -0.031076250 -0.01547422 -0.012617805
##  [6,]  0.09049539 -0.226406478 -0.518434363 -0.68516849 -0.053589406
##  [7,]  0.07324513  0.243753384 -0.046337219  0.05770197  0.425283020
##  [8,]  0.18862836  0.106668473  0.084965086  0.17472089 -0.003963641
##  [9,] -0.04696411 -0.674541106  0.602418798 -0.09456650  0.148620700
## [10,]  0.04129980  0.100211250  0.318141810 -0.16219147 -0.410770780
## [11,] -0.13189638 -0.453679763 -0.443939411  0.61306999 -0.095487339
## [12,]  0.07296723  0.256134671  0.070456742  0.19021410 -0.612529196
##               [,6]         [,7]        [,8]         [,9]        [,10]
##  [1,] -0.073982845 -0.599370484 -0.12927635  0.136938577  0.398370764
##  [2,]  0.061080085  0.035595589 -0.04189178  0.147455161 -0.025842435
##  [3,] -0.084545147  0.078696806 -0.72359793  0.184170005  0.103640562
##  [4,]  0.506773598  0.541839553 -0.07606035 -0.289452048  0.272549911
##  [5,]  0.093165155  0.046165612 -0.21552040  0.246134078 -0.742102217
##  [6,] -0.040031881 -0.040512134  0.28529356  0.005682509  0.136993620
##  [7,] -0.549407564  0.077739507  0.21145092 -0.373160857 -0.293289925
##  [8,]  0.293347633 -0.002006901  0.51424333  0.554440249 -0.029517633
##  [9,] -0.165767581  0.164635917  0.02673382  0.047108676  0.064942654
## [10,]  0.368282447 -0.320925214  0.04546348 -0.560533134 -0.154307372
## [11,] -0.002060733 -0.306858069 -0.00779765 -0.130757289  0.001722081
## [12,] -0.406853167  0.324999817  0.11095935  0.031974073  0.266839991
##              [,11]      [,12]
##  [1,] -0.329371362 -0.2886751
##  [2,]  0.010928734 -0.2886751
##  [3,]  0.518378566 -0.2886751
##  [4,] -0.170861014 -0.2886751
##  [5,] -0.460922422 -0.2886751
##  [6,] -0.112604358 -0.2886751
##  [7,]  0.296094920 -0.2886751
##  [8,]  0.416133792 -0.2886751
##  [9,] -0.061486926 -0.2886751
## [10,]  0.173106146 -0.2886751
## [11,] -0.007904589 -0.2886751
## [12,] -0.271491487 -0.2886751
## 
## $var.explained
##  [1] 0.9001112186 0.0623664710 0.0268495675 0.0056115604 0.0021067642
##  [6] 0.0011053306 0.0007157205 0.0005283593 0.0003445349 0.0001492872
## [11] 0.0001111858 0.0000000000
## 
## $dim.plot
## [1] 1 2
## 
## $distance.matrix.squared
##            AH0005    AH0015     AH0018     CC0003     CC0016       PM001
## AH0005 -1813266.9   7744465 -1387976.2 -1109087.2 -1607810.8  -401859.48
## AH0015  7744464.7 -44860351  8003284.9  5705011.2  8718801.9  4615901.06
## AH0018 -1387976.2   8003285 -1480210.8 -1041628.5 -1577921.4  -917910.64
## CC0003 -1109087.2   5705011 -1041628.5  -859613.0 -1159334.7  -542679.15
## CC0016 -1607810.8   8718802 -1577921.4 -1159334.7 -1739180.8  -856634.09
## PM001   -401859.5   4615901  -917910.6  -542679.1  -856634.1 -1230702.11
## PM0020  -906041.0   3405494  -637592.4  -570974.6  -748007.8  -176895.53
## PM0027 -1792187.1   9189932 -1626246.4 -1239065.6 -1833696.2  -725158.62
## PM0028   960569.9  -1769083   503794.0   657000.2   610986.7   140095.19
## PM0032  -545782.9   1942313  -311211.4  -227016.6  -401631.9   109148.31
## PM008   1763386.5  -6085195  1098472.2   912985.7  1339348.6    29865.87
## PM017   -904409.4   3389426  -624853.3  -525597.6  -744919.5   -43170.83
##           PM0020     PM0027      PM0028     PM0032       PM008      PM017
## AH0005 -906041.0 -1792187.1   960569.90 -545782.94  1763386.47 -904409.37
## AH0015 3405494.3  9189932.1 -1769083.17 1942312.71 -6085194.87 3389426.05
## AH0018 -637592.4 -1626246.4   503793.97 -311211.44  1098472.25 -624853.33
## CC0003 -570974.6 -1239065.6   657000.15 -227016.63   912985.67 -525597.64
## CC0016 -748007.8 -1833696.2   610986.66 -401631.92  1339348.64 -744919.50
## PM001  -176895.5  -725158.6   140095.19  109148.31    29865.87  -43170.83
## PM0020 -566446.2  -831142.8   835224.70 -197028.38   897243.57 -503833.94
## PM0027 -831142.8 -2011251.9   674503.86 -497851.77  1553807.44 -861642.97
## PM0028  835224.7   674503.9 -2419588.77   58589.35 -1027077.66  774985.81
## PM0032 -197028.4  -497851.8    58589.35 -343936.43   715960.85 -301551.71
## PM008   897243.6  1553807.4 -1027077.66  715960.85 -2163158.67  964360.46
## PM017  -503833.9  -861643.0   774985.81 -301551.71   964360.46 -618793.04
## 
## $top
## [1] 500
## 
## $gene.selection
## [1] "pairwise"
## 
## $axislabel
## [1] "Leading logFC dim"
## 
## $x
##  [1]   844.2384 -4726.3784   846.5853   611.9191   926.8916   470.6741
##  [7]   380.9540   981.0718  -244.2643   214.8037  -686.0040   379.5087
## 
## $y
##  [1]  390.648211  298.235477   -7.942027  137.073337   68.941222 -309.963213
##  [7]  333.712103  146.035145 -923.484746  137.194842 -621.113134  350.662782
plotMDS(assays(pb)[[1]],cex=1.5,labels=patient_id,col=hiv_status+1,main="MDS red=HIV+")

Differential expression without batch correction.

rownames(pat_df) <- gsub("-","",gsub("\\+","",pat_df[,1]))

deres <- lapply(1:length(assays(pb)), function(i) {
  counts <- assays(pb)[[i]]
  cellname <- names(assays(pb))[i]
  fcounts <- counts[which(rowMeans(counts)>=5),]
  fcounts <- fcounts+1
  dds <- DESeqDataSetFromMatrix(countData = fcounts , colData = pat_df, design = ~ hiv_status)
  res <- DESeq(dds)
  z <- results(res)
  vsd <- vst(dds, blind=FALSE)
  zz<-cbind(as.data.frame(z),assay(vsd),fcounts)
  de <- as.data.frame(zz[order(zz$pvalue),])
  return(de)
})
## converting counts to integer mode
##   the design formula contains one or more numeric variables with integer values,
##   specifying a model with increasing fold change for higher values.
##   did you mean for this to be a factor? if so, first convert
##   this variable to a factor using the factor() function
## estimating size factors
## estimating dispersions
## gene-wise dispersion estimates
## mean-dispersion relationship
## final dispersion estimates
## fitting model and testing
## -- replacing outliers and refitting for 21 genes
## -- DESeq argument 'minReplicatesForReplace' = 7 
## -- original counts are preserved in counts(dds)
## estimating dispersions
## fitting model and testing
## converting counts to integer mode
##   the design formula contains one or more numeric variables with integer values,
##   specifying a model with increasing fold change for higher values.
##   did you mean for this to be a factor? if so, first convert
##   this variable to a factor using the factor() function
## estimating size factors
## estimating dispersions
## gene-wise dispersion estimates
## mean-dispersion relationship
## final dispersion estimates
## fitting model and testing
## -- replacing outliers and refitting for 47 genes
## -- DESeq argument 'minReplicatesForReplace' = 7 
## -- original counts are preserved in counts(dds)
## estimating dispersions
## fitting model and testing
## converting counts to integer mode
##   the design formula contains one or more numeric variables with integer values,
##   specifying a model with increasing fold change for higher values.
##   did you mean for this to be a factor? if so, first convert
##   this variable to a factor using the factor() function
## estimating size factors
## estimating dispersions
## gene-wise dispersion estimates
## mean-dispersion relationship
## final dispersion estimates
## fitting model and testing
## -- replacing outliers and refitting for 12 genes
## -- DESeq argument 'minReplicatesForReplace' = 7 
## -- original counts are preserved in counts(dds)
## estimating dispersions
## fitting model and testing
## converting counts to integer mode
##   the design formula contains one or more numeric variables with integer values,
##   specifying a model with increasing fold change for higher values.
##   did you mean for this to be a factor? if so, first convert
##   this variable to a factor using the factor() function
## estimating size factors
## estimating dispersions
## gene-wise dispersion estimates
## mean-dispersion relationship
## final dispersion estimates
## fitting model and testing
## -- replacing outliers and refitting for 42 genes
## -- DESeq argument 'minReplicatesForReplace' = 7 
## -- original counts are preserved in counts(dds)
## estimating dispersions
## fitting model and testing
## converting counts to integer mode
##   the design formula contains one or more numeric variables with integer values,
##   specifying a model with increasing fold change for higher values.
##   did you mean for this to be a factor? if so, first convert
##   this variable to a factor using the factor() function
## estimating size factors
## estimating dispersions
## gene-wise dispersion estimates
## mean-dispersion relationship
## final dispersion estimates
## fitting model and testing
## -- replacing outliers and refitting for 22 genes
## -- DESeq argument 'minReplicatesForReplace' = 7 
## -- original counts are preserved in counts(dds)
## estimating dispersions
## fitting model and testing
## converting counts to integer mode
##   the design formula contains one or more numeric variables with integer values,
##   specifying a model with increasing fold change for higher values.
##   did you mean for this to be a factor? if so, first convert
##   this variable to a factor using the factor() function
## estimating size factors
## estimating dispersions
## gene-wise dispersion estimates
## mean-dispersion relationship
## final dispersion estimates
## fitting model and testing
## -- replacing outliers and refitting for 2 genes
## -- DESeq argument 'minReplicatesForReplace' = 7 
## -- original counts are preserved in counts(dds)
## estimating dispersions
## fitting model and testing
## converting counts to integer mode
##   the design formula contains one or more numeric variables with integer values,
##   specifying a model with increasing fold change for higher values.
##   did you mean for this to be a factor? if so, first convert
##   this variable to a factor using the factor() function
## estimating size factors
## estimating dispersions
## gene-wise dispersion estimates
## mean-dispersion relationship
## final dispersion estimates
## fitting model and testing
## -- replacing outliers and refitting for 63 genes
## -- DESeq argument 'minReplicatesForReplace' = 7 
## -- original counts are preserved in counts(dds)
## estimating dispersions
## fitting model and testing
## converting counts to integer mode
##   the design formula contains one or more numeric variables with integer values,
##   specifying a model with increasing fold change for higher values.
##   did you mean for this to be a factor? if so, first convert
##   this variable to a factor using the factor() function
## estimating size factors
## estimating dispersions
## gene-wise dispersion estimates
## mean-dispersion relationship
## final dispersion estimates
## fitting model and testing
## -- replacing outliers and refitting for 10 genes
## -- DESeq argument 'minReplicatesForReplace' = 7 
## -- original counts are preserved in counts(dds)
## estimating dispersions
## fitting model and testing
## converting counts to integer mode
##   the design formula contains one or more numeric variables with integer values,
##   specifying a model with increasing fold change for higher values.
##   did you mean for this to be a factor? if so, first convert
##   this variable to a factor using the factor() function
## estimating size factors
## estimating dispersions
## gene-wise dispersion estimates
## mean-dispersion relationship
## final dispersion estimates
## fitting model and testing
## -- replacing outliers and refitting for 30 genes
## -- DESeq argument 'minReplicatesForReplace' = 7 
## -- original counts are preserved in counts(dds)
## estimating dispersions
## fitting model and testing
names(deres) <- names(assays(pb))

nsig1 <- lapply(deres,function(x) {
  nrow(subset(x,padj<0.05))
})

nsig1
## $`NK 1 (FCGRA3A+)`
## [1] 11
## 
## $`CD14+ Mono`
## [1] 17
## 
## $`NK 2 (IL7R+)`
## [1] 3
## 
## $`CD14+ Mono (CCL4+)`
## [1] 3
## 
## $`FCGR3A+ Mono`
## [1] 1
## 
## $T
## [1] 0
## 
## $DC
## [1] 4
## 
## $Macrophage
## [1] 0
## 
## $B
## [1] 0
make_volcano <- function(dm,name) {
    sig <- subset(dm,padj<0.05)
    N_SIG=nrow(sig)
    N_UP=nrow(subset(sig,log2FoldChange>0))
    N_DN=nrow(subset(sig,log2FoldChange<0))
    HEADER=paste(N_SIG,"@5%FDR,", N_UP, "up", N_DN, "dn")
    plot(dm$log2FoldChange,-log10(dm$pval),cex=0.5,pch=19,col="darkgray",
        main=name, xlab="log FC", ylab="-log10 pval")
    mtext(HEADER)
    grid()
    points(sig$log2FoldChange,-log10(sig$pval),cex=0.5,pch=19,col="red")
}

lapply(1:length(deres),function(i) {
  x <- deres[[i]][,1:6]
  myname <- names(deres)[i]
  make_volcano(dm=x,name=myname)
})

## [[1]]
## NULL
## 
## [[2]]
## NULL
## 
## [[3]]
## NULL
## 
## [[4]]
## NULL
## 
## [[5]]
## NULL
## 
## [[6]]
## NULL
## 
## [[7]]
## NULL
## 
## [[8]]
## NULL
## 
## [[9]]
## NULL
message("Up-regulated")
## Up-regulated
lapply(deres,function(x) {
  x <- x[,1:6]
  head(subset(x,log2FoldChange>0),10)
})
## $`NK 1 (FCGRA3A+)`
##             baseMean log2FoldChange     lfcSE     stat       pvalue       padj
## LINC02446  130.85455      1.8802099 0.3551046 5.294806 1.191431e-07 0.00174771
## MSC-AS1     34.45640      2.0193514 0.4391843 4.597959 4.266504e-06 0.01043089
## FCGR3A    1984.77882      0.8208262 0.2020907 4.061672 4.872253e-05 0.05955924
## RPTOR      363.38288      0.6232042 0.1548078 4.025663 5.681491e-05 0.06057268
## NECTIN3     11.60475      1.5748953 0.3979056 3.957962 7.559204e-05 0.06057268
## MTM1        39.80513      1.5978273 0.4062433 3.933178 8.383001e-05 0.06148512
## WNK1       670.37485      0.4087957 0.1050969 3.889702 1.003676e-04 0.06534174
## ATXN1     1212.75777      0.4439386 0.1171485 3.789538 1.509276e-04 0.07634335
## ZBTB38     465.73316      0.5250362 0.1401219 3.746996 1.789652e-04 0.08750803
## ARHGAP10   321.68658      0.9123738 0.2447249 3.728161 1.928820e-04 0.08841832
## 
## $`CD14+ Mono`
##              baseMean log2FoldChange     lfcSE     stat       pvalue
## AC239799.2  219.57657      1.8277552 0.3289869 5.555707 2.764900e-08
## TEX14      6013.21823      1.5241394 0.2751144 5.540020 3.024371e-08
## AP001160.1   54.83798      2.0976703 0.3988444 5.259369 1.445502e-07
## TMEM107     329.92437      1.3416959 0.2645624 5.071377 3.949474e-07
## L3MBTL4     257.89909      1.1985093 0.2445787 4.900302 9.568934e-07
## THSD8        17.18787      2.7849343 0.5706311 4.880446 1.058463e-06
## WDR74       894.73858      1.2207754 0.2546816 4.793339 1.640282e-06
## LINC00623   270.50423      0.6194504 0.1370612 4.519518 6.198070e-06
## AC103591.3  730.87389      0.7549738 0.1682938 4.486047 7.255663e-06
## AC253572.2 1564.63259      1.4883339 0.3319639 4.483421 7.345574e-06
##                    padj
## AC239799.2 0.0001934690
## TEX14      0.0001934690
## AP001160.1 0.0006164583
## TMEM107    0.0012632394
## L3MBTL4    0.0022569968
## THSD8      0.0022569968
## WDR74      0.0029979668
## LINC00623  0.0093979278
## AC103591.3 0.0093979278
## AC253572.2 0.0093979278
## 
## $`NK 2 (IL7R+)`
##           baseMean log2FoldChange     lfcSE     stat       pvalue        padj
## HBB      854.17620      6.4604258 1.4568707 4.434454 9.230600e-06 0.006286038
## MYO5A    269.96402      0.5097731 0.1274009 4.001331 6.298708e-05          NA
## HBA2     214.66410      5.8524453 1.4660681 3.991933 6.553694e-05          NA
## HLA-DPA1 316.83019      0.6160100 0.1576249 3.908075 9.303425e-05          NA
## PDLIM1    28.75687      1.0136619 0.2681838 3.779728 1.569995e-04          NA
## HLA-DPB1 495.40166      0.6627458 0.1759387 3.766912 1.652790e-04          NA
## FCGR3A   211.86079      1.0398103 0.2795584 3.719474 1.996382e-04          NA
## CEP152    37.25640      0.8001486 0.2184655 3.662586 2.496821e-04          NA
## FABP5    108.44360      0.8482006 0.2349648 3.609904 3.063098e-04          NA
## CDYL2     59.09071      0.6422554 0.1786973 3.594098 3.255176e-04          NA
## 
## $`CD14+ Mono (CCL4+)`
##              baseMean log2FoldChange     lfcSE     stat       pvalue      padj
## AP001160.1  26.480955      1.6122615 0.3986995 4.043801 5.259161e-05 0.1214866
## AC239799.2  97.170627      1.7160044 0.4858228 3.532161 4.121787e-04 0.6423212
## CEP152      44.307348      0.8303066 0.2352792 3.529026 4.170917e-04 0.6423212
## ASTL       141.510950      1.5458773 0.4470673 3.457818 5.445690e-04 0.7547726
## CXCL9        6.076817      2.8413820 0.8391106 3.386183 7.087213e-04 0.7690969
## GCNT2      126.163599      1.1418177 0.3387022 3.371155 7.485374e-04 0.7690969
## AL035446.1   5.602586      1.9533227 0.5811889 3.360908 7.768656e-04 0.7690969
## NAA25      167.565629      0.5081391 0.1533547 3.313488 9.214012e-04 0.8018431
## TMEM107    139.182578      1.1795972 0.3614019 3.263949 1.098711e-03 0.8313600
## WDR74      377.811964      1.1301621 0.3471447 3.255593 1.131557e-03 0.8313600
## 
## $`FCGR3A+ Mono`
##              baseMean log2FoldChange     lfcSE     stat       pvalue      padj
## ASTL        27.033978      2.2631404 0.5863014 3.860029 0.0001133737 0.2497641
## AC018755.4  50.426490      0.8807728 0.2282901 3.858129 0.0001142582 0.2497641
## LINC01366    8.145255      1.8845263 0.5108783 3.688797 0.0002253171 0.4109784
## LINC01004  104.658034      0.5404469 0.1490028 3.627091 0.0002866322 0.4574650
## ANK3        13.763878      1.9490374 0.5448397 3.577267 0.0003472051 0.4925683
## CXCL10      26.077754      2.7758707 0.7872721 3.525935 0.0004219901 0.5387969
## DGKH        13.472268      1.3451211 0.3916618 3.434394 0.0005938795 0.5456725
## NLRC5      185.855270      0.5215871 0.1519611 3.432373 0.0005983251 0.5456725
## AC245014.3 103.033028      1.2574038 0.3801056 3.308038 0.0009395214 0.5999629
## NHEJ1       36.013002      0.7815564 0.2392068 3.267284 0.0010858486 0.5999629
## 
## $T
##            baseMean log2FoldChange     lfcSE     stat      pvalue    padj
## TMEM131    4.548092      1.6733488 0.5552052 3.013929 0.002578885 0.99875
## YES1       7.043204      1.3803585 0.4989873 2.766320 0.005669294 0.99875
## HBA1     205.640292      4.3108808 1.5613958 2.760915 0.005763971 0.99875
## HBA2     603.820281      4.3008982 1.6432064 2.617382 0.008860724 0.99875
## HBB     2814.201545      4.5858501 1.7787880 2.578076 0.009935221 0.99875
## NCOR1     10.841539      0.8809492 0.3725593 2.364588 0.018050135 0.99875
## NAP1L4     5.135122      1.0879024 0.4995827 2.177622 0.029434177 0.99875
## MYL9       7.648986      2.0836212 0.9610446 2.168080 0.030152630 0.99875
## SEM1       5.619102      1.0334194 0.4966629 2.080726 0.037459001 0.99875
## BOD1L1     6.914654      0.9253759 0.4540496 2.038050 0.041544896 0.99875
## 
## $DC
##             baseMean log2FoldChange     lfcSE     stat       pvalue       padj
## AC253572.2 220.28201      1.3173819 0.3048641 4.321210 1.551761e-05 0.04877858
## TMEM107     91.13860      0.9318133 0.2206358 4.223310 2.407407e-05 0.05158641
## AL035446.2  13.04327      2.5905329 0.6285129 4.121686 3.761097e-05 0.06536248
## AC239799.2  51.00850      1.2393312 0.3148959 3.935685 8.295960e-05 0.12615045
## TRIM14      88.44710      0.5999574 0.1619304 3.705033 2.113631e-04 0.21738206
## AC245014.3 108.39832      0.9174370 0.2492345 3.681020 2.323031e-04 0.21738206
## TEX14      894.05488      0.9107811 0.2509955 3.628675 2.848792e-04 0.24097488
## SLC12A2     47.96101      0.8005622 0.2212851 3.617787 2.971330e-04 0.24097488
## AC007952.4 217.50458      0.8142990 0.2314026 3.518971 4.332238e-04 0.30600822
## AC144652.1  13.96332      1.4626216 0.4193092 3.488169 4.863399e-04 0.30600822
## 
## $Macrophage
##              baseMean log2FoldChange     lfcSE     stat       pvalue      padj
## TCL1A       93.867915      1.0902743 0.2768075 3.938745 8.190880e-05 0.3375802
## KCNQ5        6.500180      2.1783939 0.5580180 3.903806 9.469175e-05 0.3375802
## NR4A3       45.271498      1.5191660 0.3928868 3.866676 1.103288e-04 0.3375802
## HLA-C      548.900354      0.8209086 0.2192877 3.743522 1.814584e-04 0.3375802
## PLEKHG2     17.590340      1.3389923 0.3596670 3.722866 1.969738e-04 0.3375802
## PKD2        34.867400      0.8070777 0.2314593 3.486909 4.886375e-04 0.6280824
## AL355075.4  34.568710      1.1212111 0.3405454 3.292399 9.933670e-04 0.8736046
## AC239799.2  16.968088      1.0861180 0.3373227 3.219819 1.282716e-03 0.9421552
## XACT         9.112779      2.1174527 0.6745234 3.139183 1.694193e-03 0.9995856
## SP4         31.731192      0.7298792 0.2352729 3.102266 1.920456e-03 0.9995856
## 
## $B
##             baseMean log2FoldChange     lfcSE     stat       pvalue      padj
## PRG2       19.494272      3.8372680 0.8942474 4.291058 1.778235e-05 0.1601123
## TPSAB1     16.225058      3.3887905 1.0126806 3.346357 8.188094e-04 0.9986398
## BX284613.2 10.353411      1.9679315 0.5995178 3.282524 1.028823e-03 0.9986398
## SLC24A3    55.632919      1.7235976 0.5353291 3.219697 1.283262e-03 0.9986398
## MS4A2      15.534285      3.1782027 0.9887487 3.214368 1.307318e-03 0.9986398
## DCAF6      33.153706      0.8652989 0.2737851 3.160504 1.574962e-03 0.9986398
## RAD51B     85.942680      0.6396572 0.2065131 3.097417 1.952148e-03 0.9986398
## DTL        11.769723      1.4877069 0.4886389 3.044594 2.329949e-03 0.9986398
## APOE        4.905372      2.7528424 0.9067484 3.035950 2.397794e-03 0.9986398
## APOC1      13.934261      1.9130840 0.6312286 3.030731 2.439627e-03 0.9986398
message("Down-regulated")
## Down-regulated
lapply(deres,function(x) {
  x <- x[,1:6]
  head(subset(x,log2FoldChange<0),10)
})
## $`NK 1 (FCGRA3A+)`
##                baseMean log2FoldChange     lfcSE      stat       pvalue
## BEX4          203.78365     -0.7457956 0.1504036 -4.958630 7.099216e-07
## AC120193.1     44.98166     -0.9418390 0.1947843 -4.835292 1.329504e-06
## PIWIL3         11.50857     -3.6677527 0.7801865 -4.701123 2.587347e-06
## SCRN1          64.16911     -1.3644860 0.2944586 -4.633881 3.588737e-06
## AC233976.1     27.14550     -1.5961076 0.3565531 -4.476493 7.587902e-06
## MIR4458HG      15.14060     -1.4397897 0.3274941 -4.396384 1.100694e-05
## ZDBF2          60.08055     -1.1772282 0.2808669 -4.191409 2.772276e-05
## ZNF442         14.05453     -1.3466068 0.3214443 -4.189238 2.798926e-05
## RNF217         22.12022     -1.5743284 0.3787806 -4.156307 3.234335e-05
## CCDC144NL-AS1  13.14685     -1.4412699 0.3594410 -4.009754 6.078207e-05
##                      padj
## BEX4          0.005206920
## AC120193.1    0.006500831
## PIWIL3        0.009488447
## SCRN1         0.010430890
## AC233976.1    0.015900990
## MIR4458HG     0.020182595
## ZDBF2         0.041057444
## ZNF442        0.041057444
## RNF217        0.043131324
## CCDC144NL-AS1 0.060572677
## 
## $`CD14+ Mono`
##             baseMean log2FoldChange     lfcSE      stat       pvalue       padj
## SULT1A1    483.86190     -0.5670462 0.1313671 -4.316503 1.585207e-05 0.01448653
## AC009974.2  14.12940     -1.3969767 0.3440152 -4.060800 4.890490e-05 0.03680525
## TNNI2      109.55689     -0.8742316 0.2248029 -3.888881 1.007075e-04 0.06611554
## SLC9A3R1   681.92293     -0.7262460 0.1873961 -3.875459 1.064241e-04 0.06611554
## FAM157C    157.93069     -0.8418565 0.2174944 -3.870704 1.085217e-04 0.06611554
## ZEB1        20.74069     -2.4279480 0.6405255 -3.790557 1.503101e-04 0.08271126
## ZNF697     116.55545     -0.9031815 0.2387684 -3.782668 1.551563e-04 0.08271126
## TBP        137.49069     -0.5924773 0.1655371 -3.579121 3.447519e-04 0.13365928
## AL032821.1  13.63233     -1.3708945 0.3933250 -3.485399 4.914041e-04 0.17463956
## AL133297.2  35.56103     -3.0297488 0.8921313 -3.396079 6.835855e-04 0.22027929
## 
## $`NK 2 (IL7R+)`
##              baseMean log2FoldChange     lfcSE      stat       pvalue padj
## AC009041.2  13.758496      -1.680409 0.3117613 -5.390049 7.043860e-08   NA
## USP44       10.777769      -1.830992 0.3633235 -5.039562 4.665981e-07   NA
## CTNNA3      13.364414      -2.041420 0.4366013 -4.675709 2.929403e-06   NA
## AP000787.1 151.177374      -1.340340 0.3036941 -4.413454 1.017344e-05   NA
## LINC00511   13.901981      -1.328786 0.3072483 -4.324794 1.526742e-05   NA
## ZNF10      126.951708      -0.712087 0.1658735 -4.292953 1.763121e-05   NA
## SLC22A23    17.461782      -1.296894 0.3082939 -4.206680 2.591496e-05   NA
## FXYD7       68.749330      -1.073189 0.2560751 -4.190914 2.778324e-05   NA
## MACROD2      9.987173      -1.671438 0.3996142 -4.182629 2.881574e-05   NA
## LRRN1        7.699828      -1.615234 0.3892157 -4.149971 3.325175e-05   NA
## 
## $`CD14+ Mono (CCL4+)`
##           baseMean log2FoldChange     lfcSE      stat       pvalue       padj
## PPARG   113.271484     -2.6220999 0.5732726 -4.573915 4.786948e-06 0.03591472
## ARRDC3  273.716433     -1.0751425 0.2390590 -4.497394 6.879153e-06 0.03591472
## GSG1     15.388658     -1.3041880 0.2916784 -4.471322 7.773749e-06 0.03591472
## PLPP3    21.386384     -3.0358517 0.7149270 -4.246380 2.172521e-05 0.06453717
## RUBCNL   44.498469     -1.4686478 0.3471290 -4.230842 2.328181e-05 0.06453717
## GPAT3   138.095157     -0.8225436 0.2235564 -3.679356 2.338240e-04 0.46297150
## SELENOK 277.429668     -0.4819702 0.1422976 -3.387058 7.064654e-04 0.76909693
## ZSCAN18  12.387733     -1.2428788 0.3752425 -3.312201 9.256485e-04 0.80184306
## DLEC1    17.000186     -0.9059846 0.2797947 -3.238034 1.203566e-03 0.83407148
## HORMAD2   7.251243     -1.8448525 0.6037576 -3.055618 2.245973e-03 0.99997103
## 
## $`FCGR3A+ Mono`
##              baseMean log2FoldChange     lfcSE      stat       pvalue
## PTGES       80.905477     -2.0005062 0.4054784 -4.933694 8.068881e-07
## TNNI2      110.306026     -0.8233175 0.2037307 -4.041205 5.317731e-05
## WDR86        6.112729     -2.3075881 0.5743551 -4.017702 5.876833e-05
## PUS10       58.468056     -0.5960076 0.1547447 -3.851555 1.173704e-04
## AF127577.2  17.771134     -1.1453710 0.3311580 -3.458684 5.428217e-04
## TWF2       181.379711     -0.4112220 0.1190295 -3.454791 5.507199e-04
## ARRDC3     258.761311     -0.8112621 0.2415165 -3.359034 7.821554e-04
## AC021752.1  18.581098     -0.9091475 0.2730268 -3.329883 8.688242e-04
## ARG2        10.353223     -1.1346791 0.3412402 -3.325162 8.836703e-04
## NAPB        46.012153     -0.7575819 0.2294716 -3.301419 9.619696e-04
##                  padj
## PTGES      0.01030235
## TNNI2      0.24976414
## WDR86      0.24976414
## PUS10      0.24976414
## AF127577.2 0.54567246
## TWF2       0.54567246
## ARRDC3     0.59996295
## AC021752.1 0.59996295
## ARG2       0.59996295
## NAPB       0.59996295
## 
## $T
##          baseMean log2FoldChange     lfcSE      stat     pvalue    padj
## BCL6     5.278050     -1.0019682 0.4167210 -2.404410 0.01619859 0.99875
## YPEL3    8.045802     -0.8840448 0.3780896 -2.338188 0.01937748 0.99875
## CYBB    14.296499     -0.8015324 0.3518583 -2.277998 0.02272671 0.99875
## ATP5F1C  6.239390     -0.9863001 0.4401401 -2.240878 0.02503401 0.99875
## REL      9.739690     -0.7762767 0.3536059 -2.195316 0.02814096 0.99875
## USP34   10.886515     -0.7929194 0.3714329 -2.134758 0.03278080 0.99875
## SFT2D1   6.453705     -0.9300804 0.4366068 -2.130247 0.03315120 0.99875
## IGHM    10.772156     -1.4059945 0.6728276 -2.089680 0.03664653 0.99875
## KCNAB2   6.145091     -0.9089676 0.4483915 -2.027174 0.04264463 0.99875
## LNPEP    5.636824     -0.8554812 0.4237925 -2.018632 0.04352545 0.99875
## 
## $DC
##            baseMean log2FoldChange     lfcSE      stat       pvalue       padj
## FAM118A  205.012845     -0.6563038 0.1425586 -4.603747 4.149570e-06 0.04777184
## LILRA5   122.388767     -0.9295040 0.2079834 -4.469126 7.853981e-06 0.04777184
## C5AR1     68.797820     -1.2797005 0.2966449 -4.313913 1.603899e-05 0.04877858
## APOBEC3A  38.319594     -1.4648867 0.3478854 -4.210831 2.544336e-05 0.05158641
## ERG       14.169042     -1.5294657 0.3993192 -3.830183 1.280479e-04 0.15587043
## CHST15    85.193328     -1.1620252 0.3033989 -3.830025 1.281302e-04 0.15587043
## TNFSF9    39.573427     -1.2374361 0.3355322 -3.687980 2.260412e-04 0.21738206
## GK5       48.861849     -0.7707061 0.2169967 -3.551695 3.827582e-04 0.29101584
## EXTL3     42.582870     -0.9016178 0.2585327 -3.487442 4.876646e-04 0.30600822
## TBC1D30    9.180131     -1.4077049 0.4046173 -3.479102 5.030961e-04 0.30600822
## 
## $Macrophage
##              baseMean log2FoldChange     lfcSE      stat       pvalue      padj
## ARRDC3      38.373223     -1.0111753 0.2690872 -3.757797 0.0001714155 0.3375802
## TFPI        15.112197     -1.1872938 0.3265052 -3.636370 0.0002765073 0.4061892
## VEGFA        7.101706     -1.7629414 0.5148229 -3.424365 0.0006162379 0.7040860
## EXT1       229.095337     -0.6489528 0.1919741 -3.380419 0.0007237551 0.7442374
## AC025159.1  33.863651     -0.9010538 0.2752763 -3.273271 0.0010631048 0.8736046
## LINC02076    4.914336     -2.1352349 0.6544827 -3.262477 0.0011044306 0.8736046
## TIGAR       43.810748     -0.5699251 0.1781626 -3.198905 0.0013795083 0.9456990
## ST3GAL1     49.433197     -0.9621846 0.3056546 -3.147948 0.0016442107 0.9995856
## AC138649.1   8.549846     -1.1672439 0.4077142 -2.862897 0.0041978686 0.9995856
## LINC01765    6.269495     -1.2807672 0.4476461 -2.861116 0.0042215281 0.9995856
## 
## $B
##              baseMean log2FoldChange     lfcSE      stat       pvalue      padj
## ID1         10.275158     -2.4210039 0.6511455 -3.718069 0.0002007513 0.9037823
## ID2         24.157156     -1.0047805 0.2894791 -3.470994 0.0005185347 0.9986398
## IGHG4       17.950157     -3.5236269 1.0165537 -3.466248 0.0005277767 0.9986398
## ZRANB2-AS2   6.245355     -1.6698395 0.5002739 -3.337850 0.0008442922 0.9986398
## HIST1H2BF   10.249874     -1.7313542 0.5526680 -3.132720 0.0017319449 0.9986398
## H3F3B      903.748686     -1.2445832 0.4032188 -3.086620 0.0020244614 0.9986398
## H1FX       194.847009     -1.3846936 0.4516522 -3.065841 0.0021705890 0.9986398
## SLC25A29    11.322208     -1.1278562 0.3693570 -3.053566 0.0022613871 0.9986398
## MYADM       26.590013     -0.9077363 0.3013125 -3.012608 0.0025901362 0.9986398
## ATP10A      19.934320     -1.2811993 0.4320608 -2.965322 0.0030236632 0.9986398
if ( ! dir.exists("de_analysis") ) {
  dir.create("de_analysis")
}

lapply(1:length(assays(pb)),function(i) {
  cellname=names(assays(pb))[[i]]
  myres <- deres[[i]]
  filename <- paste(cellname,".tsv",sep="")
  filename <- gsub("\\)","",gsub("\\(","",gsub(" ","_",filename)))
  filename <- paste("de_analysis/",filename,sep="")
  write.table(x=myres,file=filename,sep="\t",quote=FALSE)
})
## [[1]]
## NULL
## 
## [[2]]
## NULL
## 
## [[3]]
## NULL
## 
## [[4]]
## NULL
## 
## [[5]]
## NULL
## 
## [[6]]
## NULL
## 
## [[7]]
## NULL
## 
## [[8]]
## NULL
## 
## [[9]]
## NULL

Differential expression with batch correction.

deres <- lapply(1:length(assays(pb)), function(i) {
  counts <- assays(pb)[[i]]
  cellname <- names(assays(pb))[i]
  fcounts <- counts[which(rowMeans(counts)>=5),]
  fcounts <- fcounts+1
  dds <- DESeqDataSetFromMatrix(countData = fcounts , colData = pat_df, design = ~ batch + hiv_status)
  res <- DESeq(dds)
  z <- results(res)
  vsd <- vst(dds, blind=FALSE)
  zz<-cbind(as.data.frame(z),assay(vsd),fcounts)
  de <- as.data.frame(zz[order(zz$pvalue),])
  return(de)
})
## converting counts to integer mode
##   the design formula contains one or more numeric variables with integer values,
##   specifying a model with increasing fold change for higher values.
##   did you mean for this to be a factor? if so, first convert
##   this variable to a factor using the factor() function
## estimating size factors
## estimating dispersions
## gene-wise dispersion estimates
## mean-dispersion relationship
## final dispersion estimates
## fitting model and testing
## converting counts to integer mode
##   the design formula contains one or more numeric variables with integer values,
##   specifying a model with increasing fold change for higher values.
##   did you mean for this to be a factor? if so, first convert
##   this variable to a factor using the factor() function
## estimating size factors
## estimating dispersions
## gene-wise dispersion estimates
## mean-dispersion relationship
## final dispersion estimates
## fitting model and testing
## converting counts to integer mode
##   the design formula contains one or more numeric variables with integer values,
##   specifying a model with increasing fold change for higher values.
##   did you mean for this to be a factor? if so, first convert
##   this variable to a factor using the factor() function
## estimating size factors
## estimating dispersions
## gene-wise dispersion estimates
## mean-dispersion relationship
## final dispersion estimates
## fitting model and testing
## converting counts to integer mode
##   the design formula contains one or more numeric variables with integer values,
##   specifying a model with increasing fold change for higher values.
##   did you mean for this to be a factor? if so, first convert
##   this variable to a factor using the factor() function
## estimating size factors
## estimating dispersions
## gene-wise dispersion estimates
## mean-dispersion relationship
## final dispersion estimates
## fitting model and testing
## converting counts to integer mode
##   the design formula contains one or more numeric variables with integer values,
##   specifying a model with increasing fold change for higher values.
##   did you mean for this to be a factor? if so, first convert
##   this variable to a factor using the factor() function
## estimating size factors
## estimating dispersions
## gene-wise dispersion estimates
## mean-dispersion relationship
## final dispersion estimates
## fitting model and testing
## converting counts to integer mode
##   the design formula contains one or more numeric variables with integer values,
##   specifying a model with increasing fold change for higher values.
##   did you mean for this to be a factor? if so, first convert
##   this variable to a factor using the factor() function
## estimating size factors
## estimating dispersions
## gene-wise dispersion estimates
## mean-dispersion relationship
## final dispersion estimates
## fitting model and testing
## converting counts to integer mode
##   the design formula contains one or more numeric variables with integer values,
##   specifying a model with increasing fold change for higher values.
##   did you mean for this to be a factor? if so, first convert
##   this variable to a factor using the factor() function
## estimating size factors
## estimating dispersions
## gene-wise dispersion estimates
## mean-dispersion relationship
## final dispersion estimates
## fitting model and testing
## converting counts to integer mode
##   the design formula contains one or more numeric variables with integer values,
##   specifying a model with increasing fold change for higher values.
##   did you mean for this to be a factor? if so, first convert
##   this variable to a factor using the factor() function
## estimating size factors
## estimating dispersions
## gene-wise dispersion estimates
## mean-dispersion relationship
## final dispersion estimates
## fitting model and testing
## converting counts to integer mode
##   the design formula contains one or more numeric variables with integer values,
##   specifying a model with increasing fold change for higher values.
##   did you mean for this to be a factor? if so, first convert
##   this variable to a factor using the factor() function
## estimating size factors
## estimating dispersions
## gene-wise dispersion estimates
## mean-dispersion relationship
## final dispersion estimates
## fitting model and testing
names(deres) <- names(assays(pb))

nsig2 <- lapply(deres,function(x) {
  nrow(subset(x,padj<0.05))
})

nsig2
## $`NK 1 (FCGRA3A+)`
## [1] 27
## 
## $`CD14+ Mono`
## [1] 12
## 
## $`NK 2 (IL7R+)`
## [1] 20
## 
## $`CD14+ Mono (CCL4+)`
## [1] 3
## 
## $`FCGR3A+ Mono`
## [1] 1
## 
## $T
## [1] 0
## 
## $DC
## [1] 4
## 
## $Macrophage
## [1] 0
## 
## $B
## [1] 0
bc <- t(rbind(as.data.frame(nsig1),as.data.frame(nsig2)))
colnames(bc) <- c("uncorrected","corrected")

lapply(1:length(deres),function(i) {
  x <- deres[[i]][,1:6]
  myname <- names(deres)[i]
  make_volcano(dm=x,name=myname)
})

## [[1]]
## NULL
## 
## [[2]]
## NULL
## 
## [[3]]
## NULL
## 
## [[4]]
## NULL
## 
## [[5]]
## NULL
## 
## [[6]]
## NULL
## 
## [[7]]
## NULL
## 
## [[8]]
## NULL
## 
## [[9]]
## NULL
message("Up-regulated")
## Up-regulated
lapply(deres,function(x) {
  x <- x[,1:6]
  head(subset(x,log2FoldChange>0),10)
})
## $`NK 1 (FCGRA3A+)`
##            baseMean log2FoldChange      lfcSE     stat       pvalue
## LINC02446 130.85455      2.1286856 0.36093761 5.897655 3.687032e-09
## MSC-AS1    34.45640      2.1828503 0.47394921 4.605663 4.111538e-06
## MYO6      270.60487      0.8594049 0.19091451 4.501517 6.747026e-06
## IFI27L2   399.41849      0.3413644 0.07735526 4.412944 1.019746e-05
## PTTG1      48.34220      0.9210436 0.21805042 4.223994 2.400108e-05
## NECTIN3    11.60475      1.5859468 0.37948522 4.179206 2.925290e-05
## HLA-DPB1  803.55713      0.7887473 0.18968936 4.158100 3.209056e-05
## CDYL2      37.08550      1.4068589 0.35278034 3.987917 6.665584e-05
## RPTOR     363.38288      0.5663943 0.14266502 3.970099 7.184267e-05
## MTM1       39.80513      1.5043277 0.39188416 3.838705 1.236849e-04
##                   padj
## LINC02446 4.992241e-05
## MSC-AS1   9.278371e-03
## MYO6      1.305068e-02
## IFI27L2   1.725919e-02
## PTTG1     2.413923e-02
## NECTIN3   2.413923e-02
## HLA-DPB1  2.413923e-02
## CDYL2     3.610080e-02
## RPTOR     3.741345e-02
## MTM1      5.315696e-02
## 
## $`CD14+ Mono`
##              baseMean log2FoldChange     lfcSE     stat       pvalue
## AC239799.2  219.57657      1.7930081 0.3648274 4.914675 8.892974e-07
## AP001160.1   54.83798      2.2304076 0.4569053 4.881553 1.052535e-06
## TEX14      6013.21823      1.5007373 0.3097678 4.844716 1.267926e-06
## AC079753.2   68.93448      2.9246800 0.6251852 4.678102 2.895424e-06
## TMEM107     329.92437      1.3325466 0.3012027 4.424086 9.685136e-06
## THSD8        17.18787      2.7940047 0.6351446 4.399006 1.087478e-05
## LINC00623   270.50423      0.6009981 0.1374083 4.373813 1.220950e-05
## L3MBTL4     257.89909      1.1966444 0.2756084 4.341828 1.413021e-05
## AC253572.2 1564.63259      1.4227830 0.3399987 4.184672 2.855777e-05
## WDR74       894.73858      1.1893822 0.2847557 4.176851 2.955722e-05
##                   padj
## AC239799.2 0.005803720
## AP001160.1 0.005803720
## TEX14      0.005803720
## AC079753.2 0.007951994
## TMEM107    0.020957602
## THSD8      0.020957602
## LINC00623  0.020957602
## L3MBTL4    0.021559560
## AC253572.2 0.036898162
## WDR74      0.036898162
## 
## $`NK 2 (IL7R+)`
##             baseMean log2FoldChange     lfcSE     stat       pvalue
## CCL5      4304.09113      0.6725337 0.1099411 6.117218 9.522328e-10
## HLA-DPA1   316.83019      0.6997432 0.1243654 5.626509 1.838933e-08
## HLA-DPB1   495.40166      0.7422984 0.1461530 5.078913 3.795998e-07
## FABP5      108.44360      0.9488743 0.1939154 4.893238 9.919049e-07
## LINC02384  119.51675      1.3255419 0.2874366 4.611597 3.995871e-06
## CDYL2       59.09071      0.6990216 0.1870673 3.736739 1.864226e-04
## PDLIM1      28.75687      1.0227229 0.2799873 3.652747 2.594494e-04
## MT1E        90.94295      1.1979482 0.3314307 3.614475 3.009568e-04
## IRF4        50.84447      0.9102567 0.2520683 3.611151 3.048406e-04
## HLA-DRB1   391.68535      0.6263100 0.1758522 3.561570 3.686438e-04
##                   padj
## CCL5      6.848101e-06
## HLA-DPA1  8.365305e-05
## HLA-DPB1  8.633998e-04
## FABP5     1.692066e-03
## LINC02384 4.544305e-03
## CDYL2     9.086103e-02
## PDLIM1    1.011630e-01
## MT1E      1.124367e-01
## IRF4      1.124367e-01
## HLA-DRB1  1.257720e-01
## 
## $`CD14+ Mono (CCL4+)`
##              baseMean log2FoldChange     lfcSE     stat       pvalue      padj
## AP001160.1  26.480955      1.6854217 0.4069666 4.141425 3.451549e-05 0.1107013
## AC239799.2  97.170627      1.8810784 0.4578595 4.108418 3.983782e-05 0.1107013
## CEP152      44.307348      0.8916622 0.2256789 3.951021 7.781843e-05 0.1608326
## GCNT2      126.163599      1.0815122 0.2903733 3.724559 1.956573e-04 0.2827138
## CEP57L1     23.654725      0.9794998 0.2636851 3.714658 2.034791e-04 0.2827138
## SPTLC2     598.402198      0.6196831 0.1725033 3.592298 3.277753e-04 0.3276574
## STMN1       25.025196      0.9859338 0.2763163 3.568134 3.595322e-04 0.3276574
## SLC27A1     59.323226      0.7244196 0.2032486 3.564204 3.649618e-04 0.3276574
## CXCL9        6.076817      2.9344859 0.8267323 3.549499 3.859642e-04 0.3276574
## NHSL1      154.860422      0.8993505 0.2611959 3.443202 5.748690e-04 0.3953403
## 
## $`FCGR3A+ Mono`
##              baseMean log2FoldChange     lfcSE     stat       pvalue      padj
## AC253572.2 220.559222      1.3870540 0.3787469 3.662219 0.0002500401 0.6223815
## C1QB       110.990994      1.0835604 0.3079490 3.518636 0.0004337719 0.6223815
## ASTL        27.033978      1.7700031 0.5061190 3.497207 0.0004701562 0.6223815
## LINC01004  104.658034      0.5378581 0.1542118 3.487788 0.0004870346 0.6223815
## AC018755.4  50.426490      0.7671552 0.2329744 3.292874 0.0009916898 0.7825801
## NBEA        13.638682      1.5048965 0.4649165 3.236917 0.0012082835 0.7825801
## TMEM254     19.713148      0.9636004 0.2989950 3.222798 0.0012694508 0.7825801
## NLRC5      185.855270      0.5015769 0.1600344 3.134183 0.0017233351 0.7825801
## DLGAP2       7.615759      2.7779664 0.8904268 3.119815 0.0018096493 0.7825801
## TMEM14C    167.682450      0.4795074 0.1537004 3.119754 0.0018100209 0.7825801
## 
## $T
##            baseMean log2FoldChange     lfcSE     stat       pvalue      padj
## HBB     2814.201545      6.3474978 1.6888234 3.758533 0.0001709127 0.3202905
## HBA2     603.820281      5.6657502 1.6205505 3.496189 0.0004719551 0.4422220
## HBA1     205.640292      4.7273107 1.4999612 3.151622 0.0016236629 0.9983424
## TMEM131    4.548092      1.6631390 0.6006673 2.768819 0.0056259877 0.9983424
## YES1       7.043204      1.4687778 0.5364013 2.738207 0.0061775209 0.9983424
## IGKC      50.052168      1.1274159 0.5114053 2.204545 0.0274860373 0.9983424
## NCOR1     10.841539      0.8735788 0.3972474 2.199080 0.0278722434 0.9983424
## OGA       10.861904      0.8482265 0.4037803 2.100713 0.0356661716 0.9983424
## SEM1       5.619102      1.0688826 0.5363421 1.992912 0.0462711077 0.9983424
## NAP1L4     5.135122      1.0345238 0.5465827 1.892712 0.0583961564 0.9983424
## 
## $DC
##             baseMean log2FoldChange     lfcSE     stat       pvalue       padj
## TMEM107     91.13860      1.0367159 0.2144978 4.833224 1.343395e-06 0.00820747
## AC007952.4 217.50458      0.9029977 0.2173708 4.154181 3.264552e-05 0.07641274
## AC253572.2 220.28201      1.2886481 0.3126092 4.122234 3.752160e-05 0.07641274
## AL035446.2  13.04327      2.3432527 0.6228719 3.762014 1.685505e-04 0.22883546
## AC245014.3 108.39832      0.9304942 0.2629809 3.538257 4.027775e-04 0.38098156
## AC239799.2  51.00850      1.2221272 0.3455668 3.536587 4.053327e-04 0.38098156
## CCDC26     203.71458      0.9401338 0.2709768 3.469426 5.215719e-04 0.45522054
## AC144652.1  13.96332      1.5396345 0.4476805 3.439137 5.835719e-04 0.47537771
## TRIM14      88.44710      0.5855962 0.1761214 3.324958 8.843193e-04 0.56512644
## TEX14      894.05488      0.9106514 0.2741285 3.321988 8.937867e-04 0.56512644
## 
## $Macrophage
##               baseMean log2FoldChange     lfcSE     stat       pvalue      padj
## HLA-C       548.900354      0.8963731 0.2236572 4.007800 6.128706e-05 0.4275123
## TCL1A        93.867915      1.1527714 0.2929327 3.935277 8.310085e-05 0.4275123
## KCNQ5         6.500180      2.1601742 0.5823952 3.709121 2.079802e-04 0.4279816
## XACT          9.112779      2.4965598 0.6985797 3.573765 3.518844e-04 0.4566354
## PTK2        105.007602      0.5813482 0.1627778 3.571423 3.550474e-04 0.4566354
## PCNT         30.631747      0.9139271 0.2637367 3.465302 5.296365e-04 0.6033991
## HLA-B      1104.947793      0.4452650 0.1295201 3.437805 5.864507e-04 0.6033991
## NR4A3        45.271498      1.4504572 0.4387491 3.305892 9.467444e-04 0.7532456
## AC118549.1   75.847610      0.4990188 0.1510153 3.304425 9.517147e-04 0.7532456
## PKD2         34.867400      0.7914444 0.2412539 3.280545 1.036068e-03 0.7614360
## 
## $B
##             baseMean log2FoldChange     lfcSE     stat       pvalue      padj
## PRG2       19.494272      4.1189844 0.9465727 4.351472 1.352267e-05 0.1218122
## DTL        11.769723      1.8877447 0.4900108 3.852455 1.169392e-04 0.2916381
## BX284613.2 10.353411      2.0672414 0.5993348 3.449226 5.621951e-04 0.8829858
## HPGD       14.647625      1.9288985 0.5612111 3.437028 5.881344e-04 0.8829858
## APOC1      13.934261      2.1692484 0.6467004 3.354333 7.955658e-04 0.9476717
## ORC6        5.943184      2.0943681 0.6817683 3.071965 2.126549e-03 0.9999354
## TPSAB1     16.225058      3.3075888 1.1090810 2.982279 2.861112e-03 0.9999354
## DCAF6      33.153706      0.8318079 0.2884822 2.883394 3.934148e-03 0.9999354
## CDC42BPA   41.013362      0.8583532 0.2991827 2.868994 4.117796e-03 0.9999354
## ANTKMT     15.220412      1.0233334 0.3704153 2.762665 5.733161e-03 0.9999354
message("Down-regulated")
## Down-regulated
lapply(deres,function(x) {
  x <- x[,1:6]
  head(subset(x,log2FoldChange<0),10)
})
## $`NK 1 (FCGRA3A+)`
##              baseMean log2FoldChange     lfcSE      stat       pvalue
## AC120193.1  44.981664     -0.9622082 0.1769880 -5.436574 5.431493e-08
## BEX4       203.783646     -0.7063573 0.1425121 -4.956471 7.178508e-07
## TEX14      410.364373     -0.8321431 0.1695461 -4.908063 9.198032e-07
## MIR4458HG   15.140604     -1.4840070 0.3089691 -4.803092 1.562341e-06
## DHRS3      203.271030     -1.0367044 0.2385539 -4.345787 1.387775e-05
## CASC8       29.770529     -1.3671683 0.3158507 -4.328527 1.501100e-05
## ATP9A       95.576152     -1.9225314 0.4514093 -4.258954 2.053861e-05
## SCRN1       64.169106     -1.3544800 0.3213921 -4.214417 2.504247e-05
## AC051619.5   9.036788     -1.6490063 0.3923756 -4.202622 2.638407e-05
## TTTY14     123.218048     -0.7335551 0.1763472 -4.159721 3.186366e-05
##                    padj
## AC120193.1 0.0003677121
## BEX4       0.0031135340
## TEX14      0.0031135340
## MIR4458HG  0.0042308202
## DHRS3      0.0203248894
## CASC8      0.0203248894
## ATP9A      0.0241392319
## SCRN1      0.0241392319
## AC051619.5 0.0241392319
## TTTY14     0.0241392319
## 
## $`CD14+ Mono`
##             baseMean log2FoldChange     lfcSE      stat       pvalue
## SLC9A3R1   681.92293     -0.8002175 0.1695943 -4.718422 2.376806e-06
## SULT1A1    483.86190     -0.5668832 0.1365613 -4.151125 3.308447e-05
## TBP        137.49069     -0.6748776 0.1711221 -3.943837 8.018817e-05
## AC009974.2  14.12940     -1.3162658 0.3620560 -3.635531 2.774091e-04
## AL032821.1  13.63233     -1.5261433 0.4228696 -3.609017 3.073598e-04
## TNNI2      109.55689     -0.8454082 0.2372711 -3.563047 3.665749e-04
## AL592183.1 154.62901     -1.7208623 0.5099573 -3.374522 7.394389e-04
## AC011603.2  98.71458     -0.7843998 0.2419760 -3.241643 1.188428e-03
## ZEB1        20.74069     -2.1129987 0.6518860 -3.241362 1.189600e-03
## SNX18      750.67309     -0.8042320 0.2498108 -3.219365 1.284750e-03
##                   padj
## SLC9A3R1   0.007951994
## SULT1A1    0.037859665
## TBP        0.073409598
## AC009974.2 0.173153733
## AL032821.1 0.183507147
## TNNI2      0.201352251
## AL592183.1 0.312292690
## AC011603.2 0.398428859
## ZEB1       0.398428859
## SNX18      0.410283373
## 
## $`NK 2 (IL7R+)`
##             baseMean log2FoldChange     lfcSE      stat       pvalue
## AP000787.1 151.17737     -1.4275746 0.2336901 -6.108836 1.003605e-09
## CTNNA3      13.36441     -2.1364248 0.4033586 -5.296589 1.179856e-07
## SESN3      297.49087     -1.3118149 0.2544716 -5.155054 2.535582e-07
## AC009041.2  13.75850     -1.7104642 0.3413227 -5.011282 5.406851e-07
## ADAM23      22.69418     -2.5515787 0.5249462 -4.860648 1.170020e-06
## USP44       10.77777     -1.8143459 0.3868689 -4.689821 2.734442e-06
## AL589693.1 153.25046     -1.3866088 0.2977091 -4.657597 3.199221e-06
## KANK1       39.15477     -1.3029381 0.2884380 -4.517221 6.265644e-06
## FXYD7       68.74933     -1.1449563 0.2542699 -4.502918 6.702687e-06
## CDKN1B     389.46428     -0.5010516 0.1137194 -4.406034 1.052806e-05
##                    padj
## AP000787.1 6.848101e-06
## CTNNA3     4.025372e-04
## SESN3      6.920618e-04
## AC009041.2 1.054104e-03
## ADAM23     1.774140e-03
## USP44      3.731693e-03
## AL589693.1 3.969070e-03
## KANK1      6.533684e-03
## FXYD7      6.533684e-03
## CDKN1B     9.578429e-03
## 
## $`CD14+ Mono (CCL4+)`
##               baseMean log2FoldChange     lfcSE      stat       pvalue
## GPAT3       138.095157     -0.9168031 0.1714880 -5.346166 8.983703e-08
## RUBCNL       44.498469     -1.6507620 0.3503579 -4.711645 2.457254e-06
## ARRDC3      273.716433     -1.0777376 0.2371544 -4.544456 5.507726e-06
## GSG1         15.388658     -1.1738141 0.2978216 -3.941334 8.102983e-05
## PLPP3        21.386384     -2.5109896 0.6641582 -3.780710 1.563819e-04
## PPARG       113.271484     -2.0127696 0.5597499 -3.595838 3.233494e-04
## DNAJC25      72.558825     -0.8098307 0.2285502 -3.543339 3.950952e-04
## GRAMD2B      25.088827     -1.2215689 0.3451259 -3.539487 4.009051e-04
## AL669970.3    4.845053     -1.9350225 0.5563098 -3.478318 5.045710e-04
## H3F3B      4088.262249     -0.5395627 0.1581471 -3.411778 6.454073e-04
##                   padj
## GPAT3      0.001248196
## RUBCNL     0.017070545
## ARRDC3     0.025508116
## GSG1       0.160832643
## PLPP3      0.271596185
## PPARG      0.327657388
## DNAJC25    0.327657388
## GRAMD2B    0.327657388
## AL669970.3 0.389472734
## H3F3B      0.395340255
## 
## $`FCGR3A+ Mono`
##             baseMean log2FoldChange     lfcSE      stat       pvalue
## PTGES       80.90548     -2.0745952 0.3943210 -5.261183 1.431314e-07
## TNNI2      110.30603     -0.8419628 0.1999974 -4.209869 2.555193e-05
## AF127577.2  17.77113     -1.1946666 0.3237292 -3.690327 2.239655e-04
## CKB        211.14827     -0.5983243 0.1664447 -3.594732 3.247254e-04
## PUS10       58.46806     -0.6224566 0.1756193 -3.544353 3.935785e-04
## OASL        46.74276     -1.1408812 0.3237139 -3.524350 4.245227e-04
## ODF2L      101.39500     -0.5062969 0.1529856 -3.309441 9.348233e-04
## PRR7        25.89491     -1.2972399 0.3922860 -3.306872 9.434388e-04
## HSBP1      577.49415     -0.4346097 0.1320913 -3.290222 1.001082e-03
## GNS        470.88475     -0.4022688 0.1230384 -3.269457 1.077542e-03
##                   padj
## PTGES      0.001829077
## TNNI2      0.163264045
## AF127577.2 0.622381461
## CKB        0.622381461
## PUS10      0.622381461
## OASL       0.622381461
## ODF2L      0.782580136
## PRR7       0.782580136
## HSBP1      0.782580136
## GNS        0.782580136
## 
## $T
##              baseMean log2FoldChange     lfcSE      stat     pvalue      padj
## CYBB        14.296499     -0.8872705 0.3608141 -2.459079 0.01392939 0.9983424
## ATP5F1C      6.239390     -1.1671048 0.4815303 -2.423741 0.01536155 0.9983424
## SFT2D1       6.453705     -1.1138868 0.4747278 -2.346369 0.01895731 0.9983424
## BCL6         5.278050     -1.0570873 0.4613071 -2.291504 0.02193425 0.9983424
## LYZ        231.429719     -0.4427538 0.1958985 -2.260119 0.02381386 0.9983424
## MTRNR2L1    38.828218     -2.5782990 1.1461494 -2.249531 0.02447871 0.9983424
## REL          9.739690     -0.8005290 0.3745836 -2.137117 0.03258847 0.9983424
## YPEL3        8.045802     -0.8760953 0.4119422 -2.126744 0.03344139 0.9983424
## VMP1        14.801753     -0.6772379 0.3392266 -1.996418 0.04588847 0.9983424
## ATP2B1-AS1   5.738598     -0.9390538 0.4770244 -1.968565 0.04900301 0.9983424
## 
## $DC
##            baseMean log2FoldChange     lfcSE      stat       pvalue
## SLC9A3R1  157.19622     -0.8008697 0.1434666 -5.582275 2.373928e-08
## LILRA5    122.38877     -0.9867012 0.2221278 -4.442043 8.910869e-06
## FAM118A   205.01285     -0.6973272 0.1574683 -4.428367 9.494935e-06
## C5AR1      68.79782     -1.0543492 0.2669514 -3.949592 7.828454e-05
## APOBEC3A   38.31959     -1.2569278 0.3320899 -3.784903 1.537688e-04
## GK5        48.86185     -0.7305331 0.2057571 -3.550463 3.845542e-04
## CHST15     85.19333     -0.9306613 0.2625800 -3.544297 3.936617e-04
## FCN1     1472.89421     -0.6878119 0.2057424 -3.343073 8.285611e-04
## ERG        14.16904     -1.5063235 0.4540741 -3.317352 9.087517e-04
## BTG3       72.47695     -1.1699251 0.3541385 -3.303581 9.545844e-04
##                  padj
## SLC9A3R1 0.0002900703
## LILRA5   0.0290046522
## FAM118A  0.0290046522
## C5AR1    0.1366512476
## APOBEC3A 0.2288354613
## GK5      0.3809815635
## CHST15   0.3809815635
## FCN1     0.5651264359
## ERG      0.5651264359
## BTG3     0.5651264359
## 
## $Macrophage
##           baseMean log2FoldChange     lfcSE      stat       pvalue      padj
## EXT1    229.095337     -0.7140498 0.1894806 -3.768459 0.0001642587 0.4279816
## ARRDC3   38.373223     -0.7884409 0.2118195 -3.722230 0.0001974714 0.4279816
## TFPI     15.112197     -1.1593352 0.3235935 -3.582690 0.0003400746 0.4566354
## CCDC82   36.672770     -0.7019713 0.2115315 -3.318519 0.0009049618 0.7532456
## VEGFA     7.101706     -1.7449049 0.5491279 -3.177593 0.0014850321 0.8987938
## PJVK     20.376723     -1.6909953 0.5365021 -3.151889 0.0016221779 0.9272549
## ST3GAL1  49.433197     -1.0374753 0.3357297 -3.090210 0.0020001490 0.9990035
## PDE8A    31.649752     -1.0191106 0.3323116 -3.066731 0.0021641320 0.9990035
## UBE2Q2   55.306975     -0.6194901 0.2028154 -3.054454 0.0022547079 0.9990035
## TIGAR    43.810748     -0.5880053 0.1951981 -3.012351 0.0025923278 0.9990035
## 
## $B
##             baseMean log2FoldChange     lfcSE      stat       pvalue      padj
## IGHV3-15   10.498845     -3.4397435 0.8479845 -4.056376 0.0000498401 0.2244798
## CRHBP      31.060840     -1.2709966 0.3320780 -3.827404 0.0001295018 0.2916381
## ID1        10.275158     -2.2715472 0.6803629 -3.338729 0.0008416267 0.9476717
## JAM3       13.399800     -1.3601758 0.4156905 -3.272088 0.0010675633 0.9999354
## PRR11      18.250469     -3.0332235 0.9533345 -3.181699 0.0014641390 0.9999354
## CHMP1B     14.060580     -1.1177545 0.3553718 -3.145310 0.0016591075 0.9999354
## SLC25A29   11.322208     -1.1486275 0.3658656 -3.139480 0.0016924807 0.9999354
## RBPMS      23.075623     -0.9647895 0.3137937 -3.074598 0.0021078672 0.9999354
## ZRANB2-AS2  6.245355     -1.5962932 0.5246160 -3.042784 0.0023440043 0.9999354
## SNED1      18.301063     -1.0725222 0.3528598 -3.039514 0.0023696021 0.9999354
if ( ! dir.exists("de_analysis") ) {
  dir.create("de_analysis")
}

lapply(1:length(assays(pb)),function(i) {
  cellname=names(assays(pb))[[i]]
  myres <- deres[[i]]
  filename <- paste(cellname,".tsv",sep="")
  filename <- gsub("\\)","",gsub("\\(","",gsub(" ","_",filename)))
  filename <- paste("de_analysis/",filename,sep="")
  write.table(x=myres,file=filename,sep="\t",quote=FALSE)
})
## [[1]]
## NULL
## 
## [[2]]
## NULL
## 
## [[3]]
## NULL
## 
## [[4]]
## NULL
## 
## [[5]]
## NULL
## 
## [[6]]
## NULL
## 
## [[7]]
## NULL
## 
## [[8]]
## NULL
## 
## [[9]]
## NULL

Pathway analysis

Using mitch package with gene ontology terms.

go <- gmt_import("c5.go.v2023.2.Hs.symbols.gmt")
names(go) <- gsub("_"," ",names(go))

str(deres)
## List of 9
##  $ NK 1 (FCGRA3A+)   :'data.frame':  14682 obs. of  30 variables:
##   ..$ baseMean      : num [1:14682] 130.9 45 203.8 410.4 15.1 ...
##   ..$ log2FoldChange: num [1:14682] 2.129 -0.962 -0.706 -0.832 -1.484 ...
##   ..$ lfcSE         : num [1:14682] 0.361 0.177 0.143 0.17 0.309 ...
##   ..$ stat          : num [1:14682] 5.9 -5.44 -4.96 -4.91 -4.8 ...
##   ..$ pvalue        : num [1:14682] 3.69e-09 5.43e-08 7.18e-07 9.20e-07 1.56e-06 ...
##   ..$ padj          : num [1:14682] 4.99e-05 3.68e-04 3.11e-03 3.11e-03 4.23e-03 ...
##   ..$ AH0005        : num [1:14682] 7.41 6.2 7.6 8.18 5.23 ...
##   ..$ AH0015        : num [1:14682] 7.73 6.16 7.67 8.6 5.19 ...
##   ..$ AH0018        : num [1:14682] 7.77 5.72 7.47 8.83 5.57 ...
##   ..$ CC0003        : num [1:14682] 5.51 6.78 8.1 9.7 5.84 ...
##   ..$ CC0016        : num [1:14682] 8.61 6.06 7.7 8.26 5.14 ...
##   ..$ PM001         : num [1:14682] 7.62 5.95 7.58 8.09 5.22 ...
##   ..$ PM0020        : num [1:14682] 6.42 6.68 8.23 8.64 5.54 ...
##   ..$ PM0027        : num [1:14682] 6.41 6.25 8.88 8.93 5.6 ...
##   ..$ PM0028        : num [1:14682] 6.88 6.75 7.97 9.52 6.03 ...
##   ..$ PM0032        : num [1:14682] 6.7 6.59 8.08 8.68 6.07 ...
##   ..$ PM008         : num [1:14682] 7.94 6.15 7.39 8.75 5.43 ...
##   ..$ PM017         : num [1:14682] 7.21 6.24 7.67 8.65 5.24 ...
##   ..$ AH0005        : num [1:14682] 254 74 298 482 15 122 689 934 184 11 ...
##   ..$ AH0015        : num [1:14682] 268 56 255 539 11 60 421 758 234 28 ...
##   ..$ AH0018        : num [1:14682] 82 9 63 189 7 31 99 135 95 8 ...
##   ..$ CC0003        : num [1:14682] 35 186 600 2010 60 5 332 672 854 162 ...
##   ..$ CC0016        : num [1:14682] 559 51 270 426 10 70 594 805 203 25 ...
##   ..$ PM001         : num [1:14682] 126 22 121 186 6 33 287 417 86 17 ...
##   ..$ PM0020        : num [1:14682] 78 103 411 563 23 23 441 671 314 56 ...
##   ..$ PM0027        : num [1:14682] 6 5 53 55 2 2 29 45 61 3 ...
##   ..$ PM0028        : num [1:14682] 55 48 144 472 21 16 131 267 112 25 ...
##   ..$ PM0032        : num [1:14682] 27 24 93 149 13 4 53 143 95 23 ...
##   ..$ PM008         : num [1:14682] 345 60 217 654 20 112 520 581 277 56 ...
##   ..$ PM017         : num [1:14682] 330 121 493 1078 24 ...
##  $ CD14+ Mono        :'data.frame':  15548 obs. of  30 variables:
##   ..$ baseMean      : num [1:15548] 219.6 54.8 6013.2 681.9 68.9 ...
##   ..$ log2FoldChange: num [1:15548] 1.79 2.23 1.5 -0.8 2.92 ...
##   ..$ lfcSE         : num [1:15548] 0.365 0.457 0.31 0.17 0.625 ...
##   ..$ stat          : num [1:15548] 4.91 4.88 4.84 -4.72 4.68 ...
##   ..$ pvalue        : num [1:15548] 8.89e-07 1.05e-06 1.27e-06 2.38e-06 2.90e-06 ...
##   ..$ padj          : num [1:15548] 0.0058 0.0058 0.0058 0.00795 0.00795 ...
##   ..$ AH0005        : num [1:15548] 7.09 6.06 12.13 9.04 6.31 ...
##   ..$ AH0015        : num [1:15548] 8.92 7.26 13.11 8.72 6.97 ...
##   ..$ AH0018        : num [1:15548] 8.89 7.21 13.49 8.92 5.97 ...
##   ..$ CC0003        : num [1:15548] 7.23 5.62 11.85 10.25 5.96 ...
##   ..$ CC0016        : num [1:15548] 8.44 7.09 13.03 8.84 8.66 ...
##   ..$ PM001         : num [1:15548] 8.53 6.79 13.65 9.39 6.51 ...
##   ..$ PM0020        : num [1:15548] 7.32 5.03 11.27 9.8 4.86 ...
##   ..$ PM0027        : num [1:15548] 6.55 5.3 10.91 9.94 4.81 ...
##   ..$ PM0028        : num [1:15548] 6.75 5.29 11.11 9.44 5.08 ...
##   ..$ PM0032        : num [1:15548] 6.35 5.83 12.04 9.69 5.5 ...
##   ..$ PM008         : num [1:15548] 8.4 6.11 12.56 9.28 6.3 ...
##   ..$ PM017         : num [1:15548] 7.82 5.98 12.53 9.51 6.51 ...
##   ..$ AH0005        : num [1:15548] 74 28 3041 341 36 ...
##   ..$ AH0015        : num [1:15548] 649 179 12503 557 139 ...
##   ..$ AH0018        : num [1:15548] 1317 356 33816 1339 109 ...
##   ..$ CC0003        : num [1:15548] 10 2 300 97 3 12 1 11 20 126 ...
##   ..$ CC0016        : num [1:15548] 70 24 1836 95 83 ...
##   ..$ PM001         : num [1:15548] 904 220 33942 1698 170 ...
##   ..$ PM0020        : num [1:15548] 183 14 3397 1201 10 ...
##   ..$ PM0027        : num [1:15548] 153 36 4348 2181 15 ...
##   ..$ PM0028        : num [1:15548] 176 34 4776 1455 24 ...
##   ..$ PM0032        : num [1:15548] 117 67 8836 1689 44 ...
##   ..$ PM008         : num [1:15548] 136 19 2643 262 23 ...
##   ..$ PM017         : num [1:15548] 243 46 7224 862 79 ...
##  $ NK 2 (IL7R+)      :'data.frame':  13653 obs. of  30 variables:
##   ..$ baseMean      : num [1:13653] 4304.1 151.2 316.8 13.4 297.5 ...
##   ..$ log2FoldChange: num [1:13653] 0.673 -1.428 0.7 -2.136 -1.312 ...
##   ..$ lfcSE         : num [1:13653] 0.11 0.234 0.124 0.403 0.254 ...
##   ..$ stat          : num [1:13653] 6.12 -6.11 5.63 -5.3 -5.16 ...
##   ..$ pvalue        : num [1:13653] 9.52e-10 1.00e-09 1.84e-08 1.18e-07 2.54e-07 ...
##   ..$ padj          : num [1:13653] 6.85e-06 6.85e-06 8.37e-05 4.03e-04 6.92e-04 ...
##   ..$ AH0005        : num [1:13653] 12.63 6.57 8.78 5.06 7.69 ...
##   ..$ AH0015        : num [1:13653] 12.46 6.87 8.45 4.93 7.63 ...
##   ..$ AH0018        : num [1:13653] 11.92 7.16 8.48 4.86 8.06 ...
##   ..$ CC0003        : num [1:13653] 11.14 9.05 7.77 6.48 10.08 ...
##   ..$ CC0016        : num [1:13653] 12.46 6.69 9.02 4.76 7.25 ...
##   ..$ PM001         : num [1:13653] 12.33 6.9 8.87 4.7 7.67 ...
##   ..$ PM0020        : num [1:13653] 12.04 7.16 8.11 5.26 8.04 ...
##   ..$ PM0027        : num [1:13653] 11.64 8.08 8.27 5.28 8.96 ...
##   ..$ PM0028        : num [1:13653] 11.79 7.65 8.23 5.48 8.3 ...
##   ..$ PM0032        : num [1:13653] 11.96 7.51 8.03 5.48 7.98 ...
##   ..$ PM008         : num [1:13653] 11.91 7.08 8.43 4.89 8.11 ...
##   ..$ PM017         : num [1:13653] 12.09 7.2 8.43 4.96 7.89 ...
##   ..$ AH0005        : num [1:13653] 5254 54 337 7 145 ...
##   ..$ AH0015        : num [1:13653] 7855 121 444 9 233 ...
##   ..$ AH0018        : num [1:13653] 3557 104 301 5 218 ...
##   ..$ CC0003        : num [1:13653] 1277 286 107 34 603 ...
##   ..$ CC0016        : num [1:13653] 12298 160 1070 9 265 ...
##   ..$ PM001         : num [1:13653] 6014 104 514 4 202 ...
##   ..$ PM0020        : num [1:13653] 4363 117 256 13 241 ...
##   ..$ PM0027        : num [1:13653] 2687 204 236 11 397 ...
##   ..$ PM0028        : num [1:13653] 3568 172 272 18 287 ...
##   ..$ PM0032        : num [1:13653] 1792 68 104 8 100 ...
##   ..$ PM008         : num [1:13653] 3963 108 325 6 254 ...
##   ..$ PM017         : num [1:13653] 6991 187 503 11 332 ...
##  $ CD14+ Mono (CCL4+):'data.frame':  13897 obs. of  30 variables:
##   ..$ baseMean      : num [1:13897] 138.1 44.5 273.7 26.5 97.2 ...
##   ..$ log2FoldChange: num [1:13897] -0.917 -1.651 -1.078 1.685 1.881 ...
##   ..$ lfcSE         : num [1:13897] 0.171 0.35 0.237 0.407 0.458 ...
##   ..$ stat          : num [1:13897] -5.35 -4.71 -4.54 4.14 4.11 ...
##   ..$ pvalue        : num [1:13897] 8.98e-08 2.46e-06 5.51e-06 3.45e-05 3.98e-05 ...
##   ..$ padj          : num [1:13897] 0.00125 0.01707 0.02551 0.1107 0.1107 ...
##   ..$ AH0005        : num [1:13897] 6.45 5.14 7.98 5.14 6.77 ...
##   ..$ AH0015        : num [1:13897] 6.7 5.05 7.6 6.54 7.59 ...
##   ..$ AH0018        : num [1:13897] 7.28 6.01 7.83 6.24 7.68 ...
##   ..$ CC0003        : num [1:13897] 7.79 7.11 9.08 5.18 7.23 ...
##   ..$ CC0016        : num [1:13897] 6.92 5.98 7.93 5.99 7.43 ...
##   ..$ PM001         : num [1:13897] 7.25 5.46 7.61 5.67 7.34 ...
##   ..$ PM0020        : num [1:13897] 8.08 5.78 8.4 4.91 5.08 ...
##   ..$ PM0027        : num [1:13897] 8 6.79 9.32 4.66 5.54 ...
##   ..$ PM0028        : num [1:13897] 7.14 6.31 8.23 4.93 5.58 ...
##   ..$ PM0032        : num [1:13897] 7.45 6.57 8.1 5.33 5.11 ...
##   ..$ PM008         : num [1:13897] 6.91 5.64 7.68 5.94 7.59 ...
##   ..$ PM017         : num [1:13897] 7.22 5.34 7.47 5.27 6.69 ...
##   ..$ AH0005        : num [1:13897] 9 2 32 2 12 6 2 1 16 4 ...
##   ..$ AH0015        : num [1:13897] 45 7 96 39 95 43 7 2 131 26 ...
##   ..$ AH0018        : num [1:13897] 146 46 227 58 202 79 11 4 296 36 ...
##   ..$ CC0003        : num [1:13897] 683 395 1796 52 437 ...
##   ..$ CC0016        : num [1:13897] 264 109 597 110 404 127 25 14 390 67 ...
##   ..$ PM001         : num [1:13897] 216 37 288 48 232 74 13 9 160 41 ...
##   ..$ PM0020        : num [1:13897] 76 10 97 3 4 8 6 10 16 4 ...
##   ..$ PM0027        : num [1:13897] 191 71 505 5 20 20 19 130 36 11 ...
##   ..$ PM0028        : num [1:13897] 69 33 162 6 15 20 14 2 32 9 ...
##   ..$ PM0032        : num [1:13897] 154 73 256 19 14 38 30 7 73 19 ...
##   ..$ PM008         : num [1:13897] 463 132 874 184 808 219 46 40 718 121 ...
##   ..$ PM017         : num [1:13897] 132 20 162 18 84 60 8 5 164 30 ...
##  $ FCGR3A+ Mono      :'data.frame':  12783 obs. of  30 variables:
##   ..$ baseMean      : num [1:12783] 80.9 110.3 17.8 220.6 211.1 ...
##   ..$ log2FoldChange: num [1:12783] -2.075 -0.842 -1.195 1.387 -0.598 ...
##   ..$ lfcSE         : num [1:12783] 0.394 0.2 0.324 0.379 0.166 ...
##   ..$ stat          : num [1:12783] -5.26 -4.21 -3.69 3.66 -3.59 ...
##   ..$ pvalue        : num [1:12783] 1.43e-07 2.56e-05 2.24e-04 2.50e-04 3.25e-04 ...
##   ..$ padj          : num [1:12783] 0.00183 0.16326 0.62238 0.62238 0.62238 ...
##   ..$ AH0005        : num [1:12783] 5.98 6.42 5.01 6.53 8.35 ...
##   ..$ AH0015        : num [1:12783] 5.58 6.49 5.18 7.91 8.02 ...
##   ..$ AH0018        : num [1:12783] 6.17 6.9 5.24 9.52 7.23 ...
##   ..$ CC0003        : num [1:12783] 7.7 7.16 5.83 8.17 8.01 ...
##   ..$ CC0016        : num [1:12783] 6.26 7.24 5.4 8.23 7.74 ...
##   ..$ PM001         : num [1:12783] 5.84 6.83 5.36 8.7 7.5 ...
##   ..$ PM0020        : num [1:12783] 6.6 7.51 5.79 6.55 8.47 ...
##   ..$ PM0027        : num [1:12783] 8.43 7.82 6.33 6.42 8.04 ...
##   ..$ PM0028        : num [1:12783] 6.08 7.33 5.4 6.57 8.32 ...
##   ..$ PM0032        : num [1:12783] 7.41 7.66 5.5 6.83 8.33 ...
##   ..$ PM008         : num [1:12783] 6.22 6.84 5.36 8.09 7.26 ...
##   ..$ PM017         : num [1:12783] 6.2 7.07 5.43 8.32 7.17 ...
##   ..$ AH0005        : num [1:12783] 15 25 3 28 135 26 15 94 1 52 ...
##   ..$ AH0015        : num [1:12783] 14 43 7 154 167 35 16 166 14 85 ...
##   ..$ AH0018        : num [1:12783] 113 239 29 1939 323 ...
##   ..$ CC0003        : num [1:12783] 123 77 19 179 158 62 72 38 12 68 ...
##   ..$ CC0016        : num [1:12783] 61 160 19 361 244 60 26 69 43 208 ...
##   ..$ PM001         : num [1:12783] 29 86 14 406 157 54 39 94 39 121 ...
##   ..$ PM0020        : num [1:12783] 94 216 37 89 465 103 44 41 7 126 ...
##   ..$ PM0027        : num [1:12783] 253 157 40 44 187 58 91 31 5 75 ...
##   ..$ PM0028        : num [1:12783] 39 136 15 67 305 79 49 144 7 70 ...
##   ..$ PM0032        : num [1:12783] 74 91 9 44 156 32 22 50 5 41 ...
##   ..$ PM008         : num [1:12783] 69 130 21 379 191 74 62 218 81 187 ...
##   ..$ PM017         : num [1:12783] 43 103 15 289 112 44 45 230 24 110 ...
##  $ T                 :'data.frame':  1874 obs. of  30 variables:
##   ..$ baseMean      : num [1:1874] 2814.2 603.82 205.64 4.55 7.04 ...
##   ..$ log2FoldChange: num [1:1874] 6.35 5.67 4.73 1.66 1.47 ...
##   ..$ lfcSE         : num [1:1874] 1.689 1.621 1.5 0.601 0.536 ...
##   ..$ stat          : num [1:1874] 3.76 3.5 3.15 2.77 2.74 ...
##   ..$ pvalue        : num [1:1874] 0.000171 0.000472 0.001624 0.005626 0.006178 ...
##   ..$ padj          : num [1:1874] 0.32 0.442 0.998 0.998 0.998 ...
##   ..$ AH0005        : num [1:1874] 13.36 11.1 8.62 2.91 4.12 ...
##   ..$ AH0015        : num [1:1874] 11.45 9.83 8.78 3.7 3.8 ...
##   ..$ AH0018        : num [1:1874] 4.03 2.39 2.39 3.05 3.46 ...
##   ..$ CC0003        : num [1:1874] 9.9 7.93 6.35 2.56 2.72 ...
##   ..$ CC0016        : num [1:1874] 3.13 2.44 2.15 3.56 4.26 ...
##   ..$ PM001         : num [1:1874] 10.18 8.9 6.37 3.47 3.05 ...
##   ..$ PM0020        : num [1:1874] 2.96 2.53 2.53 2.53 2.76 ...
##   ..$ PM0027        : num [1:1874] 3.07 2.79 2.4 2.4 2.4 ...
##   ..$ PM0028        : num [1:1874] 2.77 3.04 2.77 3.04 3.62 ...
##   ..$ PM0032        : num [1:1874] 4.27 3.38 2.85 2.85 3.38 ...
##   ..$ PM008         : num [1:1874] 14.16 11.74 10.53 3.73 3.73 ...
##   ..$ PM017         : num [1:1874] 2.88 3.04 2.7 3.41 3.94 ...
##   ..$ AH0005        : num [1:1874] 3354 698 124 1 4 ...
##   ..$ AH0015        : num [1:1874] 6458 2090 1004 19 21 ...
##   ..$ AH0018        : num [1:1874] 9 1 1 3 5 12 3 4 4 171 ...
##   ..$ CC0003        : num [1:1874] 1617 406 130 3 4 ...
##   ..$ CC0016        : num [1:1874] 6 2 1 10 20 12 1 3 4 323 ...
##   ..$ PM001         : num [1:1874] 1806 738 121 10 6 ...
##   ..$ PM0020        : num [1:1874] 4 2 2 2 3 17 8 11 8 424 ...
##   ..$ PM0027        : num [1:1874] 3 2 1 1 1 8 10 7 4 219 ...
##   ..$ PM0028        : num [1:1874] 2 3 2 3 6 12 6 5 7 187 ...
##   ..$ PM0032        : num [1:1874] 5 2 1 1 2 12 2 5 2 58 ...
##   ..$ PM008         : num [1:1874] 34563 6458 2789 16 16 ...
##   ..$ PM017         : num [1:1874] 4 5 3 8 14 12 9 7 6 226 ...
##  $ DC                :'data.frame':  12221 obs. of  30 variables:
##   ..$ baseMean      : num [1:12221] 157.2 91.1 122.4 205 217.5 ...
##   ..$ log2FoldChange: num [1:12221] -0.801 1.037 -0.987 -0.697 0.903 ...
##   ..$ lfcSE         : num [1:12221] 0.143 0.214 0.222 0.157 0.217 ...
##   ..$ stat          : num [1:12221] -5.58 4.83 -4.44 -4.43 4.15 ...
##   ..$ pvalue        : num [1:12221] 2.37e-08 1.34e-06 8.91e-06 9.49e-06 3.26e-05 ...
##   ..$ padj          : num [1:12221] 0.00029 0.00821 0.029 0.029 0.07641 ...
##   ..$ AH0005        : num [1:12221] 7.16 7.35 7.04 7.37 8.39 ...
##   ..$ AH0015        : num [1:12221] 6.85 7.27 6.33 7.49 8.21 ...
##   ..$ AH0018        : num [1:12221] 7.42 7.31 7.24 7.93 8.21 ...
##   ..$ CC0003        : num [1:12221] 8.32 6.3 7.81 8.05 7.29 ...
##   ..$ CC0016        : num [1:12221] 6.96 7.28 7.01 7.64 8.15 ...
##   ..$ PM001         : num [1:12221] 7.34 7.23 6.75 7.44 8.75 ...
##   ..$ PM0020        : num [1:12221] 7.84 6.24 7.56 8.01 7.75 ...
##   ..$ PM0027        : num [1:12221] 7.81 6.24 7.58 8.27 7.42 ...
##   ..$ PM0028        : num [1:12221] 7.56 6.37 7.17 8.08 7.09 ...
##   ..$ PM0032        : num [1:12221] 7.58 6.92 7.91 8.43 7.79 ...
##   ..$ PM008         : num [1:12221] 7.4 6.74 6.75 7.56 7.44 ...
##   ..$ PM017         : num [1:12221] 7.6 6.72 6.82 7.71 7.91 ...
##   ..$ AH0005        : num [1:12221] 61 72 55 73 163 153 33 9 5 16 ...
##   ..$ AH0015        : num [1:12221] 90 130 55 156 276 307 46 28 10 41 ...
##   ..$ AH0018        : num [1:12221] 148 135 127 223 277 413 44 30 52 28 ...
##   ..$ CC0003        : num [1:12221] 213 38 144 173 94 164 38 21 3 46 ...
##   ..$ CC0016        : num [1:12221] 104 137 108 183 274 293 53 20 21 62 ...
##   ..$ PM001         : num [1:12221] 227 206 135 245 681 538 73 39 32 64 ...
##   ..$ PM0020        : num [1:12221] 99 24 79 113 92 32 51 46 6 38 ...
##   ..$ PM0027        : num [1:12221] 417 104 348 599 306 259 427 230 1 168 ...
##   ..$ PM0028        : num [1:12221] 195 68 141 296 132 84 96 47 3 63 ...
##   ..$ PM0032        : num [1:12221] 151 86 197 293 178 103 81 35 1 50 ...
##   ..$ PM008         : num [1:12221] 192 108 109 220 199 177 49 19 19 44 ...
##   ..$ PM017         : num [1:12221] 144 68 74 158 185 309 25 23 13 34 ...
##  $ Macrophage        :'data.frame':  10290 obs. of  30 variables:
##   ..$ baseMean      : num [1:10290] 548.9 93.9 229.1 38.4 6.5 ...
##   ..$ log2FoldChange: num [1:10290] 0.896 1.153 -0.714 -0.788 2.16 ...
##   ..$ lfcSE         : num [1:10290] 0.224 0.293 0.189 0.212 0.582 ...
##   ..$ stat          : num [1:10290] 4.01 3.94 -3.77 -3.72 3.71 ...
##   ..$ pvalue        : num [1:10290] 6.13e-05 8.31e-05 1.64e-04 1.97e-04 2.08e-04 ...
##   ..$ padj          : num [1:10290] 0.428 0.428 0.428 0.428 0.428 ...
##   ..$ AH0005        : num [1:10290] 9.18 6.9 7.34 5.6 4.44 ...
##   ..$ AH0015        : num [1:10290] 9.84 7.75 7.66 5.88 4.67 ...
##   ..$ AH0018        : num [1:10290] 9.57 7.18 7.56 5.25 4.28 ...
##   ..$ CC0003        : num [1:10290] 8.59 6.65 8.83 5.84 4.14 ...
##   ..$ CC0016        : num [1:10290] 9.11 7.52 7.98 5.84 5.24 ...
##   ..$ PM001         : num [1:10290] 9.77 6.92 7.57 5.86 5.12 ...
##   ..$ PM0020        : num [1:10290] 9.09 5.85 8.32 6.09 4.24 ...
##   ..$ PM0027        : num [1:10290] 9 5.82 7.84 6.28 4.18 ...
##   ..$ PM0028        : num [1:10290] 8.14 6.04 8.03 6.68 4.55 ...
##   ..$ PM0032        : num [1:10290] 8.24 6.81 8.31 6.33 4.21 ...
##   ..$ PM008         : num [1:10290] 9.47 6.86 7.79 5.32 5.13 ...
##   ..$ PM017         : num [1:10290] 8.86 6.86 7.93 5.36 4.78 ...
##   ..$ AH0005        : num [1:10290] 146 25 36 7 1 2 6 35 11 268 ...
##   ..$ AH0015        : num [1:10290] 415 89 83 17 3 3 12 71 26 616 ...
##   ..$ AH0018        : num [1:10290] 305 50 68 7 1 5 1 35 10 568 ...
##   ..$ CC0003        : num [1:10290] 764 163 914 74 3 ...
##   ..$ CC0016        : num [1:10290] 723 219 313 48 23 ...
##   ..$ PM001         : num [1:10290] 1327 152 259 56 22 ...
##   ..$ PM0020        : num [1:10290] 253 17 143 22 1 5 3 37 10 501 ...
##   ..$ PM0027        : num [1:10290] 569 40 240 64 2 ...
##   ..$ PM0028        : num [1:10290] 306 51 282 94 6 38 6 97 33 969 ...
##   ..$ PM0032        : num [1:10290] 444 142 469 92 3 ...
##   ..$ PM008         : num [1:10290] 1763 238 505 48 37 ...
##   ..$ PM017         : num [1:10290] 824 173 410 37 15 ...
##  $ B                 :'data.frame':  9017 obs. of  30 variables:
##   ..$ baseMean      : num [1:9017] 19.5 10.5 11.8 31.1 10.4 ...
##   ..$ log2FoldChange: num [1:9017] 4.12 -3.44 1.89 -1.27 2.07 ...
##   ..$ lfcSE         : num [1:9017] 0.947 0.848 0.49 0.332 0.599 ...
##   ..$ stat          : num [1:9017] 4.35 -4.06 3.85 -3.83 3.45 ...
##   ..$ pvalue        : num [1:9017] 1.35e-05 4.98e-05 1.17e-04 1.30e-04 5.62e-04 ...
##   ..$ padj          : num [1:9017] 0.122 0.224 0.292 0.292 0.883 ...
##   ..$ AH0005        : num [1:9017] 4.24 3.95 5.22 4.9 5.22 ...
##   ..$ AH0015        : num [1:9017] 6.62 3.52 5.23 4.58 5.68 ...
##   ..$ AH0018        : num [1:9017] 3.9 3.71 4.52 5.6 4.44 ...
##   ..$ CC0003        : num [1:9017] 3.75 3.75 3.75 6.49 4.1 ...
##   ..$ CC0016        : num [1:9017] 6.19 3.8 4.97 4.82 4.89 ...
##   ..$ PM001         : num [1:9017] 5.49 3.9 5.32 5.37 4.62 ...
##   ..$ PM0020        : num [1:9017] 3.76 6.92 4.13 5.75 3.76 ...
##   ..$ PM0027        : num [1:9017] 3.93 3.93 3.93 6.2 4.84 ...
##   ..$ PM0028        : num [1:9017] 4.26 4.06 4.81 5.12 4.06 ...
##   ..$ PM0032        : num [1:9017] 3.76 4.57 4.48 5.72 3.76 ...
##   ..$ PM008         : num [1:9017] 5.34 3.57 5.15 5.07 4.81 ...
##   ..$ PM017         : num [1:9017] 5.57 3.74 4.52 6.01 4.33 ...
##   ..$ AH0005        : num [1:9017] 2 1 9 6 9 18 1 5 3 2 ...
##   ..$ AH0015        : num [1:9017] 240 1 63 26 102 41 72 7 8 12 ...
##   ..$ AH0018        : num [1:9017] 2 1 8 32 7 1 36 2 13 37 ...
##   ..$ CC0003        : num [1:9017] 1 1 1 63 3 3 1 23 25 20 ...
##   ..$ CC0016        : num [1:9017] 40 1 11 9 10 16 15 3 8 1 ...
##   ..$ PM001         : num [1:9017] 42 3 35 37 14 48 42 7 12 1 ...
##   ..$ PM0020        : num [1:9017] 1 84 3 30 1 4 14 7 14 2 ...
##   ..$ PM0027        : num [1:9017] 1 1 1 26 6 3 2 23 20 37 ...
##   ..$ PM0028        : num [1:9017] 8 5 20 30 5 14 6 5 15 26 ...
##   ..$ PM0032        : num [1:9017] 1 7 6 29 1 6 1 7 2 29 ...
##   ..$ PM008         : num [1:9017] 52 1 42 38 27 21 56 2 16 12 ...
##   ..$ PM017         : num [1:9017] 27 1 7 42 5 23 4 2 11 10 ...
if ( ! dir.exists("enrichment_analysis") ) {
  dir.create("enrichment_analysis")
}

# mitch multi
m0 <- mitch_import(deres,DEtype="deseq2",joinType="full")
## Note: Mean no. genes in input = 11551.6666666667
## Note: no. genes in output = 17578
## Note: estimated proportion of input genes in output = 1.52
summary(m0)
##  NK 1 (FCGRA3A+)     CD14+ Mono       NK 2 (IL7R+)    CD14+ Mono (CCL4+)
##  Min.   :-5.4366   Min.   :-4.7184   Min.   :-6.109   Min.   :-5.346    
##  1st Qu.:-0.6267   1st Qu.:-0.5812   1st Qu.:-0.697   1st Qu.:-0.642    
##  Median : 0.0271   Median :-0.0019   Median :-0.012   Median :-0.037    
##  Mean   : 0.0001   Mean   : 0.0111   Mean   :-0.045   Mean   :-0.046    
##  3rd Qu.: 0.6493   3rd Qu.: 0.5927   3rd Qu.: 0.649   3rd Qu.: 0.551    
##  Max.   : 5.8977   Max.   : 4.9147   Max.   : 6.117   Max.   : 4.141    
##  NA's   :2896      NA's   :2030      NA's   :3925     NA's   :3681      
##   FCGR3A+ Mono          T                DC           Macrophage    
##  Min.   :-5.261   Min.   :-2.459   Min.   :-5.582   Min.   :-3.768  
##  1st Qu.:-0.625   1st Qu.:-0.550   1st Qu.:-0.680   1st Qu.:-0.599  
##  Median :-0.034   Median :-0.055   Median :-0.045   Median :-0.009  
##  Mean   :-0.036   Mean   :-0.043   Mean   :-0.048   Mean   :-0.001  
##  3rd Qu.: 0.544   3rd Qu.: 0.462   3rd Qu.: 0.587   3rd Qu.: 0.587  
##  Max.   : 3.662   Max.   : 3.759   Max.   : 4.833   Max.   : 4.008  
##  NA's   :4795     NA's   :15704    NA's   :5357     NA's   :7288    
##        B         
##  Min.   :-4.056  
##  1st Qu.:-0.578  
##  Median : 0.033  
##  Mean   : 0.012  
##  3rd Qu.: 0.611  
##  Max.   : 4.351  
##  NA's   :8561
dim(m0)
## [1] 17578     9
# remove genes with 7/9 or more NA values
m0 <- m0[which(apply(m0,1,function(x) { length(which(is.na(x)))<7  } )),]
dim(m0)
## [1] 14197     9
mres0 <- mitch_calc(m0,genesets=go,minsetsize=5,cores=16,priority="effect")
## Warning in mitch_rank(input_profile): Warning: >60% of genes have the same score. This isn't
##             optimal for rank based enrichment analysis.
## Note: Enrichments with large effect sizes may not be 
##             statistically significant.
head(mres0$enrichment_result,20) |> kbl(caption="top enrichments") |> kable_paper("hover", full_width = F)
top enrichments
set setSize pMANOVA s.NK.1._FCGRA3A_ s.CD14_.Mono s.NK.2._IL7R__ s.CD14_.Mono._CC s.FCGR3A_.Mono s.T s.DC s.Macrophage s.B p.NK.1._FCGRA3A_ p.CD14_.Mono p.NK.2._IL7R__ p.CD14_.Mono._CC p.FCGR3A_.Mono p.T p.DC p.Macrophage p.B s.dist SD p.adjustMANOVA
2982 GOBP OLFACTORY BULB INTERNEURON DIFFERENTIATION 5 NA -0.0468749 0.8043468 0.1758761 0.5312906 0.8282821 NaN 0.5369625 0.6497791 -0.5030506 NA NA NA NA NA NA NA NA NA 1.616176 NA NA
4807 GOBP REGULATION OF MAST CELL CHEMOTAXIS 5 0.1785184 -0.4478405 -0.6542047 -0.4143465 -0.7841459 -0.6071991 0.0491473 -0.6102114 -0.4354625 0.3217278 0.2912088 0.1732911 0.9214028 0.0681412 0.3123475 0.3616198 0.4227267 0.8620933 0.0398392 1.565795 0.3580592 0.5616839
3718 GOBP POSITIVE REGULATION OF PLASMINOGEN ACTIVATION 5 0.0119994 0.5291795 -0.3319079 0.8061593 -0.6852716 -0.6504084 -0.0309716 -0.2954518 0.2476856 0.2270875 0.0289418 0.2340076 0.0153699 0.0783854 0.0273005 0.4774223 0.6498655 0.0778675 0.3172920 1.460782 0.5160093 0.1478370
3051 GOBP OXYGEN TRANSPORT 5 NA 0.5259709 -0.3531877 0.7299719 -0.4734019 0.4563189 0.1319997 -0.3753044 0.3643384 0.5918118 NA NA NA NA NA NA NA NA NA 1.416984 0.4642098 NA
1305 GOBP GAS TRANSPORT 6 NA 0.5259709 -0.2559393 0.7299719 -0.3472933 0.5273332 0.1319997 -0.3498009 0.3643384 0.5918118 NA NA NA NA NA NA NA NA NA 1.377124 0.4312128 NA
4004 GOBP PROTECTION FROM NATURAL KILLER CELL MEDIATED CYTOTOXICITY 5 0.0629256 0.6667297 0.5702412 0.6011061 0.1216200 0.5122965 0.0515253 0.1058671 0.6463433 0.1903025 0.1717262 0.0697088 0.0374350 0.3339561 0.0278640 0.2414559 0.0599051 0.0008635 0.0494734 1.369711 0.2601175 0.3538561
8353 GOMF TAP BINDING 7 0.0012174 0.4829519 0.5249227 0.6958258 0.2327653 0.5372819 -0.0145913 0.4519257 0.4479907 0.3543498 0.0683936 0.0047148 0.0082078 0.1991973 0.0061077 0.6638393 0.0082569 0.0001158 0.0012943 1.366207 0.2044362 0.0319599
6658 GOCC MHC CLASS I PROTEIN COMPLEX 9 0.0000753 0.5665346 0.3851823 0.6270524 0.2250644 0.5407100 0.0189379 0.2158746 0.6686127 0.2793852 0.0244583 0.0031301 0.0029526 0.3246875 0.0048458 0.5453798 0.0005602 0.0000035 0.0012697 1.333268 0.2222422 0.0036524
6204 GOBP VOCALIZATION BEHAVIOR 5 0.1605311 -0.4090008 -0.2720991 -0.6703139 0.2295531 0.0620398 0.1112801 -0.4039157 -0.7112066 -0.5858199 0.0564491 0.8819581 0.1110161 0.6186341 0.2823321 0.1431443 0.3630028 0.1101123 0.1700284 1.331058 0.3520904 0.5390386
4393 GOBP REGULATION OF CARDIAC MUSCLE CELL MEMBRANE POTENTIAL 6 NA -0.2046661 -0.1940215 -0.2175527 -0.7199074 -0.5816907 NaN -0.5878752 0.0963401 0.6073098 NA NA NA NA NA NA NA NA NA 1.306597 NA NA
1981 GOBP METANEPHRIC TUBULE MORPHOGENESIS 5 NA -0.6310979 0.3847268 0.8024147 0.4596475 -0.1365636 NaN 0.4913820 0.0400124 NaN NA NA NA NA NA NA NA NA NA 1.289632 NA NA
8435 GOMF T CELL RECEPTOR BINDING 10 0.0112284 0.6777235 0.2409427 0.7388547 0.2245939 0.3339541 -0.0144500 0.1962596 0.5710660 0.1390028 0.0129919 0.0123559 0.0012610 0.1335496 0.0464063 0.6668601 0.0208861 0.0006015 0.1340639 1.268622 0.2588778 0.1432891
1992 GOBP MHC CLASS I BIOSYNTHETIC PROCESS 5 0.5116188 0.7508423 0.4405615 0.3022701 0.1866155 0.5251212 0.0713912 0.5839697 0.1379711 0.2781425 0.1673626 0.0759881 0.1602780 0.0383058 0.0536662 0.3480692 0.0325116 0.1149339 0.1136828 1.265828 0.2261669 0.7842342
1233 GOBP FAT PAD DEVELOPMENT 7 0.0959703 -0.1373445 -0.6942792 -0.1368530 -0.6334599 -0.3220268 -0.0618352 -0.5453595 -0.2047893 -0.4547057 0.0688706 0.0092969 0.2542712 0.0382769 0.0324928 0.1024039 0.0788183 0.8997600 0.0402398 1.254801 0.2354210 0.4356463
5568 GOBP RESPONSE TO ZINC ION STARVATION 6 0.0658774 -0.2349679 0.5042035 -0.3900053 0.5176162 0.6481535 -0.0061313 0.4867260 0.4173652 -0.0478135 0.0604735 0.0975426 0.1030263 0.0375966 0.1765629 0.9337724 0.2367782 0.0957241 0.1280322 1.250194 0.3814315 0.3612959
7032 GOCC TRANSCRIPTION FACTOR AP 1 COMPLEX 5 0.0000387 -0.6595987 0.6557830 -0.4343584 0.4994734 0.1212707 0.0453881 0.2488312 0.0114729 -0.4251616 0.0006091 0.0057771 0.0069127 0.0051467 0.1936047 0.2338071 0.2540453 0.2643002 0.0048440 1.250136 0.4419273 0.0022199
7175 GOMF ALPHA GLUCOSIDASE ACTIVITY 5 NA -0.0911521 0.6768655 -0.1006862 0.3561507 0.3129819 NaN 0.6524657 0.5384256 0.3661407 NA NA NA NA NA NA NA NA NA 1.245418 NA NA
6442 GOCC CYTOSOLIC SMALL RIBOSOMAL SUBUNIT 38 0.0000000 0.1201205 -0.2315719 -0.7901520 -0.7030446 -0.4385926 -0.0260576 -0.3605943 -0.1198536 -0.1093560 0.9334185 0.0129775 0.0000000 0.0000000 0.0000086 0.0397258 0.0182402 0.4839131 0.3457008 1.239379 0.3062706 0.0000000
7881 GOMF NEUROPEPTIDE RECEPTOR ACTIVITY 5 NA 0.3120706 0.1721393 0.1936572 -0.2844895 0.3692500 NaN 0.8247493 -0.6272369 NaN NA NA NA NA NA NA NA NA NA 1.206416 NA NA
3799 GOBP POSITIVE REGULATION OF RESPONSE TO TYPE II INTERFERON 5 0.5116188 0.0382196 0.2286658 0.4385018 0.4528001 0.7681868 0.0713912 0.3258101 0.3534541 0.4144303 0.1673626 0.0759881 0.1602780 0.0383058 0.0536662 0.3480692 0.0325116 0.1149339 0.1136828 1.203787 0.2200000 0.7842342
head(subset(mres0$enrichment_result,p.adjustMANOVA<0.01),20) |> kbl(caption="top enrichments") |> kable_paper("hover", full_width = F)
top enrichments
set setSize pMANOVA s.NK.1._FCGRA3A_ s.CD14_.Mono s.NK.2._IL7R__ s.CD14_.Mono._CC s.FCGR3A_.Mono s.T s.DC s.Macrophage s.B p.NK.1._FCGRA3A_ p.CD14_.Mono p.NK.2._IL7R__ p.CD14_.Mono._CC p.FCGR3A_.Mono p.T p.DC p.Macrophage p.B s.dist SD p.adjustMANOVA
6658 GOCC MHC CLASS I PROTEIN COMPLEX 9 0.0000753 0.5665346 0.3851823 0.6270524 0.2250644 0.5407100 0.0189379 0.2158746 0.6686127 0.2793852 0.0244583 0.0031301 0.0029526 0.3246875 0.0048458 0.5453798 0.0005602 0.0000035 0.0012697 1.3332676 0.2222422 0.0036524
7032 GOCC TRANSCRIPTION FACTOR AP 1 COMPLEX 5 0.0000387 -0.6595987 0.6557830 -0.4343584 0.4994734 0.1212707 0.0453881 0.2488312 0.0114729 -0.4251616 0.0006091 0.0057771 0.0069127 0.0051467 0.1936047 0.2338071 0.2540453 0.2643002 0.0048440 1.2501362 0.4419273 0.0022199
6442 GOCC CYTOSOLIC SMALL RIBOSOMAL SUBUNIT 38 0.0000000 0.1201205 -0.2315719 -0.7901520 -0.7030446 -0.4385926 -0.0260576 -0.3605943 -0.1198536 -0.1093560 0.9334185 0.0129775 0.0000000 0.0000000 0.0000086 0.0397258 0.0182402 0.4839131 0.3457008 1.2393792 0.3062706 0.0000000
6439 GOCC CYTOSOLIC LARGE RIBOSOMAL SUBUNIT 55 0.0000000 0.0961184 -0.1961419 -0.7620206 -0.6334597 -0.4608439 -0.0534745 -0.3453907 -0.1050807 -0.1091125 0.6202175 0.0036791 0.0000000 0.0000000 0.0000000 0.0000009 0.0009514 0.4279397 0.3125547 1.1777673 0.2858315 0.0000000
5404 GOBP RESPONSE TO CORTICOSTERONE 5 0.0000328 -0.6013291 0.4675347 -0.5289375 0.0438001 0.1831392 -0.0741955 0.2963820 0.3174463 -0.5341676 0.0181473 0.0295909 0.0479713 0.0242020 0.6951540 0.0897141 0.0163049 0.0149522 0.0253029 1.1725498 0.4114452 0.0019258
6840 GOCC POLYSOMAL RIBOSOME 29 0.0000000 0.1547316 -0.2034595 -0.6811214 -0.5806937 -0.3924367 -0.0474010 -0.2155780 -0.0408350 -0.1359172 0.7686282 0.0240706 0.0000000 0.0000021 0.0002819 0.0014712 0.1785882 0.9332046 0.1306343 1.0437133 0.2690732 0.0000000
174 GOBP ANTIGEN PROCESSING AND PRESENTATION OF PEPTIDE ANTIGEN VIA MHC CLASS IB 11 0.0000753 0.2937478 0.1916904 0.4493864 0.2911307 0.4443277 0.0189379 0.3137475 0.4946513 0.2929602 0.0244583 0.0031301 0.0029526 0.3246875 0.0048458 0.5453798 0.0005602 0.0000035 0.0012697 1.0180702 0.1462906 0.0036524
6441 GOCC CYTOSOLIC RIBOSOME 109 0.0000000 0.1161091 -0.1764938 -0.6725459 -0.5333003 -0.3614297 -0.0410408 -0.2913931 -0.0980106 -0.0993839 0.6696618 0.0000852 0.0000000 0.0000000 0.0000000 0.0000006 0.0000219 0.2090952 0.1027037 1.0089934 0.2502180 0.0000000
176 GOBP ANTIGEN PROCESSING AND PRESENTATION VIA MHC CLASS IB 15 0.0000466 0.3608409 0.1693360 0.4305613 0.2903743 0.3626802 0.0349164 0.2956653 0.4141032 0.2896287 0.0128205 0.0128543 0.0009335 0.1918178 0.0050656 0.2265488 0.0002358 0.0000017 0.0007852 0.9508529 0.1249792 0.0025152
6659 GOCC MHC PROTEIN COMPLEX 23 0.0000003 0.5681298 0.3962081 0.5247028 0.0960257 0.1828663 -0.0184568 0.1158107 0.2689914 0.0560049 0.0000323 0.0001241 0.0000033 0.4580556 0.0385879 0.3433688 0.0012273 0.0002209 0.0201574 0.9417919 0.2103373 0.0000312
167 GOBP ANTIGEN PROCESSING AND PRESENTATION OF ENDOGENOUS PEPTIDE ANTIGEN 18 0.0000073 0.3142297 0.3132263 0.4080091 0.2888417 0.3575872 -0.0107346 0.2545613 0.3878129 0.2545520 0.0090751 0.0006357 0.0002508 0.3427793 0.0062512 0.6669084 0.0015929 0.0000014 0.0022661 0.9245176 0.1234645 0.0005054
166 GOBP ANTIGEN PROCESSING AND PRESENTATION OF ENDOGENOUS ANTIGEN 22 0.0000015 0.3688583 0.3207871 0.4387995 0.2625187 0.3080397 -0.0213437 0.2178141 0.3582927 0.2535950 0.0035693 0.0001433 0.0000729 0.3086087 0.0043460 0.3709845 0.0015246 0.0000038 0.0054468 0.9142718 0.1310309 0.0001295
2955 GOBP NUCLEOTIDE BINDING OLIGOMERIZATION DOMAIN CONTAINING 1 SIGNALING PATHWAY 8 0.0000351 -0.5972616 0.3439327 -0.2572630 0.1071635 -0.0473110 0.0453168 -0.3612653 -0.1750879 -0.2594565 0.0082670 0.0138654 0.0405996 0.0941705 0.6667040 0.3031575 0.0505378 0.1979762 0.0974319 0.8862604 0.2795373 0.0020469
814 GOBP CYTOPLASMIC TRANSLATION 145 0.0000000 0.1048847 -0.1507584 -0.5622229 -0.4459800 -0.3124125 -0.0296235 -0.2950924 -0.0958619 -0.0806266 0.8203869 0.0006220 0.0000000 0.0000000 0.0000000 0.0000750 0.0000073 0.6924361 0.1227815 0.8660083 0.2128332 0.0000000
6656 GOCC MHC CLASS II PROTEIN COMPLEX 15 0.0000309 0.5750827 0.4151557 0.4664390 -0.0349946 -0.0356225 -0.0381978 0.0940893 0.0783623 -0.0341459 0.0002842 0.0061125 0.0002527 0.8617487 0.6274633 0.1105671 0.0738715 0.1472738 0.4761403 0.8606693 0.2488325 0.0018363
6909 GOCC RESPIRATORY CHAIN COMPLEX IV 19 0.0000775 0.2793538 -0.0407092 0.2859999 -0.5105143 -0.4052640 -0.0140489 -0.3117625 -0.0923801 0.2077131 0.1230326 0.9368514 0.0601170 0.0050836 0.0031573 0.4551236 0.2000152 0.9801178 0.0011654 0.8575707 0.2947907 0.0037114
4038 GOBP PROTEIN FOLDING IN ENDOPLASMIC RETICULUM 11 0.0000002 -0.1304684 -0.3853033 0.1047656 -0.5590238 0.0797084 -0.0321894 -0.3242935 -0.0867069 0.2833130 0.2647324 0.0446577 0.1969039 0.0067013 0.1189970 0.2598919 0.1584910 0.4305702 0.0012820 0.8302435 0.2661668 0.0000159
6636 GOCC LUMENAL SIDE OF ENDOPLASMIC RETICULUM MEMBRANE 25 0.0000268 0.4181203 0.2401054 0.5218601 -0.0357808 0.1371478 -0.0154094 0.0862629 0.1816953 0.1158959 0.0031850 0.0024039 0.0000044 0.4047116 0.0196980 0.3856381 0.0169014 0.0025228 0.0019700 0.7609380 0.1859315 0.0016190
1411 GOBP GRANZYME MEDIATED PROGRAMMED CELL DEATH SIGNALING PATHWAY 8 0.0000523 -0.0092681 0.1976203 0.5969394 0.0243153 -0.3052574 0.0144625 -0.2367026 0.0905486 -0.0643403 0.5638743 0.2407642 0.0202236 0.4940534 0.0495646 0.8355094 0.0654979 0.4176601 0.3923827 0.7468773 0.2615491 0.0027412
7796 GOMF MHC CLASS II PROTEIN COMPLEX BINDING 25 0.0001173 0.4876772 0.3763988 0.3719490 -0.0033635 -0.0359561 -0.0123617 0.0959476 0.0988246 0.0831951 0.0004898 0.0003410 0.0004746 0.4961881 0.4003801 0.5103417 0.0095958 0.0158837 0.0737933 0.7383778 0.1960889 0.0052071
sig <- head(subset(mres0$enrichment_result,p.adjustMANOVA<0.01),30)

sig <- sig[,c(1,4:12)]
rownames(sig) <- sig[,1]
sig[,1]=NULL

colfunc <- colorRampPalette(c("blue", "white", "red"))

heatmap.2(as.matrix(sig),trace="none",scale="none",
  margin=c(10,22),col=colfunc(25),cexCol=0.8, cexRow=0.7)

pdf("multimitch_heatmap.pdf")
heatmap.2(as.matrix(sig),trace="none",scale="none",
  margin=c(10,22),col=colfunc(25),cexCol=0.8, cexRow=0.7)
dev.off()
## png 
##   2

mitch single

par(mfrow=c(1,1))
par(mar=c(5,27,3,1))

message("NK 1 (FCGRA3A+)")
## NK 1 (FCGRA3A+)
m1 <- mitch_import(deres[[1]],DEtype="deseq2",joinType="full")
## The input is a single dataframe; one contrast only. Converting
##         it to a list for you.
## Note: Mean no. genes in input = 14682
## Note: no. genes in output = 14682
## Note: estimated proportion of input genes in output = 1
mres1 <- mitch_calc(m1,genesets=go,minsetsize=5,cores=16,priority="effect")
## Note: Enrichments with large effect sizes may not be
##             statistically significant.
res <- mres1$enrichment_result
res <- subset(res,p.adjustANOVA<0.05)
resup <- subset(res,s.dist>0)
resdn <- subset(res,s.dist<0)
head(resup,10)
##                                                                              set
## 607  GOBP CELL MOTILITY INVOLVED IN CEREBRAL CORTEX RADIAL GLIA GUIDED MIGRATION
## 6134                                     GOCC ALPHA BETA T CELL RECEPTOR COMPLEX
## 3570                  GOBP POSITIVE REGULATION OF MYELOID CELL APOPTOTIC PROCESS
## 8306                                                GOMF T CELL RECEPTOR BINDING
## 6764                          GOCC PROTEASOME CORE COMPLEX ALPHA SUBUNIT COMPLEX
## 1807                                           GOBP MACROPHAGE APOPTOTIC PROCESS
## 6545                                           GOCC MHC CLASS II PROTEIN COMPLEX
## 6548                                                    GOCC MHC PROTEIN COMPLEX
## 6149                                                 GOCC ARP2 3 PROTEIN COMPLEX
## 3004             GOBP PEPTIDE ANTIGEN ASSEMBLY WITH MHC CLASS II PROTEIN COMPLEX
##      setSize       pANOVA    s.dist p.adjustANOVA
## 607        6 1.336535e-03 0.7562233  0.0450649390
## 6134       8 5.093048e-04 0.7096054  0.0230205753
## 3570       8 9.939413e-04 0.6721412  0.0379513123
## 8306      11 1.283127e-04 0.6668009  0.0075559906
## 6764       8 1.251880e-03 0.6587842  0.0435129920
## 1807      10 5.862996e-04 0.6278081  0.0255354350
## 6545      13 9.366443e-05 0.6256994  0.0058449403
## 6548      20 1.609046e-06 0.6195471  0.0002038613
## 6149       9 1.403971e-03 0.6147876  0.0461341417
## 3004      12 3.393236e-04 0.5973756  0.0163070330
head(resdn,10)
##                                                           set setSize
## 3431    GOBP POSITIVE REGULATION OF HORMONE METABOLIC PROCESS       9
## 3589   GOBP POSITIVE REGULATION OF NEUROINFLAMMATORY RESPONSE       9
## 3532      GOBP POSITIVE REGULATION OF MIRNA METABOLIC PROCESS      37
## 7305           GOMF DNA BINDING TRANSCRIPTION FACTOR ACTIVITY     862
## 1163       GOBP EXTERNAL ENCAPSULATING STRUCTURE ORGANIZATION     132
## 7220 GOMF CIS REGULATORY REGION SEQUENCE SPECIFIC DNA BINDING     730
## 7307        GOMF DNA BINDING TRANSCRIPTION REPRESSOR ACTIVITY     220
## 8130                       GOMF SEQUENCE SPECIFIC DNA BINDING    1064
## 7304        GOMF DNA BINDING TRANSCRIPTION ACTIVATOR ACTIVITY     263
## 8257                    GOMF TRANSCRIPTION REGULATOR ACTIVITY    1283
##            pANOVA     s.dist p.adjustANOVA
## 3431 1.767636e-04 -0.7218171  9.987144e-03
## 3589 1.216441e-03 -0.6227084  4.310118e-02
## 3532 8.642574e-04 -0.3165641  3.457857e-02
## 7305 8.818343e-23 -0.1988221  3.686949e-19
## 1163 2.522602e-04 -0.1847256  1.302098e-02
## 7220 1.257236e-14 -0.1688533  1.340581e-11
## 7307 1.715056e-05 -0.1685709  1.419930e-03
## 8130 1.218288e-11 -0.1244816  7.276658e-09
## 7304 1.403581e-03 -0.1147285  4.613414e-02
## 8257 6.428257e-10 -0.1042064  2.150123e-07
s <- c(head(resup$s.dist,10), head(resdn$s.dist,10))
names(s) <- c(head(resup$set,10),head(resdn$set,10))
s <- s[order(s)]
cols <- gsub("1","red",gsub("-1","blue",as.character(sign(s))))
if( length(s) > 1 ) {
  barplot(abs(s),las=1,horiz=TRUE,col=cols,xlab="ES",cex.names=0.8,main="NK 1 (FCGRA3A+)")
  if (! file.exists("enrichment_analysis/NK1.html") ) {
    mitch_report(mres1,outfile="enrichment_analysis/NK1.html")
  }
}

message("CD14+ Mono")
## CD14+ Mono
m2 <- mitch_import(deres[[2]],DEtype="deseq2",joinType="full")
## The input is a single dataframe; one contrast only. Converting
##         it to a list for you.
## Note: Mean no. genes in input = 15548
## Note: no. genes in output = 15548
## Note: estimated proportion of input genes in output = 1
mres2 <- mitch_calc(m2,genesets=go,minsetsize=5,cores=16,priority="effect")
## Note: Enrichments with large effect sizes may not be
##             statistically significant.
res <- mres2$enrichment_result
res <- subset(res,p.adjustANOVA<0.05)
resup <- subset(res,s.dist>0)
resdn <- subset(res,s.dist<0)
head(resup,10)
##                                 set setSize       pANOVA     s.dist
## 5746    GOBP RRNA METABOLIC PROCESS     245 2.167667e-05 0.15786447
## 2274   GOBP NCRNA METABOLIC PROCESS     542 2.285731e-05 0.10688222
## 7284 GOMF ADENYL NUCLEOTIDE BINDING    1263 9.192851e-07 0.08316133
## 6809             GOCC MITOCHONDRION    1395 1.287532e-05 0.07066010
##      p.adjustANOVA
## 5746   0.049354640
## 2274   0.049354640
## 7284   0.007939866
## 6809   0.049354640
head(resdn,10)
## [1] set           setSize       pANOVA        s.dist        p.adjustANOVA
## <0 rows> (or 0-length row.names)
s <- c(head(resup$s.dist,10), head(resdn$s.dist,10))
names(s) <- c(head(resup$set,10),head(resdn$set,10))
s <- s[order(s)]
cols <- gsub("1","red",gsub("-1","blue",as.character(sign(s))))
if( length(s) > 1 ) {
  barplot(abs(s),las=1,horiz=TRUE,col=cols,xlab="ES",cex.names=0.8,main="CD14+ Mono")
  if (! file.exists("enrichment_analysis/CD14mono.html") ) {
    mitch_report(mres2,outfile="enrichment_analysis/CD14mono.html")
  }
}

message("NK 2 (IL7R+)")
## NK 2 (IL7R+)
m3 <- mitch_import(deres[[3]],DEtype="deseq2",joinType="full")
## The input is a single dataframe; one contrast only. Converting
##         it to a list for you.
## Note: Mean no. genes in input = 13653
## Note: no. genes in output = 13653
## Note: estimated proportion of input genes in output = 1
mres3 <- mitch_calc(m3,genesets=go,minsetsize=5,cores=16,priority="effect")
## Note: Enrichments with large effect sizes may not be
##             statistically significant.
res <- mres3$enrichment_result
res <- subset(res,p.adjustANOVA<0.05)
resup <- subset(res,s.dist>0)
resdn <- subset(res,s.dist<0)
head(resup,10)
##                                                           set setSize
## 1958                            GOBP MITOCHONDRIAL DNA REPAIR       5
## 8213                             GOMF T CELL RECEPTOR BINDING      10
## 1261                                       GOBP GAS TRANSPORT       5
## 2953                                    GOBP OXYGEN TRANSPORT       5
## 6075                GOCC ALPHA DNA POLYMERASE PRIMASE COMPLEX       5
## 6467                                         GOCC MCM COMPLEX       8
## 6414                              GOCC IKAPPAB KINASE COMPLEX       5
## 8133                                         GOMF TAP BINDING       7
## 3996 GOBP PROTEIN LOCALIZATION TO SITE OF DOUBLE STRAND BREAK       6
## 7681                       GOMF NITRIC OXIDE SYNTHASE BINDING       6
##            pANOVA    s.dist p.adjustANOVA
## 1958 1.192887e-03 0.8367819  0.0252953136
## 8213 8.148082e-06 0.8145862  0.0003743591
## 1261 1.817635e-03 0.8052755  0.0356204693
## 2953 1.817635e-03 0.8052755  0.0356204693
## 6075 2.134640e-03 0.7929660  0.0395817850
## 6467 1.085471e-04 0.7901796  0.0036196940
## 6414 2.269908e-03 0.7882181  0.0413717646
## 8133 4.348307e-04 0.7677812  0.0114635145
## 3996 1.382433e-03 0.7539386  0.0286817885
## 7681 1.536415e-03 0.7467331  0.0309182405
head(resdn,10)
##                                                                                          set
## 6265                                                  GOCC CYTOSOLIC SMALL RIBOSOMAL SUBUNIT
## 6262                                                  GOCC CYTOSOLIC LARGE RIBOSOMAL SUBUNIT
## 2407                                    GOBP NEGATIVE REGULATION OF INTERLEUKIN 4 PRODUCTION
## 6660                                                                 GOCC POLYSOMAL RIBOSOME
## 6264                                                                 GOCC CYTOSOLIC RIBOSOME
## 8226                                                GOMF UBIQUITIN LIGASE INHIBITOR ACTIVITY
## 3426 GOBP POSITIVE REGULATION OF INTRINSIC APOPTOTIC SIGNALING PATHWAY BY P53 CLASS MEDIATOR
## 6192                                                                    GOCC CILIARY ROOTLET
## 787                                                             GOBP CYTOPLASMIC TRANSLATION
## 7965                                    GOMF PROTEIN TYROSINE THREONINE PHOSPHATASE ACTIVITY
##      setSize       pANOVA     s.dist p.adjustANOVA
## 6265      38 2.644742e-20 -0.8646346  3.645336e-17
## 6262      55 9.476974e-27 -0.8335183  2.612486e-23
## 2407       6 1.030183e-03 -0.7736987  2.230265e-02
## 6660      29 4.119946e-12 -0.7435003  9.577164e-10
## 6264     109 4.297979e-40 -0.7335778  3.554429e-36
## 8226       8 3.861486e-04 -0.7246244  1.047032e-02
## 3426       6 2.908866e-03 -0.7018392  4.919493e-02
## 6192      10 7.254935e-04 -0.6172103  1.731043e-02
## 787      145 3.406841e-37 -0.6124881  1.408729e-33
## 7965       9 2.431660e-03 -0.5836021  4.352776e-02
s <- c(head(resup$s.dist,10), head(resdn$s.dist,10))
names(s) <- c(head(resup$set,10),head(resdn$set,10))
s <- s[order(s)]
cols <- gsub("1","red",gsub("-1","blue",as.character(sign(s))))
if( length(s) > 1 ) {
  barplot(abs(s),las=1,horiz=TRUE,col=cols,xlab="ES",cex.names=0.8,main="NK 2 (IL7R+)")
  if (! file.exists("enrichment_analysis/NK2.html") ) {
    mitch_report(mres3,outfile="enrichment_analysis/NK2.html")
  }
}

message("CD14+ Mono (CCL4+)")
## CD14+ Mono (CCL4+)
m4 <- mitch_import(deres[[4]],DEtype="deseq2",joinType="full")
## The input is a single dataframe; one contrast only. Converting
##         it to a list for you.
## Note: Mean no. genes in input = 13897
## Note: no. genes in output = 13897
## Note: estimated proportion of input genes in output = 1
mres4 <- mitch_calc(m4,genesets=go,minsetsize=5,cores=16,priority="effect")
## Note: Enrichments with large effect sizes may not be
##             statistically significant.
res <- mres4$enrichment_result
res <- subset(res,p.adjustANOVA<0.05)
resup <- subset(res,s.dist>0)
resdn <- subset(res,s.dist<0)
head(resup,10)
##                                                   set setSize       pANOVA
## 2012               GOBP MITOCHONDRIAL DNA REPLICATION      13 2.553776e-04
## 6735                    GOCC NUCLEAR REPLICATION FORK      30 2.557647e-05
## 1978                       GOBP MICROTUBULE ANCHORING      20 6.003216e-04
## 7682 GOMF LIGASE ACTIVITY FORMING CARBON SULFUR BONDS      30 8.749009e-05
## 4422         GOBP REGULATION OF CELL CYCLE CHECKPOINT      39 2.595989e-04
## 8185              GOMF RNA METHYLTRANSFERASE ACTIVITY      59 4.383457e-04
## 7195        GOMF ATP DEPENDENT ACTIVITY ACTING ON DNA      99 3.338083e-05
## 2942                  GOBP NUCLEOTIDE EXCISION REPAIR      80 3.617883e-04
## 959                GOBP DNA TEMPLATED DNA REPLICATION     139 4.980879e-06
## 6007                           GOBP TRNA MODIFICATION      89 2.864340e-04
##         s.dist p.adjustANOVA
## 2012 0.5857434   0.027665907
## 6735 0.4441143   0.005271248
## 1978 0.4432658   0.046969604
## 7682 0.4138795   0.013441659
## 4422 0.3381070   0.027767229
## 8185 0.2647953   0.039828186
## 7195 0.2415633   0.006131914
## 2942 0.2308497   0.033967903
## 959  0.2246405   0.001503158
## 6007 0.2226669   0.028813899
head(resdn,10)
##                                                         set setSize
## 6416                 GOCC CYTOSOLIC SMALL RIBOSOMAL SUBUNIT      38
## 8405               GOMF UBIQUITIN LIGASE INHIBITOR ACTIVITY       8
## 6413                 GOCC CYTOSOLIC LARGE RIBOSOMAL SUBUNIT      55
## 6814                                GOCC POLYSOMAL RIBOSOME      29
## 7503                   GOMF GLUTATHIONE PEROXIDASE ACTIVITY      14
## 6415                                GOCC CYTOSOLIC RIBOSOME     109
## 6883                      GOCC RESPIRATORY CHAIN COMPLEX IV      19
## 3753 GOBP POSITIVE REGULATION OF PROTEIN POLYUBIQUITINATION      15
## 807                            GOBP CYTOPLASMIC TRANSLATION     145
## 2685               GOBP NEGATIVE REGULATION OF RNA SPLICING      23
##            pANOVA     s.dist p.adjustANOVA
## 6416 3.695736e-15 -0.7368649  7.807242e-12
## 8405 4.847777e-04 -0.7123083  4.267054e-02
## 6413 1.624688e-17 -0.6636272  4.576205e-14
## 6814 1.448120e-08 -0.6079687  1.019718e-05
## 7503 1.812481e-04 -0.5778804  2.243126e-02
## 6415 7.168268e-24 -0.5583448  6.057187e-20
## 6883 5.546334e-05 -0.5342192  9.012793e-03
## 3753 4.320260e-04 -0.5249004  3.968065e-02
## 807  3.262761e-22 -0.4663898  1.378517e-18
## 2685 5.328409e-04 -0.4172710  4.446468e-02
s <- c(head(resup$s.dist,10), head(resdn$s.dist,10))
names(s) <- c(head(resup$set,10),head(resdn$set,10))
s <- s[order(s)]
cols <- gsub("1","red",gsub("-1","blue",as.character(sign(s))))
if( length(s) > 1 ) {
  barplot(abs(s),las=1,horiz=TRUE,col=cols,xlab="ES",cex.names=0.8,main="CD14+ Mono (CCL4+)")
  if (! file.exists("enrichment_analysis/CD14monoCCL4.html") ) {
    mitch_report(mres4,outfile="enrichment_analysis/CD14monoCCL4.html")
  }
}

message("FCGR3A+ Mono")
## FCGR3A+ Mono
m5 <- mitch_import(deres[[5]],DEtype="deseq2",joinType="full")
## The input is a single dataframe; one contrast only. Converting
##         it to a list for you.
## Note: Mean no. genes in input = 12783
## Note: no. genes in output = 12783
## Note: estimated proportion of input genes in output = 1
mres5 <- mitch_calc(m5,genesets=go,minsetsize=5,cores=16,priority="effect")
## Note: Enrichments with large effect sizes may not be
##             statistically significant.
res <- mres5$enrichment_result
res <- subset(res,p.adjustANOVA<0.05)
resup <- subset(res,s.dist>0)
resdn <- subset(res,s.dist<0)
head(resup,10)
##               set setSize       pANOVA    s.dist p.adjustANOVA
## 6107 GOCC CAVEOLA      45 3.268335e-05 0.3580573    0.01672774
head(resdn,10)
##                                          set setSize       pANOVA     s.dist
## 6220  GOCC CYTOSOLIC LARGE RIBOSOMAL SUBUNIT      55 3.685613e-11 -0.5157905
## 6223  GOCC CYTOSOLIC SMALL RIBOSOMAL SUBUNIT      38 1.654984e-07 -0.4907642
## 6608                 GOCC POLYSOMAL RIBOSOME      29 4.273153e-05 -0.4391266
## 6222                 GOCC CYTOSOLIC RIBOSOME     109 3.176493e-13 -0.4043038
## 779             GOBP CYTOPLASMIC TRANSLATION     144 4.931039e-13 -0.3493706
## 8030 GOMF STRUCTURAL CONSTITUENT OF RIBOSOME     156 2.585689e-10 -0.2938230
## 6397            GOCC LARGE RIBOSOMAL SUBUNIT     112 1.540361e-07 -0.2874195
## 6609                           GOCC POLYSOME      61 1.203706e-04 -0.2848841
## 6683                  GOCC RIBOSOMAL SUBUNIT     180 1.319753e-09 -0.2626888
## 2928          GOBP OXIDATIVE PHOSPHORYLATION     127 4.399774e-07 -0.2599508
##      p.adjustANOVA
## 6220  1.006049e-07
## 6223  1.936095e-04
## 6608  1.944047e-02
## 6222  2.019014e-09
## 779   2.019014e-09
## 8030  5.293552e-07
## 6397  1.936095e-04
## 6609  4.928576e-02
## 6683  2.161491e-06
## 2928  4.503718e-04
s <- c(head(resup$s.dist,10), head(resdn$s.dist,10))
names(s) <- c(head(resup$set,10),head(resdn$set,10))
s <- s[order(s)]
cols <- gsub("1","red",gsub("-1","blue",as.character(sign(s))))
if( length(s) > 1 ) {
  barplot(abs(s),las=1,horiz=TRUE,col=cols,xlab="ES",cex.names=0.8,main="FCGR3A+ Mono")
  if (! file.exists("enrichment_analysis/FCGR3Amono.html") ) {
    mitch_report(mres5,outfile="enrichment_analysis/FCGR3Amono.html")
  }
}

message("T")
## T
m6 <- mitch_import(deres[[6]],DEtype="deseq2",joinType="full")
## The input is a single dataframe; one contrast only. Converting
##         it to a list for you.
## Note: Mean no. genes in input = 1874
## Note: no. genes in output = 1874
## Note: estimated proportion of input genes in output = 1
mres6 <- mitch_calc(m6,genesets=go,minsetsize=5,cores=16,priority="effect")
## Note: Enrichments with large effect sizes may not be
##             statistically significant.
res <- mres6$enrichment_result
res <- subset(res,p.adjustANOVA<0.05)
resup <- subset(res,s.dist>0)
resdn <- subset(res,s.dist<0)
head(resup,10)
## [1] set           setSize       pANOVA        s.dist        p.adjustANOVA
## <0 rows> (or 0-length row.names)
head(resdn,10)
##                                          set setSize       pANOVA     s.dist
## 3033  GOCC CYTOSOLIC LARGE RIBOSOMAL SUBUNIT      49 1.179107e-06 -0.4051104
## 3111            GOCC LARGE RIBOSOMAL SUBUNIT      51 5.443373e-06 -0.3719252
## 3754 GOMF STRUCTURAL CONSTITUENT OF RIBOSOME      86 7.829888e-07 -0.3140185
## 3035                 GOCC CYTOSOLIC RIBOSOME      88 7.631607e-07 -0.3109157
## 3252                  GOCC RIBOSOMAL SUBUNIT      87 2.416460e-06 -0.2981881
## 3253                           GOCC RIBOSOME     100 4.696085e-07 -0.2981623
##      p.adjustANOVA
## 3033  0.0011242785
## 3111  0.0034601708
## 3754  0.0009954398
## 3035  0.0009954398
## 3252  0.0018432758
## 3253  0.0009954398
s <- c(head(resup$s.dist,10), head(resdn$s.dist,10))
names(s) <- c(head(resup$set,10),head(resdn$set,10))
s <- s[order(s)]
cols <- gsub("1","red",gsub("-1","blue",as.character(sign(s))))
if( length(s) > 1 ) {
  barplot(abs(s),las=1,horiz=TRUE,col=cols,xlab="ES",cex.names=0.8,main="T")
  if (! file.exists("enrichment_analysis/T.html") ) {
    mitch_report(mres6,outfile="enrichment_analysis/T.html")
  }
}

message("DC")
## DC
m7 <- mitch_import(deres[[7]],DEtype="deseq2",joinType="full")
## The input is a single dataframe; one contrast only. Converting
##         it to a list for you.
## Note: Mean no. genes in input = 12221
## Note: no. genes in output = 12221
## Note: estimated proportion of input genes in output = 1
mres7 <- mitch_calc(m7,genesets=go,minsetsize=5,cores=16,priority="effect")
## Note: Enrichments with large effect sizes may not be
##             statistically significant.
res <- mres7$enrichment_result
res <- subset(res,p.adjustANOVA<0.05)
resup <- subset(res,s.dist>0)
resdn <- subset(res,s.dist<0)
head(resup,10)
##                                                         set setSize
## 1955                    GOBP MITOCHONDRIAL RNA MODIFICATION      10
## 824           GOBP DEOXYRIBONUCLEOTIDE BIOSYNTHETIC PROCESS      12
## 1962                     GOBP MITOCHONDRIAL TRNA PROCESSING      14
## 5789 GOBP TRNA THREONYLCARBAMOYLADENOSINE METABOLIC PROCESS      17
## 7007               GOMF CATALYTIC ACTIVITY ACTING ON A RRNA      21
## 1932               GOBP MITOCHONDRIAL DNA METABOLIC PROCESS      20
## 4341               GOBP REGULATION OF DNA DAMAGE CHECKPOINT      24
## 5784                                  GOBP TRNA METHYLATION      40
## 7866                    GOMF RNA METHYLTRANSFERASE ACTIVITY      58
## 2772                        GOBP NON MOTILE CILIUM ASSEMBLY      52
##            pANOVA    s.dist p.adjustANOVA
## 1955 6.217545e-04 0.6249283   0.034116677
## 824  6.367725e-04 0.5694433   0.034474862
## 1962 2.820269e-04 0.5605449   0.022022501
## 5789 8.070495e-05 0.5522972   0.009747546
## 7007 1.543346e-04 0.4770570   0.015473470
## 1932 5.379888e-04 0.4471273   0.031431703
## 4341 4.323557e-04 0.4151226   0.028089285
## 5784 1.587838e-04 0.3452836   0.015559997
## 7866 1.854729e-04 0.2840015   0.017514251
## 2772 7.958755e-04 0.2690917   0.040395656
head(resdn,10)
##                                                         set setSize
## 7844                             GOMF RAGE RECEPTOR BINDING       9
## 2437    GOBP NEGATIVE REGULATION OF MIRNA METABOLIC PROCESS      18
## 7177                      GOMF EXTRACELLULAR MATRIX BINDING      17
## 451  GOBP CELLULAR RESPONSE TO ARSENIC CONTAINING SUBSTANCE      17
## 5755        GOBP TRANSFORMING GROWTH FACTOR BETA PRODUCTION      21
## 2243       GOBP NEGATIVE REGULATION OF CELL MATRIX ADHESION      20
## 6179                 GOCC CYTOSOLIC SMALL RIBOSOMAL SUBUNIT      38
## 6176                 GOCC CYTOSOLIC LARGE RIBOSOMAL SUBUNIT      55
## 1833                     GOBP MEGAKARYOCYTE DIFFERENTIATION      36
## 780                            GOBP CYTOPLASMIC TRANSLATION     144
##            pANOVA     s.dist p.adjustANOVA
## 7844 6.307889e-04 -0.6579503  3.438011e-02
## 2437 2.482072e-04 -0.4989028  2.037190e-02
## 7177 7.101974e-04 -0.4743479  3.720976e-02
## 451  1.118235e-03 -0.4566102  4.962395e-02
## 5755 4.046300e-04 -0.4459407  2.663725e-02
## 2243 8.829575e-04 -0.4296041  4.242898e-02
## 6179 6.389808e-06 -0.4232127  1.921912e-03
## 6176 1.995367e-07 -0.4055326  1.620438e-04
## 1833 1.256902e-04 -0.3694707  1.360676e-02
## 780  7.664105e-13 -0.3465449  6.224019e-09
s <- c(head(resup$s.dist,10), head(resdn$s.dist,10))
names(s) <- c(head(resup$set,10),head(resdn$set,10))
s <- s[order(s)]
cols <- gsub("1","red",gsub("-1","blue",as.character(sign(s))))
if( length(s) > 1 ) {
  barplot(abs(s),las=1,horiz=TRUE,col=cols,xlab="ES",cex.names=0.8,main="DC")
  if (! file.exists("enrichment_analysis/DC.html") ) {
    mitch_report(mres7,outfile="enrichment_analysis/DC.html")
  }
}

message("Macrophage")
## Macrophage
m8 <- mitch_import(deres[[8]],DEtype="deseq2",joinType="full")
## The input is a single dataframe; one contrast only. Converting
##         it to a list for you.
## Note: Mean no. genes in input = 10290
## Note: no. genes in output = 10290
## Note: estimated proportion of input genes in output = 1
mres8 <- mitch_calc(m8,genesets=go,minsetsize=5,cores=16,priority="effect")
## Note: Enrichments with large effect sizes may not be
##             statistically significant.
res <- mres8$enrichment_result
res <- subset(res,p.adjustANOVA<0.05)
resup <- subset(res,s.dist>0)
resdn <- subset(res,s.dist<0)
head(resup,10)
## [1] set           setSize       pANOVA        s.dist        p.adjustANOVA
## <0 rows> (or 0-length row.names)
head(resdn,10)
## [1] set           setSize       pANOVA        s.dist        p.adjustANOVA
## <0 rows> (or 0-length row.names)
s <- c(head(resup$s.dist,10), head(resdn$s.dist,10))
names(s) <- c(head(resup$set,10),head(resdn$set,10))
s <- s[order(s)]
cols <- gsub("1","red",gsub("-1","blue",as.character(sign(s))))
if( length(s) > 1 ) {
  barplot(abs(s),las=1,horiz=TRUE,col=cols,xlab="ES",cex.names=0.8,main="Macrophage")
  if (! file.exists("enrichment_analysis/macrophage.html") ) {
    mitch_report(mres8,outfile="enrichment_analysis/macrophage.html")
  }
}

message("B")
## B
m9 <- mitch_import(deres[[9]],DEtype="deseq2",joinType="full")
## The input is a single dataframe; one contrast only. Converting
##         it to a list for you.
## Note: Mean no. genes in input = 9017
## Note: no. genes in output = 9017
## Note: estimated proportion of input genes in output = 1
mres9 <- mitch_calc(m9,genesets=go,minsetsize=5,cores=16,priority="effect")
## Note: Enrichments with large effect sizes may not be
##             statistically significant.
res <- mres9$enrichment_result
res <- subset(res,p.adjustANOVA<0.05)
resup <- subset(res,s.dist>0)
resdn <- subset(res,s.dist<0)
head(resup,10)
##                                                                set setSize
## 5626                        GOCC HIGH DENSITY LIPOPROTEIN PARTICLE       5
## 5372                                          GOCC BRCA1 C COMPLEX       6
## 5891            GOCC PROTEASOME CORE COMPLEX ALPHA SUBUNIT COMPLEX       7
## 7130                    GOMF THREONINE TYPE ENDOPEPTIDASE ACTIVITY       7
## 5449                                              GOCC CMG COMPLEX       7
## 823  GOBP DOUBLE STRAND BREAK REPAIR VIA BREAK INDUCED REPLICATION       9
## 5801                        GOCC OLIGOSACCHARYLTRANSFERASE COMPLEX      12
## 6365                           GOMF DNA REPLICATION ORIGIN BINDING      12
## 6063                                                 GOCC U4 SNRNP      10
## 5890                                  GOCC PROTEASOME CORE COMPLEX      18
##            pANOVA    s.dist p.adjustANOVA
## 5626 5.925268e-04 0.8869951   0.024073897
## 5372 1.407879e-03 0.7527466   0.043143139
## 5891 8.123685e-04 0.7308705   0.030128456
## 7130 1.213907e-03 0.7062312   0.039818305
## 5449 1.220103e-03 0.7059141   0.039818305
## 823  7.239726e-04 0.6507549   0.027889882
## 5801 1.051229e-04 0.6466593   0.006497852
## 6365 1.787836e-04 0.6248010   0.010022970
## 6063 7.389734e-04 0.6163650   0.028127663
## 5890 2.062864e-05 0.5798052   0.001676251
head(resdn,10)
##                                                             set setSize
## 1450 GOBP LEUKOCYTE MIGRATION INVOLVED IN INFLAMMATORY RESPONSE       8
## 3980          GOBP REGULATION OF HETEROTYPIC CELL CELL ADHESION      10
## 5635                            GOCC IGG IMMUNOGLOBULIN COMPLEX      10
## 5194                      GOBP T HELPER 17 CELL DIFFERENTIATION      13
## 5                        GOBP 3 UTR MEDIATED MRNA STABILIZATION      16
## 4683                                    GOBP RESPONSE TO LECTIN      13
## 868                            GOBP ENDOCRINE HORMONE SECRETION      13
## 6728                             GOMF NUCLEAR RECEPTOR ACTIVITY      20
## 1224                        GOBP HETEROTYPIC CELL CELL ADHESION      25
## 3047            GOBP POSITIVE REGULATION OF MIRNA TRANSCRIPTION      25
##            pANOVA     s.dist p.adjustANOVA
## 1450 0.0006736342 -0.6942224    0.02662143
## 3980 0.0005996965 -0.6267792    0.02422536
## 5635 0.0013626676 -0.5849228    0.04284701
## 5194 0.0010280319 -0.5259543    0.03574388
## 5    0.0003753240 -0.5137346    0.01753697
## 4683 0.0013558676 -0.5133274    0.04284701
## 868  0.0015978700 -0.5057069    0.04678460
## 6728 0.0004311410 -0.4548738    0.01936653
## 1224 0.0003731442 -0.4113701    0.01753697
## 3047 0.0004073432 -0.4087011    0.01852771
s <- c(head(resup$s.dist,10), head(resdn$s.dist,10))
names(s) <- c(head(resup$set,10),head(resdn$set,10))
s <- s[order(s)]
cols <- gsub("1","red",gsub("-1","blue",as.character(sign(s))))
if( length(s) > 1 ) {
  barplot(abs(s),las=1,horiz=TRUE,col=cols,xlab="ES",cex.names=0.8,main="B")
  if (! file.exists("enrichment_analysis/B.html") ) {
    mitch_report(mres9,outfile="enrichment_analysis/B.html")
  }
}

Heatmap of combined results

pw <- unique(c(head(subset(mres1$enrichment_result,p.adjustANOVA<0.01 & s.dist>0.3),5)$set,
  head(subset(mres2$enrichment_result,p.adjustANOVA<0.01 & s.dist>0.3),6)$set,
  head(subset(mres3$enrichment_result,p.adjustANOVA<0.01 & s.dist>0.3),6)$set,
  head(subset(mres4$enrichment_result,p.adjustANOVA<0.01 & s.dist>0.3),6)$set,
  head(subset(mres5$enrichment_result,p.adjustANOVA<0.01 & s.dist>0.3),6)$set,
  head(subset(mres6$enrichment_result,p.adjustANOVA<0.01 & s.dist>0.3),6)$set,
  head(subset(mres7$enrichment_result,p.adjustANOVA<0.01 & s.dist>0.3),6)$set,
  head(subset(mres8$enrichment_result,p.adjustANOVA<0.01 & s.dist>0.3),6)$set,
  head(subset(mres9$enrichment_result,p.adjustANOVA<0.01 & s.dist>0.3),6)$set,
  head(subset(mres1$enrichment_result,p.adjustANOVA<0.01 & s.dist< -0.3),6)$set,
  head(subset(mres2$enrichment_result,p.adjustANOVA<0.01 & s.dist< -0.3),6)$set,
  head(subset(mres3$enrichment_result,p.adjustANOVA<0.01 & s.dist< -0.3),6)$set,
  head(subset(mres4$enrichment_result,p.adjustANOVA<0.01 & s.dist< -0.3),6)$set,
  head(subset(mres5$enrichment_result,p.adjustANOVA<0.01 & s.dist< -0.3),6)$set,
  head(subset(mres6$enrichment_result,p.adjustANOVA<0.01 & s.dist< -0.3),6)$set,
  head(subset(mres7$enrichment_result,p.adjustANOVA<0.01 & s.dist< -0.3),6)$set,
  head(subset(mres8$enrichment_result,p.adjustANOVA<0.01 & s.dist< -0.3),6)$set,
  head(subset(mres9$enrichment_result,p.adjustANOVA<0.01 & s.dist< -0.3),6)$set))

x1 <- mres1$enrichment_result[which(mres1$enrichment_result$set %in% pw),c("set","s.dist")]
x2 <- mres2$enrichment_result[which(mres2$enrichment_result$set %in% pw),c("set","s.dist")]
x3 <- mres3$enrichment_result[which(mres3$enrichment_result$set %in% pw),c("set","s.dist")]
x4 <- mres4$enrichment_result[which(mres4$enrichment_result$set %in% pw),c("set","s.dist")]
x5 <- mres5$enrichment_result[which(mres5$enrichment_result$set %in% pw),c("set","s.dist")]
x6 <- mres6$enrichment_result[which(mres6$enrichment_result$set %in% pw),c("set","s.dist")]
x7 <- mres7$enrichment_result[which(mres7$enrichment_result$set %in% pw),c("set","s.dist")]
x8 <- mres8$enrichment_result[which(mres8$enrichment_result$set %in% pw),c("set","s.dist")]
x9 <- mres9$enrichment_result[which(mres9$enrichment_result$set %in% pw),c("set","s.dist")]

jlist <- list(x1,x2,x3,x4,x5,x6,x7,x8,x9)

jj <- join_all(jlist,by="set")
rownames(jj) <- jj$set
jj$set=NULL
colnames(jj) <- names(deres)
colfunc <- colorRampPalette(c("blue", "white", "red"))

heatmap.2(as.matrix(jj),trace="none",scale="none",
  margin=c(10,20),col=colfunc(25),cexCol=0.8)

Differential expression2 KIR3DL2 positive cells

We are going to use muscat for pseudobulk analysis. First need to convert seurat obj to singlecellexperiment object. Then summarise counts to pseudobulk level.

Cells to look at:

  • DCs
  • NK2
  • Macrophage
sc <- assay(sce)
table(sc[which(rownames(sc)=="KIR3DL2"),])
## 
##     0     1     2     3     4     5     6 
## 34093  1144   281    64    14     6     1
KIR3DL2_2 <- sc[,sc[which(rownames(sc)=="KIR3DL2"),]>1]
KIR3DL2_0 <- sc[,sc[which(rownames(sc)=="KIR3DL2"),]<1]
summary(colSums(KIR3DL2_2))
##    Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
##    3430    5991    7220   10079    9602   77471
summary(colSums(KIR3DL2_0))
##    Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
##     507    6003    9366   11375   15524  106134
par(mfrow=c(2,1))
hist(colSums(KIR3DL2_2),breaks=50,xlim=c(0,1e5),main="KIR3DL2+")
hist(colSums(KIR3DL2_0),breaks=50,xlim=c(0,1e5),main="KIR3DL2-")

par(mfrow=c(1,1))

low <- as.numeric(sc[which(rownames(sc)=="KIR3DL2"),]==0) * 1
med <- as.numeric(sc[which(rownames(sc)=="KIR3DL2"),]==1) * 2
high <- as.numeric(sc[which(rownames(sc)=="KIR3DL2"),]>1) * 3
KIR3DL2 <- data.frame(low,med,high)
KIR3DL2$sum <- rowSums(KIR3DL2)
head(KIR3DL2)
##   low med high sum
## 1   1   0    0   1
## 2   1   0    0   1
## 3   1   0    0   1
## 4   1   0    0   1
## 5   1   0    0   1
## 6   1   0    0   1
table(KIR3DL2$sum)
## 
##     1     2     3 
## 34093  1144   366
colData(sce)$KIR3DL2 <- KIR3DL2$sum
# change cluster id names to incorporate KIR3DL2 counts
colData(sce)$cluster_id <- paste(colData(sce)$cluster_id,colData(sce)$KIR3DL2)

sc_low <- sc[,KIR3DL2$sum==1]
sc_med <- sc[,KIR3DL2$sum==2]
sc_hi <- sc[,KIR3DL2$sum==3]

summary(colSums(sc_low))
##    Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
##     507    6003    9366   11375   15524  106134
summary(colSums(sc_med))
##    Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
##     661    5570    6750    9066    9322   48659
summary(colSums(sc_hi))
##    Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
##    3430    5991    7220   10079    9602   77471
dim(sc_low)
## [1] 36603 34093
dim(sc_med)
## [1] 36603  1144
dim(sc_hi)
## [1] 36603   366
colDat_hi <- subset(colData(sce),KIR3DL2==3)
colDat_med <- subset(colData(sce),KIR3DL2==2)
colDat_low <- subset(colData(sce),KIR3DL2==1)

table(colDat_low$ident)/nrow(colDat_low)*100
## 
##    NK 1 (FCGRA3A+)         CD14+ Mono       NK 2 (IL7R+) CD14+ Mono (CCL4+) 
##          27.225530          26.184261          14.844690          10.773473 
##       FCGR3A+ Mono                  T                 DC         Macrophage 
##           8.189364           5.666852           4.185610           1.883085 
##                  B 
##           1.047136
table(colDat_med$ident)/nrow(colDat_med)*100
## 
##    NK 1 (FCGRA3A+)         CD14+ Mono       NK 2 (IL7R+) CD14+ Mono (CCL4+) 
##        71.59090909         7.77972028        11.62587413         5.85664336 
##       FCGR3A+ Mono                  T                 DC         Macrophage 
##         1.83566434         0.26223776         0.87412587         0.08741259 
##                  B 
##         0.08741259
table(colDat_hi$ident)/nrow(colDat_hi)*100
## 
##    NK 1 (FCGRA3A+)         CD14+ Mono       NK 2 (IL7R+) CD14+ Mono (CCL4+) 
##          75.956284           1.366120          13.661202           5.737705 
##       FCGR3A+ Mono                  T                 DC         Macrophage 
##           1.639344           0.000000           1.092896           0.273224 
##                  B 
##           0.273224
message("Focus on NK 1 (FCGRA3A+) now")
## Focus on NK 1 (FCGRA3A+) now
sc_low <- sc[,colData(sce)$KIR3DL2==1 & colData(sce)$ident=="NK 1 (FCGRA3A+)"]
sc_med <- sc[,colData(sce)$KIR3DL2==2 & colData(sce)$ident=="NK 1 (FCGRA3A+)"]
sc_hi <- sc[,colData(sce)$KIR3DL2==3 & colData(sce)$ident=="NK 1 (FCGRA3A+)"]

colDat_hi <- subset(colData(sce),KIR3DL2==3 & ident=="NK 1 (FCGRA3A+)")
sc_hi <- SingleCellExperiment(list(counts=sc_hi), colData=colDat_hi)

colDat_med <- subset(colData(sce),KIR3DL2==2 & ident=="NK 1 (FCGRA3A+)")
sc_med <- SingleCellExperiment(list(counts=sc_med), colData=colDat_med)

colDat_low <- subset(colData(sce),KIR3DL2==1 & ident=="NK 1 (FCGRA3A+)")
sc_low <- SingleCellExperiment(list(counts=sc_low), colData=colDat_low)

#muscat aggregation of NK 1 (FCGRA3A+) cells
pbhi <- aggregateData(sc_hi, assay="counts", fun = "sum", by = c("sample_id"))
pbmed <- aggregateData(sc_med, assay="counts", fun = "sum", by = c("sample_id"))
pblow <- aggregateData(sc_low, assay="counts", fun = "sum", by = c("sample_id"))

colnames(pbhi) <- paste(colnames(pbhi),"hi")
colnames(pbmed) <- paste(colnames(pbmed),"med")
colnames(pblow) <- paste(colnames(pblow),"low")

kx <- cbind(assay(pbhi),assay(pbmed),assay(pblow))

dfhi <- pat_df
dfhi$KIR3DL2 <- 3
dfmed <- pat_df
dfmed$KIR3DL2 <- 2
dflow <- pat_df
dflow$KIR3DL2 <- 1

kdf <- rbind(dfhi,dfmed,dflow)
rownames(kdf) <- colnames(kx)

## focus on HIV negative
kdf1 <- subset(kdf,hiv_status==0 & KIR3DL2!=2)
kx1 <- kx[,which(colnames(kx) %in% rownames(kdf1))]
colSums(kx1)
##  CC0003 hi  PM0020 hi  PM0027 hi  PM0028 hi  PM0032 hi CC0003 low PM0020 low 
##     442207     324598      12808      21053      35073    8850484    5276990 
## PM0027 low PM0028 low PM0032 low 
##     424172    2643361    1440032
plotMDS(kx1)

kx1f <- kx1[which(rowMeans(kx1)>=5),]
kx1f <- kx1f+1
dds <- DESeqDataSetFromMatrix(countData = kx1f , colData = kdf1, design = ~ batch + KIR3DL2)
## converting counts to integer mode
##   the design formula contains one or more numeric variables with integer values,
##   specifying a model with increasing fold change for higher values.
##   did you mean for this to be a factor? if so, first convert
##   this variable to a factor using the factor() function
res <- DESeq(dds)
## estimating size factors
## estimating dispersions
## gene-wise dispersion estimates
## mean-dispersion relationship
## final dispersion estimates
## fitting model and testing
z <- results(res)
vsd <- vst(dds, blind=FALSE)
zz <- cbind(as.data.frame(z),assay(vsd),kx1f)
kx1de <- as.data.frame(zz[order(zz$pvalue),])

kx1de[1:50,1:6] |> kbl(caption="KIR3DL2 associated genes in HIV- cells") |> kable_paper("hover", full_width = F)
KIR3DL2 associated genes in HIV- cells
baseMean log2FoldChange lfcSE stat pvalue padj
KIR3DL2 52.106641 4.7020539 0.3426424 13.722917 0.0000000 0.0000000
C4orf45 5.850221 1.1112152 0.2736121 4.061279 0.0000488 NA
C20orf96 5.007717 1.0546415 0.2758804 3.822822 0.0001319 NA
AC004083.1 4.882308 1.1073538 0.2899995 3.818468 0.0001343 NA
AC008083.3 8.027470 0.8413549 0.2209043 3.808685 0.0001397 NA
EIF1 819.805875 -0.5729001 0.1508867 -3.796890 0.0001465 0.0692332
SPTLC3 5.425260 1.1176408 0.2947932 3.791270 0.0001499 NA
KLRC1 45.991607 -0.6270414 0.1654733 -3.789382 0.0001510 NA
AC007114.2 4.876752 1.0176296 0.2725145 3.734221 0.0001883 NA
CBLB 267.617835 -0.4797514 0.1297975 -3.696154 0.0002189 0.0692332
TUBG2 4.334305 1.0777302 0.2938131 3.668081 0.0002444 NA
AC069277.1 6.823230 1.0633761 0.2908060 3.656652 0.0002555 NA
CMC1 173.725959 -0.5767568 0.1602494 -3.599120 0.0003193 0.0692332
ETV2 4.584710 1.0131687 0.2845123 3.561071 0.0003693 NA
ADCY4 4.276397 1.0637218 0.2989170 3.558586 0.0003729 NA
ZFP69 5.351868 0.9859325 0.2781532 3.544566 0.0003933 NA
ZBED6CL 4.215899 1.0807571 0.3057829 3.534394 0.0004087 NA
AL136418.1 5.235093 0.9877834 0.2808625 3.516964 0.0004365 NA
OLFM2 4.889633 1.0227135 0.2931494 3.488711 0.0004854 NA
PRKCA-AS1 5.192120 0.9837238 0.2822064 3.485831 0.0004906 NA
SSBP2 19.028518 -0.8406370 0.2430361 -3.458898 0.0005424 NA
HIC1 5.380199 0.9674838 0.2801605 3.453320 0.0005537 NA
LRRFIP2 41.575811 -0.5307578 0.1550092 -3.424040 0.0006170 NA
MAP3K8 208.334170 -0.5161858 0.1509093 -3.420504 0.0006251 0.0692332
HNRNPC 195.069124 -0.5223392 0.1532174 -3.409137 0.0006517 0.0692332
AC007066.2 4.271557 1.0181100 0.2991027 3.403881 0.0006644 NA
AZIN2 4.654714 0.9791401 0.2876622 3.403785 0.0006646 NA
PNRC1 214.430451 -0.4924397 0.1448863 -3.398800 0.0006768 0.0692332
ZNF283 4.460224 0.9622871 0.2868157 3.355071 0.0007934 NA
OCA2 4.423250 1.0753846 0.3231032 3.328301 0.0008738 NA
PIDD1 6.488632 0.8367719 0.2515700 3.326199 0.0008804 NA
RPL10A 516.382035 -0.4308291 0.1297381 -3.320760 0.0008977 0.0692332
YME1L1 81.255256 -0.5217900 0.1579361 -3.303805 0.0009538 0.0692332
FBXL22 4.846118 0.8899058 0.2703309 3.291913 0.0009951 NA
PET100 71.462458 -0.4927422 0.1496916 -3.291716 0.0009958 0.0692332
MCTP2 283.086344 -0.6205048 0.1885512 -3.290909 0.0009986 0.0692332
PODN 4.267074 0.9929022 0.3019045 3.288796 0.0010062 NA
HINT1 145.591336 -0.4852409 0.1478355 -3.282303 0.0010296 0.0692332
S100A10 125.090792 -0.4272536 0.1301768 -3.282102 0.0010304 0.0692332
ACSF2 4.319117 0.9902032 0.3032651 3.265141 0.0010941 NA
PSMD6-AS1 4.234843 1.0591708 0.3254203 3.254778 0.0011348 NA
EEF1A1 1392.010484 -0.4845508 0.1493585 -3.244213 0.0011778 0.0692332
KCTD3 4.642128 1.0073970 0.3118112 3.230791 0.0012345 NA
RSL1D1 28.281129 -0.5555478 0.1720146 -3.229655 0.0012394 NA
RPS10 269.903342 -0.4826707 0.1498178 -3.221719 0.0012742 0.0692332
RPS25 607.763430 -0.5028058 0.1571536 -3.199454 0.0013769 0.0692332
KLRB1 324.068178 -0.5903132 0.1846262 -3.197343 0.0013870 0.0692332
SNHG29 83.136073 -0.4475459 0.1403459 -3.188877 0.0014283 0.0692332
RAB3A 4.529164 1.0857122 0.3405551 3.188066 0.0014323 NA
AC109454.2 5.305082 0.9331262 0.2928082 3.186818 0.0014385 NA
write.table(x=kx1de,file="KIR3DL2_de_hivneg.tsv",sep="\t",quote=FALSE)

## select HIV positive
kdf2 <- subset(kdf,hiv_status==1 & KIR3DL2!=2)
kx2 <- kx[,which(colnames(kx) %in% rownames(kdf2))]
colSums(kx2)
##  AH0005 hi  AH0015 hi  AH0018 hi  CC0016 hi   PM001 hi   PM008 hi   PM017 hi 
##     217038     297540      39159     250893      61946     147293     265861 
## AH0005 low AH0015 low AH0018 low CC0016 low  PM001 low  PM008 low  PM017 low 
##    7345282    5384408    1506339    5759154    3078125    6244346   10425498
plotMDS(kx2)

kx2f <- kx2[which(rowMeans(kx2)>=5),]
kx2f <- kx2f+1
dds <- DESeqDataSetFromMatrix(countData = kx2f , colData = kdf2, design = ~ batch + KIR3DL2)
## converting counts to integer mode
##   the design formula contains one or more numeric variables with integer values,
##   specifying a model with increasing fold change for higher values.
##   did you mean for this to be a factor? if so, first convert
##   this variable to a factor using the factor() function
res <- DESeq(dds)
## estimating size factors
## estimating dispersions
## gene-wise dispersion estimates
## mean-dispersion relationship
## final dispersion estimates
## fitting model and testing
z <- results(res)
vsd <- vst(dds, blind=FALSE)
zz <- cbind(as.data.frame(z),assay(vsd),kx2f)
kx2de <- as.data.frame(zz[order(zz$pvalue),])

kx2de[1:50,1:6] |> kbl(caption="KIR3DL2 associated genes in HIV+ cells") |> kable_paper("hover", full_width = F)
KIR3DL2 associated genes in HIV+ cells
baseMean log2FoldChange lfcSE stat pvalue padj
KIR3DL2 111.251600 5.1688446 0.2779886 18.593730 0.0e+00 0.0000000
ANXA1 330.695628 -0.3571074 0.0564729 -6.323517 0.0e+00 0.0000017
RPL14 1339.849913 -0.3246228 0.0530914 -6.114419 0.0e+00 0.0000042
RPS13 1055.770716 -0.2646047 0.0443627 -5.964575 0.0e+00 0.0000079
MTRNR2L12 745.895516 -0.2572095 0.0449080 -5.727476 0.0e+00 0.0000264
RPS9 962.893860 -0.2508178 0.0441028 -5.687120 0.0e+00 0.0000278
ZFP36L2 268.298087 -0.3216007 0.0568442 -5.657584 0.0e+00 0.0000283
MYL6 674.762201 -0.2478012 0.0449192 -5.516598 0.0e+00 0.0000558
ENSA 119.471549 -0.3650545 0.0670936 -5.440969 1.0e-07 0.0000761
KLRF1 388.167538 -0.3601608 0.0670454 -5.371895 1.0e-07 0.0001007
ZNF793 7.513469 1.0932337 0.2064566 5.295224 1.0e-07 0.0001359
PFDN5 480.414165 -0.2765681 0.0523375 -5.284320 1.0e-07 0.0001359
RPS4Y1 336.046167 -0.2997723 0.0571280 -5.247380 2.0e-07 0.0001534
RPL36AL 537.139944 -0.2791345 0.0534097 -5.226288 2.0e-07 0.0001597
SERF2 753.238525 -0.2129074 0.0409663 -5.197137 2.0e-07 0.0001744
COX7C 324.658202 -0.2213873 0.0428444 -5.167239 2.0e-07 0.0001919
SRSF5 434.366284 -0.2174878 0.0423934 -5.130233 3.0e-07 0.0002026
SLCO3A1 138.342138 -0.3364410 0.0656454 -5.125130 3.0e-07 0.0002026
ARPC3 487.775569 -0.1969847 0.0384371 -5.124859 3.0e-07 0.0002026
MT-ATP6 7923.155688 -0.2780958 0.0548326 -5.071727 4.0e-07 0.0002548
RPS21 1432.921696 -0.2880248 0.0573086 -5.025855 5.0e-07 0.0003085
FAU 1403.069146 -0.2961102 0.0590991 -5.010398 5.0e-07 0.0003191
EEF1B2 570.653008 -0.3179521 0.0637808 -4.985079 6.0e-07 0.0003481
CRIP1 428.229053 -0.2426964 0.0489161 -4.961481 7.0e-07 0.0003768
CYBA 1019.415429 -0.2671190 0.0539279 -4.953263 7.0e-07 0.0003772
SPRED2 9.427582 1.1186816 0.2262969 4.943425 8.0e-07 0.0003772
MT-ND3 4330.574779 -0.2498882 0.0506015 -4.938355 8.0e-07 0.0003772
RPL31 482.551773 -0.2504642 0.0510465 -4.906587 9.0e-07 0.0004080
MYL12B 404.083840 -0.2112882 0.0430969 -4.902633 9.0e-07 0.0004080
DDX5 1159.083946 -0.2370850 0.0483613 -4.902367 9.0e-07 0.0004080
RPL41 3845.669904 -0.2905363 0.0597830 -4.859844 1.2e-06 0.0004797
MT-ND5 1165.181446 -0.2529116 0.0520705 -4.857104 1.2e-06 0.0004797
ATP5F1E 825.740823 -0.2150538 0.0443261 -4.851623 1.2e-06 0.0004797
RRAS2 110.081277 -0.3598003 0.0742934 -4.842962 1.3e-06 0.0004863
RPL37A 1461.770259 -0.2428534 0.0508757 -4.773464 1.8e-06 0.0006688
RPS15 1564.271198 -0.2413148 0.0506966 -4.759985 1.9e-06 0.0006879
RPL10 3746.676756 -0.2587117 0.0543905 -4.756560 2.0e-06 0.0006879
RPS27A 2898.049396 -0.2796611 0.0589381 -4.744995 2.1e-06 0.0007093
MT-CO2 7043.701193 -0.2552830 0.0539275 -4.733815 2.2e-06 0.0007303
RPL23A 1668.021337 -0.2987048 0.0631943 -4.726765 2.3e-06 0.0007372
ZFP41 6.321451 1.0558292 0.2246751 4.699361 2.6e-06 0.0008228
RPL27A 1387.033833 -0.2886663 0.0618622 -4.666276 3.1e-06 0.0009439
GTF3A 171.201269 -0.2903334 0.0623229 -4.658534 3.2e-06 0.0009573
RPS8 1562.798207 -0.2468416 0.0534194 -4.620827 3.8e-06 0.0011228
ATP5ME 200.767163 -0.2510822 0.0545132 -4.605895 4.1e-06 0.0011734
LRTOMT 6.152779 1.0284531 0.2235787 4.599959 4.2e-06 0.0011734
CHCHD2 346.353623 -0.2153823 0.0468800 -4.594337 4.3e-06 0.0011734
SRSF11 245.848464 -0.2710483 0.0590062 -4.593558 4.4e-06 0.0011734
NDUFB7 168.463219 -0.2577164 0.0563309 -4.575044 4.8e-06 0.0012449
NSMCE2 138.313155 -0.3204694 0.0700837 -4.572666 4.8e-06 0.0012449
write.table(x=kx2de,file="KIR3DL2_de_hivpos.tsv",sep="\t",quote=FALSE)

Now make a model that incorporates HIV+ and HIV- cells.

kdf
##            patient_id hiv_status batch KIR3DL2
## AH0005 hi     AH0005+          1     2       3
## AH0015 hi     AH0015+          1     2       3
## AH0018 hi     AH0018+          1     1       3
## CC0003 hi     CC0003-          0     1       3
## CC0016 hi     CC0016+          1     3       3
## PM001 hi       PM001+          1     3       3
## PM0020 hi     PM0020-          0     3       3
## PM0027 hi     PM0027-          0     3       3
## PM0028 hi     PM0028-          0     2       3
## PM0032 hi     PM0032-          0     2       3
## PM008 hi       PM008+          1     1       3
## PM017 hi       PM017+          1     1       3
## AH0005 med    AH0005+          1     2       2
## AH0015 med    AH0015+          1     2       2
## AH0018 med    AH0018+          1     1       2
## CC0003 med    CC0003-          0     1       2
## CC0016 med    CC0016+          1     3       2
## PM001 med      PM001+          1     3       2
## PM0020 med    PM0020-          0     3       2
## PM0027 med    PM0027-          0     3       2
## PM0028 med    PM0028-          0     2       2
## PM0032 med    PM0032-          0     2       2
## PM008 med      PM008+          1     1       2
## PM017 med      PM017+          1     1       2
## AH0005 low    AH0005+          1     2       1
## AH0015 low    AH0015+          1     2       1
## AH0018 low    AH0018+          1     1       1
## CC0003 low    CC0003-          0     1       1
## CC0016 low    CC0016+          1     3       1
## PM001 low      PM001+          1     3       1
## PM0020 low    PM0020-          0     3       1
## PM0027 low    PM0027-          0     3       1
## PM0028 low    PM0028-          0     2       1
## PM0032 low    PM0032-          0     2       1
## PM008 low      PM008+          1     1       1
## PM017 low      PM017+          1     1       1
head(kx,2)
##             AH0005 hi AH0015 hi AH0018 hi CC0003 hi CC0016 hi PM001 hi
## gene-HIV1-1         0         0         0         0         0        0
## gene-HIV1-2         0         0         0         0         0        0
##             PM0020 hi PM0027 hi PM0028 hi PM0032 hi PM008 hi PM017 hi
## gene-HIV1-1         0         0         0         0        0        0
## gene-HIV1-2         0         0         0         0        0        0
##             AH0005 med AH0015 med AH0018 med CC0003 med CC0016 med PM001 med
## gene-HIV1-1          0          0          0          0          0         0
## gene-HIV1-2          0          0          0          0          0         0
##             PM0020 med PM0027 med PM0028 med PM0032 med PM008 med PM017 med
## gene-HIV1-1          0          0          0          0         0         0
## gene-HIV1-2          0          0          0          0         0         0
##             AH0005 low AH0015 low AH0018 low CC0003 low CC0016 low PM001 low
## gene-HIV1-1          0          0          0          0          0         0
## gene-HIV1-2          0          0          0          0          0         0
##             PM0020 low PM0027 low PM0028 low PM0032 low PM008 low PM017 low
## gene-HIV1-1          0          0          0          0         0         0
## gene-HIV1-2          0          0          0          0         0         0
kdf3 <- subset(kdf, KIR3DL2!=2)

kx3 <- kx[,which(colnames(kx) %in% rownames(kdf3))]

colSums(kx3)
##  AH0005 hi  AH0015 hi  AH0018 hi  CC0003 hi  CC0016 hi   PM001 hi  PM0020 hi 
##     217038     297540      39159     442207     250893      61946     324598 
##  PM0027 hi  PM0028 hi  PM0032 hi   PM008 hi   PM017 hi AH0005 low AH0015 low 
##      12808      21053      35073     147293     265861    7345282    5384408 
## AH0018 low CC0003 low CC0016 low  PM001 low PM0020 low PM0027 low PM0028 low 
##    1506339    8850484    5759154    3078125    5276990     424172    2643361 
## PM0032 low  PM008 low  PM017 low 
##    1440032    6244346   10425498
plotMDS(kx3)

dim(kx3)
## [1] 36603    24
kx3f <- kx3[which(rowMeans(kx3)>=5),]
dim(kx3f)
## [1] 12609    24
# hiv-
dds <- DESeqDataSetFromMatrix(countData = kx3f , colData = kdf3, design = ~ batch + hiv_status + KIR3DL2)
## converting counts to integer mode
##   the design formula contains one or more numeric variables with integer values,
##   specifying a model with increasing fold change for higher values.
##   did you mean for this to be a factor? if so, first convert
##   this variable to a factor using the factor() function
res <- DESeq(dds)
## estimating size factors
## estimating dispersions
## gene-wise dispersion estimates
## mean-dispersion relationship
## final dispersion estimates
## fitting model and testing
z <- results(res)
vsd <- vst(dds, blind=FALSE)
zz <- cbind(as.data.frame(z),assay(vsd),kx3f)
kx3de <- as.data.frame(zz[order(zz$pvalue),])

kx3de[1:50,1:6] |> kbl(caption="KIR3DL2 associated genes irrespective of HIV status") |> kable_paper("hover", full_width = F)
KIR3DL2 associated genes irrespective of HIV status
baseMean log2FoldChange lfcSE stat pvalue padj
KIR3DL2 97.307953 6.2748928 0.2988685 20.995497 0.0000000 0.0000000
UHMK1 77.213912 0.1978831 0.0478042 4.139452 0.0000348 0.2193953
KCMF1 77.698935 0.1996632 0.0511112 3.906447 0.0000937 0.3089647
HELLPAR 4.372628 0.8168230 0.2122167 3.849004 0.0001186 0.3089647
BTBD7 54.771378 0.2118470 0.0551901 3.838496 0.0001238 0.3089647
KIR2DL3 23.258110 0.3651384 0.0961916 3.795950 0.0001471 0.3089647
ADCK5 3.800859 0.7419097 0.2045018 3.627889 0.0002857 0.4531163
EOMES 15.669980 -0.5172341 0.1426373 -3.626219 0.0002876 0.4531163
ZNF793 3.251561 0.8012653 0.2242374 3.573291 0.0003525 0.4936892
ADCY4 1.870875 0.7780127 0.2203989 3.530021 0.0004155 0.5229981
AC008083.3 8.731393 0.5899135 0.1683016 3.505097 0.0004564 0.5229981
MRPS14 11.815139 -0.6484091 0.1881568 -3.446110 0.0005687 0.5569805
AC022217.3 24.324045 -0.3846740 0.1117139 -3.443385 0.0005745 0.5569805
AXIN1 50.039516 0.2363560 0.0699812 3.377423 0.0007317 0.6250211
GEN1 11.015877 0.5225860 0.1555977 3.358572 0.0007835 0.6250211
ATG5 92.124772 0.1751891 0.0525373 3.334566 0.0008543 0.6250211
DPP7 37.774690 -0.2835242 0.0852512 -3.325749 0.0008818 0.6250211
URM1 30.680793 0.2403529 0.0726472 3.308498 0.0009380 0.6250211
YJU2 26.078674 0.3342589 0.1013028 3.299603 0.0009682 0.6250211
KLRC1 59.392693 -0.7218007 0.2192026 -3.292848 0.0009918 0.6250211
AC044849.1 23.916146 -0.4524116 0.1396809 -3.238892 0.0011999 0.6580211
NUMA1 33.327456 0.2231371 0.0689952 3.234096 0.0012203 0.6580211
ZNF283 1.889343 0.6838368 0.2129058 3.211922 0.0013185 0.6580211
XPO7 45.150202 0.2133917 0.0665351 3.207205 0.0013403 0.6580211
URB1 4.595532 0.4993579 0.1558063 3.204992 0.0013507 0.6580211
RNF8 14.627144 0.3180501 0.0992802 3.203562 0.0013574 0.6580211
COQ3 4.460614 0.6323281 0.1993022 3.172710 0.0015102 0.6797251
TET2 112.232618 0.1690499 0.0534299 3.163957 0.0015564 0.6797251
BAALC-AS1 1.761370 0.8345782 0.2638943 3.162548 0.0015640 0.6797251
RABGAP1 60.820168 0.2111305 0.0670064 3.150899 0.0016277 0.6838453
PITPNC1 449.720396 0.1304240 0.0415538 3.138680 0.0016971 0.6899897
COPB1 56.570094 -0.2003537 0.0640236 -3.129373 0.0017518 0.6899897
RPL14 990.545038 -0.1037334 0.0335122 -3.095392 0.0019655 0.7331588
RPL35A 937.727296 -0.0914427 0.0295591 -3.093555 0.0019777 0.7331588
SPRED2 4.717274 0.7670289 0.2487434 3.083615 0.0020450 0.7364403
FTL 835.063531 -0.0964821 0.0314225 -3.070478 0.0021372 0.7482456
GPATCH8 199.228473 0.1158290 0.0378410 3.060944 0.0022064 0.7516080
ST8SIA1 3.136623 0.7890891 0.2589560 3.047194 0.0023099 0.7618723
SLC39A14 2.195216 0.7182748 0.2361919 3.041065 0.0023574 0.7618723
ZEB1 26.727442 -0.4058789 0.1345021 -3.017640 0.0025475 0.7620230
AC007114.2 1.996371 0.6376296 0.2122141 3.004653 0.0026588 0.7620230
THAP12 34.928360 -0.2336252 0.0778968 -2.999165 0.0027072 0.7620230
NPC2 26.371800 -0.2969408 0.0993097 -2.990047 0.0027893 0.7620230
SPIN1 35.915940 0.2150037 0.0719163 2.989638 0.0027931 0.7620230
OSBP2 4.392749 0.5598884 0.1872821 2.989545 0.0027939 0.7620230
ZRANB2-AS2 3.167680 0.7118759 0.2381313 2.989426 0.0027950 0.7620230
DNMBP-AS1 6.343188 0.6501072 0.2189099 2.969749 0.0029804 0.7620230
RPL23A 1202.442646 -0.1016582 0.0342699 -2.966402 0.0030131 0.7620230
BRD4 70.444549 0.1489815 0.0502637 2.963998 0.0030367 0.7620230
HIST1H3A 3.477017 0.5177001 0.1750148 2.958036 0.0030961 0.7620230

Pathway analysis.

k1 <- mitch_import(kx1de,DEtype="deseq2")
## The input is a single dataframe; one contrast only. Converting
##         it to a list for you.
## Note: Mean no. genes in input = 12037
## Note: no. genes in output = 12037
## Note: estimated proportion of input genes in output = 1
k1m <- mitch_calc(k1,genesets=go,minsetsize=5,cores=16,priority="effect")
## Note: Enrichments with large effect sizes may not be
##             statistically significant.
head(subset(k1m$enrichment_result, s.dist > 0),20) |> kbl(caption="top enrichments (positive correl)") |> kable_paper("hover", full_width = F)
top enrichments (positive correl)
set setSize pANOVA s.dist p.adjustANOVA
2613 GOBP NEURON CELL CELL ADHESION 5 0.0021734 0.7915891 0.0125380
7314 GOMF NEUROPEPTIDE RECEPTOR ACTIVITY 5 0.0065832 0.7016955 0.0302007
1979 GOBP MUCOCILIARY CLEARANCE 5 0.0076384 0.6888963 0.0341866
374 GOBP CARNITINE TRANSPORT 5 0.0084152 0.6804521 0.0368477
6303 GOCC OUTER DYNEIN ARM 5 0.0094338 0.6703790 0.0403661
698 GOBP COMPLEMENT RECEPTOR MEDIATED SIGNALING PATHWAY 5 0.0100335 0.6648936 0.0424712
7119 GOMF INTRACELLULAR CHLORIDE CHANNEL ACTIVITY 6 0.0071402 0.6342227 0.0323050
1505 GOBP INTRACELLULAR PH ELEVATION 5 0.0146879 0.6301197 0.0574262
7088 GOMF HYDROLASE ACTIVITY ACTING ON CARBON NITROGEN BUT NOT PEPTIDE BONDS IN CYCLIC AMIDES 6 0.0093206 0.6129720 0.0399250
1254 GOBP GLYCINE METABOLIC PROCESS 8 0.0029074 0.6079059 0.0158667
6740 GOMF BICARBONATE MONOATOMIC ANION ANTIPORTER ACTIVITY 6 0.0121207 0.5914166 0.0491687
6876 GOMF C METHYLTRANSFERASE ACTIVITY 7 0.0074369 0.5842299 0.0334173
3889 GOBP PYRIDINE CONTAINING COMPOUND CATABOLIC PROCESS 6 0.0164375 0.5655944 0.0622604
5153 GOBP RETINAL ROD CELL DEVELOPMENT 5 0.0285290 0.5655585 0.0952496
839 GOBP DIACYLGLYCEROL BIOSYNTHETIC PROCESS 5 0.0292560 0.5629987 0.0971421
5786 GOCC AMPA GLUTAMATE RECEPTOR COMPLEX 6 0.0172185 0.5615770 0.0645672
6579 GOCC UBIQUINONE BIOSYNTHESIS COMPLEX 6 0.0186533 0.5545951 0.0682600
2837 GOBP PEPTIDYL LYSINE HYDROXYLATION 6 0.0192148 0.5519907 0.0699251
7663 GOMF SCAVENGER RECEPTOR ACTIVITY 5 0.0338525 0.5479721 0.1081690
2805 GOBP OXALATE TRANSPORT 5 0.0343751 0.5463763 0.1093514
head(subset(k1m$enrichment_result, s.dist < 0),20) |> kbl(caption="top enrichments (negative correl)") |> kable_paper("hover", full_width = F)
top enrichments (negative correl)
set setSize pANOVA s.dist p.adjustANOVA
5972 GOCC CYTOSOLIC SMALL RIBOSOMAL SUBUNIT 38 0.0000000 -0.9425303 0.0000000
3247 GOBP POSITIVE REGULATION OF INTRINSIC APOPTOTIC SIGNALING PATHWAY BY P53 CLASS MEDIATOR 5 0.0002763 -0.9389960 0.0022719
5969 GOCC CYTOSOLIC LARGE RIBOSOMAL SUBUNIT 55 0.0000000 -0.9031305 0.0000000
309 GOBP CALCIUM ION EXPORT ACROSS PLASMA MEMBRANE 5 0.0006623 -0.8791556 0.0047657
6356 GOCC POLYSOMAL RIBOSOME 29 0.0000000 -0.8651646 0.0000000
3401 GOBP POSITIVE REGULATION OF OXIDATIVE STRESS INDUCED INTRINSIC APOPTOTIC SIGNALING PATHWAY 5 0.0008291 -0.8631981 0.0057575
5799 GOCC ARP2 3 PROTEIN COMPLEX 9 0.0000138 -0.8365850 0.0001680
6654 GOMF ADENYLATE CYCLASE REGULATOR ACTIVITY 5 0.0012905 -0.8309840 0.0082540
5971 GOCC CYTOSOLIC RIBOSOME 109 0.0000000 -0.8234268 0.0000000
1656 GOBP LYMPHOCYTE ANERGY 5 0.0016555 -0.8123670 0.0101281
7777 GOMF TPR DOMAIN BINDING 6 0.0005712 -0.8120688 0.0041978
1857 GOBP MITOCHONDRIAL ELECTRON TRANSPORT CYTOCHROME C TO OXYGEN 18 0.0000000 -0.8102172 0.0000001
5945 GOCC CRD MEDIATED MRNA STABILITY COMPLEX 5 0.0017140 -0.8097407 0.0103940
2239 GOBP NEGATIVE REGULATION OF FIBROBLAST MIGRATION 5 0.0017589 -0.8077793 0.0105928
6169 GOCC MCRD MEDIATED MRNA STABILITY COMPLEX 5 0.0019447 -0.8001330 0.0115219
6181 GOCC MHC CLASS I PROTEIN COMPLEX 7 0.0002699 -0.7949650 0.0022314
593 GOBP CELL SUBSTRATE JUNCTION DISASSEMBLY 5 0.0021042 -0.7940824 0.0122024
4264 GOBP REGULATION OF FOCAL ADHESION DISASSEMBLY 5 0.0021042 -0.7940824 0.0122024
4528 GOBP REGULATION OF NATURAL KILLER CELL CHEMOTAXIS 5 0.0022943 -0.7874003 0.0130824
6540 GOCC TRANSCRIPTION FACTOR AP 1 COMPLEX 5 0.0026196 -0.7770612 0.0145891
up <- head(subset(k1m$enrichment_result, s.dist > 0 & p.adjustANOVA < 0.05),20)
dn <- head(subset(k1m$enrichment_result, s.dist < 0 & p.adjustANOVA < 0.05),20)
top <- rbind(up,dn)
top <- top[order(top$s.dist),]

par(mar=c(5.1, 25.1, 4.1, 2.1))
gsn <- substr(top$set, start = 1, stop = 70 )
barplot(top$s.dist,horiz=TRUE,las=1,xlab="ES",names.arg=gsn,cex.names=0.6,main="HIV neg")

mitch_plots(k1m,outfile="KIR3DL2_assoc_hivneg.pdf")
## png 
##   2
if ( ! file.exists("KIR3DL2_assoc_hivneg.html") ) {
  mitch_report(res=k1m,outfile="KIR3DL2_assoc_hivneg.html")
}

# pos
k2 <- mitch_import(kx2de,DEtype="deseq2")
## The input is a single dataframe; one contrast only. Converting
##         it to a list for you.
## Note: Mean no. genes in input = 12931
## Note: no. genes in output = 12931
## Note: estimated proportion of input genes in output = 1
k2m <- mitch_calc(k2,genesets=go,minsetsize=5,cores=16,priority="effect")
## Note: Enrichments with large effect sizes may not be
##             statistically significant.
head(subset(k2m$enrichment_result, s.dist > 0),20) |> kbl(caption="top enrichments (positive correl)")  |> kable_paper("hover", full_width = F)
top enrichments (positive correl)
set setSize pANOVA s.dist p.adjustANOVA
2670 GOBP NEURON CELL CELL ADHESION 5 0.0043995 0.7354479 0.0242289
637 GOBP CEREBROSPINAL FLUID CIRCULATION 5 0.0050641 0.7238125 0.0272738
441 GOBP CELLULAR RESPONSE TO CAFFEINE 7 0.0020426 0.6730999 0.0128297
127 GOBP AMYLOID BETA CLEARANCE BY CELLULAR CATABOLIC PROCESS 5 0.0096870 0.6680179 0.0455827
514 GOBP CELLULAR RESPONSE TO PURINE CONTAINING COMPOUND 8 0.0015824 0.6449934 0.0104075
3020 GOBP POLYOL TRANSMEMBRANE TRANSPORT 5 0.0130893 0.6407860 0.0577868
828 GOBP DETECTION OF MOLECULE OF BACTERIAL ORIGIN 6 0.0068814 0.6371115 0.0346090
1056 GOBP ERBB4 SIGNALING PATHWAY 6 0.0074205 0.6311799 0.0369054
1153 GOBP FATTY ACYL COA CATABOLIC PROCESS 6 0.0078378 0.6268472 0.0384355
2988 GOBP PIRNA PROCESSING 5 0.0161310 0.6213214 0.0673405
2021 GOBP MUCOCILIARY CLEARANCE 5 0.0166897 0.6181030 0.0691356
2880 GOBP PARTURITION 5 0.0167662 0.6176698 0.0693455
7679 GOMF POSTSYNAPTIC NEUROTRANSMITTER RECEPTOR ACTIVITY 9 0.0013424 0.6172935 0.0090428
648 GOBP CHEMOSENSORY BEHAVIOR 6 0.0089316 0.6164023 0.0428092
7154 GOMF GLYCERALDEHYDE 3 PHOSPHATE DEHYDROGENASE NADPLUS NON PHOSPHORYLATING ACTIVITY 5 0.0203407 0.5991335 0.0799407
7827 GOMF SCAVENGER RECEPTOR ACTIVITY 8 0.0056341 0.5652325 0.0297082
8050 GOMF VOLTAGE GATED SODIUM CHANNEL ACTIVITY 5 0.0302019 0.5597401 0.1065865
1200 GOBP FRUCTOSE METABOLIC PROCESS 10 0.0022610 0.5576813 0.0140255
7600 GOMF PHOSPHATE ION BINDING 6 0.0194246 0.5510251 0.0771717
6798 GOMF ADP D RIBOSE MODIFICATION DEPENDENT PROTEIN BINDING 5 0.0335761 0.5488163 0.1147367
head(subset(k2m$enrichment_result, s.dist < 0),20) |> kbl(caption="top enrichments (negative correl)") |> kable_paper("hover", full_width = F)
top enrichments (negative correl)
set setSize pANOVA s.dist p.adjustANOVA
6099 GOCC CYTOSOLIC SMALL RIBOSOMAL SUBUNIT 38 0.0000000 -0.9505525 0.0000000
6337 GOCC MITOCHONDRIAL PROTON TRANSPORTING ATP SYNTHASE COMPLEX COUPLING FACTOR F O 10 0.0000002 -0.9438279 0.0000042
6539 GOCC PROTON TRANSPORTING ATP SYNTHASE COMPLEX CATALYTIC CORE F 1 6 0.0000993 -0.9174726 0.0009754
6096 GOCC CYTOSOLIC LARGE RIBOSOMAL SUBUNIT 55 0.0000000 -0.9150527 0.0000000
6538 GOCC PROTON TRANSPORTING ATP SYNTHASE COMPLEX 18 0.0000000 -0.9053839 0.0000000
6540 GOCC PROTON TRANSPORTING ATP SYNTHASE COMPLEX COUPLING FACTOR F O 13 0.0000000 -0.9010921 0.0000004
6490 GOCC POLYSOMAL RIBOSOME 29 0.0000000 -0.8931574 0.0000000
7924 GOMF TAP BINDING 7 0.0000509 -0.8841358 0.0005440
8015 GOMF UBIQUITIN LIGASE INHIBITOR ACTIVITY 8 0.0000173 -0.8772150 0.0002134
5926 GOCC ARP2 3 PROTEIN COMPLEX 9 0.0000056 -0.8738241 0.0000776
7761 GOMF PROTON TRANSPORTING ATP SYNTHASE ACTIVITY ROTATIONAL MECHANISM 16 0.0000000 -0.8699187 0.0000000
3325 GOBP POSITIVE REGULATION OF INTRINSIC APOPTOTIC SIGNALING PATHWAY BY P53 CLASS MEDIATOR 5 0.0009716 -0.8517716 0.0069581
6098 GOCC CYTOSOLIC RIBOSOME 109 0.0000000 -0.8320275 0.0000000
1901 GOBP MITOCHONDRIAL ELECTRON TRANSPORT UBIQUINOL TO CYTOCHROME C 12 0.0000006 -0.8308048 0.0000103
6470 GOCC PICLN SM PROTEIN COMPLEX 6 0.0004743 -0.8238298 0.0038211
6610 GOCC SIGNAL PEPTIDASE COMPLEX 5 0.0014482 -0.8224045 0.0096514
6792 GOMF ADENYLATE CYCLASE REGULATOR ACTIVITY 5 0.0014810 -0.8207334 0.0098127
6423 GOCC NURF COMPLEX 6 0.0006112 -0.8077369 0.0047215
5599 GOBP TELOMERASE HOLOENZYME COMPLEX ASSEMBLY 6 0.0006267 -0.8061380 0.0048098
8009 GOMF UBIQUINOL CYTOCHROME C REDUCTASE ACTIVITY 6 0.0006277 -0.8060348 0.0048098
up <- head(subset(k2m$enrichment_result, s.dist > 0 & p.adjustANOVA < 0.05),20)
dn <- head(subset(k2m$enrichment_result, s.dist < 0 & p.adjustANOVA < 0.05),20)
top <- rbind(up,dn)
top <- top[order(top$s.dist),]

par(mar=c(5.1, 25.1, 4.1, 2.1))
gsn <- substr(top$set, start = 1, stop = 70 )
barplot(top$s.dist,horiz=TRUE,las=1,xlab="ES",names.arg=gsn,cex.names=0.6,main="HIV pos")

mitch_plots(k2m,outfile="KIR3DL2_assoc_hivpos.pdf")
## png 
##   2
if ( ! file.exists("KIR3DL2_assoc_hivpos.html") ) {
  mitch_report(res=k2m,outfile="KIR3DL2_assoc_hivpos.html")
}

par(mar=c(5.1, 4.1, 4.1, 2.1))

Multi-contrast enrichment

km <- merge(k1,k2,by=0)
rownames(km) <- km[,1]
km[,1]=NULL
colnames(km) <- c("neg","pos")
dim(km)
## [1] 11958     2
kmm <- mitch_calc(km,genesets=go,minsetsize=5,cores=16,priority="effect")
## Note: Enrichments with large effect sizes may not be 
##             statistically significant.
head(subset(kmm$enrichment_result, s.dist > 0),20) |> kbl(caption="top multi-enrichment") |> kable_paper("hover", full_width = F)
top multi-enrichment
set setSize pMANOVA s.neg s.pos p.neg p.pos s.dist SD p.adjustMANOVA
5960 GOCC CYTOSOLIC SMALL RIBOSOMAL SUBUNIT 38 0.0000000 -0.9421494 -0.9465162 0.0000000 0.0000000 1.335492 0.0030878 0.0000000
5957 GOCC CYTOSOLIC LARGE RIBOSOMAL SUBUNIT 55 0.0000000 -0.9024875 -0.9081271 0.0000000 0.0000000 1.280304 0.0039877 0.0000000
3238 GOBP POSITIVE REGULATION OF INTRINSIC APOPTOTIC SIGNALING PATHWAY BY P53 CLASS MEDIATOR 5 0.0008915 -0.9385928 -0.8397055 0.0002780 0.0011465 1.259389 0.0699239 0.0067230
6344 GOCC POLYSOMAL RIBOSOME 29 0.0000000 -0.8642717 -0.8844427 0.0000000 0.0000000 1.236610 0.0142631 0.0000000
5788 GOCC ARP2 3 PROTEIN COMPLEX 9 0.0000119 -0.8355046 -0.8635497 0.0000142 0.0000072 1.201577 0.0198309 0.0001543
6195 GOCC MITOCHONDRIAL PROTON TRANSPORTING ATP SYNTHASE COMPLEX COUPLING FACTOR F O 10 0.0000015 -0.7472548 -0.9392534 0.0000427 0.0000003 1.200244 0.1357636 0.0000244
5959 GOCC CYTOSOLIC RIBOSOME 109 0.0000000 -0.8222805 -0.8183844 0.0000000 0.0000000 1.160129 0.0027550 0.0000000
6641 GOMF ADENYLATE CYCLASE REGULATOR ACTIVITY 5 0.0029100 -0.8298670 -0.8061407 0.0013102 0.0017973 1.156954 0.0167770 0.0180824
6169 GOCC MHC CLASS I PROTEIN COMPLEX 7 0.0002927 -0.7936096 -0.8361165 0.0002765 0.0001275 1.152782 0.0300569 0.0026125
7833 GOMF UBIQUITIN LIGASE INHIBITOR ACTIVITY 8 0.0000790 -0.7549791 -0.8672176 0.0002173 0.0000215 1.149809 0.0793646 0.0008399
3392 GOBP POSITIVE REGULATION OF OXIDATIVE STRESS INDUCED INTRINSIC APOPTOTIC SIGNALING PATHWAY 5 0.0029154 -0.8622940 -0.7510583 0.0008397 0.0036324 1.143521 0.0786555 0.0180877
7743 GOMF TAP BINDING 7 0.0002695 -0.7227728 -0.8747027 0.0009276 0.0000612 1.134683 0.1074307 0.0024475
6394 GOCC PROTON TRANSPORTING ATP SYNTHASE COMPLEX COUPLING FACTOR F O 13 0.0000002 -0.6990566 -0.8930354 0.0000127 0.0000000 1.134104 0.1371637 0.0000030
7584 GOMF PROTON TRANSPORTING ATP SYNTHASE ACTIVITY ROTATIONAL MECHANISM 16 0.0000000 -0.7004166 -0.8593200 0.0000012 0.0000000 1.108609 0.1123617 0.0000003
6392 GOCC PROTON TRANSPORTING ATP SYNTHASE COMPLEX 18 0.0000000 -0.6499814 -0.8976736 0.0000018 0.0000000 1.108284 0.1751448 0.0000000
6464 GOCC SIGNAL PEPTIDASE COMPLEX 5 0.0047404 -0.7534008 -0.8079478 0.0035283 0.0017551 1.104714 0.0385705 0.0268339
1853 GOBP MITOCHONDRIAL ELECTRON TRANSPORT CYTOCHROME C TO OXYGEN 18 0.0000000 -0.8089708 -0.7324028 0.0000000 0.0000001 1.091260 0.0541418 0.0000002
2235 GOBP NEGATIVE REGULATION OF FIBROBLAST MIGRATION 5 0.0053152 -0.8065088 -0.7331214 0.0017886 0.0045262 1.089919 0.0518928 0.0293249
6393 GOCC PROTON TRANSPORTING ATP SYNTHASE COMPLEX CATALYTIC CORE F 1 6 0.0005209 -0.5848951 -0.9107541 0.0131037 0.0001116 1.082393 0.2304171 0.0042945
309 GOBP CALCIUM ION EXPORT ACROSS PLASMA MEMBRANE 5 0.0030725 -0.8783569 -0.6319920 0.0006699 0.0143958 1.082093 0.1742063 0.0188833
mitch_plots(kmm,outfile="KIR3DL2_assoc_hivnegpos.pdf")
## png 
##   2
if ( ! file.exists("KIR3DL2_assoc_hivnegpos.html") ) {
  mitch_report(res=kmm,outfile="KIR3DL2_assoc_hivnegpos.html")
}

Pathway analysis irrespective of HIV status.

k3 <- mitch_import(kx3de,DEtype="deseq2")
## The input is a single dataframe; one contrast only. Converting
##         it to a list for you.
## Note: Mean no. genes in input = 12609
## Note: no. genes in output = 12609
## Note: estimated proportion of input genes in output = 1
k3m <- mitch_calc(k3,genesets=go,minsetsize=5,cores=16,priority="effect")
## Note: Enrichments with large effect sizes may not be
##             statistically significant.
head(subset(k3m$enrichment_result, s.dist > 0),20) |> kbl(caption="top enrichments (positive correl)") |> kable_paper("hover", full_width = F)
top enrichments (positive correl)
set setSize pANOVA s.dist p.adjustANOVA
5988 GOCC CIS GOLGI NETWORK MEMBRANE 7 0.0001954 0.8129095 0.0211285
2645 GOBP NEURON CELL CELL ADHESION 5 0.0043860 0.7357030 0.2013826
6693 GOMF 1 ACYLGLYCEROPHOSPHOCHOLINE O ACYLTRANSFERASE ACTIVITY 5 0.0051584 0.7222786 0.2230638
3878 GOBP PROTEIN RETENTION IN GOLGI APPARATUS 5 0.0053317 0.7195176 0.2268801
5492 GOBP STRESS INDUCED PREMATURE SENESCENCE 5 0.0054152 0.7182164 0.2292138
5326 GOBP SECRETORY GRANULE LOCALIZATION 7 0.0014294 0.6959440 0.1039529
5011 GOBP RENAL SODIUM ION ABSORPTION 5 0.0084301 0.6802920 0.2957945
5012 GOBP RENAL SODIUM ION TRANSPORT 5 0.0084301 0.6802920 0.2957945
2557 GOBP NEGATIVE REGULATION OF TOLL LIKE RECEPTOR 2 SIGNALING PATHWAY 5 0.0115801 0.6519835 0.3443884
7149 GOMF HISTONE H2A UBIQUITIN LIGASE ACTIVITY 5 0.0118006 0.6502698 0.3476446
3594 GOBP POSITIVE REGULATION OF SYNAPTIC PLASTICITY 5 0.0136329 0.6370359 0.3760056
7609 GOMF PLUS END DIRECTED MICROTUBULE MOTOR ACTIVITY 10 0.0008627 0.6084769 0.0711521
7967 GOMF UBIQUITIN LIKE PROTEIN SPECIFIC ENDOPEPTIDASE ACTIVITY 5 0.0187105 0.6072041 0.4192825
7625 GOMF POTASSIUM CHLORIDE SYMPORTER ACTIVITY 5 0.0189529 0.6059664 0.4199947
3612 GOBP POSITIVE REGULATION OF TORC2 SIGNALING 5 0.0207011 0.5974294 0.4335315
1540 GOBP INTRACILIARY TRANSPORT INVOLVED IN CILIUM ASSEMBLY 6 0.0130381 0.5853104 0.3685670
1516 GOBP INTESTINAL LIPID ABSORPTION 7 0.0082523 0.5765751 0.2921165
3527 GOBP POSITIVE REGULATION OF RAC PROTEIN SIGNAL TRANSDUCTION 5 0.0256785 0.5761663 0.4611018
3015 GOBP POSITIVE REGULATION OF ADIPOSE TISSUE DEVELOPMENT 5 0.0284451 0.5658521 0.4860487
7104 GOMF GLYCOLIPID MANNOSYLTRANSFERASE ACTIVITY 5 0.0285966 0.5653126 0.4860487
head(subset(k3m$enrichment_result, s.dist < 0),20) |> kbl(caption="top enrichments (negative correl)") |> kable_paper("hover", full_width = F)
top enrichments (negative correl)
set setSize pANOVA s.dist p.adjustANOVA
6052 GOCC CYTOSOLIC LARGE RIBOSOMAL SUBUNIT 55 0.0000000 -0.8330731 0.0000000
6055 GOCC CYTOSOLIC SMALL RIBOSOMAL SUBUNIT 38 0.0000000 -0.8030890 0.0000000
6444 GOCC POLYSOMAL RIBOSOME 29 0.0000000 -0.7480566 0.0000000
2712 GOBP NUCLEAR PORE LOCALIZATION 5 0.0069471 -0.6970803 0.2646531
5193 GOBP RESPONSE TO SELENIUM ION 5 0.0070739 -0.6955252 0.2658834
4762 GOBP REGULATION OF PROTEIN OLIGOMERIZATION 5 0.0070791 -0.6954618 0.2658834
7958 GOMF UBIQUITIN LIGASE INHIBITOR ACTIVITY 8 0.0006700 -0.6944687 0.0576383
6054 GOCC CYTOSOLIC RIBOSOME 109 0.0000000 -0.6938569 0.0000000
6252 GOCC MATRIX SIDE OF MITOCHONDRIAL INNER MEMBRANE 6 0.0038457 -0.6814251 0.1947206
6292 GOCC MITOCHONDRIAL PROTON TRANSPORTING ATP SYNTHASE COMPLEX COUPLING FACTOR F O 10 0.0003309 -0.6555600 0.0326862
1758 GOBP MARGINAL ZONE B CELL DIFFERENTIATION 7 0.0027495 -0.6535697 0.1556077
731 GOBP CO TRANSCRIPTIONAL RNA 3 END PROCESSING CLEAVAGE AND POLYADENYLATION PATHWAY 6 0.0056890 -0.6518818 0.2370421
730 GOBP CO TRANSCRIPTIONAL MRNA 3 END PROCESSING CLEAVAGE AND POLYADENYLATION PATHWAY 5 0.0150052 -0.6281181 0.4001451
2337 GOBP NEGATIVE REGULATION OF LIPASE ACTIVITY 5 0.0157121 -0.6238020 0.4081062
4207 GOBP REGULATION OF CYTOCHROME C OXIDASE ACTIVITY 5 0.0184402 -0.6086004 0.4192825
6073 GOCC DOPAMINERGIC SYNAPSE 5 0.0191098 -0.6051730 0.4199947
3231 GOBP POSITIVE REGULATION OF GLIAL CELL MIGRATION 6 0.0104254 -0.6038509 0.3270701
3930 GOBP PURINE NUCLEOSIDE DIPHOSPHATE BIOSYNTHETIC PROCESS 5 0.0200420 -0.6005712 0.4285076
2593 GOBP NEGATIVE REGULATION OF UBIQUITIN PROTEIN LIGASE ACTIVITY 8 0.0034703 -0.5967384 0.1812063
1883 GOBP MITOCHONDRIAL ELECTRON TRANSPORT UBIQUINOL TO CYTOCHROME C 12 0.0003536 -0.5956048 0.0336781
up <- head(subset(k3m$enrichment_result, s.dist > 0 & p.adjustANOVA < 0.05),20)
dn <- head(subset(k3m$enrichment_result, s.dist < 0 & p.adjustANOVA < 0.05),20)
top <- rbind(up,dn)
top <- top[order(top$s.dist),]

par(mar=c(5.1, 25.1, 4.1, 2.1))
gsn <- substr(top$set, start = 1, stop = 70 )
barplot(top$s.dist,horiz=TRUE,las=1,xlab="ES",names.arg=gsn,cex.names=0.6,main="HIV neg")

mitch_plots(k3m,outfile="KIR3DL2_assoc_all.pdf")
## png 
##   2

Session information

For reproducibility.

save.image("scanalyse2.Rdata")

sessionInfo()
## R version 4.4.1 (2024-06-14)
## Platform: x86_64-pc-linux-gnu
## Running under: Ubuntu 22.04.5 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] gplots_3.2.0                kableExtra_1.4.0           
##  [3] limma_3.60.6                mitch_1.19.3               
##  [5] DESeq2_1.44.0               muscat_1.18.0              
##  [7] beeswarm_0.4.0              stringi_1.8.4              
##  [9] SingleCellExperiment_1.26.0 SummarizedExperiment_1.34.0
## [11] Biobase_2.64.0              GenomicRanges_1.56.2       
## [13] GenomeInfoDb_1.40.1         IRanges_2.38.1             
## [15] S4Vectors_0.42.1            BiocGenerics_0.50.0        
## [17] MatrixGenerics_1.16.0       matrixStats_1.4.1          
## [19] hdf5r_1.3.11                Seurat_5.1.0               
## [21] SeuratObject_5.0.2          sp_2.1-4                   
## [23] plyr_1.8.9                 
## 
## loaded via a namespace (and not attached):
##   [1] bitops_1.0-9              spatstat.sparse_3.1-0    
##   [3] httr_1.4.7                RColorBrewer_1.1-3       
##   [5] doParallel_1.0.17         numDeriv_2016.8-1.1      
##   [7] backports_1.5.0           tools_4.4.1              
##   [9] sctransform_0.4.1         utf8_1.2.4               
##  [11] R6_2.5.1                  lazyeval_0.2.2           
##  [13] uwot_0.2.2                mgcv_1.9-1               
##  [15] GetoptLong_1.0.5          withr_3.0.2              
##  [17] GGally_2.2.1              prettyunits_1.2.0        
##  [19] gridExtra_2.3             progressr_0.15.1         
##  [21] cli_3.6.3                 spatstat.explore_3.3-3   
##  [23] fastDummies_1.7.4         labeling_0.4.3           
##  [25] sass_0.4.9                mvtnorm_1.3-2            
##  [27] spatstat.data_3.1-4       blme_1.0-6               
##  [29] ggridges_0.5.6            pbapply_1.7-2            
##  [31] systemfonts_1.1.0         svglite_2.1.3            
##  [33] scater_1.32.1             parallelly_1.39.0        
##  [35] rstudioapi_0.17.1         generics_0.1.3           
##  [37] shape_1.4.6.1             gtools_3.9.5             
##  [39] ica_1.0-3                 spatstat.random_3.3-2    
##  [41] dplyr_1.1.4               Matrix_1.7-1             
##  [43] ggbeeswarm_0.7.2          fansi_1.0.6              
##  [45] abind_1.4-8               lifecycle_1.0.4          
##  [47] yaml_2.3.10               edgeR_4.2.2              
##  [49] SparseArray_1.4.8         Rtsne_0.17               
##  [51] grid_4.4.1                promises_1.3.1           
##  [53] crayon_1.5.3              miniUI_0.1.1.1           
##  [55] lattice_0.22-6            echarts4r_0.4.5          
##  [57] beachmat_2.20.0           cowplot_1.1.3            
##  [59] pillar_1.9.0              knitr_1.49               
##  [61] ComplexHeatmap_2.20.0     rjson_0.2.23             
##  [63] boot_1.3-31               corpcor_1.6.10           
##  [65] future.apply_1.11.3       codetools_0.2-20         
##  [67] leiden_0.4.3.1            glue_1.8.0               
##  [69] spatstat.univar_3.1-1     data.table_1.16.2        
##  [71] vctrs_0.6.5               png_0.1-8                
##  [73] spam_2.11-0               Rdpack_2.6.2             
##  [75] gtable_0.3.6              cachem_1.1.0             
##  [77] xfun_0.49                 rbibutils_2.3            
##  [79] S4Arrays_1.4.1            mime_0.12                
##  [81] reformulas_0.4.0          survival_3.7-0           
##  [83] iterators_1.0.14          statmod_1.5.0            
##  [85] fitdistrplus_1.2-1        ROCR_1.0-11              
##  [87] nlme_3.1-166              pbkrtest_0.5.3           
##  [89] bit64_4.5.2               EnvStats_3.0.0           
##  [91] progress_1.2.3            RcppAnnoy_0.0.22         
##  [93] bslib_0.8.0               TMB_1.9.15               
##  [95] irlba_2.3.5.1             vipor_0.4.7              
##  [97] KernSmooth_2.23-24        colorspace_2.1-1         
##  [99] ggrastr_1.0.2             tidyselect_1.2.1         
## [101] bit_4.5.0                 compiler_4.4.1           
## [103] BiocNeighbors_1.22.0      xml2_1.3.6               
## [105] DelayedArray_0.30.1       plotly_4.10.4            
## [107] scales_1.3.0              caTools_1.18.3           
## [109] remaCor_0.0.18            lmtest_0.9-40            
## [111] stringr_1.5.1             digest_0.6.37            
## [113] goftest_1.2-3             spatstat.utils_3.1-1     
## [115] minqa_1.2.8               variancePartition_1.34.0 
## [117] rmarkdown_2.29            aod_1.3.3                
## [119] XVector_0.44.0            RhpcBLASctl_0.23-42      
## [121] htmltools_0.5.8.1         pkgconfig_2.0.3          
## [123] lme4_1.1-35.5             sparseMatrixStats_1.16.0 
## [125] fastmap_1.2.0             rlang_1.1.4              
## [127] GlobalOptions_0.1.2       htmlwidgets_1.6.4        
## [129] UCSC.utils_1.0.0          shiny_1.9.1              
## [131] DelayedMatrixStats_1.26.0 farver_2.1.2             
## [133] jquerylib_0.1.4           zoo_1.8-12               
## [135] jsonlite_1.8.9            BiocParallel_1.38.0      
## [137] BiocSingular_1.20.0       magrittr_2.0.3           
## [139] scuttle_1.14.0            GenomeInfoDbData_1.2.12  
## [141] dotCall64_1.2             patchwork_1.3.0          
## [143] munsell_0.5.1             Rcpp_1.0.13-1            
## [145] viridis_0.6.5             reticulate_1.40.0        
## [147] zlibbioc_1.50.0           MASS_7.3-61              
## [149] ggstats_0.7.0             listenv_0.9.1            
## [151] ggrepel_0.9.6             deldir_2.0-4             
## [153] splines_4.4.1             tensor_1.5               
## [155] hms_1.1.3                 circlize_0.4.16          
## [157] locfit_1.5-9.10           igraph_2.1.1             
## [159] spatstat.geom_3.3-4       RcppHNSW_0.6.0           
## [161] reshape2_1.4.4            ScaledMatrix_1.12.0      
## [163] evaluate_1.0.1            nloptr_2.1.1             
## [165] foreach_1.5.2             httpuv_1.6.15            
## [167] RANN_2.6.2                tidyr_1.3.1              
## [169] purrr_1.0.2               polyclip_1.10-7          
## [171] future_1.34.0             clue_0.3-66              
## [173] scattermore_1.2           ggplot2_3.5.1            
## [175] rsvd_1.0.5                broom_1.0.7              
## [177] xtable_1.8-4              fANCOVA_0.6-1            
## [179] RSpectra_0.16-2           later_1.4.0              
## [181] viridisLite_0.4.2         tibble_3.2.1             
## [183] lmerTest_3.1-3            glmmTMB_1.1.10           
## [185] cluster_2.1.6             globals_0.16.3