Skip to main content

General Topological Overlap Measure

This package takes an undirected unweighted scipy.sparse adjacency matrix as an input and computes the GTOM(m) method, using m+1-step neighbors (1). It’s highly efficient and can be used for parallel computation by calling the function for only few nodes at a time.

(1) *Gene network interconnectedness and the generalized topological overlap measure*, A. M. Yip and S. Horvath, BMC Bioinformatics 2007 8:22

Install

$ pip install gtom

Example

Recreating Panels a and c of Figure 3 of the technical report [1]:

#!python

import matplotlib.pyplot as pl
import networkx as nx
from gtom import gtom
import scipy.sparse as sprs
import numpy as np

edges = [(0,1),(1,2),(0,3),(0,4),(0,5),(0,7),
         (1,3),(1,4),(1,6),(1,8),(1,9),(1,10),
         (5,6),(7,8)]
G = nx.Graph()
G.add_edges_from(edges)

pos = nx.spring_layout(G)
labels = { n:str(n+1) for n in G.nodes()}
nx.draw(G,pos=pos)
nx.draw_networkx_labels(G,pos=pos,labels=labels)

N = G.number_of_nodes()
edges = np.array(edges,dtype=int)
A = sprs.csc_matrix((np.ones((edges.shape[0],)),(edges[:,0],edges[:,1])),dtype=float,shape=(N,N))
A += A.T

print("recreate results from figure 3 in [1]")
print("       |\t(i,j)=(1,2)\t(i,j)=(1,3)\t(i,j)=(2,3)")
print("---------------------------------------------------------")
for m in range(3):
    T = gtom(A,m)
    print(" m = %d |\t%f\t%f\t%f" %(m,T[0,1],T[0,2],T[1,2]))

pl.show()

Metadata

Release files for gtom 0.5

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for gtom 0.5
File Size Uploaded
gtom-0.5.tar.gz 4.4 kB Details

Release files / gtom-0.5.tar.gz

Download URL gtom-0.5.tar.gz
Size 4.4 kB
Tags Source
SHA-256 checksum
How to use checksums
9f2a5608963cc3e8966b39be3fae69b466059e54fcf702f6acca618be01e7b03
BLAKE2b-256 checksum
How to use checksums
ad64127b36e7a40d45ee854defa74becf3da2bf6a1acd9b55e691a08044b0a1c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/1.12.1 pkginfo/1.4.2 requests/2.21.0 setuptools/40.8.0 requests-toolbelt/0.8.0 tqdm/4.28.1 CPython/3.7.2

Release history Release notifications | RSS feed

This release

0.5 This release

1 release file

0.4

1 release file

0.2

1 release file

0.1

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page