biocore / songbird

Vanilla regression methods for microbiome differential abundance analysis
BSD 3-Clause "New" or "Revised" License
54 stars 25 forks source link

q2-songbird biplot metadata issue #167

Closed pablocatarecha closed 1 year ago

pablocatarecha commented 1 year ago

Hi everyone,

I am quite new to Qiime2 and songbird, and perhaps this thread has already been answered elsewhere. I apologize if so.

I want to analyze differential composition of fungal communities, and I find Songbird+Qurro extremely useful and powerful tools for this purpose. Unfortunately, when it comes to plotting the biplot in emperor, there is an issue with metadata I haven't been able to solve or find a solution for.

As I have understood, Songbird biplots are "upside down" in a way dots are actual features and arrows are differentials, so Emperor's --m-sample-metadata should be provided with actual feature metadata (e.g. taxonomy).

Taking the above into account, I ran this code with the files attached below:

qiime emperor biplot --i-biplot regression_biplot.qza --m-sample-metadata-file taxonomy.qza --p-ignore-missing-samples --o-visualization songbird_biplot_visualizer.qzv

I can see that biplot data corresponding to dots are the feature data stored in my taxonomy, but I keep getting this error message:

There was an issue with loading the file /taxonomy.qza as metadata:

Metadata file path doesn't exist, or the path points to something other than a file. Please check that the path exists, has read permissions, and points to a regular file (not a directory): /taxonomy.qza

There may be more errors present in the metadata file. To get a full report, sample/feature metadata files can be validated with Keemei: https://keemei.qiime2.org

Find details on QIIME 2 metadata requirements here: https://docs.qiime2.org/2022.11/tutorials/metadata/

I have extracted metadata and tried to load a plain .tsv file instead, but got this error message:

Plugin error from emperor:

index cannot be a set

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

I don't know what I am doing wrong. Any help?

Regards,

Pablo.

q2-songbird-metadata.zip

mortonjt commented 1 year ago

Hi, can you print out the full error message saved under /tmp/qiime2-q2cli-err-5il5vxec.log?

From a first glance, it looks like you did not pass in the correct path to your metadata file (according to your first message). The second approach may yield a more useful message, but there is a chance that your metadata index name needs to be renamed from featureid to sampleid (the qiime2 error message can help confirm this).

pablocatarecha commented 1 year ago

Sure. There it goes:

/home/pablo/miniconda3/envs/qiime2-2022.11/lib/python3.8/site-packages/emperor/core.py:327: EmperorWarning: 2506 out of 9559 samples have no metadata and are being included with a placeholder value. warnings.warn("%d out of %d %ss have no metadata and are being" Traceback (most recent call last): File "/home/pablo/miniconda3/envs/qiime2-2022.11/lib/python3.8/site-packages/q2cli/commands.py", line 352, in call results = action(arguments) File "", line 2, in biplot File "/home/pablo/miniconda3/envs/qiime2-2022.11/lib/python3.8/site-packages/qiime2/sdk/action.py", line 234, in bound_callable outputs = self._callableexecutor(scope, callable_args, File "/home/pablo/miniconda3/envs/qiime2-2022.11/lib/python3.8/site-packages/qiime2/sdk/action.py", line 443, in _callableexecutor ret_val = self._callable(output_dir=temp_dir, view_args) File "/home/pablo/miniconda3/envs/qiime2-2022.11/lib/python3.8/site-packages/q2_emperor/_plot.py", line 127, in biplot generic_plot(output_dir, master=biplot, other_pcoa=None, File "/home/pablo/miniconda3/envs/qiime2-2022.11/lib/python3.8/site-packages/q2_emperor/_plot.py", line 41, in generic_plot viz = Emperor(master, mf, feature_mapping_file=feature_metadata, File "/home/pablo/miniconda3/envs/qiime2-2022.11/lib/python3.8/site-packages/emperor/core.py", line 220, in init self.mf = self._validate_metadata(self.mf, self.ordination.samples, File "/home/pablo/miniconda3/envs/qiime2-2022.11/lib/python3.8/site-packages/emperor/core.py", line 333, in _validate_metadata pad = pd.DataFrame(index=difference, columns=metadata.columns, File "/home/pablo/miniconda3/envs/qiime2-2022.11/lib/python3.8/site-packages/pandas/core/frame.py", line 637, in init raise ValueError("index cannot be a set") ValueError: index cannot be a set

I will try renaming the first cell, as you say.

The path to the files is a lot longer than what I have posted, of course, only I didn't want to add extra junk on it.

pablocatarecha commented 1 year ago

Sorry, my bad. The actual path had a mismatch. I feel so embarrassed. Everything works as it should. Your tool is awesome.

mortonjt commented 1 year ago

Great!