theislab / diffxpy

Differential expression analysis for single-cell RNA-seq data.
https://diffxpy.rtfd.io
BSD 3-Clause "New" or "Revised" License
193 stars 23 forks source link

QUESTION: Using diffxpy with multiple groups #79

Open cartal opened 5 years ago

cartal commented 5 years ago

Hi,

I'm trying to use diffxpy with an AnnData object that has been clustered using the Leiden algorithm.

When I run the following command:

wilcox_test = de.test.wilcoxon(data = batches_bbknn, grouping = "leiden") diffxpy_wilcox = wilcox_test.summary().iloc[:30000,:] diffxpy_wilcox = diffxpy_wilcox[diffxpy_wilcox.log2fc > 1] diffxpy_wilcox.head(10)

I get a nice table of markers, however I don't know which cluster is expressing which genes. Maybe I've missed this somewhere in the documentation, but do you know how to get this from the output?

Also, is there a way I can add multiple conditions to the model? Say I have leiden and I want to add patient and ignore source. Is this possible?

Thank you!

HypoChloremic commented 4 years ago

Was this ever resolved?

mtvector commented 4 years ago

Yes, I'm also wondering how you get the coefficients for multiple factor levels of a covariate? If you have 4 clusters, how do you get the beta for each of the clusters? And what about interaction terms like ~ leiden:treatment

dawe commented 3 years ago

I am facing similar problem. I am testing multiple groups like this:

dmat, coefs = de.utils.design_matrix(adata, formula='~1 + time + group + time:group')
# select only the interactions
coef_to_test = coefs[6:]
test = de.test.wald(
    data = adata
    formula_loc= '~1 + time + group + time:group',
    coef_to_test = coef_to_test,
)

test.summary() gives a DataFrame with genes that are selected for all those coefficients, while I wanted genes for each of them. So far, the only thing I could do is to test each coefficient separately

test = de.test.wald(
    data = adata
    formula_loc= '~1 + time + group + time:group',
    coef_to_test = coef_to_test[x],
)

where x changes in a loop.