SCPA icon indicating copy to clipboard operation
SCPA copied to clipboard

Issue with comapre_pathways

Open Achiraa opened this issue 1 year ago • 4 comments

> bm_neu[[i]] <- compare_pathways(list(marrow), pathways)

ERROR Using single core processing. Specify 'parallel = TRUE' and cores = x arguments for parallel processing

Cell numbers in population 1 = 1107

  • If greater than 500 cells, these populations will be downsampled

Excluding 1081 pathway(s) based on min/max genes parameter: BIOCARTA_ACE2_PATHWAY, BIOCARTA_ACETAMINOPHEN_PATHWAY, BIOCARTA_ACH_PATHWAY, BIOCARTA_ACTINY_PATHWAY, BIOCARTA_AGPCR_PATHWAY...

Calculating pathway fold changes...

Performing a two-sample analysis with SCPA... 0%Error in if (lowerpval < level) { : missing value where TRUE/FALSE needed

Achiraa avatar Jan 17 '25 18:01 Achiraa

Hi.

It looks like you're only supplying one population in marrow. You need to supply 2 or more populations for the comparison to run.

Jack

jackbibby1 avatar Jan 17 '25 18:01 jackbibby1

But when I did for Blood it worked perfectly.

> bl_neu[[i]] <- compare_pathways(list(blood), pathways)

Using single core processing. Specify 'parallel = TRUE' and cores = x arguments for parallel processing

Cell numbers in population 1 = 403

  • If greater than 500 cells, these populations will be downsampled

Excluding 1081 pathway(s) based on min/max genes parameter: BIOCARTA_ACE2_PATHWAY, BIOCARTA_ACETAMINOPHEN_PATHWAY, BIOCARTA_ACH_PATHWAY, BIOCARTA_ACTINY_PATHWAY, BIOCARTA_AGPCR_PATHWAY...

Calculating pathway fold changes...

Performing a two-sample analysis with SCPA... |==================================================| 100%

Achiraa avatar Jan 17 '25 20:01 Achiraa

Can you give me the code you're using to generate the blood and marrow objects?

jackbibby1 avatar Jan 17 '25 21:01 jackbibby1

setwd("C:/Users/S236282/Desktop/Itaconate data/CellChat/Pathway Analysis")

library(SCPA) library(msigdbr) library(Seurat) library(dplyr) library(ggplot2) library(multicross)

data_all <- readRDS("C:/Users/S236282/Desktop/Itaconate data/CellChat/seurat_annotation.rds")

head([email protected])

DimPlot(data_all) + theme(aspect.ratio = 1)

Visualize the data colored by tissue and location type

DimPlot(data_all, group.by = "type", split.by = "batch", ncol = 3) + theme(aspect.ratio = 1) + ggtitle("DimPlot Day 3: All Cell types within BM, BL, HO")

define all the pathways that we want to use

pws <- c("kegg", "reactome", "biocarta", "wiki", "pid") pathways <- msigdbr("Mus musculus") %>% filter(grepl(paste(pws, collapse = "|"), gs_subcat, ignore.case = T) | grepl("HALLMARK", x = gs_name, ignore.case = T)) %>% format_pathways()

#Data prep cell_types <- unique(data_all$type) split_location <- SplitObject(data_all, split.by = "batch")

#Pathway analysis across location

We first create empty lists to store results from the for loop

bl_neu <- list(); bm_neu <- list(); ho_neu <- list()

We extract expression data using seurat_extract based on location and cell type

Loop over cell types and only run analysis for "Neu"

for (i in cell_types) { # Extract expression data for neutrophils across locations blood <- seurat_extract(split_location$Blood, meta1 = "type", value_meta1 = "Neu") marrow <- seurat_extract(split_location$Marrow, meta1 = "type", value_meta1 = "Neu") ho <- seurat_extract(split_location$HO, meta1 = "type", value_meta1 = "Neu")

# Perform pathway comparisons for neutrophils
result_bl <- compare_pathways(list(blood), pathways)
result_bm <- compare_pathways(list(marrow[1:500,]), pathways)
result_ho <- compare_pathways(list(ho), pathways)

}

View(result_bl)

Image

Achiraa avatar Jan 17 '25 22:01 Achiraa