3dem / model-angelo

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

Build with fasta crashes after completing 1st GNN round #57

Closed Rafael-Ayala closed 7 months ago

Rafael-Ayala commented 1 year ago

Hi,

Firstly, thanks a lot for this amazing software.

I previously used version 0.2.4 with no problem. However, I have recently been trying to run 1.0.1, but have been unable to complete a successful run. It seems to always crash after completing the 1st GNN refinement round.

Here is the traceback found in the log file:

  File "*/envs/model_angelo/bin/model_angelo", line 33, in <module>
    sys.exit(load_entry_point('model-angelo==1.0.1', 'console_scripts', 'model_angelo')())
    │   │    └ <function importlib_load_entry_point at 0x7fc6b232fd90>
    │   └ <built-in function exit>
    └ <module 'sys' (built-in)>
  File "*/envs/model_angelo/lib/python3.10/site-packages/model_angelo-1.0.1-py3.10.egg/model_angelo/__main__.py", line 52, in main
    args.func(args)
    │    │    └ Namespace(volume_path='cryosparc_P1_J964_005_volume_map_sharp.mrc', protein_fasta='proteins.fasta', rna_fasta='rna.fasta', dn...
    │    └ <function main at 0x7fc5d0f8f760>
    └ Namespace(volume_path='cryosparc_P1_J964_005_volume_map_sharp.mrc', protein_fasta='proteins.fasta', rna_fasta='rna.fasta', dn...
> File "/data/mcm12/spring/spring/envs/model_angelo/lib/python3.10/site-packages/model_angelo-1.0.1-py3.10.egg/model_angelo/apps/build.py", line 241, in main
    gnn_output = gnn_infer(gnn_infer_args)
                 │         └ {'num_rounds': 3, 'crop_length': 200, 'repeat_per_residue': 1, 'esm_model': 'esm1b_t33_650M_UR50S', 'aggressive_pruning': Tru...
                 └ <function infer at 0x7fc5d10edd80>
  File "*/envs/model_angelo/lib/python3.10/site-packages/model_angelo-1.0.1-py3.10.egg/model_angelo/gnn/inference.py", line 184, in infer
    final_results_to_cif(
    └ <function final_results_to_cif at 0x7fc5d0f8f010>
  File "/data/mcm12/spring/spring/envs/model_angelo/lib/python3.10/site-packages/model_angelo-1.0.1-py3.10.egg/model_angelo/gnn/flood_fill.py", line 331, in final_results_to_cif
    fix_chains_output = prune_and_connect_chains(
                        └ <function prune_and_connect_chains at 0x7fc5d0f8e9e0>
  File "/data/mcm12/spring/spring/envs/model_angelo/lib/python3.10/site-packages/model_angelo-1.0.1-py3.10.egg/model_angelo/utils/hmm_sequence_align.py", line 552, in prune_and_connect_chains
    chains, best_match_output = sort_chains(best_match_output, chains, ca_pos,)
    │                           │           │                  │       └ array([[464.73087, 485.62305, 299.9831 ],
    │                           │           │                  │                [462.0669 , 489.67865, 299.92734],
    │                           │           │                  │                [452.70947, 479.33026, 311.5133 ],...
    │                           │           │                  └ []
    │                           │           └ <model_angelo.utils.match_to_sequence.MatchToSequence object at 0x7fc5311f6770>
    │                           └ <function sort_chains at 0x7fc5d0f8e440>
    └ []
  File "*/envs/model_angelo/lib/python3.10/site-packages/model_angelo-1.0.1-py3.10.egg/model_angelo/utils/hmm_sequence_align.py", line 371, in sort_chains
    chain_start_pos = ca_positions[chain_starts]
                      │            └ array([], dtype=float64)
                      └ array([[464.73087, 485.62305, 299.9831 ],
                               [462.0669 , 489.67865, 299.92734],
                               [452.70947, 479.33026, 311.5133 ],...

IndexError: arrays used as indices must be of integer (or boolean) type

Any help would be greatly appreciated!

Thanks a lot in advance

Best wishes,

Rafa

jamaliki commented 11 months ago

Hi,

Sorry for the very late response. Is this crashing on a previously working input? If that is the case, do you mind sharing the input map and sequence to my email? kjamali [at] mrc-lmb.cam.ac.uk

qitsweauca commented 8 months ago

I think this can be solved by updating line 366 and line 365 of the hmm_sequence_align.py file from

og_chain_starts = np.array([c[0] for c in chains]) og_chain_ends = np.array([c[-1] for c in chains])

to

og_chain_starts = np.array([c[0] for c in chains], dtype=np.int32) og_chain_ends = np.array([c[-1] for c in chains], dtype=np.int32)

Just some datatype errors. At least so far works for me.

Thanks.

jamaliki commented 7 months ago

Thank you qitsweauca! I will push this in