Exemple #1
0
def retrieve_components(graph_dict, tumor_type, all_cogs,
                        radius, signif_res_neighbours):
    """Get the connected components and format the output."""

    #inv_signif_struct_info = {v: k for k, v in signif_struct_info.items()}
    ttype_output = []

    #neighbours = pstruct.find_neighbors(all_cogs, radius)
    for mystruct in graph_dict:

        g = graph_dict[mystruct]

        components = graph.connected_components(g)

        added_components = components
        """
        added_components = []
        for cluster in components:
            neighbours_in_cluster = set()
            for res in cluster:
                if res in signif_res_neighbours:
                    neighbours_in_cluster |= signif_res_neighbours[res]
            added_components.append(cluster | neighbours_in_cluster)
        """

        #print added_components
        tmp = [mystruct, tumor_type]
        for component in added_components:
            format_str = ';'.join('{0}:{1}:{2}'.format(n[0], n[1], n[2]) for n in component)
            tmp.append(format_str)
        ttype_output.append(tmp)
    return ttype_output
def retrieve_components(graph_dict, tumor_type):
    """Get the connected components and format the output."""
    ttype_output = []
    for mygene in graph_dict:
        g = graph_dict[mygene]
        components = graph.connected_components(g)
        tmp = [mygene, tumor_type]
        for component in components:
            format_str = ';'.join('{0}:{1}'.format(n[1], n[2]) for n in component)
            tmp.append(format_str)
        ttype_output.append(tmp)
    return ttype_output
Exemple #3
0
def retrieve_components(graph_dict, tumor_type):
    """Get the connected components and format the output."""
    ttype_output = []
    for mygene in graph_dict:
        g = graph_dict[mygene]
        components = graph.connected_components(g)
        tmp = [mygene, tumor_type]
        for component in components:
            format_str = ';'.join('{0}:{1}'.format(n[1], n[2])
                                  for n in component)
            tmp.append(format_str)
        ttype_output.append(tmp)
    return ttype_output