Giter VIP home page Giter VIP logo

Comments (6)

gianfilippo avatar gianfilippo commented on June 19, 2024

perhaps not combining?....I just got an error
Error in simpleLoess(y, x, w, span, degree = degree, parametric = parametric, :
invalid 'x'

from scgate.

mass-a avatar mass-a commented on June 19, 2024

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.

gianfilippo avatar gianfilippo commented on June 19, 2024

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.

gianfilippo avatar gianfilippo commented on June 19, 2024

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.

mass-a avatar mass-a commented on June 19, 2024

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.

gianfilippo avatar gianfilippo commented on June 19, 2024

Thanks!

from scgate.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.