Closed seoanezonjic closed 7 years ago
Oops. My bad, I didn't include it in the documentation. In the meantime you can do it like this:
new CanvasXpress("canvas", { y: { smps: ["A", "B", "C", "D"], vars: ["V1"], data: [[2, 10, 20, 15]] } }, { graphType: "Bar", smpDendrogramNewick: "A,(D,(B,C))", samplesClustered: true } );
I will include it in the next release!
Sorry Neuhasi, I have to reopen this issue. I have tested your code and the tree it's show but there is a problem with the relations. Maybe I don´t understand how to set the relations. With my example I mean that B is connected directly with C and this cluster is connected to D and this whole cluster it's connected with A. If you inspect your chart, the relations are different, B is connected to D and this cluster is connected to C and then to A. This is a bug or I have to specify the relations in other way?
By the way, I would like to ask you a question. You use the newick format to describe the trees. Your library has support to custom distances? In newick format it's annotated as:
(sample_name1:distance, sample_name2:distance)
This format is the tipical output of alignment programs such as clustal and would be very useful to load the generated trees in your charts.
Thank you very much in advance
Arghhh! Sorry it is not reading the smpDendrogramNewick property because I forgot to register it when I moved the trees from the data to the properties. Currently it is clustering by the value of the gene which make sense since the data is clustered by the magnitude of 'V1'. I will create a new version and publish it before the end of the week. And, yes the format supports distances. Let me fix it and put an example. Regards, Isaac
Fixed in Version 17.5!
new CanvasXpress("canvas", { y: { smps: ["A", "B", "C", "D"], vars: ["V1"], data: [[2, 10, 20, 15]] } }, { graphType: "Bar", smpDendrogramNewick: "D,(A,(B,C))", showSmpDendrogram: true } );
Isaac
Hi neuhasi I'm working with you javascript library but with your last changes I'm lost with the tree feature. Take a histogram with four samples : A, B, C and D with values of 2, 10 ,20 and 15 and the relations are A,(D,(B,C)). How the tree is declared in the canvas object? and how it is placed in the chart? Thank you in advance