SystemsGenetics / KINC

Knowledge Independent Network Construction
MIT License
11 stars 4 forks source link

Added a visualization script. #114

Closed biggstd closed 4 years ago

biggstd commented 5 years ago

Visualization script is for plain-text co-expression files. This new file is the only change in this commit.

This script can be launched as a 'panel' application via:

panel serve kinc_network.py --args "data/rice_heat_drought.GEM.hisat2.FPKM.log2.th0.5-gmm-Treatment-1e-10.coexpnet.pa-filtered-wt1e-30.txt"

Or as a standard python module via:

python kinc_network.py "data/rice_heat_drought.GEM.hisat2.FPKM.log2.th0.5-gmm-Treatment-1e-10.coexpnet.pa-filtered-wt1e-30.txt"

You may need to install some python packages -- I didn't see a python requirements.txt to update:

conda install pandas networkx holoviews param bokeh
spficklin commented 5 years ago

@biggstd , when I test I get this:

$ python /local/projects/KINC/scripts/viz_kinc_network.py "rice_heat_drought.GEM.FPKM.filtered.traditional.gcn.txt"
  File "/local/projects/KINC/scripts/viz_kinc_network.py", line 127
    **self.graph_opts}
     ^
SyntaxError: invalid syntax

Thoughts?

biggstd commented 5 years ago

What version of python are you using? I think this script requires 3.6.

spficklin commented 4 years ago

I finally got back to this. Sorry for the slowness. I was able to get it to work and it looks great and is very responsive! The Bokeh controls work great. But I had a few issues that I couldn't get past. Before I get into those. I did update the code a bit to support the new file formats that KINC 3.4.0 will generate. I also fixed a bug that kept the code from opening. I just had to uncomment this line:

    edge_line_width = param.Selector(default=None)

Issues

  1. The panel of options on the left is great but I couldn't get them to update the view. Changing the node size or any of the dropdowns to alter the edge width or edge color did not work.
  2. The "update graph" button did not work.

Requested Changes

  1. We need docstring documentation for each function. It's a very short program but for folks who are new to all of the great libraries being used it would be helpful if the code comments taught new users as well as helped old-timers too.
  2. In the application GUI, there is a "Documentation" tab on the top left, but the contents I don't think would make sense to the end-user. It uses Python terminology to define concepts that are not Python specific. We should fix those or remove that tab. We have enough documentation on the KINC RTD so I don't think it's necessary.
  3. Let's rename this script KINCviz.py. On the GUI in the right panel it says "KINCnetworkViz" which is a bit hard to read. IF we could make that say KINCviz too that would be great.
  4. I saw a comment in the code about making drag and drop to work. I think we can take that out. If we really think that is needed we should add it as an issue.

Testing to be done

  1. I want to test it on a really large dataset to see how well it scales.
spficklin commented 4 years ago

Oh, one thing that would be nice. Is it possible with the graph library being used to get the degree of each node and size the node according to it's degree? This way it would be easier to spot hub nodes in the hair ball.

spficklin commented 4 years ago

I have replaced the 2D visualization script with a 3D version. This is the only change and it's independent of the C++ code for KINC so I'm merging.