RUBi-ZA / MD-TASK

Tool suite for analysing molecular dynamics trajectories using network analysis and PRS
GNU General Public License v3.0
38 stars 18 forks source link

MD-TASK VERSION PROBLEMS python 3.11 and python 3.8 mdmtaskweb #54

Open lsegura1 opened 1 month ago

lsegura1 commented 1 month ago

First off, this is an awesome program. I am grateful to the developers for making such a fast md analysis tool.

I just had a few issues. After some digging, it seems like there is an issue running certain modules in the older version and other modules in the newer version

When I run my .xtc and .pdb trajectories through calc_correlation.py in 3.11, I get the following error: python /usr/local/bin/MD-TASK/calc_correlation.py --trajectory '/run/media/kcheng1/CR2024-1/AA-MD2MD-2024/MD-with-ligand/rcg-2tam-PS-raft-e-ny-01-CNS11-BHT-2nd/0to400ns-c-skip20-protein-ligand.xtc' --topology '/run/media/kcheng1/CR2024-1/AA-MD2MD-2024/MD-with-ligand/rcg-2tam-PS-raft-e-ny-01-CNS11-BHT-2nd/0ns-c-skip20-protein-ligand.pdb' INFO::Started at: 2024-07-09 09:28:41.780377 INFO::Preparing a trajectory matrix... INFO::Correlating... Traceback (most recent call last): File "/usr/local/bin/MD-TASK/calc_correlation.py", line 163, in CLI(parser, main, log) File "/usr/local/bin/MD-TASK/lib/cli.py", line 20, in CLI callback(args) File "/usr/local/bin/MD-TASK/calc_correlation.py", line 140, in main correlation = correlate(traj_matrix) File "/usr/local/bin/MD-TASK/calc_correlation.py", line 76, in correlate jdelta = resJ - meanJ ValueError: operands could not be broadcast together with shapes (2001,3) (4002,3)

When I run the same trajectories through calc_correlation.py in python 3.8 mdmtaskweb, I get no error : python /usr/local/MD-TASK/src/calc_correlation.py '/run/media/kcheng1/CR2024-1/AA-MD2MD-2024/MD-with-ligand/rcg-2tam-PS-raft-e-ny-01-CNS11-BHT-2nd/0to400ns-c-skip20-protein-ligand.xtc' --topology '/run/media/kcheng1/CR2024-1/AA-MD2MD-2024/MD-with-ligand/rcg-2tam-PS-raft-e-ny-01-CNS11-BHT-2nd/0ns-c-skip20-protein-ligand.pdb' INFO::Using Python 3.8.19 | packaged by conda-forge | (default, Mar 20 2024, 12:47:35) [GCC 12.3.0] INFO::Started at: 2024-07-09 09:52:50.262479 INFO::Preparing a trajectory matrix... INFO::Correlating... INFO::Plotting heat map... INFO::Completed at: 2024-07-09 09:53:34.654892 INFO::- Total time: 0:00:44

However, when I run calc_network.py in python 3.8 mdmtaskweb, I get an error: python /usr/local/MD-TASK/src/calc_network.py '/run/media/kcheng1/CR2024-1/AA-MD2MD-2024/MD-with-ligand/rcg-2tam-PS-raft-e-ny-01-CNS11-BHT-2nd/0to400ns-c-skip20-protein-ligand.xtc' --topology '/run/media/kcheng1/CR2024-1/AA-MD2MD-2024/MD-with-ligand/rcg-2tam-PS-raft-e-ny-01-CNS11-BHT-2nd/0ns-c-skip20-protein-ligand.pdb' --ligands NON --calc-BC --calc-L INFO::Started at: 2024-07-09 10:09:59.395735 INFO::Calculating centralities... Traceback (most recent call last): File "/usr/local/MD-TASK/src/calc_network.py", line 314, in CLI(parse_args(), main, LOG) File "/usr/local/MD-TASK/src/lib/cli.py", line 20, in CLI callback(args) File "/usr/local/MD-TASK/src/calc_network.py", line 306, in main drn = calc_centralities(traj, traj_name, total_frames, args) File "/usr/local/MD-TASK/src/calc_network.py", line 178, in calc_centralities atom_filter = get_selection(ligands=args.ligands) File "/usr/local/MD-TASK/src/calc_network.py", line 43, in get_selection atom_filter += " or (name {} and resname {})".format(arr[1], arr[0]) IndexError: list index out of range (mdmtaskweb) [kcheng1@amylin02 Downloads]$

And when I run calc_network.py in python 3.11, i get no error: python /usr/local/bin/MD-TASK/calc_network.py '/run/media/kcheng1/CR2024-1/AA-MD2MD-2024/MD-with-ligand/rcg-2tam-PS-raft-e-ny-01-CNS11-BHT-2nd/0to400ns-c-skip20-protein-ligand.xtc' --topology '/run/media/kcheng1/CR2024-1/AA-MD2MD-2024/MD-with-ligand/rcg-2tam-PS-raft-e-ny-01-CNS11-BHT-2nd/0ns-c-skip20-protein-ligand.pdb' --calc-BC --calc-L INFO::Started at: 2024-07-09 09:30:25.853352 INFO::Calculating betweenness centralities... ^ZFO::Progress: 167/2001

oliserand commented 1 month ago

Hi @lsegura1

Many thanks for using our tools. Quickly looking at the path in the DCC calculation, it would seem that you're running it from MD-TASK branch, which will be separated from MDM-TASK-web implementation in the near future.

The error seems to indicate that the number of atoms in the coordinate file and the trajectory file might be unequal (ValueError: operands could not be broadcast together with shapes (2001,3) (4002,3)), but you may have stumbled on an old bug, which we missed. The MDM-TASK-web version of calc_correlation.py should be fine if you're not getting this indexing issue. In case anyone wonders how to quickly coarse-grain the topology (coordinate) and trajectory files , there is an mdtaskprep.py tool in the MDM-TASK-web branch, which may make debugging/prep a bit faster.

The error in the second case is possibly due to the "--ligands NON". If there is a ligand is named "NON", then it would need a designated atom to use for the contact determination, something like this "--ligands NON:C1", where "NON" would be the residue name and "C1" would be some designed, unique atom name from the ligand. We generally do not recommend the inclusion of the ligand in DRN calculation, but it's there.

We advise caution when using a higher versions of Python, as networkx behaves differently in later versions of matplotlib, affecting the network display for the "weighted residue contact mapping" tool.

I hope that helps. We'll fix the bug in the MD-TASK branch as soon as we can.