Hi all,
I am trying to generate an unweighted unifrac with the qiime2 python API and get the following output and error:
from qiime2 import Artifact
from qiime2.plugins import diversity_lib
tab1N=('/home/sdegregori/TOL/GMTOLsubsample/GMTOLsong_tablef_V4_N1_pythontest.qza')
phyf=('/home/sdegregori/TOL/GMTOLsubsample/GMTOLsong_rooted_treef.qza')
table1N = Artifact.load(tab1N)
phylogenyf = Artifact.load(phyf)
distance_matrix_result = diversity_lib.methods.unweighted_unifrac(table=table1N,phylogeny=phylogenyf)
distance_matrix = distance_matrix_result.distance_matrix
distance_matrix.save('/home/sdegregori/TOL/GMTOLsubsample/adonis/UW1N.qza')
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:
ssu -i /tmp/qiime2/sdegregori/data/cf615d32-1809-41f8-a49f-6524020e030d/data/feature-table.biom -t /tmp/qiime2/sdegregori/data/47068e69-1522-4054-9c8f-49ae9c8a0d3d/data/tree.nwk -m unweighted -o /tmp/q2-LSMatFormat-5ivdpzio
FileNotFoundError Traceback (most recent call last)
Cell In[47], line 1
----> 1 distance_matrix_result = diversity_lib.methods.unweighted_unifrac(table=table1N,phylogeny=phylogenyf)
2 distance_matrix = distance_matrix_result.distance_matrix
3 distance_matrix.save('/home/sdegregori/TOL/GMTOLsubsample/adonis/UW1N.qza')
File <decorator-gen-190>:2, in unweighted_unifrac(table, phylogeny, threads, bypass_tips)
File ~/miniconda3/envs/qiime2-2023.2/lib/python3.8/site-packages/qiime2/sdk/action.py:234, in Action._bind.<locals>.bound_callable(*args, **kwargs)
230 warn(self._build_deprecation_message(),
231 FutureWarning)
233 # Execute
--> 234 outputs = self._callable_executor_(scope, callable_args,
235 output_types, provenance)
237 if len(outputs) != len(self.signature.outputs):
238 raise ValueError(
239 "Number of callable outputs must match number of "
240 "outputs defined in signature: %d != %d" %
241 (len(outputs), len(self.signature.outputs)))
File ~/miniconda3/envs/qiime2-2023.2/lib/python3.8/site-packages/qiime2/sdk/action.py:381, in Method._callable_executor_(self, scope, view_args, output_types, provenance)
380 def _callable_executor_(self, scope, view_args, output_types, provenance):
--> 381 output_views = self._callable(**view_args)
382 output_views = tuplize(output_views)
384 # TODO this won't work if the user has annotated their "view API" to
385 # return a `typing.Tuple` with some number of components. Python will
386 # return a tuple when there are multiple return values, and this length
(...)
389 # due to how Python handles multiple returns, and can be worked around
390 # by using something like `typing.List` instead.
File <decorator-gen-103>:2, in unweighted_unifrac(table, phylogeny, threads, bypass_tips)
File ~/miniconda3/envs/qiime2-2023.2/lib/python3.8/site-packages/q2_diversity_lib/_util.py:69, in _disallow_empty_tables(wrapped_function, *args, **kwargs)
66 if tab_obj.is_empty():
67 raise ValueError("The provided table is empty")
---> 69 return wrapped_function(*args, **kwargs)
File <decorator-gen-102>:2, in unweighted_unifrac(table, phylogeny, threads, bypass_tips)
File ~/miniconda3/envs/qiime2-2023.2/lib/python3.8/site-packages/q2_diversity_lib/_util.py:112, in _validate_requested_cpus(wrapped_function, *args, **kwargs)
107 if cpus_requested > cpus_available:
108 raise ValueError(f"The value passed to '{param_name}' cannot exceed "
109 f"the number of processors ({cpus_available}) "
110 "available to the system.")
--> 112 return wrapped_function(*bound_arguments.args, **bound_arguments.kwargs)
File ~/miniconda3/envs/qiime2-2023.2/lib/python3.8/site-packages/q2_diversity_lib/beta.py:221, in unweighted_unifrac(table, phylogeny, threads, bypass_tips)
218 if bypass_tips:
219 cmd += ['-f']
--> 221 _omp_cmd_wrapper(threads, cmd)
223 return result
File ~/miniconda3/envs/qiime2-2023.2/lib/python3.8/site-packages/q2_diversity_lib/_util.py:128, in _omp_cmd_wrapper(threads, cmd, verbose)
126 env = environ.copy()
127 env.update({'OMP_NUM_THREADS': str(threads)})
--> 128 return _run_external_cmd(cmd, verbose=verbose, env=env)
File ~/miniconda3/envs/qiime2-2023.2/lib/python3.8/site-packages/q2_diversity_lib/_util.py:122, in _run_external_cmd(cmd, verbose, env)
117 print("Running external command line application. This may print"
118 " messages to stdout and/or stderr.\nThe command being run is"
119 " below. This command cannot be manually re-run as it will"
120 " depend on temporary files that no longer exist.\n\nCommand:\n")
121 print(" ".join(cmd), end='\n\n')
--> 122 return subprocess.run(cmd, check=True, env=env)
File ~/miniconda3/envs/qiime2-2023.2/lib/python3.8/subprocess.py:493, in run(input, capture_output, timeout, check, *popenargs, **kwargs)
490 kwargs['stdout'] = PIPE
491 kwargs['stderr'] = PIPE
--> 493 with Popen(*popenargs, **kwargs) as process:
494 try:
495 stdout, stderr = process.communicate(input, timeout=timeout)
File ~/miniconda3/envs/qiime2-2023.2/lib/python3.8/subprocess.py:858, in Popen.__init__(self, args, bufsize, executable, stdin, stdout, stderr, preexec_fn, close_fds, shell, cwd, env, universal_newlines, startupinfo, creationflags, restore_signals, start_new_session, pass_fds, encoding, errors, text)
854 if self.text_mode:
855 self.stderr = io.TextIOWrapper(self.stderr,
856 encoding=encoding, errors=errors)
--> 858 self._execute_child(args, executable, preexec_fn, close_fds,
859 pass_fds, cwd, env,
860 startupinfo, creationflags, shell,
861 p2cread, p2cwrite,
862 c2pread, c2pwrite,
863 errread, errwrite,
864 restore_signals, start_new_session)
865 except:
866 # Cleanup if the child failed starting.
867 for f in filter(None, (self.stdin, self.stdout, self.stderr)):
File ~/miniconda3/envs/qiime2-2023.2/lib/python3.8/subprocess.py:1704, in Popen._execute_child(self, args, executable, preexec_fn, close_fds, pass_fds, cwd, env, startupinfo, creationflags, shell, p2cread, p2cwrite, c2pread, c2pwrite, errread, errwrite, restore_signals, start_new_session)
1702 if errno_num != 0:
1703 err_msg = os.strerror(errno_num)
-> 1704 raise child_exception_type(errno_num, err_msg, err_filename)
1705 raise child_exception_type(err_msg)
FileNotFoundError: [Errno 2] No such file or directory: 'ssu'
Is this something to do with my temp folder?
When I run the first chunks to just load the artifact files the code works fine so I know the files are there and the paths are correct. FYI I am doing this in jupyterhub on a university HPC.
Any ideas would be appreciateed!