Open crarlus opened 4 years ago
I agree. This type of command would be very useful! As great as the interactive program is, it can be laborious when I have to generate multiple MSTs with different subsets of data, node colors, etc.
I agree, too. Another nice feature would be the preloading of a json file before launching the local browser instance.
I came looking for this!! I would like this feature too. I'll bet that the hangup is that it is programmed in javascript instead of python. Maybe somewhere in here. I think it would be a great addition to bring it into the command line. https://github.com/achtman-lab/GrapeTree/blob/master/static/js/tree/d3_m_tree.js
Can anyone find the relevant code? I can't figure it out yet.
This is my MST based on a sample lambda dataset if it helps anyone either in programming it or finding where it is programmed.
{
"links": [
{
"source": 0,
"target": 1,
"distance": 85
},
{
"source": 0,
"target": 2,
"distance": 80
},
{
"source": 0,
"target": 3,
"distance": 75
},
{
"source": 0,
"target": 4,
"distance": 0
}
],
"nodes": [
"_hypo_0",
"sample1",
"sample2",
"sample3",
"sample4"
],
"layout_data": {
"node_positions": {
"sample4": [
508.6975515344812,
621.3798986409274
],
"sample1": [
1028.5434415728532,
608.720885637819
],
"sample2": [
28.764701999876763,
723.0719659155677
],
"sample3": [
584.0186640866862,
166.39586921998318
]
},
"nodes_links": {
"max_link_length": 10000,
"max_link_scale": 500,
"base_node_size": 10,
"size_power": 0.5,
"link_font_size": 14,
"show_link_labels": false,
"show_node_labels": false,
"node_font_size": 12,
"custom_colours": {},
"hide_link_length": 10000,
"show_individual_segments": false,
"node_collapsed_value": 0,
"manual_collapsing": {},
"custom_color_scheme": [
"#1f77b4",
"#aec7e8",
"#ff7f0e",
"#ffbb78",
"#2ca02c",
"#98df8a",
"#d62728",
"#ff9896",
"#9467bd",
"#c5b0d5",
"#8c564b",
"#c49c94",
"#e377c2",
"#f7b6d2",
"#7f7f7f",
"#c7c7c7",
"#bcbd22",
"#dbdb8d",
"#17becf",
"#9edae5",
"#393b79",
"#5254a3",
"#6b6ecf",
"#9c9ede",
"#637939",
"#8ca252",
"#b5cf6b",
"#cedb9c",
"#8c6d31",
"#bd9e39",
"#e7ba52",
"#e7cb94",
"#843c39",
"#ad494a",
"#d6616b",
"#e7969c",
"#7b4173",
"#a55194",
"#ce6dbd",
"#de9ed6",
"#3182bd",
"#6baed6",
"#9ecae1",
"#c6dbef",
"#e6550d",
"#fd8d3c",
"#fdae6b",
"#fdd0a2",
"#31a354",
"#74c476",
"#a1d99b",
"#c7e9c0",
"#756bb1",
"#9e9ac8",
"#bcbddc",
"#dadaeb",
"#636363",
"#969696",
"#bdbdbd",
"#d9d9d9"
]
},
"scale": 0.7095940084767466,
"translate": [
174,
-64
],
"display_category": "nothing"
},
"metadata": {
"_hypo_0": {
"ID": "_hypo_0",
"__Node": "_hypo_0"
},
"sample1": {
"ID": "sample1",
"__Node": "sample1",
"__selected": false,
"id": 1
},
"sample2": {
"ID": "sample2",
"__Node": "sample2",
"__selected": false,
"id": 2
},
"sample3": {
"ID": "sample3",
"__Node": "sample3",
"__selected": false,
"id": 3
},
"sample4": {
"ID": "sample4",
"__Node": "sample4",
"__selected": false,
"id": 4
}
},
"initial_category": "nothing",
"category_num": 30,
"newickTree": "(sample1:85,sample2:80,sample3:75,sample4:0);",
"metadata_options": {
"nothing": {
"label": "No Category",
"coltype": "character",
"grouptype": "size",
"colorscheme": "category",
"minnum": 0,
"category_num": 30
},
"ID": {
"label": "ID",
"coltype": "character",
"grouptype": "size",
"colorscheme": "category",
"minnum": 0
}
}
}
Hi, thanks for grapetree, we use it a lot by uploading a mstree and metadata to a local grapetree instance in the browser.
However I wonder whether it is possible to create the grapetree visualizions (i.e. the json file) programmatically from the command line?
For instance, is there any such option as
grapetree --json --treefile mstree.nwk --meta metadata.tsv > grapetree_viz.json
?This would be really helpful for updating the visualization whenever new data is available.