If each strains has an integer ID so that the Newick tree would be in the format:
((1:0.4,(2:0.1,3:0.1):0.2):0.2,(4:0.1,5:0.1):0.3);
then using metadata in the following CSV format:
strain, location
1, 0
2, 1
3, 0
4, 1
5, 0
will cause newick_to_taxonium (and when converted usher_to_taxonium) to fail to assign metadata to nodes.
The issue is that when pandas loads the metadata CSV, it casts the strain column as an integer since it can, whereas the loading of a newick tree always casts the strains as strings, so the types are not equal and searching by strain from metadata will result in no matches in the tree.
A temporary workaround is just renaming a strain to a non-number format to force the column to be read as a string, however this is a bit hacky for me to place in my pipeline since my strain names being integers is heavily embedded in my pipeline.
I've not managed to setup a local version of taxonium on my machine, but it should be fixable by changing how the must_have_cols is parsed in read_metadata in taxoniumtools/src/taxoniumtools/utils.py, maybe by appending
metadata.index = metadata.index.astype(str) after line 25.
If each strains has an integer ID so that the Newick tree would be in the format:
((1:0.4,(2:0.1,3:0.1):0.2):0.2,(4:0.1,5:0.1):0.3);
then using metadata in the following CSV format:
will cause
newick_to_taxonium
(and when convertedusher_to_taxonium
) to fail to assign metadata to nodes.The issue is that when pandas loads the metadata CSV, it casts the strain column as an integer since it can, whereas the loading of a newick tree always casts the strains as strings, so the types are not equal and searching by strain from metadata will result in no matches in the tree.
A temporary workaround is just renaming a strain to a non-number format to force the column to be read as a string, however this is a bit hacky for me to place in my pipeline since my strain names being integers is heavily embedded in my pipeline.
I've not managed to setup a local version of taxonium on my machine, but it should be fixable by changing how the
must_have_cols
is parsed inread_metadata
intaxoniumtools/src/taxoniumtools/utils.py
, maybe by appendingmetadata.index = metadata.index.astype(str)
after line 25.