3dem / model-angelo

Automatic atomic model building program for cryo-EM maps
MIT License
110 stars 18 forks source link

UnboundLocalError: local variable 'grid_np' referenced before assignment #52

Closed rdrighetto closed 1 year ago

rdrighetto commented 1 year ago

Hi,

I've recently installed version 1.0.1 from Github and my runs end shortly after a few seconds without any meaningul output to stdout or stderr:

diogori@worker08:model-angelo$ time model_angelo build -v urease_emd_10835.map -f urease_rcsb_pdb_6YL3.fasta -o urease_seq
---------------------------- ModelAngelo -----------------------------
By Kiarash Jamali, Scheres Group, MRC Laboratory of Molecular Biology
--------------------- Initial C-alpha prediction ---------------------

real    0m4.335s
user    0m3.720s
sys 0m6.969s

However, upon inspecting urease_seq/model_angelo.log I find the following error:

2023-06-14 at 10:37:39 | INFO | ModelAngelo with args: {'volume_path': 'urease_emd_10835.map', 'protein_fasta': 'urease_rcsb_pdb_6YL3.fasta', 'rna_fasta': None, 'dna_fasta': None, 'output_dir': 'urease_seq', 'mask_path': None, 'device': None, 'config_path': None, 'model_bundle_name': 'nucleotides', 'model_bundle_path': None, 'keep_intermediate_results': False, 'pipeline_control': False, 'func': <function main at 0x7fc646066560>}
2023-06-14 at 10:37:39 | INFO | Initial C-alpha prediction with args: {'model_checkpoint': 'chkpt.torch', 'bfactor': 0, 'batch_size': 4, 'box_size': 64, 'stride': 16, 'dont_mask_input': True, 'threshold': 0.05, 'save_real_coordinates': False, 'save_cryo_em_grid': False, 'do_nucleotides': True, 'save_backbone_trace': False, 'save_output_grid': False, 'crop': 6, 'log_dir': '/scicore/home/engel0006/GROUP/pool-engel/soft/model-angelo/weights/hub/checkpoints/model_angelo_v1.0/nucleotides/c_alpha', 'map_path': 'urease_emd_10835.map', 'output_path': 'urease_seq/see_alpha_output', 'mask_path': None, 'device': None, 'auto_mask': False}
2023-06-14 at 10:37:39 | INFO | Using model file /scicore/home/engel0006/GROUP/pool-engel/soft/model-angelo/weights/hub/checkpoints/model_angelo_v1.0/nucleotides/c_alpha/model.py
2023-06-14 at 10:37:39 | INFO | Using checkpoint file /scicore/home/engel0006/GROUP/pool-engel/soft/model-angelo/weights/hub/checkpoints/model_angelo_v1.0/nucleotides/c_alpha/chkpt.torch
2023-06-14 at 10:37:39 | ERROR | Error in ModelAngelo
Traceback (most recent call last):

  File "/scicore/home/engel0006/GROUP/pool-engel/soft/miniconda/miniconda3/envs/model_angelo_v1.0.1/bin/model_angelo", line 33, in <module>
    sys.exit(load_entry_point('model-angelo==1.0.1', 'console_scripts', 'model_angelo')())
    \u2502   \u2502    \u2514 <function importlib_load_entry_point at 0x7fc7888ed360>
    \u2502   \u2514 <built-in function exit>
    \u2514 <module 'sys' (built-in)>
  File "/scicore/home/engel0006/GROUP/pool-engel/soft/miniconda/miniconda3/envs/model_angelo_v1.0.1/lib/python3.10/site-packages/model_angelo-1.0.1-py3.10.egg/model_angelo/__main__.py", line 52, in main
    args.func(args)
    \u2502    \u2502    \u2514 Namespace(volume_path='urease_emd_10835.map', protein_fasta='urease_rcsb_pdb_6YL3.fasta', rna_fasta=None, dna_fasta=None, out...
    \u2502    \u2514 <function main at 0x7fc646066560>
    \u2514 Namespace(volume_path='urease_emd_10835.map', protein_fasta='urease_rcsb_pdb_6YL3.fasta', rna_fasta=None, dna_fasta=None, out...
> File "/scicore/home/engel0006/GROUP/pool-engel/soft/miniconda/miniconda3/envs/model_angelo_v1.0.1/lib/python3.10/site-packages/model_angelo-1.0.1-py3.10.egg/model_angelo/apps/build.py", line 207, in main
    ca_cif_path = c_alpha_infer(ca_infer_args)
                  \u2502             \u2514 {'model_checkpoint': 'chkpt.torch', 'bfactor': 0, 'batch_size': 4, 'box_size': 64, 'stride': 16, 'dont_mask_input': True, 'th...
                  \u2514 <function infer at 0x7fc645fad480>
  File "/scicore/home/engel0006/GROUP/pool-engel/soft/miniconda/miniconda3/envs/model_angelo_v1.0.1/lib/python3.10/site-packages/model_angelo-1.0.1-py3.10.egg/model_angelo/c_alpha/inference.py", line 176, in infer
    mask_grid = np.ones_like(grid_np)
                \u2502  \u2514 <function ones_like at 0x7fc6f20dab00>
                \u2514 <module 'numpy' from '/scicore/home/engel0006/GROUP/pool-engel/soft/miniconda/miniconda3/envs/model_angelo_v1.0.1/lib/python3...

UnboundLocalError: local variable 'grid_np' referenced before assignment

Is this a bug or is there something wrong with my installation?

Thank you!

jamaliki commented 1 year ago

Hi Racardo!

Sorry for the obscure bug message, the issue is that your volume file ends with the extension ".map", if you rename it to ".mrc", it should work. This is really stupid and I will fix it soon :)

Best, Kiarash.

rdrighetto commented 1 year ago

oh my... this is embarrassing, how did I not notice it before?? Thanks for the tip, now it works :-D

jamaliki commented 1 year ago

No problem!