Single Cell Pathway Analysis (SCPA)
website·Indexed 30 days ago
https://jackbibby1.github.io/SCPA//index.htmlAn R package for comparing gene sets and pathways in single-cell data. It provides tools to extract data from Seurat and SingleCellExperiment objects, create pathway matrices, and perform pathway comparisons. The package includes visualization functions such as plot_heatmap and plot_rank to analyze q-values and pathway rankings.
What's inside SCPA
- SCPA is a method for pathway analysis in single-cell RNA-seq data. Unlike traditional methods that rely on gene enrichment or over-representation, SCPA defines pathway activity as a change in the multivariate distribution of a pathway across conditions. This allows for the identification of pathways that show transcriptional changes independent of overall enrichment. SCPA supports multisample testing (e.g., comparing multiple time points or pseudotime trajectory phases) and can be applied to Seurat objects, SingleCellExperiment (SCE) objects, or manually subsetted expression matrices.
Overview of Single Cell Pathway Analysis (SCPA)
SCPA is a method for pathway analysis in single-cell RNA-seq data. Unlike traditional methods that rely on gene enrichment or over-representation, SCPA defines pathway activity as a change in the multivariate distribution of a given pathway across conditions. This allows for the identification of pathways that show transcriptional changes independent of overall enrichment. SCPA supports multisample testing (e.g., comparing multiple time points or pseudotime trajectories) and can be applied to Seurat objects, SingleCellExperiment (SCE) objects, or manually subsetted expression matrices.Overview of Single Cell Pathway Analysis (SCPA)
SCPA is a method for pathway analysis in single-cell RNA-seq data. Unlike traditional methods that rely on gene enrichment or over-representation, SCPA defines pathway activity as a change in the multivariate distribution of a pathway across conditions. This allows for the identification of pathways that show transcriptional changes independent of overall enrichment. SCPA supports multisample testing (e.g., comparing multiple time points or pseudotime trajectories) and is compatible with Seurat objects, SingleCellExperiment (SCE) objects, and manually subsetted expression matrices.Understand GNU General Public License (GPL) v3 basic permissions
The GNU GPL v3 is a copyleft license that guarantees the freedom to share and change software. It provides irrevocable permission to run unmodified programs and allows users to make, run, and propagate covered works that are not conveyed to others without conditions. If a user conveys (distributes) the software, they must pass on the same freedoms to the recipients, including providing access to the source code and the license terms. Sublicensing is not permitted.Understand the GNU General Public License v3 (GPLv3) Overview
The GNU General Public License v3 is a free, copyleft license designed to guarantee the freedom to share and change all versions of a program. It ensures that software remains free for all users by requiring that any distributed copies or modified versions pass on the same freedoms to recipients, including access to the source code. Key protections include prohibiting the use of software patents to make the program non-free and preventing manufacturers from blocking users from installing modified software versions on their devices.Apply GNU GPL v3 to a new software project
To license a new program under the GNU General Public License v3, you must attach specific notices to the program. The safest method is to place these notices at the start of every source file. Each file must contain at least the copyright line and a pointer to the full license notice.<one line to give the program's name and a brief idea of what it does.> Copyright (C) <year> <name of author> This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses/>.Example: Subset Seurat data by Hour and Cell Type
This example demonstrates how to extract an expression matrix for CD4 cells collected at hour 12 from a Seurat object.cd4 <- seurat_extract( Seurat_Object, meta1 = "Hour", value_meta1 = 12, meta2 = "Cell_Type", value_meta2 = "CD4" )Requirements for conveying verbatim copies of GPLv3 software
To convey verbatim copies of the Program's source code, you must:
- Conspicuously and appropriately publish an appropriate copyright notice on each copy.
- Keep all notices intact that state this License and any non-permissive terms added under section 7 apply to the code.
- Keep all notices of the absence of any warranty intact.
- Provide all recipients with a copy of the GPLv3 License along with the Program.
You may charge a fee for each copy or offer support and warranty protection for a fee.
Guidelines for conveying non-source (object code) forms of GPLv3 software
If conveying a covered work in object code form, you must also provide the machine-readable Corresponding Source via one of these methods:
- Physical Medium: Accompany the object code in a physical product with the source on a durable physical medium.
- Written Offer: Accompany the object code in a physical product with a written offer (valid for at least 3 years) to provide the source on a physical medium for a reasonable cost or via a network server for free.
- Occasional Non-commercial: Convey individual copies of object code with a written offer, provided you received the object code with such an offer.
- Designated Place: Offer access to the object code and the Corresponding Source from the same designated place (e.g., a network server) at no further charge.
- Peer-to-Peer: Use P2P transmission, provided you inform peers where the object code and source are offered to the general public for free.
Installation Information requirements for GPLv3 User Products
For 'User Products' (consumer products used for personal/household purposes or designed for dwellings), if you convey object code as part of a transaction transferring possession in perpetuity or for a fixed term, you must provide Installation Information.
Installation Information includes the methods, procedures, authorization keys, or other data required to install and execute modified versions of the covered work in the User Product. This information must ensure that the continued functioning of the modified object code is not prevented solely because a modification was made.
Constraints:
- This does not apply if neither the conveyor nor a third party retains the ability to install modified object code (e.g., installed in ROM).
- It does not require providing ongoing support, warranties, or updates for modified works.
- The information must be in a publicly documented format and require no special password or key for unpacking, reading, or copying.
Use CSV files as gene sets in SCPA
SCPA can read CSV files formatted like classical GMT files: the first column must be the pathway name, and subsequent columns must contain the genes belonging to that pathway. You can provide the file path directly to thecompare_pathways()function.# Specify the path to the CSV gene set file pathways <- "path/to/geneset/file.csv" # Pass the path to compare_pathways scpa_out <- compare_pathways(samples = samples, pathways = pathways)Perform systems-level pathway comparison across cell types
To characterize pathway perturbations in a disease, you can loop thecompare_pathwaysfunction across different cell types. This involves extracting expression matrices for both healthy and disease states for each cell type and comparing them against a set of pathways (e.g., from MSigDB). For large datasets, parallel processing can be enabled using theparallel = TRUEandcores = xarguments.# Assume blood_atlas is a SplitObject by 'Status' (e.g., Healthy vs COVID) # pathways is a path to a CSV of gene sets scpa_out <- list() for (i in cell_types) { # Extract expression matrices for the specific cell type healthy <- seurat_extract(blood_atlas$Healthy, meta1 = "cell.type.fine", value_meta1 = i) covid <- seurat_extract(blood_atlas$COVID, meta1 = "cell.type.fine", value_meta1 = i) # Compare pathways and keep only Pathway and qval scpa_out[[i]] <- compare_pathways(list(healthy, covid), pathways) %>% select(Pathway, qval) %>% set_colnames(c("Pathway", paste(i, "qval", sep = "_"))) }