diffxpy icon indicating copy to clipboard operation
diffxpy copied to clipboard

QUESTION: Using diffxpy with multiple groups

Open cartal opened this issue 5 years ago • 3 comments

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!

cartal avatar Mar 04 '19 10:03 cartal

Was this ever resolved?

HypoChloremic avatar Jun 04 '20 13:06 HypoChloremic

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

mtvector avatar Jun 16 '20 04:06 mtvector

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.

dawe avatar Nov 26 '21 13:11 dawe