OSCR

Acarbose modulates microglial Pkm2 acetylation to reshape immunometabolism and preserve retinal neurons after ischemia-reperfusion.

Code ↔ Paper

2 matches between paragraphs of the paper and lines of its authors' code, computed by the harvester (lexical-v1). Click a colored paragraph or line to see its counterpart.

The 2 matches
  1. [1] § Materials and methods › ScRNA-seq analysis ↔ R/generics.R, lines 109–170 · score 0.68 · quality control, Fold Change, FindMarkers, Seurat, seq, gene
  2. [2] § Materials and methods › ScRNA-seq analysis ↔ R/differential_expression.R, lines 455–538 · score 0.65 · Fold Change, FindMarkers, scRNA, utilized, Seurat, ratio

Paper

Loaded from Europe PMC by your browser, not stored by OSCR: doi.org · Europe PMC

The paper is loaded when this pane is shown.

The authors' code

R · 842 lines · 28 KB · other · 1 match

  1. #' @include reexports.R
  2. #'
  3. NULL
  4. #%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  5. # Generics
  6. #%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  7. #' Calculate module scores for feature expression programs in single cells
  8. #'
  9. #' Calculate the average expression levels of each program (cluster) on single
  10. #' cell level, subtracted by the aggregated expression of control feature sets.
  11. #' All analyzed features are binned based on averaged expression, and the
  12. #' control features are randomly selected from each bin.
  13. #'
  14. #' @param object An object
  15. #' @param ... Arguments passed to other methods
  16. #'
  17. #' @return Returns a Seurat object with module scores added to object meta data;
  18. #' each module is stored as \code{name#} for each module program present in
  19. #' \code{features}
  20. #'
  21. #' @references Tirosh et al, Science (2016)
  22. #'
  23. #' @export
  24. #' @concept utilities
  25. #'
  26. AddModuleScore <- function(object, ...) {
  27. UseMethod(generic = 'AddModuleScore', object = object)
  28. }
  29. #' Add info to anchor matrix
  30. #'
  31. #' @param anchors An \code{\link{AnchorSet}} object
  32. #' @param vars Variables to pull for each object via FetchData
  33. #' @param slot Slot to pull feature data for
  34. #' @param assay Specify the Assay per object if annotating with expression data
  35. #' @param ... Arguments passed to other methods
  36. #
  37. #' @return Returns the anchor dataframe with additional columns for annotation
  38. #' metadata
  39. #'
  40. #' @export
  41. #'
  42. AnnotateAnchors <- function(anchors, vars, slot, ...) {
  43. UseMethod(generic = 'AnnotateAnchors', object = anchors)
  44. }
  45. #' Convert objects to CellDataSet objects
  46. #'
  47. #' @param x An object to convert to class \code{CellDataSet}
  48. #' @param ... Arguments passed to other methods
  49. #'
  50. #' @rdname as.CellDataSet
  51. #' @export as.CellDataSet
  52. #'
  53. as.CellDataSet <- function(x, ...) {
  54. UseMethod(generic = 'as.CellDataSet', object = x)
  55. }
  56. #' Convert objects to SingleCellExperiment objects
  57. #'
  58. #' @param x An object to convert to class \code{SingleCellExperiment}
  59. #' @param ... Arguments passed to other methods
  60. #'
  61. #' @rdname as.SingleCellExperiment
  62. #' @export as.SingleCellExperiment
  63. #'
  64. as.SingleCellExperiment <- function(x, ...) {
  65. UseMethod(generic = 'as.SingleCellExperiment', object = x)
  66. }
  67. #' Cluster Determination
  68. #'
  69. #' Identify clusters of cells by a shared nearest neighbor (SNN) modularity
  70. #' optimization based clustering algorithm. First calculate k-nearest neighbors
  71. #' and construct the SNN graph. Then optimize the modularity function to
  72. #' determine clusters. For a full description of the algorithms, see Waltman and
  73. #' van Eck (2013) \emph{The European Physical Journal B}. Thanks to Nigel
  74. #' Delaney (evolvedmicrobe@github) for the rewrite of the Java modularity
  75. #' optimizer code in Rcpp!
  76. #'
  77. #' To run Leiden algorithm, you must first install the leidenalg python
  78. #' package (e.g. via pip install leidenalg), see Traag et al (2018).
  79. #'
  80. #' @param object An object
  81. #' @param ... Arguments passed to other methods
  82. #'
  83. #' @return Returns a Seurat object where the idents have been updated with new cluster info;
  84. #' latest clustering results will be stored in object metadata under 'seurat_clusters'.
  85. #' Note that 'seurat_clusters' will be overwritten everytime FindClusters is run
  86. #'
  87. #' @export
  88. #'
  89. #' @rdname FindClusters
  90. #' @export FindClusters
  91. #'
  92. FindClusters <- function(object, ...) {
  93. UseMethod(generic = 'FindClusters', object = object)
  94. }
  95. #' Gene expression markers of identity classes
  96. #'
  97. #' Finds markers (differentially expressed genes) for each of the identity classes in a dataset. Note that differential expression between groups (e.g. treatment conditions) should account for biological variation across samples, e.g. by using pseudobulk expression profiles.
  98. #'
  99. #' @param object An object
  100. #' @param ... Arguments passed to other methods and to specific DE methods
  101. #' @return data.frame with a ranked list of putative markers as rows, and associated
  102. #' statistics as columns (p-values, ROC score, etc., depending on the test used (\code{test.use})). The following columns are always present:
  103. #' \itemize{
  104. #' \item \code{avg_logFC}: log fold-chage of the average expression between the two groups. Positive values indicate that the gene is more highly expressed in the first group
  105. #' \item \code{pct.1}: The percentage of cells where the gene is detected in the first group
  106. #' \item \code{pct.2}: The percentage of cells where the gene is detected in the second group
  107. #' \item \code{p_val_adj}: Adjusted p-value, based on bonferroni correction using all genes in the dataset
  108. #' }
  109. #'
  110. #' @details p-value adjustment is performed using bonferroni correction based on
  111. #' the total number of genes in the dataset. Other correction methods are not
  112. #' recommended, as Seurat pre-filters genes using the arguments above, reducing
  113. #' the number of tests performed. Lastly, as Aaron Lun has pointed out, p-values
  114. #' should be interpreted cautiously, as the genes used for clustering are the
  115. #' same genes tested for differential expression.
  116. #'
  117. #' @references McDavid A, Finak G, Chattopadyay PK, et al. Data exploration,
  118. #' quality control and testing in single-cell qPCR-based gene expression experiments.
  119. #' Bioinformatics. 2013;29(4):461-467. doi:10.1093/bioinformatics/bts714
  120. #' @references Trapnell C, et al. The dynamics and regulators of cell fate
  121. #' decisions are revealed by pseudotemporal ordering of single cells. Nature
  122. #' Biotechnology volume 32, pages 381-386 (2014)
  123. #' @references Andrew McDavid, Greg Finak and Masanao Yajima (2017). MAST: Model-based
  124. #' Analysis of Single Cell Transcriptomics. R package version 1.2.1.
  125. #' https://github.com/RGLab/MAST/
  126. #' @references Love MI, Huber W and Anders S (2014). "Moderated estimation of
  127. #' fold change and dispersion for RNA-seq data with DESeq2." Genome Biology.
  128. #' https://bioconductor.org/packages/release/bioc/html/DESeq2.html
  129. #'
  130. #' @note See the DE vignette for more details and examples
  131. #'
  132. #' @export
  133. #'
  134. #' @examples
  135. #' \dontrun{
  136. #' data("pbmc_small")
  137. #' # Find markers for cluster 2
  138. #' markers <- FindMarkers(object = pbmc_small, ident.1 = 2)
  139. #' head(x = markers)
  140. #'
  141. #' # Within cluster 2, find markers for cells in the 'g1' group compared with
  142. #' # other cells, using the 'groups' metadata variable.
  143. #' markers <- FindMarkers(pbmc_small, ident.1 = "g1", group.by = 'groups', subset.ident = "2")
  144. #' head(x = markers)
  145. #'
  146. #' # Pass 'clustertree' or an object of class phylo to ident.1 and
  147. #' # a node to ident.2 as a replacement for FindMarkersNode
  148. #' if (requireNamespace("ape", quietly = TRUE)) {
  149. #' pbmc_small <- BuildClusterTree(object = pbmc_small)
  150. #' markers <- FindMarkers(object = pbmc_small, ident.1 = 'clustertree', ident.2 = 5)
  151. #' head(x = markers)
  152. #' }
  153. #' }
  154. #'
  155. #' @rdname FindMarkers
  156. #' @export FindMarkers
  157. #'
  158. #' @aliases FindMarkersNode
  159. #'
  160. FindMarkers <- function(object, ...) {
  161. UseMethod(generic = 'FindMarkers', object = object)
  162. }
  163. #' (Shared) Nearest-neighbor graph construction
  164. #'
  165. #' Computes the \code{k.param} nearest neighbors for a given dataset. Can also
  166. #' optionally (via \code{compute.SNN}), construct a shared nearest neighbor
  167. #' graph by calculating the neighborhood overlap (Jaccard index) between every
  168. #' cell and its \code{k.param} nearest neighbors.
  169. #'
  170. #' @param object An object
  171. #' @param ... Arguments passed to other methods
  172. #'
  173. #' @return This function can either return a \code{\link[SeuratObject]{Neighbor}} object
  174. #' with the KNN information or a list of \code{\link[SeuratObject]{Graph}} objects with
  175. #' the KNN and SNN depending on the settings of \code{return.neighbor} and
  176. #' \code{compute.SNN}. When running on a \code{\link[SeuratObject]{Seurat}} object, this
  177. #' returns the \code{\link[SeuratObject]{Seurat}} object with the Graphs or Neighbor objects
  178. #' stored in their respective slots. Names of the Graph or Neighbor object can
  179. #' be found with \code{\link[SeuratObject]{Graphs}} or \code{\link[SeuratObject]{Neighbors}}.
  180. #'
  181. #' @examples
  182. #' data("pbmc_small")
  183. #' pbmc_small
  184. #' # Compute an SNN on the gene expression level
  185. #' pbmc_small <- FindNeighbors(pbmc_small, features = VariableFeatures(object = pbmc_small))
  186. #'
  187. #' # More commonly, we build the SNN on a dimensionally reduced form of the data
  188. #' # such as the first 10 principle components.
  189. #'
  190. #' pbmc_small <- FindNeighbors(pbmc_small, reduction = "pca", dims = 1:10)
  191. #'
  192. #' @rdname FindNeighbors
  193. #' @export FindNeighbors
  194. #'
  195. FindNeighbors <- function(object, ...) {
  196. UseMethod(generic = 'FindNeighbors', object = object)
  197. }
  198. #' Find variable features
  199. #'
  200. #' Identifies features that are outliers on a 'mean variability plot'.
  201. #'
  202. #' For the mean.var.plot method:
  203. #' Exact parameter settings may vary empirically from dataset to dataset, and
  204. #' based on visual inspection of the plot. Setting the y.cutoff parameter to 2
  205. #' identifies features that are more than two standard deviations away from the
  206. #' average dispersion within a bin. The default X-axis function is the mean
  207. #' expression level, and for Y-axis it is the log(Variance/mean). All mean/variance
  208. #' calculations are not performed in log-space, but the results are reported in
  209. #' log-space - see relevant functions for exact details.
  210. #'
  211. #' @param object An object
  212. #' @param ... Arguments passed to other methods
  213. #'
  214. #' @rdname FindVariableFeatures
  215. #' @export FindVariableFeatures
  216. #'
  217. #' @aliases FindVariableGenes
  218. #'
  219. FindVariableFeatures <- function(object, ...) {
  220. UseMethod(generic = 'FindVariableFeatures', object = object)
  221. }
  222. #' Find spatially variable features
  223. #'
  224. #' Identify features whose variability in expression can be explained to some
  225. #' degree by spatial location.
  226. #'
  227. #' @param object An object
  228. #' @param ... Arguments passed to other methods
  229. #'
  230. #' @rdname FindSpatiallyVariableFeatures
  231. #' @export FindSpatiallyVariableFeatures
  232. #'
  233. FindSpatiallyVariableFeatures <- function(object, ...) {
  234. UseMethod(generic = 'FindSpatiallyVariableFeatures', object = object)
  235. }
  236. #' Fold Change
  237. #'
  238. #' Calculate log fold change and percentage of cells expressing each feature
  239. #' for different identity classes.
  240. #'
  241. #' If the slot is \code{scale.data} or a reduction is specified, average difference
  242. #' is returned instead of log fold change and the column is named "avg_diff".
  243. #' Otherwise, log2 fold change is returned with column named "avg_log2_FC".
  244. #'
  245. #' @examples
  246. #' \dontrun{
  247. #' data("pbmc_small")
  248. #' FoldChange(pbmc_small, ident.1 = 1)
  249. #' }
  250. #'
  251. #' @param object A Seurat object
  252. #' @param ... Arguments passed to other methods
  253. #' @rdname FoldChange
  254. #' @export FoldChange
  255. #' @return Returns a data.frame
  256. #' @seealso \code{FindMarkers}
  257. FoldChange <- function(object, ...) {
  258. UseMethod(generic = 'FoldChange', object = object)
  259. }
  260. #' Get an Assay object from a given Seurat object.
  261. #'
  262. #' @param object An object
  263. #' @param ... Arguments passed to other methods
  264. #'
  265. #' @return Returns an Assay object
  266. #'
  267. #' @rdname GetAssay
  268. #' @export GetAssay
  269. #'
  270. GetAssay <- function(object, ...) {
  271. UseMethod(generic = 'GetAssay', object = object)
  272. }
  273. #' Integrate low dimensional embeddings
  274. #'
  275. #' Perform dataset integration using a pre-computed Anchorset of specified low
  276. #' dimensional representations.
  277. #'
  278. #' The main steps of this procedure are identical to \code{\link{IntegrateData}}
  279. #' with one key distinction. When computing the weights matrix, the distance
  280. #' calculations are performed in the full space of integrated embeddings when
  281. #' integrating more than two datasets, as opposed to a reduced PCA space which
  282. #' is the default behavior in \code{\link{IntegrateData}}.
  283. #'
  284. #' @param anchorset An AnchorSet object
  285. #' @param new.reduction.name Name for new integrated dimensional reduction.
  286. #' @param reductions Name of reductions to be integrated. For a
  287. #' TransferAnchorSet, this should be the name of a reduction present in the
  288. #' anchorset object (for example, "pcaproject"). For an IntegrationAnchorSet,
  289. #' this should be a \code{\link[SeuratObject]{DimReduc}} object containing all cells present
  290. #' in the anchorset object.
  291. #' @param dims.to.integrate Number of dimensions to return integrated values for
  292. #' @param weight.reduction Dimension reduction to use when calculating anchor
  293. #' weights. This can be one of:
  294. #' \itemize{
  295. #' \item{A string, specifying the name of a dimension reduction present in
  296. #' all objects to be integrated}
  297. #' \item{A vector of strings, specifying the name of a dimension reduction to
  298. #' use for each object to be integrated}
  299. #' \item{A vector of \code{\link[SeuratObject]{DimReduc}} objects, specifying the object to
  300. #' use for each object in the integration}
  301. #' \item{NULL, in which case the full corrected space is used for computing
  302. #' anchor weights.}
  303. #' }
  304. #' @param ... Reserved for internal use
  305. #'
  306. #' @return When called on a TransferAnchorSet (from FindTransferAnchors), this
  307. #' will return the query object with the integrated embeddings stored in a new
  308. #' reduction. When called on an IntegrationAnchorSet (from IntegrateData), this
  309. #' will return a merged object with the integrated reduction stored.
  310. #'
  311. #' @rdname IntegrateEmbeddings
  312. #' @export IntegrateEmbeddings
  313. #'
  314. IntegrateEmbeddings <- function(anchorset, ...) {
  315. UseMethod(generic = "IntegrateEmbeddings", object = anchorset)
  316. }
  317. #' Leverage Score Calculation
  318. #'
  319. #' This function computes the leverage scores for a given object
  320. #' It uses the concept of sketching and random projections. The function provides an approximation
  321. #' to the leverage scores using a scalable method suitable for large matrices.
  322. #'
  323. #' @param object A matrix-like object
  324. #' @param ... Arguments passed to other methods
  325. #'
  326. #' @references Clarkson, K. L. & Woodruff, D. P.
  327. #' Low-rank approximation and regression in input sparsity time.
  328. #' JACM 63, 1–45 (2017). \doi{10.1145/3019134};
  329. #'
  330. #' @export
  331. #'
  332. LeverageScore <- function(object, ...) {
  333. UseMethod(generic = 'LeverageScore', object = object)
  334. }
  335. #' Normalize Raw Data
  336. #'
  337. #' @param data Matrix with the raw count data
  338. #' @param scale.factor Scale the data; default is \code{1e4}
  339. #' @param margin Margin to normalize over
  340. #' @param verbose Print progress
  341. #'
  342. #' @return A matrix with the normalized and log-transformed data
  343. #'
  344. #' @template param-dotsm
  345. #'
  346. #' @export
  347. #' @concept preprocessing
  348. #'
  349. #' @examples
  350. #' mat <- matrix(data = rbinom(n = 25, size = 5, prob = 0.2), nrow = 5)
  351. #' mat
  352. #' mat_norm <- LogNormalize(data = mat)
  353. #' mat_norm
  354. #'
  355. LogNormalize <- function(
  356. data,
  357. scale.factor = 1e4,
  358. margin = 2L,
  359. verbose = TRUE,
  360. ...
  361. ) {
  362. UseMethod(generic = 'LogNormalize', object = data)
  363. }
  364. #' Metric for evaluating mapping success
  365. #'
  366. #' This metric was designed to help identify query cells that aren't well
  367. #' represented in the reference dataset. The intuition for the score is that we
  368. #' are going to project the query cells into a reference-defined space and then
  369. #' project them back onto the query. By comparing the neighborhoods before and
  370. #' after projection, we identify cells who's local neighborhoods are the most
  371. #' affected by this transformation. This could be because there is a population
  372. #' of query cells that aren't present in the reference or the state of the cells
  373. #' in the query is significantly different from the equivalent cell type in the
  374. #' reference.
  375. #'
  376. #' @param anchors Set of anchors
  377. #' @param ... Arguments passed to other methods
  378. #'
  379. #' @rdname MappingScore
  380. #' @export MappingScore
  381. #'
  382. MappingScore <- function(anchors, ...) {
  383. UseMethod(generic = "MappingScore", object = anchors)
  384. }
  385. #' Normalize Data
  386. #'
  387. #' Normalize the count data present in a given assay.
  388. #'
  389. #' @param object An object
  390. #' @param ... Arguments passed to other methods
  391. #'
  392. #' @return Returns object after normalization
  393. #'
  394. #' @rdname NormalizeData
  395. #' @export NormalizeData
  396. #'
  397. NormalizeData <- function(object, ...) {
  398. UseMethod(generic = 'NormalizeData', object = object)
  399. }
  400. #' Project query data to the reference dimensional reduction
  401. #'
  402. #'
  403. #' @param query An object for query cells
  404. #' @param reference An object for reference cells
  405. #' @param query.assay Assay name for query object
  406. #' @param reference.assay Assay name for reference object
  407. #' @param reduction Name of dimensional reduction from reference object
  408. #' @param dims Dimensions used for reference dimensional reduction
  409. #' @param scale Determine if scale query data based on reference data variance
  410. #' @param verbose Print progress
  411. #' @param feature.mean Mean of features in reference
  412. #' @param feature.sd Standard variance of features in reference
  413. #'
  414. #' @return A matrix with projected cell embeddings
  415. #'
  416. #' @rdname ProjectCellEmbeddings
  417. #' @export ProjectCellEmbeddings
  418. #'
  419. #' @keywords internal
  420. #'
  421. ProjectCellEmbeddings <- function(
  422. query,
  423. ...
  424. ) {
  425. UseMethod(generic = 'ProjectCellEmbeddings', object = query)
  426. }
  427. #' Project query into UMAP coordinates of a reference
  428. #'
  429. #' This function will take a query dataset and project it into the coordinates
  430. #' of a provided reference UMAP. This is essentially a wrapper around two steps:
  431. #' \itemize{
  432. #' \item{FindNeighbors - Find the nearest reference cell neighbors and their
  433. #' distances for each query cell.}
  434. #' \item{RunUMAP - Perform umap projection by providing the neighbor set
  435. #' calculated above and the umap model previously computed in the reference.}
  436. #' }
  437. #'
  438. #' @param query Query dataset
  439. #'
  440. #' @rdname ProjectUMAP
  441. #' @export ProjectUMAP
  442. #'
  443. ProjectUMAP <- function(query, ...) {
  444. UseMethod(generic = "ProjectUMAP", object = query)
  445. }
  446. #' Pseudobulk Expression
  447. #'
  448. #' Normalize the count data present in a given assay.
  449. #'
  450. #' @param object An assay
  451. #' @param ... Arguments passed to other methods
  452. #'
  453. #' @return Returns object after normalization
  454. #'
  455. #' @rdname PseudobulkExpression
  456. #' @export PseudobulkExpression
  457. #' @concept utilities
  458. #'
  459. PseudobulkExpression <- function(object, ...) {
  460. UseMethod(generic = "PseudobulkExpression", object = object)
  461. }
  462. #' Perform Canonical Correlation Analysis
  463. #'
  464. #' Runs a canonical correlation analysis using a diagonal implementation of CCA.
  465. #' For details about stored CCA calculation parameters, see
  466. #' \code{PrintCCAParams}.
  467. #' @param object1 First Seurat object
  468. #' @param object2 Second Seurat object.
  469. # @param ... Arguments passed to other methods
  470. #'
  471. #' @return Returns a combined Seurat object with the CCA results stored.
  472. #'
  473. #' @seealso \code{\link[SeuratObject]{merge.Seurat}}
  474. #'
  475. #' @examples
  476. #' \dontrun{
  477. #' data("pbmc_small")
  478. #' pbmc_small
  479. #' # As CCA requires two datasets, we will split our test object into two just for this example
  480. #' pbmc1 <- subset(pbmc_small, cells = colnames(pbmc_small)[1:40])
  481. #' pbmc2 <- subset(pbmc_small, cells = colnames(x = pbmc_small)[41:80])
  482. #' pbmc1[["group"]] <- "group1"
  483. #' pbmc2[["group"]] <- "group2"
  484. #' pbmc_cca <- RunCCA(object1 = pbmc1, object2 = pbmc2)
  485. #' # Print results
  486. #' print(x = pbmc_cca[["cca"]])
  487. #' }
  488. #'
  489. #' @rdname RunCCA
  490. #' @export RunCCA
  491. #'
  492. RunCCA <- function(object1, object2, ...) {
  493. UseMethod(generic = 'RunCCA', object = object1)
  494. }
  495. #' Run Graph Laplacian Eigendecomposition
  496. #'
  497. #' Run a graph laplacian dimensionality reduction. It is used as a low
  498. #' dimensional representation for a cell-cell graph. The input graph
  499. #' should be symmetric
  500. #'
  501. #' @param object A Seurat object
  502. #' @param ... Arguments passed to
  503. #' \code{\link[RSpectra:eigs_sym]{RSpectra::eigs_sym}}
  504. #'
  505. #' @return Returns Seurat object with the Graph laplacian eigenvector
  506. #' calculation stored in the reductions slot
  507. #'
  508. #' @rdname RunGraphLaplacian
  509. #' @export RunGraphLaplacian
  510. #'
  511. RunGraphLaplacian <- function(object, ...) {
  512. UseMethod(generic = 'RunGraphLaplacian', object = object)
  513. }
  514. #' Run Independent Component Analysis on gene expression
  515. #'
  516. #' Run fastica algorithm from the ica package for ICA dimensionality reduction.
  517. #' For details about stored ICA calculation parameters, see
  518. #' \code{PrintICAParams}.
  519. #'
  520. #' @param object Seurat object
  521. #'
  522. #' @rdname RunICA
  523. #' @export RunICA
  524. #'
  525. RunICA <- function(object, ...) {
  526. UseMethod(generic = "RunICA", object = object)
  527. }
  528. #' Run Linear Discriminant Analysis
  529. #'
  530. #'
  531. #' @param object An object
  532. #' @param ... Arguments passed to other methods
  533. #'
  534. #' @rdname RunLDA
  535. #' @export RunLDA
  536. #'
  537. #' @aliases RunLDA
  538. #'
  539. RunLDA <- function(object, ...) {
  540. UseMethod(generic = 'RunLDA', object = object)
  541. }
  542. #' Run Principal Component Analysis
  543. #'
  544. #' Run a PCA dimensionality reduction. For details about stored PCA calculation
  545. #' parameters, see \code{PrintPCAParams}.
  546. #'
  547. #' @param object An object
  548. #' @param ... Arguments passed to other methods and IRLBA
  549. #'
  550. #' @return Returns Seurat object with the PCA calculation stored in the reductions slot
  551. #'
  552. #' @export
  553. #'
  554. #' @rdname RunPCA
  555. #' @export RunPCA
  556. #'
  557. RunPCA <- function(object, ...) {
  558. UseMethod(generic = 'RunPCA', object = object)
  559. }
  560. #' Run Supervised Latent Semantic Indexing
  561. #'
  562. #' Run a supervised LSI (SLSI) dimensionality reduction supervised by a
  563. #' cell-cell kernel. SLSI is used to capture a linear transformation of peaks
  564. #' that maximizes its dependency to the given cell-cell kernel.
  565. #'
  566. #' @param object An object
  567. #' @param ... Arguments passed to IRLBA irlba
  568. #'
  569. #' @return Returns Seurat object with the SLSI calculation stored in the
  570. #' reductions slot
  571. #'
  572. #' @export
  573. #'
  574. #' @rdname RunSLSI
  575. #' @export RunSLSI
  576. #'
  577. RunSLSI <- function(object, ...) {
  578. UseMethod(generic = 'RunSLSI', object = object)
  579. }
  580. #' Run Supervised Principal Component Analysis
  581. #'
  582. #' Run a supervised PCA (SPCA) dimensionality reduction supervised by a cell-cell kernel.
  583. #' SPCA is used to capture a linear transformation which maximizes its dependency to
  584. #' the given cell-cell kernel. We use SNN graph as the kernel to supervise the linear
  585. #' matrix factorization.
  586. #'
  587. #' @param object An object
  588. #' @param ... Arguments passed to other methods and IRLBA
  589. #'
  590. #' @return Returns Seurat object with the SPCA calculation stored in the reductions slot
  591. #' @references Barshan E, Ghodsi A, Azimifar Z, Jahromi MZ.
  592. #' Supervised principal component analysis: Visualization, classification and
  593. #' regression on subspaces and submanifolds.
  594. #' Pattern Recognition. 2011 Jul 1;44(7):1357-71. \url{doi:10.1016/j.patcog.2010.12.015};
  595. #' @export
  596. #'
  597. #' @rdname RunSPCA
  598. #' @export RunSPCA
  599. #'
  600. RunSPCA <- function(object, ...) {
  601. UseMethod(generic = 'RunSPCA', object = object)
  602. }
  603. #' Run t-distributed Stochastic Neighbor Embedding
  604. #'
  605. #' Run t-SNE dimensionality reduction on selected features. Has the option of
  606. #' running in a reduced dimensional space (i.e. spectral tSNE, recommended),
  607. #' or running based on a set of genes. For details about stored TSNE calculation
  608. #' parameters, see \code{PrintTSNEParams}.
  609. #'
  610. #' @param object Seurat object
  611. #' @param ... Arguments passed to other methods and to t-SNE call (most commonly used is perplexity)
  612. #'
  613. #' @rdname RunTSNE
  614. #' @export RunTSNE
  615. #'
  616. RunTSNE <- function(object, ...) {
  617. UseMethod(generic = 'RunTSNE', object = object)
  618. }
  619. #' Run UMAP
  620. #'
  621. #' Runs the Uniform Manifold Approximation and Projection (UMAP) dimensional
  622. #' reduction technique. To run using \code{umap.method="umap-learn"}, you must
  623. #' first install the umap-learn python package (e.g. via
  624. #' \code{pip install umap-learn}). Details on this package can be
  625. #' found here: \url{https://github.com/lmcinnes/umap}. For a more in depth
  626. #' discussion of the mathematics underlying UMAP, see the ArXiv paper here:
  627. #' \url{https://arxiv.org/abs/1802.03426}.
  628. #'
  629. #' @param object An object
  630. #' @param ... Arguments passed to other methods and UMAP
  631. #'
  632. #' @return Returns a Seurat object containing a UMAP representation
  633. #'
  634. #' @references McInnes, L, Healy, J, UMAP: Uniform Manifold Approximation and
  635. #' Projection for Dimension Reduction, ArXiv e-prints 1802.03426, 2018
  636. #'
  637. #' @export
  638. #'
  639. #' @examples
  640. #' \dontrun{
  641. #' data("pbmc_small")
  642. #' pbmc_small
  643. #' # Run UMAP map on first 5 PCs
  644. #' pbmc_small <- RunUMAP(object = pbmc_small, dims = 1:5)
  645. #' # Plot results
  646. #' DimPlot(object = pbmc_small, reduction = 'umap')
  647. #' }
  648. #'
  649. #' @rdname RunUMAP
  650. #' @export RunUMAP
  651. #'
  652. RunUMAP <- function(object, ...) {
  653. UseMethod(generic = 'RunUMAP', object = object)
  654. }
  655. #' Scale and center the data.
  656. #'
  657. #' Scales and centers features in the dataset. If variables are provided in vars.to.regress,
  658. #' they are individually regressed against each feature, and the resulting residuals are
  659. #' then scaled and centered.
  660. #'
  661. #' ScaleData now incorporates the functionality of the function formerly known
  662. #' as RegressOut (which regressed out given the effects of provided variables
  663. #' and then scaled the residuals). To make use of the regression functionality,
  664. #' simply pass the variables you want to remove to the vars.to.regress parameter.
  665. #'
  666. #' Setting center to TRUE will center the expression for each feature by subtracting
  667. #' the average expression for that feature. Setting scale to TRUE will scale the
  668. #' expression level for each feature by dividing the centered feature expression
  669. #' levels by their standard deviations if center is TRUE and by their root mean
  670. #' square otherwise.
  671. #'
  672. #' @param object An object
  673. #' @param ... Arguments passed to other methods
  674. #'
  675. #' @rdname ScaleData
  676. #' @export ScaleData
  677. #'
  678. ScaleData <- function(object, ...) {
  679. UseMethod(generic = 'ScaleData', object = object)
  680. }
  681. #' Get image scale factors
  682. #'
  683. #' @param object An object to get scale factors from
  684. #' @param ... Arguments passed to other methods
  685. #'
  686. #' @return An object of class \code{scalefactors}
  687. #'
  688. #' @rdname ScaleFactors
  689. #' @export ScaleFactors
  690. #'
  691. ScaleFactors <- function(object, ...) {
  692. UseMethod(generic = 'ScaleFactors', object = object)
  693. }
  694. #' Compute Jackstraw scores significance.
  695. #'
  696. #' Significant PCs should show a p-value distribution that is
  697. #' strongly skewed to the left compared to the null distribution.
  698. #' The p-value for each PC is based on a proportion test comparing the number
  699. #' of features with a p-value below a particular threshold (score.thresh), compared with the
  700. #' proportion of features expected under a uniform distribution of p-values.
  701. #'
  702. #' @param object An object
  703. #' @param ... Arguments passed to other methods
  704. #'
  705. #' @return Returns a Seurat object
  706. #'
  707. #' @author Omri Wurtzel
  708. #' @seealso \code{\link{JackStrawPlot}}
  709. #'
  710. #' @rdname ScoreJackStraw
  711. #' @export ScoreJackStraw
  712. #'
  713. ScoreJackStraw <- function(object, ...) {
  714. UseMethod(generic = 'ScoreJackStraw', object = object)
  715. }
  716. #' Perform sctransform-based normalization
  717. #' @param object An object
  718. #' @param ... Arguments passed to other methods (not used)
  719. #'
  720. #' @rdname SCTransform
  721. #' @export SCTransform
  722. #'
  723. SCTransform <- function(object, ...) {
  724. UseMethod(generic = 'SCTransform', object = object)
  725. }
  726. #' Get SCT results from an Assay
  727. #'
  728. #' Pull the \code{\link{SCTResults}} information from an \code{\link{SCTAssay}}
  729. #' object.
  730. #'
  731. #' @param object An object
  732. #' @param ... Arguments passed to other methods (not used)
  733. #'
  734. #' @rdname SCTResults
  735. #' @export SCTResults
  736. #'
  737. SCTResults <- function(object, ...) {
  738. UseMethod(generic = 'SCTResults', object = object)
  739. }
  740. #' Get the Pearson residuals from an sctransform-normalized dataset.
  741. #'
  742. #' @param object An object
  743. #' @param ... Arguments passed to other methods (not used)
  744. #'
  745. #' @rdname FetchResiduals
  746. #' @export FetchResiduals
  747. #'
  748. FetchResiduals <- function(object, ...) {
  749. UseMethod(generic = 'FetchResiduals', object = object)
  750. }
  751. #' @param value new data to set
  752. #'
  753. #' @rdname SCTResults
  754. #' @export SCTResults<-
  755. #'
  756. "SCTResults<-" <- function(object, ..., value) {
  757. UseMethod(generic = 'SCTResults<-', object = object)
  758. }
  759. #' Variance Stabilizing Transformation
  760. #'
  761. #' Apply variance stabilizing transformation for selection of variable features
  762. #'
  763. #' @inheritParams stats::loess
  764. #' @param data A matrix-like object
  765. #' @param margin Unused
  766. #' @param nselect Number of of features to select
  767. #' @param clip Upper bound for values post-standardization; defaults to the
  768. #' square root of the number of cells
  769. #' @param verbose ...
  770. #'
  771. #' @template param-dotsm
  772. #'
  773. #' @return A data frame with the following columns:
  774. #' \itemize{
  775. #' \item \dQuote{\code{mean}}: ...
  776. #' \item \dQuote{\code{variance}}: ...
  777. #' \item \dQuote{\code{variance.expected}}: ...
  778. #' \item \dQuote{\code{variance.standardized}}: ...
  779. #' \item \dQuote{\code{variable}}: \code{TRUE} if the feature selected as
  780. #' variable, otherwise \code{FALSE}
  781. #' \item \dQuote{\code{rank}}: If the feature is selected as variable, then how
  782. #' it compares to other variable features with lower ranks as more variable;
  783. #' otherwise, \code{NA}
  784. #' }
  785. #'
  786. #' @rdname VST
  787. #' @export VST
  788. #'
  789. #' @keywords internal
  790. #'
  791. VST <- function(
  792. data,
  793. margin = 1L,
  794. nselect = 2000L,
  795. span = 0.3,
  796. clip = NULL,
  797. ...
  798. ) {
  799. UseMethod(generic = 'VST', object = data)
  800. }

