nextstrain / auspice

Web app for visualizing pathogen evolution
https://docs.nextstrain.org/projects/auspice/
GNU Affero General Public License v3.0
292 stars 162 forks source link

BUG: Cannot view `.json` file with local auspice if metadata not in directory #1545

Open corneliusroemer opened 2 years ago

corneliusroemer commented 2 years ago

Current Behavior

When debugging something with Bryan, I wanted to quickly visualise a bare bones tree we had produced without metadata. augur export v2 does not require metadata to be present. So the output tree was produced.

Yet when I wanted to view the tree using:

npx auspice view --datasetDir results/nebraska_hmpxv1   

and clicked on the tree in the screen I got the following error:

ET DATASET query received: prefix=raw
Trace: [Error: ENOENT: no such file or directory, open '/Users/corneliusromer/Downloads/bryan/monkeypox/results/nebraska_hmpxv1/raw_meta.json'] {
  errno: -2,
  code: 'ENOENT',
  syscall: 'open',
  path: '/Users/corneliusromer/Downloads/bryan/monkeypox/results/nebraska_hmpxv1/raw_meta.json'
}
    at /Users/corneliusromer/.npm/_npx/cf0e2cb1de202dd7/node_modules/auspice/cli/server/getDataset.js:14:15
[warning]       couldn't fetch JSONs -- ENOENT: no such file or directory, open '/Users/corneliusromer/Downloads/bryan/monkeypox/results/nebraska_hmpxv1/raw_meta.json'
image

Why is that?

On auspice.us, I can see the tree fine. Would be nice if local auspice behaved the same and allowed me to view it without metadata.

This is how auspice.us shows the tree:

image

We reproduced this on v2.37.3 and v2.38.0

corneliusroemer commented 2 years ago

Could the issue be that the file is called results/nebraska_hmpxv1/raw_tree.json - and _tree is treated as a magic extension?

Oh that seems to be it - when I rename it auspice shows it. Hmm, would be nice to show the tree even if it's called _tree.

joverlee521 commented 2 years ago

The special case of *_tree.json + *_meta.json is to keep backwards compatibility with v1 dataset JSONs. These are the JSONs created by augur export v1 or augur export when using any augur versions < 6.0.0.

jameshadfield commented 2 years ago

Jover is correct on why this is happening.

As for solutions, if only one of X_tree.json and X_meta.json exist we could assume it's a v2 dataset. I don't see many downsides to this. In practice I think this would only require improving the code to detect which files are v2 datasets.