becksteinlab / hop Goto Github PK
View Code? Open in Web Editor NEWSolvent network analysis. Hop is a python package based on MDAnalysis to analyze solvation dynamics.
Home Page: https://hop.readthedocs.io
License: GNU General Public License v3.0
Solvent network analysis. Hop is a python package based on MDAnalysis to analyze solvation dynamics.
Home Page: https://hop.readthedocs.io
License: GNU General Public License v3.0
Right now almost all docs are in python doc strings. The strings should be all turned into restructured text and then processed with Sphinx.
With the modification "MDAnalysis>=0.7.4" in setup.py and in Hop.egg-info/requires.txt the installation works well.
At some point (maybe MDA 0.10 - 0.11 transition?) the sorting of sites by increasing volume broke.
Some issue with newer version of the Bio.PDB writer:
In [44]: density.export3D() S --> ? S --> ? ... --------------------------------------------------------------------------- ValueError Traceback (most recent call last) /Volumes/Data/oliver/Biop/Projects/WaterNetworks/testcases/2IFB/analysis/ in () /Volumes/Data/oliver/Biop/Library/python/Hop/hop/sitemap.pyc in export3D(self, filename, site_labels) 1300 1301 self._write_psf(filename,site_labels) # atoms are numbered consecutively... -> 1302 self._write_pdb(filename,site_labels) # ..and residues correspond to sites 1303 self._write_vmd(filename,site_labels) # tcl code for labels in VMD 1304 /Volumes/Data/oliver/Biop/Library/python/Hop/hop/sitemap.pyc in _write_pdb(self, filename, site_labels) 1334 io.set_structure(s) 1335 pdbfile = self.filename(filename,'pdb') -> 1336 io.save(pdbfile) 1337 1338 def _write_psf(self,filename,site_labels): /opt/local/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/Bio/PDB/PDBIO.pyc in save(self, file, select, write_end) 154 model_residues_written=1 155 s=get_atom_line(atom, hetfield, segid, atom_number, resname, --> 156 resseq, icode, chain_id) 157 fp.write(s) 158 atom_number=atom_number+1 /opt/local/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/Bio/PDB/PDBIO.pyc in _get_atom_line(self, atom, hetfield, segid, atom_number, resname, resseq, icode, chain_id, charge) 76 element = atom.element.strip().upper() 77 if len(atom.element) > 2 or not element.isalpha(): ---> 78 raise ValueError("Unrecognised element %s" % repr(atom.element)) 79 element = element.rjust(2) 80 else: ValueError: Unrecognised element '?' > /opt/local/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/Bio/PDB/PDBIO.py(78)_get_atom_line() 77 if len(atom.element) > 2 or not element.isalpha(): ---> 78 raise ValueError("Unrecognised element %s" % repr(atom.element)) 79 element = element.rjust(2)
Remove most of the code in hop.constants
and use MDAnalysis.units
(which was based on hop.constants
...).
hop-generate-hopgraph.py -f hoptraj.dcd -s hoptraj.psf analysis/water.pickle
fails with
...
self._cache['sitelabels'].sort()
AttributeError: 'NodeView' object has no attribute 'sort'
To ensure minimum coding style: add
# -*- Mode: python; tab-width: 4; indent-tabs-mode:nil; coding:utf-8 -*-
# vim: tabstop=4 expandtab shiftwidth=4 softtabstop=4 fileencoding=utf-8
@iwelland has done major additions, which need to be merged
Serve docs from RTD instead of gh-pages.
via @iorga:
How can we visualize the network encoded by the file hopgraph.xgmml ? I tried with Cytoscape, it recognizes the columns etc, but the drawing shows only one big rectangle.
I also installed graphviz, but I'm not sure about how to use the modules, like "dot" for example. Is it correct to type
dot -Tpng -o x.png test.xgmml
The result is :
Warning: test.xgmml: syntax error in line 1 near '>'
Or do I have to format the xgmml file into a specific format ?
The current manual testing protocol contains a short (0.5 ns) trajectory of I-FABP. The rates that come out of running it through hop are not very believable, see discussion following #11 (comment).
We want to figure out if these rates are correctly calculated but just not converged or if there's a deeper problem.
(This is also important if we want to use a short version of the test trajectory for proper tests #2.)
In [66]: hm = HeatmapAnalysis(cg)
<type 'exceptions.AttributeError'> Traceback (most recent call last)
/mnt/denniej0/1l2x/namd_alex3/analysis/ in ()
/mnt/denniej0/1l2x/namd_alex3/analysis/build/bdist.linux-i686/egg/hop/analysis.py in init(self, hoppinggraphs, normalization, verbosity, prune)
<type 'exceptions.AttributeError'>: 'CombinedGraph' object has no attribute 'keys'
Most of the code in hop.density
can be replaced with MDAnalysis.analysis.density
(which originated here...).
Remove legacy code for Grid
and replace with the gridDataFormats library.
Remove code to call VMD (not really needed and too complicated to maintain)
Code is broken with modern networkx > 0.99.
Needs to be upgraded. Use networkx 0.36 for the time being.
Replace own versioning with versioneer.
Should have proper unit tests to check function.
Currently, the sphinx docs do not build correctly with a weird
RuntimeError: sys.path must be a list of directory names
Need be fixed.
When the 2 (h and h_ref) networks are combined and then trying to graph them
In [70]: cg = hop.graph.CombinedGraph(g0=h,g1=h_ref)
In [71]: cg.plot(0,'cg_h',linewidths=(0.01,))
<type 'exceptions.ValueError'> Traceback (most recent call last)
/mnt/denniej0/1l2x/namd_alex3/analysis/ in ()
/mnt/denniej0/1l2x/namd_alex3/analysis/build/bdist.linux-i686/egg/hop/graph.py in plot(self, igraph, filename, format, use_filtered_graph, label_sites, prog, cmap, max_node_size, interactive, **drawargs)
/mnt/denniej0/1l2x/namd_alex3/analysis/build/bdist.linux-i686/egg/hop/graph.py in select_graph(self, use_filtered_graph)
<type 'exceptions.ValueError'>: No filtered graph defined; create one with CombinedGraph.filter().
The h and h_ref stats show the following:
In [63]: h_ref.stats()
Out[63]:
{'G_degree': 14.352941176470589,
'G_degree_in': 7.1764705882352944,
'G_degree_in_max': 203,
'G_degree_in_min': 1,
'G_degree_in_nobulk': 6.2118226601,
'G_degree_in_nobulk_max': 23,
'G_degree_in_nobulk_min': 1,
'G_degree_max': 406,
'G_degree_min': 2,
'G_degree_nobulk': 12.423645320197044,
'G_degree_nobulk_max': 44,
'G_degree_nobulk_min': 2,
'G_degree_out': 7.1764705882352944,
'G_degree_out_max': 203,
'G_degree_out_min': 1,
'G_degree_out_nobulk': 6.2118226601,
'G_degree_out_nobulk_max': 22,
'G_degree_out_nobulk_min': 1,
'G_edges': 1464,
'G_edges_nobulk': 1261.0,
'G_internal': 0,
'G_isolated': 0,
'G_order': 204,
'G_order_nobulk': 203,
'site_N_equivalence_sites': 3,
'site_N_subsites': 3,
'site_lifetime_avg': 16.3956265762,
'site_lifetime_max': 520.0,
'site_lifetime_med': 10.9756097561,
'site_lifetime_min': 9.88235294118,
'site_lifetime_std': 36.3143549497,
'site_occupancy_kin_avg': 0.288865545357,
'site_occupancy_kin_max': 3.81550801001,
'site_occupancy_kin_med': 0.171122994142,
'site_occupancy_kin_min': 0.045454545319,
'site_occupancy_kin_std': 0.400538382202,
'site_occupancy_rho_avg': 0.295487473986,
'site_occupancy_rho_med': 0.177807486631,
'site_occupancy_rho_std': 0.408680025598,
'site_volume_avg': 4.65500820728,
'site_volume_med': 2.0}
In [64]: h.stats()
Out[64]:
{'G_degree': 14.617647058823529,
'G_degree_in': 7.3088235294117645,
'G_degree_in_max': 203,
'G_degree_in_min': 1,
'G_degree_in_nobulk': 6.34482758621,
'G_degree_in_nobulk_max': 23,
'G_degree_in_nobulk_min': 1,
'G_degree_max': 406,
'G_degree_min': 2,
'G_degree_nobulk': 12.689655172413794,
'G_degree_nobulk_max': 46,
'G_degree_nobulk_min': 2,
'G_degree_out': 7.3088235294117645,
'G_degree_out_max': 203,
'G_degree_out_min': 1,
'G_degree_out_nobulk': 6.34482758621,
'G_degree_out_nobulk_max': 23,
'G_degree_out_nobulk_min': 1,
'G_edges': 1491,
'G_edges_nobulk': 1288.0,
'G_internal': 0,
'G_isolated': 0,
'G_order': 204,
'G_order_nobulk': 203,
'site_N_equivalence_sites': 203,
'site_N_subsites': 203,
'site_lifetime_avg': 16.5140403744,
'site_lifetime_max': 520.0,
'site_lifetime_med': 11.0880829016,
'site_lifetime_min': 9.87951807229,
'site_lifetime_std': 36.5261078654,
'site_occupancy_kin_avg': 0.304829297582,
'site_occupancy_kin_max': 3.98997325014,
'site_occupancy_kin_med': 0.179812833689,
'site_occupancy_kin_min': 0.0548128340612,
'site_occupancy_kin_std': 0.42739504416,
'site_occupancy_rho_avg': 0.295487473986,
'site_occupancy_rho_med': 0.177807486631,
'site_occupancy_rho_std': 0.408680025598,
'site_volume_avg': 4.65500820728,
'site_volume_med': 2.0}
I ran the tests https://github.com/Becksteinlab/hop/wiki/Testing (see also #11) but no transitions are detected, even though earlier versions showed them.
(hop) yngvi:TESTING oliver$ ./HOP_TESTRUN.sh
MDAnalysis : INFO MDAnalysis 0.18.0 STARTED logging to 'MDAnalysis.log'
Histogramming bulk=3036 solvent=3444 atoms in frame 500/500 [100.0%]
/Users/oliver/anaconda3/envs/hop/lib/python2.7/site-packages/numpy/core/fromnumeric.py:2909: RuntimeWarning: Mean of empty slice.
out=out, **kwargs)
/Users/oliver/anaconda3/envs/hop/lib/python2.7/site-packages/numpy/core/_methods.py:80: RuntimeWarning: invalid value encountered in double_scalars
ret = ret.dtype.type(ret / rcount)
MDAnalysis : INFO MDAnalysis STOPPED logging
MDAnalysis : INFO MDAnalysis 0.18.0 STARTED logging to 'MDAnalysis.log'
MDAnalysis.app: INFO Generating hopping trajectory for density 'analysis/water.pickle'
Mapping frame 500/ 500 [100.0%]
MDAnalysis.analysis.hop.trajectory: INFO HoppingTrajectory.write(): wrote hoptraj 'analysis/hoptraj.dcd'.
MDAnalysis.analysis.hop.trajectory: INFO HoppingTrajectory.write(): wrote hoppsf 'analysis/hoptraj.psf'.
MDAnalysis.app: INFO Created hopping trajectory analysis/hoptraj.dcd with analysis/hoptraj.psf
MDAnalysis : INFO MDAnalysis STOPPED logging
MDAnalysis : INFO MDAnalysis 0.18.0 STARTED logging to 'MDAnalysis.log'
MDAnalysis.app: INFO Generating hopping graph from trajectory '/Volumes/Data/oliver/Biop/Projects/Bogdan/TESTING/analysis/hoptraj.psf'/'/Volumes/Data/oliver/Biop/Projects/Bogdan/TESTING/analysis/hoptraj.dcd' ...
Analyzing hops: frame 500/500 [100.0%]
MDAnalysis.analysis.hop.graph: INFO Building hopping graph with rate constants k1, k2 or k.
MDAnalysis.analysis.hop.graph: INFO (Ignore 'Warning: ... maxfev = 800': then a single k is chosen automatically.)
MDAnalysis.app: INFO Saved hopgraph as analysis/hopgraph.pickle
No handlers could be found for logger "hop.interactive"
/Users/oliver/anaconda3/envs/hop/lib/python2.7/site-packages/hop/graph.py:924: MissingDataWarning: Filtered graph contains no transitions: no plots available
warnings.warn(msg, category=MissingDataWarning)
MDAnalysis.analysis.hop.graph: WARNING Filtered graph contains no transitions: no plots available
MDAnalysis.app: INFO Created hopping graph analysis/hopgraph.pickle and other files
MDAnalysis : INFO MDAnalysis STOPPED logging
@iwelland , is the g_flux
like tool part of your PR #20? It would be good to have this available because people (occasionally) ask for an update of g_flux
such as orbeckst/g_count#6.
In density.py, lines 149-155 assume that the MD trajectory will have the properties mentioned in the subject. My local version just has try/except clauses added to get around this since all that code is doing is determining metadata that as far as I can tell is not used for the Hop process.
Installing the package directly from the tar ball should work but doesn't:
easy_install Hop-0.3.0.tar.gz
Gives the error message
Processing Hop-0.3.0.tar.gz
Running Hop-0.3.0/setup.py -q bdist_egg --dist-dir /var/folders/ja/jaE1z6Zo2RaPfE+F75CkvU+++TM/-Tmp-/easy_install-2eLMhS/Hop-0.3.0/egg-dist-tmp-ED49ho
The required version of setuptools (>=0.6c11) is not available, and can't be installed
while this script is running. Please install a more recent version first, using
'easy_install -U setuptools'.
(Currently using setuptools 0.6c9 (/System/Library/Frameworks/Python.framework/Versions/2.6/Extras/lib/python))
error: Setup script exited with 2
The same error appears even after upgrading setuptools.
The new MDAnalysis release 0.11.0 breaks parts of the API and it is likely that hop needs to be migrated and pinned to MDAnalysis >= 0.11.0.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.