theislab / diffxpy

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

'Simulator' object has no attribute 'np_clip_param' #142

Open wangjiawen2013 opened 4 years ago

wangjiawen2013 commented 4 years ago

Dear, This chunk of code: sim = Simulator(num_observations=200, num_features=100) sim.generate_sample_description(num_batches=0, num_conditions=4) sim.generate_params(rand_fn_loc=lambda shape: np.random.uniform(-0.1, 0.1, shape),rand_fn_scale=lambda shape: np.random.uniform(0.1, 2, shape)) sim.generate_data() showed the error: 'Simulator' object has no attribute 'np_clip_param' what caused the problem ?

And, how to integrate diffxpy with scanpy anndata object ? especially for the data (raw counts, normalized data or scaled data)

davidsebfischer commented 4 years ago

Hi @wangjiawen2013, thanks for the issue! I just resolved this, the fix is on diffxpy and batchglm dev branches so please install them from source via pip install -e ..

And, how to integrate diffxpy with scanpy anndata object ? especially for the data (raw counts, normalized data or scaled data)

You can give adata or adata.raw to the data argument of diffxpy tests. If you use negative binomial noise models, you should use raw counts. Does that answer your question?

wangjiawen2013 commented 4 years ago

My adata stores scaled data, and adata.raw stores raw counts, could you give me an example on how to test it using negative binomial noise models ? adata.raw only contains the raw counts matrix, while the condition/batch are in adata object.

davidsebfischer commented 4 years ago

My adata stores scaled data, and adata.raw stores raw counts, could you give me an example on how to test it using negative binomial noise models ? adata.raw only contains the raw counts matrix, while the condition/batch are in adata object.

sure:

de.test.wald(
   data=adata.raw, 
   sample_description=adata.obs, 
   gene_names=adata.raw.var_names, 
   formula_loc=..., 
   fac_loc_totest=...,
   ...
)
davidsebfischer commented 4 years ago

I will make access of raw objects easier, I will comment in this issue again once it s done! Thanks for the feedback @wangjiawen2013!