generics.R at commit 586015a, under other · at the source

Overview

Authors: Yuwen Wen1, Ya-nan Dou2, Xiaohong Chen1, Xiuxing Liu1, Zhenlan Yang1, Yingting Zhu1, Zhidong Li1, Caibin Deng1, Ye Deng1, Wenru Su3, Yehong Zhuo1
  1. State Key Laboratory of Ophthalmology, Zhongshan Ophthalmic Center, Guangdong Provincial Key Laboratory of Ophthalmology and Visual Science, Sun Yat-sen University, Guangzhou, 510060 China
  2. Department of Neurosurgery, Xijing Hospital, Air Force Military Medical University, Xi’an, 710032 China
  3. Department of Ophthalmology, Shanghai Key Laboratory of Orbital Diseases and Ocular Oncology, Shanghai Ninth People’s Hospital, Shanghai Jiao Tong University School of Medicine, Shanghai, 200011 China
Journal: Journal of neuroinflammation, volume 23, issue 1, article 206
Dates: received 3 November 2025; accepted 22 April 2026; published online 2 May 2026
Type: Research article · Language: English
License: CC BY-NC-ND
Identifiers: DOI 10.1186/s12974-026-03838-8 · PMID 42069589 · PMCID PMC13281619 · OpenAlex W7159953270
Open access: gold, a free copy (OpenAlex)
Status: code verified
Categories: genetics / omics (modality), mouse (organism), cellular / molecular (subfield)
Methods: Statistics
Keywords: Retinal ischemia and reperfusion, Acarbose, Immunometabolism, Microglia, Pkm2, Acetylation
MeSH: Microglia*, Pyruvate Kinase*, Reperfusion Injury*, Retinal Ganglion Cells*, Retinal Neurons*, Thyroid Hormones*, Acetylation, Animals, Male, Mice, Mice, Inbred C57BL (* major topic)
Topic: Neuroinflammation and Neurodegeneration Mechanisms (Neurology, Neuroscience), according to OpenAlex
Funding: Guangdong Basic Research Center of Excellence for Major Blinding Eye Diseases Prevention and Treatment (2024-PIZC-022); National Natural Science Foundation of China (82401720, 32571061, 82171057); Youth Science Fund Project (82525019); Basic and Applied Basic Research Foundation of Guangdong Province (2024A1515013058)
Citations: cited by 1 paper (Europe PMC); 89 references in the paper
Research resources: The mouse BV2 cells line RRID:CVCL_0182

