nextstrain / augur

Pipeline components for real-time phylodynamic analysis
https://docs.nextstrain.org/projects/augur/
GNU Affero General Public License v3.0
268 stars 128 forks source link

Augur index may always report sequence file is missing even if output dir is missing? #1644

Closed emmahodcroft closed 2 months ago

emmahodcroft commented 2 months ago

Current Behavior

My student Nosihle @Nosi-msomi reports that when trying to run:

augur index \
  --sequences data/sequences.fasta \
  --output results/sequence_index.tsv

If the results folder doesn't exist, she gets the error "ERROR: Could not open sequences file 'data/sequences.fasta'" (even though data/sequences.fasta does exist).

Checking the code I am wondering if this is because of the generic FileNotFoundError catch, which may be being triggered if the output directory isn't found?

Very sorry, I haven't had time to test this myself....

Possible solution

victorlin commented 2 months ago

Checking the code I am wondering if this is because of the generic FileNotFoundError catch, which may be being triggered if the output directory isn't found?

Good thinking! I just tested and can confirm that this is the case.

Another solution would be to automatically create the directory (or add an option to do so), but that is a bigger change that should be considered across Augur.

It's very possible to fix the error message to show the right file – I would go for that solution over making it generic.

emmahodcroft commented 2 months ago

Thanks so much for the check and quick fix! :D

Agree, that if we want it to create directories this would be a bigger change and something we'd want to be more wary of - in general I think most augur functions don't create directories. But the new clearer message will help get people in the right direction to a fix more quickly! 😁