madscatt / zazzie

development branch
GNU General Public License v3.0
2 stars 3 forks source link

The Isopeptide module of TAMC does not use the same input parsing as the other modules #30

Closed StevenCHowell closed 7 years ago

StevenCHowell commented 8 years ago

I changed the gui mimic input from resid<48 to resid < 48 and it crashes with the error:

raceback (most recent call last):
  File "gui_mimic_iso_peptide.py", line 106, in <module>
    simulation.main(variables, txtQueue)
  File "/opt/intel/intelpython35/envs/sassie/lib/python2.7/site-packages/sassie/simulate/monte_carlo/monte_carlo.py", line 124, in main
    self.initialization()
  File "/opt/intel/intelpython35/envs/sassie/lib/python2.7/site-packages/sassie/simulate/monte_carlo/monte_carlo.py", line 543, in initialization
    self.setup_groups()
  File "/opt/intel/intelpython35/envs/sassie/lib/python2.7/site-packages/sassie/simulate/monte_carlo/monte_carlo.py", line 359, in setup_groups
    torsion.setup(self, group_number)
  File "/opt/intel/intelpython35/envs/sassie/lib/python2.7/site-packages/sassie/simulate/monte_carlo/monte_carlo_utilities/torsion.py", line 70, in setup
    setup_torsion_parameters(other_self, mol, group_number, pvars)
  File "/opt/intel/intelpython35/envs/sassie/lib/python2.7/site-packages/sassie/simulate/monte_carlo/monte_carlo_utilities/tamc_utilities/setup_torsion_parameters.py", line 335, in setup_torsion_parameters
    main_pivots_indices, pvars.main_pivots_masks[group_number], pvars.residue_main_pivots[group_number] = torsion_parameter_module.assign_main_pivots(group_flexible_molecule, pvars)
  File "/opt/intel/intelpython35/envs/sassie/lib/python2.7/site-packages/sassie/simulate/monte_carlo/monte_carlo_utilities/isopeptide_bond_torsion/isopeptide_bond_torsion_parameters.py", line 185, in assign_main_pivots
    residue_basis_strings = build_basis_strings(residue_main_pivots,residue_main_pivots_outside,residue_main_pivots_list, pvars.flexible_basis)
  File "/opt/intel/intelpython35/envs/sassie/lib/python2.7/site-packages/sassie/simulate/monte_carlo/monte_carlo_utilities/isopeptide_bond_torsion/isopeptide_bond_torsion_parameters.py", line 94, in build_basis_strings
    cter_resid = int(cter_list[cter_list.index('resid')+1])
ValueError: invalid literal for int() with base 10: '76)'
hailiangzhang commented 7 years ago

Hi,

I just gave a try on the TAMC script "gui_mimic_iso_peptide.py" from the most recent revision (#3362) in sassie-2.0. I did not see "resid<48" in line 106; instead, I did see it in line 36:

36 post_basis_string_array = ['(segname UB2 and resid<48) or (segname UB2 and resid>48)']

However, changing "resid<48" to "resid < 48" here did not affect TAMC running. Maybe we were referring to some different driver script? If yes, could you attach the driver script you were using?

StevenCHowell commented 7 years ago

This may be an issue caused by what is on SASSIE-web and in the svn differing from this repo. I will look into this more and post back here.

StevenCHowell commented 7 years ago

@hailiangzhang, try entering your input on sassie-web. Here is the log file. It breaks when parsing the flexible and post input. Here are my inputs.

StevenCHowell commented 7 years ago

The problem is that the input parsing does not use the basis filtering.This is from sassie_2.0/trunk/sassie/simulate/monte_carlo/monte_carlo_utilities/isopeptide_bond_torsion/isopeptide_bond_torsion_parameters.py which is the code running on SASSIE-web:

def build_basis_strings(residue_main_pivots,residue_main_pivots_outside,residue_main_pivots_list, isopeptide_basis_string):

    '''
    method to create basis strings for each main pivot in each residue
    '''
    cter = isopeptide_basis_string.split('or')[0] ## @NOTE to ZHL: assume contract
    lys = isopeptide_basis_string.split('or')[1] ## @NOTE to ZHL: assume contract

    cter_list = cter.split()
    cter_resid = int(cter_list[cter_list.index('resid')+1])
    cter_segname = cter_list[cter_list.index('segname')+1]
    lys_list = lys.split()
    lys_resid = int(lys_list[lys_list.index('resid')+1])
    lys_segname = lys_list[lys_list.index('segname')+1]

It should instead be something like:

import sassie.util.basis_to_python as basis_to_python

cter_basis_string = isopeptide_basis_string + ' and resname LYS'
cter_basis = basis_to_python.parse_basis(cter_basis_string )
error, cter_mask = mol.get_subset_mask(cter_basis)
hailiangzhang commented 7 years ago

Yes, I should have use basis_to_python to parse the basis string; however, Isopeptide basis string follows a different contract compared to other regular moveset due to its unique topology.

Attached is the modified "isopeptide_bond_torsion_parameters.py" to fix this bug (not tested), and following are the changes

 87 def build_basis_strings(residue_main_pivots,residue_main_pivots_outside,residue_main_pivots_list, isopeptide_basis_string):
 88
 89     '''
 90     method to create basis strings for each main pivot in each residue
 91     '''
 92     cter = isopeptide_basis_string.split('or')[0] ## @NOTE to ZHL: assume contract
 93     lys = isopeptide_basis_string.split('or')[1] ## @NOTE to ZHL: assume contract
 94
 95     r_resid = re.compile(r'resid\[i\]\s*==\s*("|\'{0,1})([\w\'"]+)\1')
 96     r_segname = re.compile(r'segname\[i\]\s*==\s*("|\'{0,1})([\w\'"]+)\1')
 97
 98     basis_python = basis_to_python.parse_basis(cter)
 99     cter_resid = int(r_resid.search(basis_python).groups()[1])
100     cter_segname  = r_segname.search(basis_python).groups()[1]
101
102     basis_python = basis_to_python.parse_basis(lys)
103     lys_resid = int(r_resid.search(basis_python).groups()[1])
104     lys_segname  = r_segname.search(basis_python).groups()[1]

isopeptide_bond_torsion_parameters.py.tar.gz

madscatt commented 7 years ago

NOTE: the DOCs need to state that the c-terminal part of the flexible region MUST come before the LYS part.

StevenCHowell commented 7 years ago

The current implementation of the post region seems it could be simplified. The current gui_mimic script has the post regions as follows:

forward: (segname UB2 and resid < 48) or (segname UB2 and resid > 48) reverse: (segname UB1 and resid < 76) or (segname UB1 and resid > 76)

I tested the following and got comparable results:

forward: segname UB2 and not resid 48

Any problems with this?

StevenCHowell commented 7 years ago

I am now able to enter input comparable to the other modules.