yatisht / usher

Ultrafast Sample Placement on Existing Trees
MIT License
122 stars 41 forks source link

ENH: Make `sample type` an Auspice filter #228

Open corneliusroemer opened 2 years ago

corneliusroemer commented 2 years ago

I think it would be nice to have sample type enabled as an Auspice filter.

It should be as easy as adding a few lines to the auspice_config.json that's used for exporting.

That way, one could quickly filter down to new samples as opposed to reference tree samples.

yatisht commented 2 years ago

@jmcbroome would this be easy to add?

jmcbroome commented 2 years ago

I'm afraid I'm lacking some context for this request. We don't use an "Auspice_config" json, we have a simple Nextstrain json format hardcoded into matUtils. Would "sample type" be some kind of metadata tagging that we could set a coloring by, similar to country? How would "sample type" be determined? Would this be part of an output from calling an UShER placement, and the samples would be tagged by whether they were added in that call?

corneliusroemer commented 2 years ago

Happy to explain @jmcbroome :)

You already have it as a color by:

image

All that's needed is to add a little bit of code to the hardcoded auspice.json part here: https://github.com/yatisht/usher/blob/728b739a27613e8277988a504743c58e09bc233e/src/matUtils/convert.cpp#L481

I'll see what needs to be added to get it to work - it should just be a very small code change.

corneliusroemer commented 2 years ago

Right now, filters seems to be empty, at least in the auspice.json produced by online Usher:

image

Maybe a bug? Or maybe I'm looking at the wrong part of the code.

corneliusroemer commented 2 years ago

Alright, so all you have to do is add the following inside filter:

"filters": ["country","userOrOld"]

That's it!

I manually edited an auspice.json produced by usher conforming with the above and it works 🎉

image
corneliusroemer commented 2 years ago

Here's an auspice config.json I found in this repo. Not sure whether it's used at all.

https://github.com/yatisht/usher/blob/master/workflows/config/config.json

corneliusroemer commented 2 years ago

@jmcbroome what I don't understand is why the filters array was empty. It should have already contained country but didn't. Any idea why?

The weird thing is, that I can only find a description mentioning matUtils while the description of the web produced auspice.json has a different description. So that may be why country isn't showing in the filter. https://github.com/yatisht/usher/blob/a37da007af2cb04c8d1942e0e8aac051b0e1b64d/src/matUtils/convert.cpp#L474

@AngieHinrichs do you have an idea where the web version of auspice meta comes from?