Allow to omit --ligand and --batch when writing maps.#383
Allow to omit --ligand and --batch when writing maps.#383pslacerda wants to merge 4 commits intoccsb-scripps:developfrom
Conversation
diogomart
left a comment
There was a problem hiding this comment.
Many thanks for this!
About not allowing to read and write maps simultaneously: even though the only reason to do that might be testing the parser and the writer, I think we should not forbid it.
|
Hey, just removed the last commit... |
|
@diogomart I think it's done. |
src/main/main.cpp
Outdated
| } else if (vm.count("write_maps")) { | ||
| // Will compute maps only for Vina atom types in the ligand(s) | ||
| // In the case users ask for score and local only with the autobox arg, we compute the optimal box size for it/them. | ||
| if ((score_only || local_only) && autobox) { |
There was a problem hiding this comment.
v.grid_dimensions_from_ligand(buffer_size) needs m_model to be a ligand, although m_model could possibly store a receptor as well.. So this if block won't be a valid condition, without a ligand. I think we might want to delete this if block.
src/main/main.cpp
Outdated
|
|
||
| if (vm.count("write_maps")) | ||
| if ((score_only || local_only) && autobox) { | ||
| std::vector<double> dim = v.grid_dimensions_from_ligand(buffer_size); |
There was a problem hiding this comment.
In the "batch" mode, v.grid_dimensions_from_ligand(buffer_size) cannot be called before a ligand is set. I think the addition of if ((score_only || local_only) && autobox) block here is not valid.
There was a problem hiding this comment.
It was my attempt to allow ad4 in batch mode, but I was wrong.
|
@rwxayheee, Brute force is something I'm good at, but can't get me very far. Hope I'm not very inconvenient you. |
|
|
||
| if (vm.count("write_maps")) | ||
| v.write_maps(out_maps); | ||
| // Batch mode is allowed only if not ad4? |
There was a problem hiding this comment.
Hi, I think batch mode is allowed with ad4. It will go to the if (vm.count("maps")) { v.load_maps(maps); } condition just a little above this. You can run a test and tell us if it's broken. The only difference is: with ad4, we will provide the maps beforehand, instead of asking it to compute the maps. Since you suggested that the read maps flag should not coexist with write maps flag, there will be no usage case of write maps for ad4. See this tutorial for the expected procedure: https://autodock-vina.readthedocs.io/en/latest/docking_basic.html#a-using-autodock4-forcefield
| // Will compute maps only for Vina atom types in the ligand(s) | ||
| // In the case users ask for score and local only with the autobox arg, we compute the optimal box size for it/them. | ||
| if (vm.count("ligand") && autobox) { | ||
| v.set_ligand_from_file(ligand_names); |
There was a problem hiding this comment.
Here when people have ligand and write_maps, the ligand will be set twice. To avoid this, you can keep the code structure in 4d37e15. This means: (1) we can have the previous structure if ligand ... elseif batch ... elseif write_maps (2) we can call write_maps at the end of each condition (3) for the last condition, when there's no ligand and not batch mode, we can use the simple v.compute_vina_maps(center_x, center_y, center_z, size_x, size_y, size_z, grid_spacing, force_even_voxels); to write maps. In other words, deleting https://github.com/pslacerda/AutoDock-Vina/blob/4d37e15412b7fb45c2df4bb9f74aeb067e3e1c40/src/main/main.cpp#L532-L537 from commit 4d37e15 could be an easy fix, to avoid the undefined behaviors in the invalid condition
Previously, @pslacerda Would it be ok if we apply some more edits, and supersede this PR with a new one? Your commits in this PR will be merged with edits. Here's the difference - my edit vs. the current state of your develop branch: Here's the difference - my edit vs. the current official develop branch: I have also added the error handling ( |
@rwxayheee I'd be ok. In fact, this problem is smaller than I thought: when |
|
Hi @pslacerda
Thanks! I will not push my commits to your branch (this PR), but will open another PR (that includes your commits) and ask for another reviewer.
Yes, this is an efficient approach, but I encourage you to consider the precision of the maps and benchmark a few systems, to see how much discrepancy there will be when you use maps instead of a real receptor. This is why I brought up the two different ways of calculating the interactions the other day - with maps, or directly from the receptor. I think because of the precision of the maps, the numerical results will be slightly different. You could do this small test: 1- run a docking, and write maps 2- rerun the docking, but with the pre-computed maps In my experience, the numerical results will be different, and I think it's because the maps have limited precision (and hopefully there're no more underlying problems with the map function..) If your application relies on the map function, you might want to do the benchmark and show how much the results can differ. |
There's some redundant code and it was barely tested.
May fix #382.