saeyslab / multinichenetr

MultiNicheNet: a flexible framework for differential cell-cell communication analysis from multi-sample multi-condition single-cell transcriptomics data
GNU General Public License v3.0
109 stars 14 forks source link

ERROR in less than 3 samples (basic_analysis_steps_MISC_SACL.knit.md). ERROR: get_DE_info_sampleAgnostic #80

Open tian6067 opened 1 month ago

tian6067 commented 1 month ago
contrasts_oi = c("'P-(A+B+C+D+T)/5','A-(P+B+C+D+T)/5','B-(A+P+C+D+T)/5','C-(A+B+P+D+T)/5','D-(A+B+C+P+T)/5','T-(A+B+C+D+P)/5'")
contrast_tbl = tibble(contrast = 
                        c("P-(A+B+C+D+T)/5","A-(P+B+C+D+T)/5", "B-(A+P+C+D+T)/5","C-(A+B+P+D+T)/5","D-(A+B+C+P+T)/5","T-(A+B+C+D+P)/5"), 
                      group = c("P","A","B","C","D","T"))
senders_oi = SummarizedExperiment::colData(sce)[,celltype_id] %>% unique()
receivers_oi = SummarizedExperiment::colData(sce)[,celltype_id] %>% unique()
sce = sce[, SummarizedExperiment::colData(sce)[,celltype_id] %in% 
            c(senders_oi, receivers_oi)
]
conditions_keep =c("P","A","B","C","D","T")
sce = sce[, SummarizedExperiment::colData(sce)[,group_id] %in% 
                             conditions_keep
             ]

DE_info = get_DE_info_sampleAgnostic(
  sce = sce, 
  group_id = group_id, celltype_id = celltype_id, 
  contrasts_oi = contrasts_oi, 
  expressed_df = frq_list$expressed_df, 
  min_cells = min_cells, 
  contrast_tbl = contrast_tbl)  

bug information: Error in assign(".effective_grid", effective_grid, envir = envir) : 'envir' Incorrect parameters

but it has something wrong when i run above code , i don't konw which step is wrong.can you help me to solve it issue:

tian6067 commented 1 month ago

The previous codes can all run normally, but an error occurs when calculating differentially expressed genes (get_DE_info_sampleAgnostic).

tian6067 commented 1 month ago

The detail information : sce: class: SingleCellExperiment dim: 15611 200474 metadata(0): assays(2): counts logcounts rownames(15611): A4GALT AAAS ... ZZEF1 ZZZ3 rowData names(0): colnames(200474): AAACCCAAGAGTGTGC-1_1 AAACCCAAGCACCAGA-1_1 ... TTTGTTGTCCTCTGCA-1_17 TTTGTTGTCGTTCTAT-1_17 colData names(16): orig.ident nCount_RNA ... cell ident reducedDimNames(1): PCA.FULL mainExpName: RNA altExpNames(0):

sample_id = "orig.ident"

group_id = "time" table(sce$time) A B C D P T 32108 29129 38452 33829 33313 33643

celltype_id = "cell" table(sce$cell) CEC LEC AT1 AT2 BASEL CIL GC SC TC AM B BPLA CD4 CD8 DC 6428 545 18701 101362 1873 5578 0 3958 1085 7714 3089 1610 9690 4268 0 MAST MON NEUT FIB MES SMC 848 14810 10777 2200 1303 4635

covariates = NA batches = NA

frq_list$expressed_df

A tibble: 477,128 × 3

Groups: gene [25,112]

celltype gene expressed

1 AM A1BG FALSE 2 AT1 A1BG FALSE 3 AT2 A1BG FALSE 4 B A1BG FALSE 5 BASEL A1BG FALSE 6 BPLA A1BG FALSE 7 CD4 A1BG FALSE 8 CD8 A1BG FALSE 9 CEC A1BG FALSE 10 CIL A1BG FALSE # ℹ 477,118 more rows # ℹ Use `print(n = ...)` to see more rows
browaeysrobin commented 1 week ago

Hi @tian6067

as a test: can you check whether running the DE analysis on your data works if you would only compare 2 conditions?

eg contrasts_oi = c("'P-A','A-P'"