idekerlab / pyNBS

Python 2.7 implementation of network-based stratification (NBS) algorithm from Hofree et al (Nature Methods 2013)
MIT License
37 stars 22 forks source link

TypeError: 'DataFrame' objects are mutable, thus they cannot be hashed #2

Open DlisKeepOnGoing opened 6 years ago

DlisKeepOnGoing commented 6 years ago

When I run the pyNBS in my pc, some problem occurred in the file of network_propagation.py. It says "TypeError: 'DataFrame' objects are mutable, thus they cannot be hashed". I figure out the problem in the code "binary_matrix_filt = np.array(binary_matrix.T.ix[subgraph_nodes].fillna(0).T)", can you tell why?

justinkhuang commented 6 years ago

What version of NetworkX do you have installed? I believe that this may be an issue if you are using NetworkX v2.0+. In this case, you may want to try to explicitly change the lines setting subgraph_nodes to return a list similarly to how the subgraph nodelists are defined in the network_kernel_propagation() function

DlisKeepOnGoing commented 6 years ago

Thank you so much! I've already changed subgraph_nodes to a list type. Then the problem has been solved. But there is another question,it seems that there is no mapping file in the pyNBS different from the matlab code. It means that the mutation_files must be processed in advance. For example, one line of the OV_sm_data.txt,'TCGA-04-1331 ABHD13', we need to change it to 'TCGA-04-1331 ENSG0000000xxxx'.Otherwise it will report an error "ValueError: No mutations found in network nodes. Gene names may be mismatched.".So it is not feasible to run pyNBS directly with the files you provide.

justinkhuang commented 6 years ago

Hi Dailu, Sorry for the very delayed reply on this issue. Unfortunately, as you suggested this is the case if you would like to use your own network or mutation data. We did not want to make any decisions for the user in this case if the user has any particular preferences. If you need some scripts helping with converting gene name symbols, I have some helper functions that you may be able to hack together/borrow code from in the gene_conversion_tools module.

Gene names across different naming systems often are not mapped one-to-one, making automatic conversion between gene symbol types a non-trivial task, so we left much of that decision making to the user in this case.