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
ComBat error "TypeError: data type not understood" #2
Comments
Hi,
|
@mbuttner Thanks for the confirmation. The case study also includes a call to |
Hi, Thanks for your rely, the adata.X is a numpy.ndarray as I did adata.X = adata.X.toarray() before this step for the R issues, and the data is a pandas dataframe. And I tried "data = pd.DataFrame(adata.X.todense())", but it reports an error that "AttributeError: 'numpy.ndarray' object has no attribute 'todense'" And yes, have already filtered out genes with constant 0 expression in the QC step followed the tutorials "sc.pp.filter_genes(adata, min_cells=20)" Thanks, |
The The rather uninformative error message doesn't really help. Could it be that you have 0 variance of a gene in your current dataset within a batch? |
Hi, |
I use the same test data of the tutorials from GSE92332_RAW.tar, and have checked there is no 0 variance genes Have tried to convert the adata.X to sparse and then convert to dense, bu still the same error. import scipy ~/anaconda3/envs/py36/lib/python3.6/site-packages/numpy/core/numerictypes.py in issubdtype(arg1, arg2) TypeError: data type not understood |
Hi, @mbuttner The output is like the attached. |
It's quite strange that you are using the tutorial dataset and nonetheless get different results than I do. The version of Combat that I have works for me. So to clarify, you have followed all the tutorial steps up until the batch correction part? I will investigate and let you know if I can reproduce the error. |
So if I rerun the script, I get the results as expected. Could you possibly send me your Thanks |
Hm, the output looks ok. Do you have the full traceback of the error message? Also, what is the output of |
So I have a different dataset in |
Hi, Thanks, I have rebuild an independent conda environment with updated all packages to the latest version and it is correct now, may some of packages is too old. Thanks agin. |
I'm glad it's working for you now. It would be good to know what package caused this in case it happens again though. |
Issue report for the issue posted in #1:
ComBat gives the following error:
TypeError: data type not understood
.@jphe Could you clarify whether you are still using a sparse data matrix? The current ComBat implementation does not work with the sparse matrix format.
The ComBat function from www.github.com/mbuttner/maren_codes/ was designed to take pandas Dataframes as input, so the pandas dataframe is not the problem. The code does have issues when your data has 0 variance in the expression values of a gene. So you should filter out genes with constant gene expression values (usually genes with 0 expression).
It would also be good to know the output of
type(data.T)
.The text was updated successfully, but these errors were encountered: