q2-SCNIC Correlations calculation #error plugin DataFrame to_dense


Thank you so much for developing this package. I successfully installed in qiime2-2020.11 environment and I filtered my features table as you described in the SCNIC workflow.

I’m now stuck at the point 2. Calculating correlations and making your network.
Once I run the code:

qiime SCNIC calculate-correlations
–i-table rarefied_table_filtered.qza
–p-method sparcc
–o-correlation-table rarefied_correls.qza

I got this error:

Plugin error from SCNIC:

‘DataFrame’ object has no attribute ‘to_dense’

Debug info has been saved to /tmp/qiime2-q2cli-err-un4tp3mu.log

How can I fix it?

Thank you!

Hi @Giulia_Gionchetta,

it is a while I have not used SCNIC, but I’m glad you manage to install on the latest environment.

SCNIC should work considering the data as compositional, so you can use the abundance table before rarefaction, but after applying a filter in your case.

Basic question, do you know the filtering step did work as expected, e.g. are you sure you did not filter out all the features/samples?

This are my first thought, I am also tagging the developer to see if he can help more @michael.shaffer

Hope it helps

Hi @llenzi ,

Thank you for your response!

I've repeated the filtering step with the final dada2 asv table (not rarefied) as you suggested, but i got the same error when I've tried to do the correlations step.

Basic question, do you know the filtering step did work as expected, e.g. are you sure you did not filter out all the features/samples?

Yes, I've visualized it and it gave me:

What could I do to make it working?

this is the error line:

Thank you very much for your support

here the log file:

Correlating with sparcc
Traceback (most recent call last):
File “/cluster/work/gdc/people/ggionchetta/miniconda3/envs/qiime2-2020.11/lib/python3.6/site-packages/q2cli/commands.py”, line 329, in call
results = action(**arguments)
File “”, line 2, in calculate_correlations
File “/cluster/work/gdc/people/ggionchetta/miniconda3/envs/qiime2-2020.11/lib/python3.6/site-packages/qiime2/sdk/action.py”, line 245, in bound_callable
output_types, provenance)
File “/cluster/work/gdc/people/ggionchetta/miniconda3/envs/qiime2-2020.11/lib/python3.6/site-packages/qiime2/sdk/action.py”, line 390, in callable_executor
output_views = self._callable(**view_args)
File “/cluster/work/gdc/people/ggionchetta/miniconda3/envs/qiime2-2020.11/lib/python3.6/site-packages/q2_SCNIC/_SCNIC_methods.py”, line 29, in calculate_correlations
correls = ca.fastspar_correlation(table, verbose=True, nprocs=n_procs)
File “/cluster/work/gdc/people/ggionchetta/miniconda3/envs/qiime2-2020.11/lib/python3.6/site-packages/SCNIC/correlation_analysis.py”, line 77, in fastspar_correlation
table.to_dataframe().to_dense().to_csv(path.join(temp, ‘otu_table.tsv’), sep=’\t’, index_label=’#OTU ID’)
File “/cluster/work/gdc/people/ggionchetta/miniconda3/envs/qiime2-2020.11/lib/python3.6/site-packages/pandas/core/generic.py”, line 5141, in getattr
return object.getattribute(self, name)
AttributeError: ‘DataFrame’ object has no attribute ‘to_dense’

Hi @Giulia_Gionchetta,

Within the SCNIC tutorial post, there sis a link to a fake dataset to test the command,
the link is: wget https://github.com/shafferm/q2-SCNIC/raw/master/tests/data/fake_data.biom

Did you try your command with this dataset, as possible control?
(at least to check that your installation works properly).

Thanks @llenzi
I’ve tried but there is no fake.data available…
Therefore it is not possible to try the command as control.

Ciao @Giulia_Gionchetta,

my bad, they moved the github repo for SCNIC,
the test data are here:


This topic was automatically closed 31 days after the last reply. New replies are no longer allowed.