Abstract

The abstract is not reproduced here: the paper's license (CC BY-NC-ND) does not allow it. Read it in the paper, at the publisher or on Europe PMC.

Repository

Its files are read in the Code ↔ Paper reader above, with 2 matches between paragraphs and lines of code.

satijalab/seurat

License: other
State: the link answers, verified on 27 September 2026
Evidence: files inventoried
Commit: 586015abde10618ecb32d3fe632267a83317a08d, 21 September 2026
Languages: R (114), C++ (8), C/C++ (4), C (1)
Size: 455 files, 127 scripts
Software Heritage: archived
Found in: the text, “ScRNA-seq analysis”
Holds: README, license file, environment (DESCRIPTION), tests, continuous integration, documentation, 70 notebooks
Not found: CITATION.cff
Tools: Seurat (75 files), ggplot2 (48 files), patchwork (27 files), tidyverse (19 files), cowplot (10 files), reshape2 (3 files), SingleCellExperiment (3 files), Plotly (2 files), data.table (1 file), DESeq2 (1 file), Harmony (1 file), igraph (1 file), limma (1 file), Monocle 3 (1 file), reticulate (1 file), UMAP (1 file)
Availability: 1 check, the latest on 27 September 2026: the link answers
  • 27 September 2026: the link answers
130 files

