pub enum JsonFormat {
NodeLink,
Tree,
}
Expand description
We can handle 2 kinds of JSON formats:
- the node link format
- the tree format
The node link format comes from an old version of NetworkX
and looks like the following:
{'nodes': [{'id': 'A'}, {'id': 'B'}], 'links': [{'source': 0, 'target': 1}]}
This format is only used as legacy and is not recommended for new projects
as it’s easy to mess up and not even supported anymore by NetworkX.
The tree format is a more natural looking format (only id
is required):
{
"id": "1",
"name": "root",
"rank": "no rank",
"children": [
{
"id": "2",
"name": "Bacteria",
"rank": "no rank",
"children": [
{
"id": "562",
"name": "Escherichia coli",
"rank": "species",
}
]
}
]
For both formats, you can add more data on each node object and these will be available after loading.
If a rank
propery is present, it will be parsed as a NCBI rank.
Variants§
NodeLink
The node link format is made of 2 arrays:
- the nodes with their taxonomic info. Internal (integer) IDs are the node’s position in the nodes array
- the links between each node: a
source
node has aparent
node. The nodes are represented by indices in the nodes array Only use that format if you have existing taxonomies in that format.
Tree
The preferred format
Trait Implementations§
Source§impl PartialEq for JsonFormat
impl PartialEq for JsonFormat
impl Eq for JsonFormat
impl StructuralPartialEq for JsonFormat
Auto Trait Implementations§
impl Freeze for JsonFormat
impl RefUnwindSafe for JsonFormat
impl Send for JsonFormat
impl Sync for JsonFormat
impl Unpin for JsonFormat
impl UnwindSafe for JsonFormat
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more