Converts a bipartite NetworkX graph representing mutations in genes in different patients into the mutation data format used by Multi-Dendrix.
For more information on the mutation data format used by Multi-Dendrix, see multi_dendrix.load_mutation_data().
Parameters: |
|
---|---|
Returns: | Mutation data tuple in the same format as multi_dendrix.load_mutation_data(). |
>>> import networkx as nx
>>> H = nx.Graph()
>>> H.add_edges_from([("G1", "TCGA-01"), ("G1", "TCGA-02"), ("G1", "TCGA-03"),
("G2", "TCGA-02")])
>>> nx.draw_spectral(H)
>>> graph_to_mutation_data(H, ["G1", "G2"], ["TCGA-01", "TCGA-02", "TCGA-03"])
>>> (2, 3, ['G2', 'G1'], ['TCGA-03', 'TCGA-02', 'TCGA-01'],
{'G2': set(['TCGA-02']), 'G1': set(['TCGA-03', 'TCGA-02', 'TCGA-01'])},
{'TCGA-03': set(['G1']), 'TCGA-02': set(['G2', 'G1']), 'TCGA-01': set(['G1'])})
See also: permute_mutation_data(), construct_mutation_graph().