Comments (15)
Thanks @stemangiola - it now works for me.
from sccomp.
Hello @MartaCasado, they should not. Could you please paste here the two estimate tibbles for the two comparisons?
from sccomp.
Hi @stemangiola,
Sorry for the delay in my response.
What differs when I change the conditions' order are the boxplots (the significant cell types), but not the credible interval plots. With tibbles do you mean the output of res? I attach both results below.
Aged condition first:
`> res1
# A tibble: 16 × 9
cell_group parameter covariate c_lower c_effect c_upper c_pH0 c_FDR count_data
<chr> <chr> <chr> <dbl> <dbl> <dbl> <dbl> <dbl> <list>
1 Macrophage_3 (Intercept) NA 1.17 1.29 1.41 0 0 <tibble [6 × 10]>
2 Macrophage_3 typeadult type -0.0246 0.192 0.416 0.530 0.273 <tibble [6 × 10]>
3 Macrophage_1 (Intercept) NA 0.523 0.670 0.801 0 0 <tibble [6 × 10]>
4 Macrophage_1 typeadult type -1.18 -0.898 -0.639 0 0 <tibble [6 × 10]>
5 Monocyte_3 (Intercept) NA 0.116 0.264 0.404 0.180 0.0485 <tibble [6 × 10]>
6 Monocyte_3 typeadult type 0.309 0.587 0.860 0.00400 0.00200 <tibble [6 × 10]>
7 Monocyte_1 (Intercept) NA -0.343 -0.125 0.0635 0.765 0.138 <tibble [6 × 10]>
8 Monocyte_1 typeadult type -0.616 -0.213 0.177 0.473 0.209 <tibble [6 × 10]>
9 Macrophage_2 (Intercept) NA -0.522 -0.307 -0.115 0.133 0.0266 <tibble [6 × 10]>
10 Macrophage_2 typeadult type -0.366 0.0298 0.429 0.824 0.470 <tibble [6 × 10]>
11 Monocyte_2 (Intercept) NA -0.629 -0.413 -0.210 0.0208 0.00526 <tibble [6 × 10]>
12 Monocyte_2 typeadult type -0.443 -0.0376 0.373 0.804 0.420 <tibble [6 × 10]>
13 Proliferative myeloid (Intercept) NA -0.629 -0.440 -0.270 0.00551 0.00138 <tibble [6 × 10]>
14 Proliferative myeloid typeadult type -0.338 0.0615 0.468 0.770 0.356 <tibble [6 × 10]>
15 Dendritic cell (Intercept) NA -1.17 -0.925 -0.687 0 0 <tibble [6 × 10]>
16 Dendritic cell typeadult type -0.198 0.281 0.744 0.358 0.121 <tibble [6 × 10]>`
Adult condition first:
`> res2
# A tibble: 16 × 9
cell_group parameter covariate c_lower c_effect c_upper c_pH0 c_FDR count_data
<chr> <chr> <chr> <dbl> <dbl> <dbl> <dbl> <dbl> <list>
1 Macrophage_3 (Intercept) NA 1.14 1.27 1.38 0 0 <tibble [6 × 10]>
2 Macrophage_3 typeaged type -0.483 -0.236 -0.0146 0.373 0.181 <tibble [6 × 10]>
3 Macrophage_1 (Intercept) NA 0.513 0.659 0.793 0 0 <tibble [6 × 10]>
4 Macrophage_1 typeaged type 0.599 0.871 1.15 0 0 <tibble [6 × 10]>
5 Monocyte_3 (Intercept) NA 0.113 0.253 0.393 0.222 0.0412 <tibble [6 × 10]>
6 Monocyte_3 typeaged type -0.890 -0.612 -0.322 0.00350 0.00175 <tibble [6 × 10]>
7 Monocyte_1 (Intercept) NA -0.368 -0.138 0.0398 0.723 0.173 <tibble [6 × 10]>
8 Monocyte_1 typeaged type -0.206 0.179 0.595 0.538 0.252 <tibble [6 × 10]>
9 Macrophage_2 (Intercept) NA -0.424 -0.221 -0.0326 0.413 0.0943 <tibble [6 × 10]>
10 Macrophage_2 typeaged type -0.230 0.151 0.550 0.603 0.311 <tibble [6 × 10]>
11 Monocyte_2 (Intercept) NA -0.654 -0.428 -0.216 0.0183 0.00511 <tibble [6 × 10]>
12 Monocyte_2 typeaged type -0.409 0.0151 0.445 0.815 0.425 <tibble [6 × 10]>
13 Proliferative myeloid (Intercept) NA -0.657 -0.453 -0.248 0.00726 0.00181 <tibble [6 × 10]>
14 Proliferative myeloid typeaged type -0.477 -0.0818 0.299 0.723 0.370 <tibble [6 × 10]>
15 Dendritic cell (Intercept) NA -1.18 -0.928 -0.690 0 0 <tibble [6 × 10]>
16 Dendritic cell typeaged type -0.793 -0.292 0.243 0.346 0.117 <tibble [6 × 10]>
`
Thank you,
Marta
from sccomp.
These small changes could be due to the algorithm not being deterministic, or slightly tight priors on the intercept.
I would suggest, use the formula ~ 0 + factor_of_interest
and use contrasts
argument for the hypothesis testing, to have a perfect symmetric outcome.
from sccomp.
Thanks for the feedback!
I've used the following:
res = data |> sccomp_glm( formula_composition = ~ 0 + type, formula_variability = ~ 1, contrasts = c(typeadult - typeaged), percent_false_positive = 5, .sample = sample, .cell_group = cell_group, )
However, I get this error:
sccomp says: outlier identification first pass - step 1/3 [ETA: ~20s] Error in data_spread_to_model_input(., formula_composition, !!.sample, : object 'typeadult' not found
Thanks!!
from sccomp.
try to use
formula_variability = ~ 0 + type
if that fixes it, I have to fix in case variability has no covariates
from sccomp.
thank you! I've tried, but I still get the same error.
from sccomp.
Are you sure one of your covariate values is "adult", can you show me the distinct(type)
of your input table?
from sccomp.
I use as input the Seurat object.
> unique(data$type)
[1] adult aged
Levels: aged adult
from sccomp.
Can you send here input data and code?
from sccomp.
input data:
> data
An object of class Seurat
12815 features across 3781 samples within 1 assay
Active assay: RNA (12815 features, 1516 variable features)
2 dimensional reductions calculated: pca, umap
code:
data$cell_group = data$final.annot
data$sample = data$replicate
data$type = data$age
res = data |>
sccomp_glm( formula_composition = ~ type,
formula_variability = ~ 0 + type,
contrasts = c(typeadult - typeaged),
percent_false_positive = 5,
.sample = sample,
.cell_group = cell_group, )
Thank you!!
from sccomp.
This is the correct usage
res = data |>
sccomp_glm( formula_composition = ~ 0 + type,
formula_variability = ~ 0 + type,
contrasts = c(typeadult - typeaged),
percent_false_positive = 5,
.sample = sample,
.cell_group = cell_group, )
from sccomp.
Hi @stemangiola, I've tried that, but I still get this:
sccomp says: outlier identification first pass - step 1/3 [ETA: ~20s]
Error in data_spread_to_model_input(., formula_composition, !!.sample, :
object 'typeadult' not found
Thank you
from sccomp.
Hi @stemangiola,
I have come across the same error with my single cell RNAseq data.
The code I'm trying to run:
res <-
seu |>
sccomp_glm(
formula_composition = ~ 0 + Disease,
formula_variability = ~ 0 + Disease,
contrasts = c(DiseaseHealthy - DiseaseCF,
DiseaseHealthy - DiseaseCSLD,
DiseaseHealthy - DiseaseWheeze),
.sample = sample.id,
.cell_group = predicted.Broad)
The error:
Error in data_spread_to_model_input(., formula_composition, !!.sample, :
object 'DiseaseHealthy' not found
My input data:
> seu
An object of class Seurat
35369 features across 190480 samples within 4 assays
Active assay: refAssay (17656 features, 0 variable features)
3 other assays present: RNA, prediction.score.Annotation, prediction.score.Broad
> levels(seu$Disease)
[1] "CF" "CSLD" "Healthy" "Wheeze"
Session information:
> sessionInfo()
R version 4.2.0 (2022-04-22)
Platform: x86_64-pc-linux-gnu (64-bit)
Running under: CentOS Linux 7 (Core)
Matrix products: default
BLAS: /usr/lib64/libblas.so.3.4.2
LAPACK: /usr/lib64/liblapack.so.3.4.2
locale:
[1] LC_CTYPE=en_AU.UTF-8 LC_NUMERIC=C LC_TIME=en_AU.UTF-8 LC_COLLATE=en_AU.UTF-8
[5] LC_MONETARY=en_AU.UTF-8 LC_MESSAGES=en_AU.UTF-8 LC_PAPER=en_AU.UTF-8 LC_NAME=C
[9] LC_ADDRESS=C LC_TELEPHONE=C LC_MEASUREMENT=en_AU.UTF-8 LC_IDENTIFICATION=C
attached base packages:
[1] stats4 stats graphics grDevices datasets utils methods base
other attached packages:
[1] edgeR_3.38.1 sccomp_0.99.30 SingleCellExperiment_1.18.0 SummarizedExperiment_1.26.1
[5] Biobase_2.56.0 GenomicRanges_1.48.0 GenomeInfoDb_1.32.2 IRanges_2.30.0
[9] S4Vectors_0.34.0 BiocGenerics_0.42.0 MatrixGenerics_1.8.1 matrixStats_0.62.0
[13] limma_3.52.2 speckle_0.99.0 paletteer_1.4.0 patchwork_1.1.2
[17] sp_1.5-0 SeuratObject_4.1.0 Seurat_4.1.1 glue_1.6.2
[21] here_1.0.1 forcats_0.5.1 stringr_1.4.0 dplyr_1.0.9
[25] purrr_0.3.4 readr_2.1.2 tidyr_1.2.0 tibble_3.1.7
[29] ggplot2_3.3.6 tidyverse_1.3.1 BiocStyle_2.24.0 workflowr_1.7.0
from sccomp.
Hello @JovMaksimovic , try adding quotes
res <-
seu |>
sccomp_glm(
formula_composition = ~ 0 + Disease,
formula_variability = ~ 0 + Disease,
contrasts = c("DiseaseHealthy - DiseaseCF",
"DiseaseHealthy - DiseaseCSLD",
"DiseaseHealthy - DiseaseWheeze"),
.sample = sample.id,
.cell_group = predicted.Broad)
I have updated the documentation.
from sccomp.
Related Issues (20)
- use of inv_logit vs softmax HOT 3
- throw error if missing values due to pivoting long HOT 3
- Best strategy for differential composition estimation in integrated Seurat object HOT 1
- stanfit correspondence parameters variable names HOT 18
- FDR calculation HOT 3
- Question about "test_composition_above_logit_fold_change" parameter in sccomp_glm HOT 3
- dirichlet_multinomial noise model doesn't seem to function HOT 4
- Interaction terms in sccomp_glm HOT 12
- Warings from sccomp_remove_outliers() when sample size is large HOT 1
- Does sccomp require replicates ? HOT 2
- Relationship between CI, minimal effect threshold, and FDR on plots$credible_intervals_1D HOT 2
- Fig 3B and 3 group comparisson HOT 1
- question: scope of the statistical model HOT 6
- sccomp_boxplot() errors when passing a factor variable HOT 3
- custom ggplot theme misses theme element HOT 1
- sccomp plot method -> rstan::gqs throws warning HOT 3
- question about lumping or selecting compositional data HOT 1
- Interpretation when both bars are highlighted versus one HOT 14
- Multilevel model error HOT 2
- Continuous variable as main effect HOT 4
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from sccomp.