tanaylab / metacells

Metacells - Single-cell RNA Sequencing Analysis
MIT License
86 stars 8 forks source link

Format error #65

Open Ray569743422 opened 7 months ago

Ray569743422 commented 7 months ago

When I use this code :

mc.pl.related_genes.relate_to_lateral_genes(data, random_seed=0)

I meet this error:

/dellfsqd2/ST_OCEAN/USER/wangrui21/03.software/anaconda3/envs/stana/lib/python3.11/site-packages/metacells/utilities/computation.py:357: UserWarning: sum of rows of a matrix with column_major layout warn(operating_on_matrix_of_wrong_layout) Traceback (most recent call last): File "<stdin>", line 1, in <module> File "/dellfsqd2/ST_OCEAN/USER/wangrui21/03.software/anaconda3/envs/stana/lib/python3.11/site-packages/metacells/utilities/logging.py", line 384, in wrapper return function(*args, **kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^ File "/dellfsqd2/ST_OCEAN/USER/wangrui21/03.software/anaconda3/envs/stana/lib/python3.11/site-packages/metacells/pipeline/related_genes.py", line 96, in relate_to_lateral_genes fraction_per_gene_per_cell = ut.fraction_by(umis_per_cell_per_gene, by="row") ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/dellfsqd2/ST_OCEAN/USER/wangrui21/03.software/anaconda3/envs/stana/lib/python3.11/site-packages/metacells/utilities/computation.py", line 1495, in fraction_by return scale_by(proper, scale, by=by) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/dellfsqd2/ST_OCEAN/USER/wangrui21/03.software/anaconda3/envs/stana/lib/python3.11/site-packages/metacells/utilities/computation.py", line 1464, in scale_by assert utt.matrix_layout(result) == utt.matrix_layout(compressed) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ AssertionError

The data of input is standard anndata format,could you help me?

orenbenkiki commented 7 months ago

I'm assuming you are using the latest published version (0.9.4)?

This is probably due to scipy changing subtle implementation details and my assert has detected the change. Again. Sigh.

Workaround... Hmmm...

In the file /dellfsqd2/ST_OCEAN/USER/wangrui21/03.software/anaconda3/envs/stana/lib/python3.11/site-packages/metacells/utilities/computation.py In line number 1464 Replace the line with result = to_layout(result, utt.matrix_layout(compressed)) That is, force the result layout instead of asserting it is as expected.

I'll push this into the next version (0.9.5) when it is published.