Skip to content

Commit

Permalink
Updated shortest path determination to reflect networkx return struct…
Browse files Browse the repository at this point in the history
…ure; updated requirements
  • Loading branch information
Manu Setty authored and Manu Setty committed Mar 20, 2017
1 parent c54899e commit 6eba135
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 22 deletions.
20 changes: 9 additions & 11 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,23 +14,23 @@


setup(name='wishbone',
version='0.4.1.1',
version='0.4.2',
description='Wishbone algorithm for identifying bifurcating trajectories from single-cell data',
author='Manu Setty',
author_email='manu.talanki@gmail.com',
package_dir={'': 'src'},
packages=['wishbone'],
install_requires=[
'numpy>=1.10.0',
'pandas>=0.18.0',
'scipy>=0.14.0',
'numpy>=1.12.0',
'pandas>=0.19.2',
'scipy>=0.18.1',
'bhtsne',
'matplotlib',
'seaborn',
'matplotlib>=1.5.1sn',
'seaborn>=0.7.1',
'sklearn',
'networkx',
'fcsparser',
'statsmodels'],
'networkx>=1.11',
'fcsparser>=0.1.2',
'statsmodels>=0.8.0'],
scripts=['src/wishbone/wishbone_gui.py'],
)

Expand All @@ -43,8 +43,6 @@
if os.path.isdir(tools_dir):
shutil.rmtree(tools_dir)
shutil.copytree(setup_dir + '/tools/', tools_dir)
shutil.unpack_archive(tools_dir + '/DiffusionGeometry.zip', tools_dir +
'/DiffusionGeometry/')
shutil.unpack_archive(tools_dir + '/mouse_gene_sets.tar.gz', tools_dir)
shutil.unpack_archive(tools_dir + '/human_gene_sets.tar.gz', tools_dir)

Expand Down
2 changes: 1 addition & 1 deletion src/wishbone/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@
from . import wishbone_gui
from . import autocomplete_entry

__version__ = "0.4.1.1"
__version__ = "0.4.2"
18 changes: 8 additions & 10 deletions src/wishbone/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -250,22 +250,20 @@ def _trajectory_landmarks(spdists, data, s, waypoints, partial_order,
# # calculate all shortest paths
print('Determining shortest path distances and perspectives....')
graph = nx.Graph(spdists)
dist = np.zeros([len(l), data.shape[0]])
paths_l2l = list()

for i in range(len(l)):
# Shortest distances and paths
temp = nx.single_source_dijkstra(graph, l[i])
paths = temp[1]
# dist[i, :] = temp[0].values()
dist[i, list(temp[0].keys())] = list(temp[0].values())
paths_l2l.append( [paths[li] for li in l] )

if i == 0:
dist = [list(temp[0].values())]
paths_l2l = [[paths[li] for li in l]]
else:
dist.append(list(temp[0].values()))
paths_l2l.append([paths[li] for li in l])

unreachable = np.where(dist[i]==np.inf)[0]
# Update distances for unreachable cells
unreachable = np.where(dist[i, :]==np.inf)[0]
if(len(unreachable) > 0):
dist[i][unreachable] = max(max(dist))
dist[i, unreachable] = np.max(dist[i, dist[i, :] != np.inf])
if(verbose):
sys.stdout.write('.')
print("")
Expand Down
Binary file removed tools/DiffusionGeometry.zip
Binary file not shown.

0 comments on commit 6eba135

Please sign in to comment.