Tracing map

Proposed by the machine: these links were found in the paper and verified at the source, without human review. The map will receive a Zenodo DOI once one of the paper's authors has validated it with their ORCID.

What the map holds:

  • 1 repository of the authors' code, each at its verified commit, with its license and how the link was found in the paper;
  • 127 scripts, each with its path and the digest of its content;
  • 2 matches between paragraphs of the paper and lines of the code (method lexical-v1);
  • neither the text of the paper nor the code itself.

Its JSON (tracing-map.json) is deposited on Zenodo with its DOI once the map is validated.

Data

No dataset and no data link were found in the paper.

Data availability statement

The paper has a data availability statement. Its license (CC BY-NC-ND) does not allow reproducing it here; in short, from what the harvester recognized in it:

  • it says that the data are available on request

Read it in the paper: doi.org/10.1186/s12974-026-03838-8.

Versions

The history of this record: each version stored by the harvester or made by a correction of its authors or of the maintainers of its code, and what changed in its facts. The texts of the paper (its abstract, its availability statements) are not part of it; versions that changed only those are not listed.

Version 1, 28 September 2026: the first record

Recorded: type, language, journal, volume, issue, pages, dates, 11 authors, 6 keywords, 11 MeSH terms, 4 funders, 89 references, 1 RRID.

