Heat Diffusion Test


In [3]:
import hdsubnetfinder

# Location of the human net SIF file
!ls ../


HumanNet.v1.benchmark.txt         __init__.py                       docs
HumanNet.v1.nodes.entrez.txt      aws-create.sh                     file-server
HumanNet.v1.nodes.gene_symbol.txt ciservice                         nodes.txt
HumanNet.v1.sif                   collector                         sample-notebooks
LICENSE                           conda_environment.yml             workers
README.md                         docker-compose.yml

In [16]:
entrez2symbol = {}

for line in open('../HumanNet.v1.nodes.gene_symbol.txt', 'r'):
    entrez, gene_symbol = line[:-1].split('\t')
    entrez2symbol[entrez] = gene_symbol

    
out = open('HumanNet.v1.symbol.sif', 'w')

for line in open('../HumanNet.v1.sif', 'r'):
    source, interaction, target = line[:-1].split('\t')
    if target is '':
        print('+++++++++++++++++++ ' + line)
    if source in entrez2symbol.keys():
        source_symbol = entrez2symbol[source]
    else:
        source_symbol = source
    
    if target in entrez2symbol.keys():
        target_symbol = entrez2symbol[target]
    else:
        target_symbol = target

    out.write(source_symbol + '\t-\t' + target_symbol + '\n')

out.close()

In [14]:
import pandas as pd

hndf = pd.read_csv('HumanNet.v1.symbol.sif', sep='\t')
hndf.tail()


Out[14]:
ADA - ACOT8
270698 SLC23A2 - SLC23A1
270699 TNFSF15 - CDC42
270700 THRAP3 - MED12
270701 THRAP3 - MED13
270702 MED12 - MED13