Output files not collected in specified directory (--output-dir option)


I am working on a plugin which takes advantage of the miscellaneous option --output-dir Qiime2 provides. I would like for the user to be able to provide this option to name a directory into which my plugin's output files will be collected. However, the way the plugin is setup right now, the directory gets created but the .qzv and .tsv files are put into the directory from which the user ran the plugin. Could I have not properly set this up in my plugin_setup.py file, or could I be missing an import, or maybe I should forego this option all together?

I have attached the plugin_setup.py file and the file containing the function I am working with. The function is called "generate_corr_matrix".

Let me know of additional information needed.

plugin_setup.py (2.3 KB)
generate_corr_matrix.py (11.0 KB)

1 Like

Hello @asah, can you post an example of how you are invoking the action?

Of course:

qiime q2-ps-qc generate-corr-matrix
--p-data input-dat/IM0032-pA_PV1_subset_CS.tsv
--o-bad-output bad_corr
--o-good-output good_corr
--output-dir corr_mat_gen --verbose > corr_mat_gen.out

Hi @asah,
The --o-* options and the --output-dir options are not intended to be used directly. If you specify a path using a ``--o-parameter, that path will be where that particular output is written (appending.qzaor.qzv, if the extension is not included in the path). Any --o-*options that are not provided will be written to the directory specified by--output-dir` using the name of the plugin-specified output.

In your case, if you adapt your command to the following:

qiime q2-ps-qc generate-corr-matrix \
  --p-data input-dat/IM0032-pA_PV1_subset_CS.tsv \
  --output-dir corr_mat_gen

You should have two output files, corr_mat_gen/good-output.qza and corr_mat_gen/bad-output.qza.

Does that make sense?

Also, I notice that you're providing a filepath to your --p-data option. We highly recommend providing this either as metadata (a --m-* parameter) if relevant, or as a QIIME 2 artifact (a --i-*) option. While what you're doing here will work on the command line, it won't work with other QIIME 2 interfaces (e.g., Galaxy), and the data in this file won't be linked to data provenance.

Thanks for your interest in building a QIIME 2 plugin, and welcome to the forum! Let us know if you run into other questions.


I tried out the command adaptation you suggested, and I was able to collect my visualization files into the directory specified by the --output-dir option. Your explanation also makes sense given some of the other example commands I have seen for the other plugins I work with.

Thanks you for the help, and I look forward to developing more technologies using Qiime2!

1 Like