Cite

This paper

Wen, Y., Dou, Y.-n., Chen, X., Liu, X., Yang, Z., Zhu, Y., Li, Z., Deng, C., Deng, Y., Su, W., & Zhuo, Y. (2026). Acarbose modulates microglial Pkm2 acetylation to reshape immunometabolism and preserve retinal neurons after ischemia-reperfusion. Journal of neuroinflammation, 23(1), 206. https://doi.org/10.1186/s12974-026-03838-8

BibTeX

@article{wen2026acarbose,
author = {Wen, Yuwen and Dou, Ya-nan and Chen, Xiaohong and Liu, Xiuxing and Yang, Zhenlan and Zhu, Yingting and Li, Zhidong and Deng, Caibin and Deng, Ye and Su, Wenru and Zhuo, Yehong},
title = {{Acarbose modulates microglial Pkm2 acetylation to reshape immunometabolism and preserve retinal neurons after ischemia-reperfusion}},
journal = {Journal of neuroinflammation},
year = {2026},
month = may,
volume = {23},
number = {1},
pages = {206},
publisher = {BMC},
issn = {1742-2094},
doi = {10.1186/s12974-026-03838-8},
url = {https://doi.org/10.1186/s12974-026-03838-8},
pmid = {42069589},
pmcid = {PMC13281619}
}

RIS

TY - JOUR
AU - Wen, Yuwen
AU - Dou, Ya-nan
AU - Chen, Xiaohong
AU - Liu, Xiuxing
AU - Yang, Zhenlan
AU - Zhu, Yingting
AU - Li, Zhidong
AU - Deng, Caibin
AU - Deng, Ye
AU - Su, Wenru
AU - Zhuo, Yehong
TI - Acarbose modulates microglial Pkm2 acetylation to reshape immunometabolism and preserve retinal neurons after ischemia-reperfusion
T2 - Journal of neuroinflammation
J2 - J Neuroinflammation
PY - 2026
DA - 2026/05/02
VL - 23
IS - 1
SP - 206
SN - 1742-2094
PB - BMC
DO - 10.1186/s12974-026-03838-8
UR - https://doi.org/10.1186/s12974-026-03838-8
LA - en
ER -

CSL-JSON

{
"id": "10.1186/s12974-026-03838-8",
"type": "article-journal",
"title": "Acarbose modulates microglial Pkm2 acetylation to reshape immunometabolism and preserve retinal neurons after ischemia-reperfusion",
"container-title": "Journal of neuroinflammation",
"author": [
{
"family": "Wen",
"given": "Yuwen"
},
{
"family": "Dou",
"given": "Ya-nan"
},
{
"family": "Chen",
"given": "Xiaohong"
},
{
"family": "Liu",
"given": "Xiuxing"
},
{
"family": "Yang",
"given": "Zhenlan"
},
{
"family": "Zhu",
"given": "Yingting"
},
{
"family": "Li",
"given": "Zhidong"
},
{
"family": "Deng",
"given": "Caibin"
},
{
"family": "Deng",
"given": "Ye"
},
{
"family": "Su",
"given": "Wenru"
},
{
"family": "Zhuo",
"given": "Yehong"
}
],
"container-title-short": "J Neuroinflammation",
"volume": "23",
"issue": "1",
"page": "206",
"DOI": "10.1186/s12974-026-03838-8",
"PMID": "42069589",
"PMCID": "PMC13281619",
"ISSN": "1742-2094",
"publisher": "BMC",
"URL": "https://doi.org/10.1186/s12974-026-03838-8",
"language": "en",
"issued": {
"date-parts": [
[
2026,
5,
2
]
]
}
}

The tracing map gets a citation of its own once an author has validated it and it has a DOI.

Similar papers

The papers with a page that share the most with this one: the tools found in their code, their categories, datasets, cited references and authors, the rarest counting most.

[1] doi:10.1002/imt2.70163 [code]
Spatial multi-omics unveils sphingolipid metabolic reprogramming within the retinal pathological niche.
Journal: iMeta
In common: Monocle 3, Harmony, SingleCellExperiment, 11 other tools, genetics / omics, mouse, cellular / molecular, 4 references
[2] doi:10.1002/ctm2.70683 [code]
Niacin promotes motor function recovery after spinal cord injury via Hcar2-dependent microglia immunometabolic regulation.
Journal: Clinical and translational medicine
In common: Monocle 3, Harmony, SingleCellExperiment, 13 other tools, genetics / omics, mouse, cellular / molecular, 2 references
[3] doi:10.7554/elife.93640 [code]
Sibling chimerism among microglia in marmosets.
Journal: eLife
In common: Monocle 3, Harmony, SingleCellExperiment, 13 other tools, genetics / omics, cellular / molecular
[4] doi:10.1038/s41420-026-02971-w [code]
Multi-omics reveals heterogeneity and functional populations of oligodendrocyte progenitor cells induced by human neural stem cells.
Journal: Cell death discovery
In common: Monocle 3, Harmony, SingleCellExperiment, 13 other tools, genetics / omics, cellular / molecular
[5] doi:10.1038/s44318-026-00818-9 [code]
FAM134B-mediated ER-phagy degrades APP and suppresses Alzheimer's disease pathology.
Journal: The EMBO journal
In common: Monocle 3, Harmony, SingleCellExperiment, 13 other tools, mouse, cellular / molecular
[6] doi:10.1016/j.xcrm.2026.102766 [code]
A longitudinal single-cell and spatial multiomic atlas of pediatric high-grade glioma.
Journal: Cell reports. Medicine
In common: Monocle 3, Harmony, SingleCellExperiment, 12 other tools, genetics / omics, cellular / molecular, 1 reference
[7] doi:10.1038/s41593-026-02367-0 [code]
A reproducible three-dimensional model of human brain tissue to investigate physiological and disease-associated microglia phenotypes.
Journal: Nature neuroscience
In common: Monocle 3, Harmony, SingleCellExperiment, 11 other tools, cellular / molecular, 1 reference
[8] doi:10.1016/j.xcrm.2026.102651 [code]
Integrative CSF profiling identifies disease-specific immune responses in leptomeningeal disease.
Journal: Cell reports. Medicine
In common: Harmony, SingleCellExperiment, reticulate, 11 other tools, genetics / omics, cellular / molecular
[9] doi:10.3390/ijms27104466 [code]
Uncovering the Key Circuit FOSL2/FOS/EGR3/EGR1, Contributing to the Hyperexcitability of Excitatory Neurons in the Epileptic Temporal Cortex and Hippocampus.
Journal: International journal of molecular sciences
In common: Monocle 3, reticulate, limma, 10 other tools, genetics / omics, 1 reference
[10] doi:10.1038/s41586-026-10214-2 [code]
Multidimensional profiling of heterogeneity in supratentorial ependymomas.
Journal: Nature
In common: Monocle 3, Harmony, SingleCellExperiment, 10 other tools, genetics / omics, mouse

Contribute

The authors of this paper can claim it, correct its record and validate its tracing map, and the maintainers of its code (its owner, or a public member of its organization) correct what it says of their repository; anyone signed in can ask for its removal. Every request goes to OSCR's own machine, which answers it; your account page follows them.

Sign in with ORCID to claim this paper as one of its authors, correct its record or validate its tracing map: when the paper's metadata lists your ORCID iD, you are recognized at once. Maintainers of its code: sign in with GitHub, then claim the repository on your account page.

Request its removal

To ask OSCR to remove this record, the copies of its authors' scripts or its tracing map, use the removal request page: signed in, you say who you are, what to remove and why, then review and confirm the request. Published rules decide every request (how).

Discussion, reproductions, activity

Discussion: questions and error reports about this paper and its code, from signed-in readers and its authors. It opens with sign-in.

Reproductions: reports from readers who ran the authors' code: what they reproduced, with which environment, commit and data. It opens with sign-in.

Activity: what happens around this paper: new versions of its record, its map's validation, discussions and reproductions. It opens with sign-in.