churchmanlab / genewalk

GeneWalk identifies relevant gene functions for a biological context using network representation learning
https://churchman.med.harvard.edu/genewalk
BSD 2-Clause "Simplified" License
127 stars 14 forks source link

AttributeError: type object 'object' has no attribute 'dtype' #32

Closed vertesy closed 3 years ago

vertesy commented 3 years ago

Hello, thank you for developing this great algorithm!

  1. I installed on my macbook, as recommended, without error.
  2. It went smooth for the first set of genes.
  3. Before the second set, I realized it was complaining about the NumPy version,
  4. so I ran pip install numpy --upgrade.
  5. Then I ran the for the second set of genes, and it failed after the moonlight plot.
  6. I reran, failed
  7. I reran the 1st gene set, failed as well now.
INFO: [2021-02-09 15:29:42] gensim.models.base_any2vec - EPOCH 5 - PROGRESS: at 96.25% examples, 2188362 words/s, in_qsize 8, out_qsize 0
INFO: [2021-02-09 15:29:43] gensim.models.base_any2vec - EPOCH 5 - PROGRESS: at 97.75% examples, 2190384 words/s, in_qsize 8, out_qsize 0
INFO: [2021-02-09 15:29:44] gensim.models.base_any2vec - EPOCH 5 - PROGRESS: at 99.33% examples, 2194058 words/s, in_qsize 8, out_qsize 0
INFO: [2021-02-09 15:29:44] gensim.models.base_any2vec - worker thread finished; awaiting finish of 3 more threads
INFO: [2021-02-09 15:29:44] gensim.models.base_any2vec - worker thread finished; awaiting finish of 2 more threads
INFO: [2021-02-09 15:29:44] gensim.models.base_any2vec - worker thread finished; awaiting finish of 1 more threads
INFO: [2021-02-09 15:29:44] gensim.models.base_any2vec - worker thread finished; awaiting finish of 0 more threads
INFO: [2021-02-09 15:29:44] gensim.models.base_any2vec - EPOCH - 5 : training on 155070000 raw words (155070000 effective words) took 70.6s, 2195957 effective words/s
INFO: [2021-02-09 15:29:44] gensim.models.base_any2vec - training on a 775350000 raw words (775350000 effective words) took 330.0s, 2349202 effective words/s
INFO: [2021-02-09 15:29:44] genewalk.deepwalk - Generating node vectors done in 374.79s
INFO: [2021-02-09 15:29:45] genewalk.cli - Saving into ~/genewalk/SEO_cl6/deepwalk_node_vectors_rand_3.pkl...
INFO: [2021-02-09 15:29:48] genewalk.cli - Saving into ~/genewalk/SEO_cl6/genewalk_rand_simdists.pkl...
INFO: [2021-02-09 15:29:48] genewalk.cli - Loading ~/genewalk/SEO_cl6/multi_graph.pkl...
INFO: [2021-02-09 15:29:48] genewalk.cli - Loading ~/genewalk/SEO_cl6/genes.pkl...
INFO: [2021-02-09 15:29:48] genewalk.cli - Loading ~/genewalk/SEO_cl6/deepwalk_node_vectors_1.pkl...
INFO: [2021-02-09 15:29:48] genewalk.cli - Loading ~/genewalk/SEO_cl6/deepwalk_node_vectors_2.pkl...
INFO: [2021-02-09 15:29:48] genewalk.cli - Loading ~/genewalk/SEO_cl6/deepwalk_node_vectors_3.pkl...
INFO: [2021-02-09 15:29:49] genewalk.cli - Loading ~/genewalk/SEO_cl6/genewalk_rand_simdists.pkl...
INFO: [2021-02-09 15:29:49] genewalk.cli - Saving final results into ~/genewalk/SEO_cl6/genewalk_results.csv
INFO: [2021-02-09 15:29:49] genewalk.cli - Creating figures folder at ~/genewalk/SEO_cl6/figures
INFO: [2021-02-09 15:29:49] genewalk.cli - Creating barplots folder at ~/genewalk/SEO_cl6/figures/barplots
INFO: [2021-02-09 15:29:49] genewalk.plot - Scatter plot data output to genewalk_scatterplots.csv...
INFO: [2021-02-09 15:29:51] genewalk.plot - Regulator genes plotted in regulators_x_gene_con_y_frac_rel_go...
INFO: [2021-02-09 15:29:51] genewalk.plot - Regulator genes listed in genewalk_regulators.csv...
INFO: [2021-02-09 15:29:52] genewalk.plot - Moonlighting genes plotted in moonlighters_x_go_con_y_frac_rel_go...
Traceback (most recent call last):
  File "~/miniconda3/bin/genewalk", line 11, in <module>
    sys.exit(main())
  File "~/miniconda3/lib/python3.7/site-packages/genewalk/cli.py", line 146, in main
    run_main(args)
  File "~/miniconda3/lib/python3.7/site-packages/genewalk/cli.py", line 235, in run_main
    GWp.generate_plots()
  File "~/miniconda3/lib/python3.7/site-packages/genewalk/plot.py", line 53, in generate_plots
    moonlight_html = self.scatterplot_moonlighters()
  File "~/miniconda3/lib/python3.7/site-packages/genewalk/plot.py", line 221, in scatterplot_moonlighters
    df = pd.DataFrame(sorted(moonlighters), columns=['gw_moonlighter'])
  File "~/miniconda3/lib/python3.7/site-packages/pandas/core/frame.py", line 453, in __init__
    mgr = init_dict({}, index, columns, dtype=dtype)
  File "~/miniconda3/lib/python3.7/site-packages/pandas/core/internals/construction.py", line 196, in init_dict
    nan_dtype)
  File "~/miniconda3/lib/python3.7/site-packages/pandas/core/dtypes/cast.py", line 1175, in construct_1d_arraylike_from_scalar
    dtype = dtype.dtype
