Skip to content
This repository has been archived by the owner on Nov 9, 2023. It is now read-only.

filter_samples_from_otu_table.py --sample_id_fp fails on blank lines #2099

Open
jairideout opened this issue Oct 27, 2015 · 3 comments
Open

Comments

@jairideout
Copy link
Member

If the file specified via --sample_id_fp has blank lines, filter_samples_from_otu_table.py fails with an uninformative error message:

$ filter_samples_from_otu_table.py -i final_otu_table.biom -o site_C.biom --sample_id_fp Site_C.txt
Traceback (most recent call last):
  File "/macqiime/anaconda/bin/filter_samples_from_otu_table.py", line 162, in <module>
    main()
  File "/macqiime/anaconda/bin/filter_samples_from_otu_table.py", line 129, in main
    l.startswith('#')])
IndexError: list index out of range

Relevant QIIME forum post here.

@gblanchard4
Copy link
Contributor

A couple questions about this bug:

  1. Should the list comprehension be changed to a couple conditional statements due to the fact adding an or would make it overly complex?
  2. On line 87 we assign input_fp = opts.input_fp but on line 116 we are still using opts.input_fp for the load_table function
87:    input_fp = opts.input_fp
...
116:  otu_table = load_table(opts.input_fp)

Is this just an artifact of the code being refactored at some point? Should this be fixed too?

I understand the upgrade to QIIME 2 will bring a whole new codebase, so it may not be worth fixing.

@colinbrislawn
Copy link
Contributor

Qiime 1.9.x is an LTS release, so it's probably worth fixing, eventually.

  1. I'm not sure the best way to address this. What's the desired functionality with blank lines? Throw an error? Ignore them?
  2. Good catch. That's inconsistent, but IDK if it matters.

@gregcaporaso
Copy link
Contributor

Hi @gblanchard4, thanks for the questions. Since it's a pretty straight-forward fix, if we end up doing a 1.9.2, we'd fix this, but probably not otherwise.

On your first question, yes it's probably worth changing that. On the second question, yep, just must have been missed on a refactor at some point.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

4 participants