Error when running diversity core-metrics-phylogenetic

Hi everyone,
I'm trying to run diversity core-metrics-phylogenetic with an filtered input file but am experiencing an error. I have previously run this with the unfiltered feature table and rep-seqs and had no problem. But now after filtering my rep-seqs and feature-table to exclude certain samples I always get an error (see below). Only when using a sample depth of 1 was I able to get an output but for any other sample depth including the desired one the error always occurs. Any suggestions on how to fix this would be highly appreciated.

filtered-table-2.qza (130.9 KB)
400bp-filtered-rep-seqs-2-filtered.qza (166.3 KB)
exclude-metadata.tsv (8.5 KB)
filtered-feature-table-nocontrol-raw-A3Fbf.qza (129.5 KB)
filtered-sequences-nocontrol-raw-A3Fbf.qza (164.9 KB)

Here the code that I've used:

qiime feature-table filter-samples
--i-table filtered-table-2.qza
--m-metadata-file exclude-metadata.tsv
--p-where '[exclude]="False"'
--o-filtered-table filtered-feature-table-nocontrol-raw-A3Fbf.qza

qiime feature-table filter-seqs
--i-data 400bp-filtered-rep-seqs-2-filtered.qza
--i-table filtered-feature-table-nocontrol-raw-A3Fbf.qza
--o-filtered-data filtered-sequences-nocontrol-raw-A3Fbf.qza

qiime phylogeny align-to-tree-mafft-fasttree
--i-sequences filtered-sequences-nocontrol-raw-A3Fbf.qza
--o-alignment aligned-rep-seqs-nocontrol-raw-A3Fbf.qza
--o-masked-alignment masked-aligned-rep-seqs-nocontrol-raw-A3Fbf.qza \
--o-tree unrooted-tree-nocontrol-raw-A3Fbf.qza \
--o-rooted-tree rooted-tree-nocontrol-raw-A3Fbf.qza

qiime diversity core-metrics-phylogenetic
--i-phylogeny rooted-tree-nocontrol-raw-A3Fbf.qza
--i-table filtered-feature-table-nocontrol-raw-A3Fbf.qza
--p-sampling-depth 11897
--m-metadata-file exclude-metadata.tsv
--output-dir 11897-core-metrics-results
--verbose
Running external command line application. This may print messages to stdout and/or stderr.
The command being run is below. This command cannot be manually re-run as it will depend on temporary files that no longer exist.

Command:

faithpd -i /var/folders/f_/gf3866213j5g3x_dzng98rvr0000gn/T/qiime2/isabelherden/data/92f578ff-0833-459e-b823-d4e4c33c4d6a/data/feature-table.biom -t /var/folders/f_/gf3866213j5g3x_dzng98rvr0000gn/T/qiime2/isabelherden/data/f695a070-cc7f-4a1c-9672-460c5756f83c/data/tree.nwk -o /var/folders/f_/gf3866213j5g3x_dzng98rvr0000gn/T/q2-AlphaDiversityFormat-jslhvazs