AttributeError: type object 'object' has no attribute 'dtype'

Error after reunning the with the gene set that worked:

INFO: [2021-02-09 21:21:22] genewalk.plot - Moonlighting genes plotted in moonlighters_x_go_con_y_frac_rel_go...
Traceback (most recent call last):
  File "~/miniconda3/bin/genewalk", line 11, in <module>
    sys.exit(main())
  File "~/miniconda3/lib/python3.7/site-packages/genewalk/cli.py", line 146, in main
    run_main(args)
  File "~/miniconda3/lib/python3.7/site-packages/genewalk/cli.py", line 235, in run_main
    GWp.generate_plots()
  File "~/miniconda3/lib/python3.7/site-packages/genewalk/plot.py", line 53, in generate_plots
    moonlight_html = self.scatterplot_moonlighters()
  File "~/miniconda3/lib/python3.7/site-packages/genewalk/plot.py", line 221, in scatterplot_moonlighters
    df = pd.DataFrame(sorted(moonlighters), columns=['gw_moonlighter'])
  File "~/miniconda3/lib/python3.7/site-packages/pandas/core/frame.py", line 453, in __init__
    mgr = init_dict({}, index, columns, dtype=dtype)
  File "~/miniconda3/lib/python3.7/site-packages/pandas/core/internals/construction.py", line 196, in init_dict
    nan_dtype)
  File "~/miniconda3/lib/python3.7/site-packages/pandas/core/dtypes/cast.py", line 1175, in construct_1d_arraylike_from_scalar
    dtype = dtype.dtype
AttributeError: type object 'object' has no attribute 'dtype'

I guess I would have to downgrade NumPy. Or do you have a version working with the latest NumPy?

Thanks, Abel

bgyori commented 3 years ago

Thanks @vertesy, yes, for the time being, I would suggest downgrading to

pip install numpy==1.19.5

It appears that pandas is not yet compatible with numpy 1.20.1 causing the error. Unfortunately this isn't something we can fix on our end.

vertesy commented 3 years ago

Wunderbar, worked like charm, thank you!