To Create Protovis Sunburst charts : Python script to create dataset in json format (or) Parent - Child json

1.7k Views Asked by At

Help!!! As a biologist I am just interested in visualizing and displaying my data and I am very new to programming. Here I have a set of data in a excel file, which looks like this-

I guess it's very perfect to display my data set using Sunburst chart in Protovis.

But I have stuck with preparing the data, which has to be in json format. If you notice that the structure of the data is hierarchical (Parent - Child hierarchy). Being not so good in programming (just know a little bit of Python) it's difficult to go ahead.

I need a python script which can read my excel file and generate a json as specified above.

My excel data file has columns named L1, L2, L3, L4, L5, GENE_NAMES having data and there is a parent and child relationship. L1 is Parent to L2 and L2 is parent to L3, so on...

  • L1 (PARENT) - L2 (CHILD)
  • L2 (PARENT) - L3 (CHILD)
  • L3 (PARENT) - L4 (CHILD)
  • L4 (PARENT) - L5 (CHILD)
  • L5 (PARENT) - GENE_NAME (CHILD)

Hope I can get my data set visualized in the above format. But I should have my data-set in the json format specified in here

Any sort of help appreciated.

1

There are 1 best solutions below

0
namit On

use networkx to represent such graphs(where parent-child relationship is present).. . by using it; your code remains in the python.. .
example:

http://networkx.github.com/documentation/latest/examples/drawing/lanl_routes.html