Compute failed in faith_pd_one_off: Table observation IDs are not a subset of the tree tips. This error can also be triggered if a node name contains a single quote (this is unlikely).
Traceback (most recent call last):
File "/Users/isabelherden/miniforge3/envs/qiime2-amplicon-2024.5/lib/python3.9/site-packages/q2cli/commands.py", line 520, in call
results = self._execute_action(
File "/Users/isabelherden/miniforge3/envs/qiime2-amplicon-2024.5/lib/python3.9/site-packages/q2cli/commands.py", line 586, in _execute_action
results = action(**arguments)
File "", line 2, in core_metrics_phylogenetic
File "/Users/isabelherden/miniforge3/envs/qiime2-amplicon-2024.5/lib/python3.9/site-packages/qiime2/sdk/action.py", line 342, in bound_callable
outputs = self.callable_executor(
File "/Users/isabelherden/miniforge3/envs/qiime2-amplicon-2024.5/lib/python3.9/site-packages/qiime2/sdk/action.py", line 657, in callable_executor
outputs = self._callable(scope.ctx, **view_args)
File "/Users/isabelherden/miniforge3/envs/qiime2-amplicon-2024.5/lib/python3.9/site-packages/q2_diversity/_core_metrics.py", line 65, in core_metrics_phylogenetic
faith_pd_vector, = faith_pd(table=cr.rarefied_table,
File "", line 2, in faith_pd
File "/Users/isabelherden/miniforge3/envs/qiime2-amplicon-2024.5/lib/python3.9/site-packages/qiime2/sdk/context.py", line 143, in deferred_action
return action_obj._bind(
File "", line 2, in faith_pd
File "/Users/isabelherden/miniforge3/envs/qiime2-amplicon-2024.5/lib/python3.9/site-packages/qiime2/sdk/action.py", line 342, in bound_callable
outputs = self.callable_executor(
File "/Users/isabelherden/miniforge3/envs/qiime2-amplicon-2024.5/lib/python3.9/site-packages/qiime2/sdk/action.py", line 576, in callable_executor
output_views = self._callable(**view_args)
File "", line 2, in faith_pd
File "/Users/isabelherden/miniforge3/envs/qiime2-amplicon-2024.5/lib/python3.9/site-packages/q2_diversity_lib/_util.py", line 75, in _validate_tables
return wrapped_function(*args, **kwargs)
File "", line 2, in faith_pd
File "/Users/isabelherden/miniforge3/envs/qiime2-amplicon-2024.5/lib/python3.9/site-packages/q2_diversity_lib/_util.py", line 118, in _validate_requested_cpus
return wrapped_function(*bound_arguments.args, **bound_arguments.kwargs)
File "/Users/isabelherden/miniforge3/envs/qiime2-amplicon-2024.5/lib/python3.9/site-packages/q2_diversity_lib/alpha.py", line 63, in faith_pd
_omp_cmd_wrapper(threads, cmd)
File "/Users/isabelherden/miniforge3/envs/qiime2-amplicon-2024.5/lib/python3.9/site-packages/q2_diversity_lib/_util.py", line 134, in _omp_cmd_wrapper
return run_external_cmd(cmd, verbose=verbose, env=env)
File "/Users/isabelherden/miniforge3/envs/qiime2-amplicon-2024.5/lib/python3.9/site-packages/q2_diversity_lib/util.py", line 128, in run_external_cmd
return subprocess.run(cmd, check=True, env=env)
File "/Users/isabelherden/miniforge3/envs/qiime2-amplicon-2024.5/lib/python3.9/subprocess.py", line 528, in run
raise CalledProcessError(retcode, process.args,
subprocess.CalledProcessError: Command '['faithpd', '-i', '/var/folders/f
/gf3866213j5g3x_dzng98rvr0000gn/T/qiime2/isabelherden/data/92f578ff-0833-459e-b823-d4e4c33c4d6a/data/feature-table.biom', '-t', '/var/folders/f
/gf3866213j5g3x_dzng98rvr0000gn/T/qiime2/isabelherden/data/f695a070-cc7f-4a1c-9672-460c5756f83c/data/tree.nwk', '-o', '/var/folders/f
/gf3866213j5g3x_dzng98rvr0000gn/T/q2-AlphaDiversityFormat-jslhvazs']' returned non-zero exit status 1.

Plugin error from diversity:

Command '['faithpd', '-i', '/var/folders/f_/gf3866213j5g3x_dzng98rvr0000gn/T/qiime2/isabelherden/data/92f578ff-0833-459e-b823-d4e4c33c4d6a/data/feature-table.biom', '-t', '/var/folders/f_/gf3866213j5g3x_dzng98rvr0000gn/T/qiime2/isabelherden/data/f695a070-cc7f-4a1c-9672-460c5756f83c/data/tree.nwk', '-o', '/var/folders/f_/gf3866213j5g3x_dzng98rvr0000gn/T/q2-AlphaDiversityFormat-jslhvazs']' returned non-zero exit status 1.

See above for debug info.

Hi @Isabel,
Your error is alittle hidden but here is the main issue:

I think you probably know this but we definitely want a sampling depth greater than 1!

I had to dive into the provenance for this but it seems like you ran qiime rescript filter-seqs-length. This removed any sequences in your rep-seqs that was less than 400. I assume that this is what removed sequences from your rep-seqs/tree that are still found in your feature-table.

Is there any reason that you are doing this filitering?

I think if you skipped the qiime rescript filter-seqs-length step this should all work.

Hope this helps!
:turtle:

2 Likes

Hi @cherman2,
Thanks for your quick response. As you suggested I was able to run diversity core-metrics-phylogenetic without any errors when skipping the sequence length filtering step. I originally filtered the sequences to exclude any sequences not close to my target amplicon size. Is there a way to still do it with the filtered rep-seqs?

Hi @Isabel,
I think this post by @SoilRotifer has the solution your are looking for:

Hope this helps!

1 Like

Hi again@cherman2,
Thanks for the link, this seems to be exactly what I was looking for.

1 Like