RGLab / MASTdata

Data for the MAST single-cell transcriptomics modeling and inference paper
0 stars 1 forks source link

Error in summary() of gseaAfterBoot() result #7

Open sofiapuvogelvittini opened 3 years ago

sofiapuvogelvittini commented 3 years ago

Hello, I am trying to do a GSEA with MAST on my own data but I am following the tutorial "Using MAST with RNASeq: MAIT Analysis"

I could conduct the GSEA with the function gsea = gseaAfterBoot() but then when I try to run summary(gsea) i get this error Error in names(dimnames(out3d)) <- c("set", "comp", "metric"): 'names' attribute [3] must be the same length as the vector [2] Traceback:

  1. summary(gsea, testType = "normal")
  2. summary(gsea, testType = "normal")
  3. as.data.table(reshape2::melt(calcZ(object, combined = "none", . ...)))
  4. reshape2::melt(calcZ(object, combined = "none", ...))
  5. calcZ(object, combined = "none", ...)

My code is:

sce_bsc<-readRDS(file="sce_bsc.rds") #is a single cell experiment cdr2 <-colSums(assay(sce_bsc)>0) colData(sce_bsc)$cngeneson <- scale(cdr2) tpm1<-calculateTPM(assay(sce_bsc, "counts"))+1 assay(sce_bsc, "tpm1")<-tpm1 log2tpm1<-log2(assay(sce_bsc, "tpm1")) assay(sce_bsc, "log2tpm1")<-log2tpm1 label <-"cell_type_x" #I want to run the GSEA on a particular cell type (x) sce_bsc_cell_type_x<-sce_bsc[,label==sce_bsc$labels_subclass] cond<-factor(colData(sce_bsc_cell_type_x)$group) cond<-relevel(cond,"A") colData(sce_bsc_cell_type_x)$group<-cond cond_sex<-factor(colData(sce_bsc_cell_type_x)$sex) colData(sce_bsc_cell_type_x)$sex<-cond_sex sca_sce<-SceToSingleCellAssay(sce_bsc_cell_type_x) zlmCond <- zlm(~group + cngeneson + sex, sca_sce, exprs_value = 'log2tpm1') #I want to test between two groups, A and B #and my covariates are cngeneson and sex boots <- bootVcov1(zlmCond, R = 50) gene_set_astro<-getGmt("activated_astro_gene_set.gmt") gene_ids_astro<-geneIds(gene_set_astro) set_indices_astro <- limma::ids2indices(gene_ids_astro, mcols(sca_sce)$Symbol) gsea <- gseaAfterBoot(zlmCond, boots, sets_indices_astro, CoefficientHypothesis("groupB"))

Until here everything looks fine but then when I run:

z_stat_comb <- summary(gsea, testType="normal")

I get the error Error in names(dimnames(out3d)) <- c("set", "comp", "metric"): 'names' attribute [3] must be the same length as the vector [2] Traceback:

  1. summary(gsea, testType = "normal")
  2. summary(gsea, testType = "normal")
  3. as.data.table(reshape2::melt(calcZ(object, combined = "none", . ...)))
  4. reshape2::melt(calcZ(object, combined = "none", ...))
  5. calcZ(object, combined = "none", ...)

Could you help me to understand what it means? Thank you very much for your time Sofia

gfinak commented 3 years ago

It's difficult to say without seeing your data object and debugging. The first thing you should try is to install the latest MAST version from here on github. There was a recent fix related to the length of coefficient vectors that was just pushed. As of right now, MAST is building and testing successfully on bioconductor: http://bioconductor.org/checkResults/devel/bioc-LATEST/ That tells me that if the latest version of MAST doesn't solve your problem, then this is something particular about your data. I'd like to help and fix it but I'd need to see the data to trace the issue. If you're not comfortable sharing the data, set, see if you can reproduce it with a subset of the data (fewer genes and samples).

sofiapuvogelvittini commented 3 years ago

Thank you very much for your reply. I am trying to download the new version 1.17.2, as you suggested to me, but when I do it from bioconductor it downloads again the 1.16.0 version, I don't know why...

Installing package(s) 'MAST'trying URL 'https://bioconductor.org/packages/3.12/bioc/src/contrib/MAST_1.16.0.tar.gz' Content type 'application/x-gzip' length 6751795 bytes (6.4 MB)

I have no problem sharing the data, I would like to include my single cell experiment and the results of the boots. But it says that do not support .rds documents. Could I share you a drive maybe? https://drive.google.com/file/d/1LYqBJ_ILrklOkpKeK7aWUaHGIKAm3xFc/view?usp=sharing = boots https://drive.google.com/file/d/1fmLHOCLm4qNH7Uwihf9S8vJiERKb3tHK/view?usp=sharing =sce_bsc

Thank you

sofiapuvogelvittini commented 3 years ago

Screenshot_2020-11-16 GSEA_MAST_astro