parsing_utils.py
def loadPPIData(filename, graph):
    """ Generates the graph from PPI data file """
    file = open(filename, 'r')
    count_nodes = 0
    count_edges = 0
    for line in file:
        gene_data = line.strip().split('\t')
        if len(gene_data) != 3 or float(gene_data[2]) == 0:
            continue
        for gene_id in [gene_data[0].strip(), gene_data[1].strip()]:
            if gene_id not in graph.nodes:
                graph.addNode(gene_id)
                count_nodes += 1
        count_edges += 1
        graph.addEdge(gene_data[0].strip(), gene_data[1].strip(), float(gene_data[2]))
    print('Loaded ' + str(count_nodes) + ' nodes and ' + str(count_edges) + ' edges.')
    file.close()
 Generates the graph from PPI data file 
Generates the graph from PPI data file
Generates the graph from PPI data file
def loadPPIData(filename, graph):
    file = open(filename, 'r')
    count_nodes = 0
    count_edges = 0
    for line in file:
        gene_data = line.strip().split('\t')
        if len(gene_data) != 3 or float(gene_data[2]) == 0:
            continue
        for gene_id in [gene_data[0].strip(), gene_data[1].strip()]:
            if gene_id not in graph.nodes:
                graph.addNode(gene_id)
                count_nodes += 1
        count_edges += 1
        graph.addEdge(gene_data[0].strip(), gene_data[1].strip(), float(gene_data[2]))
    print('Loaded ' + str(count_nodes) + ' nodes and ' + str(count_edges) + ' edges.')
    file.close()
def loadPPIData ( filename , graph ) : file = open ( filename , 'r' ) count_nodes = 0 count_edges = 0 for line in file : gene_data = line . strip ( ) . split ( '\t' ) if len ( gene_data ) != 3 or float ( gene_data [ 2 ] ) == 0 : continue for gene_id in [ gene_data [ 0 ] . strip ( ) , gene_data [ 1 ] . strip ( ) ] : if gene_id not in graph . nodes : graph . addNode ( gene_id ) count_nodes += 1 count_edges += 1 graph . addEdge ( gene_data [ 0 ] . strip ( ) , gene_data [ 1 ] . strip ( ) , float ( gene_data [ 2 ] ) ) print ( 'Loaded ' + str ( count_nodes ) + ' nodes and ' + str ( count_edges ) + ' edges.' ) file . close ( )
Generates the graph from PPI data file
Generates the graph from PPI data file
""" Generates the graph from PPI data file """
filename
graph