Issues with q2-shogun

(Sarath) #1

I’ve been trying to build a bowtie index and run q2-shogun plugin based on the directions in But I was getting some errors and I tried to debug and found some issues. I think they’re bugs in the code.

At first, I created a bowtie index with some reference sequences and base name test_bt and when I run the following command:

qiime shogun nobunaga \
           --i-query query_seq_v1.qza \
           --i-reference-reads ref_seq.qza \
           --i-reference-taxonomy ref_tax.qza \
           --i-database test_bt.qza \
           --o-taxa-table taxatable_v2.qza \

I go this error -
Exception: Database /tmp/tmphrcjl3yb is not formatted correctly: Prefix not found: /tmp/tmphrcjl3yb/bowtie2/genomes.small not found

Apparently in the source code the base name for bowtie index is hard coded as genomes.small. So once I change the base name of bowtie index to genomes.small, that issue got resolved and I got another error.

Error: No such command "assign-taxonomy".
Traceback (most recent call last):
  File "/home/sarath/anaconda3/envs/qiime2-2019.1/lib/python3.6/site-packages/q2cli/", line 274, in __call__
    results = action(**arguments)
  File "</home/sarath/anaconda3/envs/qiime2-2019.1/lib/python3.6/site-packages/>", line 2, in nobunaga
  File "/home/sarath/anaconda3/envs/qiime2-2019.1/lib/python3.6/site-packages/qiime2/sdk/", line 231, in bound_callable
    output_types, provenance)
  File "/home/sarath/anaconda3/envs/qiime2-2019.1/lib/python3.6/site-packages/qiime2/sdk/", line 365, in _callable_executor_
    output_views = self._callable(**view_args)
  File "/home/sarath/anaconda3/envs/qiime2-2019.1/lib/python3.6/site-packages/q2_shogun/", line 78, in nobunaga
  File "/home/sarath/anaconda3/envs/qiime2-2019.1/lib/python3.6/site-packages/q2_shogun/", line 32, in _run_command, check=True)
  File "/home/sarath/anaconda3/envs/qiime2-2019.1/lib/python3.6/", line 418, in run
    output=stdout, stderr=stderr)
subprocess.CalledProcessError: Command '['shogun', 'assign-taxonomy', '-i', '/tmp/tmpwf6j8gx8/alignment.bowtie2.sam', '-d', '/tmp/tmpwf6j8gx8', '-o', '/tmp/tmpwf6j8gx8/taxatable.tsv', '-a', 'bowtie2']' returned non-zero exit status 2.

Plugin error from shogun:

  Command '['shogun', 'assign-taxonomy', '-i', '/tmp/tmpwf6j8gx8/alignment.bowtie2.sam', '-d', '/tmp/tmpwf6j8gx8', '-o', '/tmp/tmpwf6j8gx8/taxatable.tsv', '-a', 'bowtie2']' returned non-zero exit status 2.

I checked the code and the function name is actually ‘assign_taxonomy’, but here its called as ‘assign-taxonomy’. And if I correct it, the code will work well.

It’d be nice if you can fix these issues.


(Nicholas Bokulich) #2

Thanks @sarath!

You are correct — you found a couple bugs. The second one in particular arose because the function name was recently changed in SHOGUN. SHOGUN and q2-shogun are both young and we are working out the kinks. Thank you for your help!

It sounds like you already fixed these… would you like to submit a pull request to incorporate these fixes in the source code?

(Sarath) #3

Hi Nicholas,

I’ve submitted a pull request incorporating the bug fixes.

There is another issue when you access the same function from Artifact API. I forgot to mention it last time:

FileNotFoundError                         Traceback (most recent call last)
<ipython-input-7-bceda3adca9d> in <module>
      3 results = q2_shogun._shogun.nobunaga(query=test_reads, 
      4                              reference_reads=ref_reads, reference_taxonomy=ref_tax,
----> 5                             database=bt_index)

/anaconda3/envs/qiime2-2019.1/lib/python3.6/site-packages/q2_shogun-0+untagged.16.g01fa19b.dirty-py3.6.egg/q2_shogun/ in nobunaga(query, reference_reads, reference_taxonomy, database, taxacut, threads, percent_id)
     81         print(tmpdir)
     82         setup_database_dir(tmpdir,
---> 83                            database, reference_reads, reference_taxonomy)
     85         # run aligner

/anaconda3/envs/qiime2-2019.1/lib/python3.6/site-packages/q2_shogun-0+untagged.16.g01fa19b.dirty-py3.6.egg/q2_shogun/ in setup_database_dir(tmpdir, database, refseqs, reftaxa)
     40     print(reftaxa)
     41     BOWTIE_PATH = 'bowtie2'
---> 42     duplicate(str(refseqs), os.path.join(tmpdir, 'refseqs.fna'))
     43     reftaxa.to_csv(os.path.join(tmpdir, 'taxa.tsv'), sep='\t')
     44     shutil.copytree(str(database), os.path.join(tmpdir, BOWTIE_PATH),

/anaconda3/envs/qiime2-2019.1/lib/python3.6/site-packages/qiime2/ in duplicate(src, dst)
     88     try:
---> 89, dst)
     90     except OSError as e:
     91         if e.errno == errno.EXDEV:  # Invalid cross-device link

FileNotFoundError: [Errno 2] No such file or directory: '<artifact: FeatureData[Sequence] uuid: 18ea390f-77b8-4ff4-9f9c-7284db1cfa68>' -> '/var/folders/mh/9jvnfxhj2v365njp2cvp1z_40000gn/T/tmpgriwn8ac/refseqs.fna' 

I’m not sure how to fix this since the same code works well from command line.

(Nicholas Bokulich) #4

Hi @sarath,
Thanks for the error report. This is a bit surprising that the command fails only with the artifact API — the unit tests in the package actually use artifact API so either this is:

  1. an issue with the input files
  2. because you are running on a development version of q2-shogun (presumably your local branch where you have made several changes to the source code) and those changes are causing the issue.

To troubleshoot, let’s work backwards.

  1. What happens when you attempt to run the unit tests? If they pass, this is probably an issue with your input files, not with the source code behaving differently between API and CLI. If they fail, then I suspect local changes to the source code are the problem (but perhaps not… changes to the shogun package could be causing this issue).
  2. If this is a problem with the input files, it would be good to know where and why this problem is occurring so that we can have q2-shogun raise a clearer error message. Let’s cross this bridge after you perform troubleshooting step #1.