immunogenomics / harmony

Fast, sensitive and accurate integration of single-cell data with Harmony
https://portals.broadinstitute.org/harmony/
Other
513 stars 98 forks source link

feature.loadings of harmony is missing in SummarizedExperiment #238

Open xiangpin opened 7 months ago

xiangpin commented 7 months ago

Thanks for the work, I found when the input is Seurat, we can obtain the features.loadings, but if the input is SingleCellExperiment, this is missing

> pbmc.sce
class: SingleCellExperiment
dim: 9015 2000
metadata(0):
assays(2): counts logcounts
rownames(9015): LINC00115 NOC2L ... S100B PRMT2
rowData names(0):
colnames(2000): ATCACTTGCTCGAA-1 CCGGAGACTGTGAC-1 ... GCATGATGGGCGAA-1
  ATACCACTCGGTAT-1
colData names(5): orig.ident nCount_RNA nFeature_RNA stim ident
reducedDimNames(2): PCA HARMONY
mainExpName: RNA
altExpNames(0):
> pbmc.sce |> reducedDim('HARMONY') |> str()
 num [1:2000, 1:50] 109.5 364.4 64.1 102.3 -206.6 ...
 - attr(*, "dimnames")=List of 2
  ..$ : chr [1:2000] "ATCACTTGCTCGAA-1" "CCGGAGACTGTGAC-1" "CAAGCCCTGTTAGC-1" "GAGGTACTAACGGG-1" ...
  ..$ : chr [1:50] "HARMONY_1" "HARMONY_2" "HARMONY_3" "HARMONY_4" ...
> pbmc.sce |> reducedDim('PCA') |> str()
 num [1:2000, 1:50] 110.2 367 64.2 103.2 -141.2 ...
 - attr(*, "dimnames")=List of 2
  ..$ : chr [1:2000] "ATCACTTGCTCGAA-1" "CCGGAGACTGTGAC-1" "CAAGCCCTGTTAGC-1" "GAGGTACTAACGGG-1" ...
  ..$ : chr [1:50] "PC1" "PC2" "PC3" "PC4" ...
 - attr(*, "varExplained")= num [1:50] 28583 18766 3558 3110 1537 ...
 - attr(*, "percentVar")= num [1:50] 47.2 30.99 5.88 5.14 2.54 ...
 - attr(*, "rotation")= num [1:500, 1:50] -0.8427 0.1212 -0.4521 -0.104 -0.0562 ...
  ..- attr(*, "dimnames")=List of 2
  .. ..$ : chr [1:500] "FTH1" "HBB" "FTL" "ISG15" ...
  .. ..$ : chr [1:50] "PC1" "PC2" "PC3" "PC4" ...
> # this is Seurat object as input
> pbmc@reductions$harmony@feature.loadings[1:10, 1:3]
             harmony_1  harmony_2   harmony_3
LINC00115  -1089.81768   422.0957   95.493779
NOC2L       -646.07807  3688.8628  471.784832
HES4       -9200.61102 -2606.4641  199.833325
ISG15     -14507.01536 -4591.7228 -175.591820
TNFRSF18    -730.27738  3033.6111  246.001729
TNFRSF4    -2164.10675  3107.5163  430.330156
SDF4       -4078.34267  1318.9736 -516.130637
B3GALT6       36.91902  1457.2042    9.419754
UBE2J2     -2115.69325  1161.7211   91.321004
ACAP3        110.42502   264.2238  118.171979

I want to know How to calculate the feature.loadings? And what is the meaning of feature.loadings in harmony?