Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Example of using harmonised labels for de.method="wilcox" instead of classic marker detection #247

Open
denvercal1234GitHub opened this issue Sep 7, 2023 · 1 comment

Comments

@denvercal1234GitHub
Copy link

Hi there,

Thanks again for a great package.

In the tutorial (https://bioconductor.org/books/release/SingleRBook/using-multiple-references.html#using-harmonized-labels), the gene from references are determined via getClassicMarkers() for use when de.method="classic".

com.markers <- getClassicMarkers(
    ref = list(BPE=bpe.ont, HPCA=hpca.ont), 
    labels = list(bpe.ont$label.ont, hpca.ont$label.ont))

com.res3b <- SingleR(test = pbmc, assay.type.test=1,
    ref = list(BPE=bpe.ont, HPCA=hpca.ont), 
    labels = list(bpe.ont$label.ont, hpca.ont$label.ont),
    genes = list(com.markers, com.markers))

table(Label=com.res3b$labels, Reference=com.res3b$reference)

Q1. If I want to use de.method="wilcox", would you mind giving me how to modify the code?

Q2. And, is it appropriate to use com.markers from getClassicMarkers() in `SingleR(... de.method="wilcox"...) or really com.markers should only be used for de.method="classic"?

Thank you again!

@LTLA
Copy link
Collaborator

LTLA commented Sep 11, 2023

Q1. If I want to use de.method="wilcox", would you mind giving me how to modify the code?

de.method="wilcox" just uses genes derived from scran::findMarkers. Basically something like:

pairwise <- pairwiseWilcox(x = ref, groups = labels, direction = "up", log.p = TRUE)
collected <- scran::getTopMarkers(pairwise$statistics, pairwise$pairs,
    n = 10, pval.field = "log.p.value", fdr.field = "log.FDR", fdr.threshold = log(0.05))
lapply(collected, as.list)

(Adapted from SingleR:::.get_genes_by_de, which is what trainSingleR calls under the hood.)

This will give you a list of lists of markers that is comparable to the output of getClassicMarkers.

Q2. And, is it appropriate to use com.markers from getClassicMarkers() in `SingleR(... de.method="wilcox"...) or really com.markers should only be used for de.method="classic"?

If you give genes=, any setting of de.method= will be ignored.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants