bedapub / besca

BESCA (Beyond Single Cell Analysis) offers python functions for single-cell analysis
https://bedapub.github.io/besca/
GNU General Public License v3.0
49 stars 16 forks source link

high memory consumption and nonetype error #341

Open wangjiawen2013 opened 6 months ago

wangjiawen2013 commented 6 months ago

Hi, I tried to export adata object to mtx format (matrix.mtx, genes.tsv, barcodes.tsv) using besca.export.X_to_mtx while finding that it took a lot o memory. Are there any ways to reduce the memory usage ? image

Besides, sometimes the following error occured, how to keep avoid of it ?

In [28]: bc.export.X_to_mtx(adata)
writing out matrix.mtx ...
adata.X successfully written to matrix.mtx.
---------------------------------------------------------------------------
TypeError                                 Traceback (most recent call last)
Cell In[28], line 1
----> 1 bc.export.X_to_mtx(adata)

File ~/programs/miniconda3/envs/py311/lib/python3.11/site-packages/besca/export/_export.py:124, in X_to_mtx(adata, outpath, write_metadata, geneannotation, additional_geneannotation)
    122         fp.write(ENSEMBL + "\t" + symbol + "\t" + feature + "\n")
    123 else:
--> 124     for ENSEMBL, symbol in zip(genes_ENSEMBL, genes_SYMBOL):
    125         fp.write(ENSEMBL + "\t" + symbol + "\n")
    126 fp.close()

TypeError: 'NoneType' object is not iterable