Comments (6)
perhaps not combining?....I just got an error
Error in simpleLoess(y, x, w, span, degree = degree, parametric = parametric, :
invalid 'x'
from scgate.
Hello Gianfilippo,
I assume you want to use scGate as a multi-class classifier, and annotate all T cell subtypes?
In that case, I would suggest to work with CD4 and CD8 T cells separately, and then join the results. For example:
# Split CD4 and CD8 T cells
filters <- scGate_models_DB$human$generic
data <- scGate(data, model=list(CD4=filters$CD4T, CD8=filters$CD8T))
cd8s <- subset(data, subset=scGate_multi=="CD8")
cd4s <- subset(data, subset=scGate_multi=="CD4")
# Classify subtypes
cd8s <- scGate(cd8s, model=scGate_models_DB$human$CD8_TIL)
cd4s <- scGate(cd4s, model=scGate_models_DB$human$CD4_TIL)
# Merge results
tcells <- merge(cd8s, cd4s)
Best
-massimo
from scgate.
Hi,
thanks for the suggestions. I am still having an error, though. Let me give you more details.
My data is composed of 6 samples and 2 conditions. I am presently running sample by sample.
First I normalize each sample
scdata.list <- lapply(X = scdata.list, FUN = function(x) {
x <- NormalizeData(x)
x <- FindVariableFeatures(x, selection.method = "vst", nfeatures = 2000)
x <- ScaleData(x, features = all.genes)
x <- MYscGate(data, model)
})
where MYscGate is a function with the steps you suggested.
The default assay is RNA.
Beyond the specific classification results, every sample gets classified (using the steps you proposed).
One of my samples fails and generates the following error
Detected a total of 1666 non-pure cells for NaiveLike (100.00% of total)
Error in apply(., 2, max) : dim(X) must have a positive length
Calls: source ... run_scGate_singlemodel -> filter_bymean -> %>% -> apply
Execution halted
I just tested the same sample that fails using SCT as assay, and I do not get any error and it runs faster.
further update:
the error seems to be related to my Seurat object. Specifically, I get an error if the Default Assay is "integrated" or "RNA". No error if I set "SCT".
Now, this specific object resulted from a standard integration step . It was then split and subsequently merged.
I had a similar issue running on the integrated Seurat object. In that case, I had an error running with either "integrated" and "RNA" as default assays. Also, under the "SCT" assay, no signature genes are found missing, while using either "RNA" or "integrated" various signature genes are found missing. The "integrated" assay relies on a subset of the genes, so that is expected, but the "RNA" and "SCT" assays have the same genes.
I will try to force reinstall scGate, but I was wondering whether you had any other idea.
Thanks
from scgate.
Looks like reinstalling scGate solved the error, but still leaves some questions.
I see somewhat different results running with the 6 combinations of assays and reductions
assay="RNA" or "SCT"
reduction="pca" or "umap" or "calculate"
I understand that assay is used for UCell scores and reduction for the knn smoothing (i.e. imputation).
UCell scores should not change for any normalization that does not alter genes ranking, but SCT probably does that.
The reduction="calculate" combinations should also produce different results, given that there is a param_decay step, not present in the others.
Which combination is the most reliable ? did you test them all ?
RNA - pca
RNA - umap
SCT - pca
SCT - umap
RNA - calculate
SCT - calculate
from scgate.
Hello Gianfilippo,
great that the error solved itself.
Yes, you are right that UCell scores should not be affected by normalization - as long as the normalization does not alter the relative ranking of genes. The dimensionality reduction used to calculate the KNNs may also affect the results, as the neighbors are generally different in different reduction spaces.
In my experience I have not seen any advantage of using SCT compared to simple log-normalization (RNA assay), but others may disagree. PCA spaces are generally more robust than 2D UMAP spaces, and would normally work in that space. As for using a pre-computed PCA reduction vs. letting scGate calculate its own PCA reduction: I would advise to use "calculate" when the target population is expected to be a relatively small fraction of the whole dataset, so that multi-level models can recalculate a new PCA space for each level of the model, focused on an increasingly more specific subset of cells. The pre-calculated PCA option is faster and works fine when the target population constitutes the majority of the set, e.g. when filtering out contaminants from a dataset.
I hope this helps,
-massimo
from scgate.
Thanks!
from scgate.
Related Issues (20)
- Re-use existing ucell score columns in a seurat object? HOT 1
- new function to evaluate multiple models (list) with one command HOT 1
- new function to obtain a multi-class variable from a set of scGate models' pure/impure output HOT 3
- for merged datasets, allow for independent gating HOT 1
- Ucell scores for _additional_signatures_ not exported in multi-model mode [dev]
- plot_UCell_scores() fails unless scGate() is run with save.levels=T
- Use of pos.thr neg.thr HOT 2
- scGate & performance.metrics HOT 3
- nn.idx with pre-calculated dimensionality reductions HOT 5
- Possible issue related to future / parallelism? HOT 1
- Add in custom scGATE db function
- Update models for blood cells HOT 1
- Create model for macrophages HOT 1
- kNN smoothing parameters HOT 1
- scGate as a multi-class classifier HOT 1
- Prepare for upcoming Seurat v5 release
- Discrepancy in genes included in block list between Human and Mouse
- scGate parallelization
- incomplete final line found by readTableHeader on HSPC_scGate_Model HOT 2
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 scgate.