marrink-lab / vermouth-martinize

Describe and apply transformation on molecular structures and topologies
Apache License 2.0
84 stars 37 forks source link

martinize2 fails to detect newly parameterizing residues #535

Closed mdsptnlip closed 3 months ago

mdsptnlip commented 11 months ago

I am trying to martinize a protein containing a phosphorylated residue, using martini3001 force field.

Initially, (i) I copied the forcefield and the mapping folders w.r.t martini3001ff locally, (ii) the aminoacid.ff file was inserted with the new bead parameters which is inside the martini3001ff and a new mapping file is created inside martini3001map folder.

While martinizing the protein file and pointing the new parameter folders and mapping files using respective flags -ff-dir ../martini3001ff -map-dir ../martini3001map, the martinizing process fails to recognize the new parameters, but throws the error - Cannot recognize residue 'PHD' in molecule 0, plus, the residues following the phosphorylated residue gets ignored to be martinized.

Apart from working on parameters and the mapping files, I wonder any other part need to be worked on.

If you have any suggestions to make to recognize the new parameters from the local folders, that would be much helpful, as I am new in this area.

pckroon commented 11 months ago

You're very close :) To add a new residue you need to add it in 3 places: The target force field (martini3001); the mapping; and the input forcefield (default charmm). You missed the last one.

mdsptnlip commented 10 months ago

Thank you for the suggestion.

I copied the charmm forcefield folder locally from vermouth/data/force_fields/charmm

Inside charmm, I have inserted a block for the new residue inside the aminoacids.rtp and modifications.ff files, pointing the new charmm folder with "-from ../phd-charmm" flag, the martinize2 process still reports the following.

ValueError('Unknown force field "{}".'.format(args.from_ff)) ValueError: Unknown force field "../phd-charmm".

I cant able to comprehend this. Any suggestions to overcome this would be much helpful.

pckroon commented 10 months ago

-from takes the name of a force field, not a folder. You need a folder ('my-awesome-forcefields') in which you place your modified martini and charmm folders. Then: -ff-dir my-awesome-forcefields -from phd-charmm -ff phd-martini -map-dir ... Once this works be sure to double check the backbone bonds to your new residue, since PHD isn't listed as a protein resname, which affects the links (https://github.com/marrink-lab/vermouth-martinize/blob/master/vermouth/data/force_fields/martini3001/aminoacids.ff#L16).

mdsptnlip commented 10 months ago

Thank you for your support. I am advancing but haven't achieved yet.

Yes, the backbone of PHD has already taken care of.

Like you mentioned, the three folders (i) phd-charmm (ii) phd-martini3001ff and (iii) phd-martini3001map are placed in the modified-PHD folder, locally.

Here is the command I used, martinize2 -v -f protein.pdb -dssp mkdssp -cys auto -elastic -ef 500 -el 0.5 -eu 1 -ea 0 -ep 0 -x ptn-martinized.pdb -o ptn-martinized.top -maxwarn 5 -ff martini3001 -ff-dir PHD-modified -from phd-charmm -ff phd-martini3001ff -map-dir phd-martini3001map

Now I am getting the following error. ValueError: not enough values to unpack (expected 4, got 3)

pckroon commented 10 months ago

ValueError: not enough values to unpack (expected 4, got 3)

Do you have the full traceback for me?

mdsptnlip commented 10 months ago

Sure, Here it is.

Traceback (most recent call last): File "/site/app9/vermouth/bin/martinize2", line 818, in entry() File "/site/app9/vermouth/bin/martinize2", line 533, in entry vermouth.forcefield.find_force_fields(directory, known_force_fields) File "/site/app9/vermouth/lib64/python3.9/site-packages/vermouth/forcefield.py", line 170, in find_force_fields force_fields[name] = ForceField(path) File "/site/app9/vermouth/lib64/python3.9/site-packages/vermouth/forcefield.py", line 71, in init self.read_from(directory) File "/site/app9/vermouth/lib64/python3.9/site-packages/vermouth/forcefield.py", line 90, in read_from FORCE_FIELD_PARSERS[extension](infile, self) File "/site/app9/vermouth/lib64/python3.9/site-packages/vermouth/gmx/rtp.py", line 510, in read_rtp _subsection_parsers[subsection_name](subsection, block) File "/site/app9/vermouth/lib64/python3.9/site-packages/vermouth/gmx/rtp.py", line 172, in _atoms name, atype, charge, charge_group = line.split() ValueError: not enough values to unpack (expected 4, got 3)

pckroon commented 10 months ago

Something is wrong with an rtp file, probably your modified charmm file. Could you post the PHD residue you added to that?

mdsptnlip commented 10 months ago

Yes, Here it is.

[ PHD ]
 [ atoms ]
         N      NH1       -0.470    0
        HN      H          0.310    1
        CA      CT1        0.070    2
        HA      HB1        0.090    3
        CB      CG321     -0.229    4
       HB1      HGA2       0.128    5
       HB2      HGA2       0.017    6
        CG      CG2O2      0.691    7
       OD2      OG2D1     -0.644    8
       OD1      OG303     -0.632    9
         P      PG1        1.402    10
       OP1      OG2P1     -0.911    11
       OP2      OG2P1     -0.911    12
       OP3      OG311     -0.911    13
         C      C          0.510    14
         O      O         -0.510    15
 [ bonds ]
         N      CA
         C      CA
         C      +N
        CA      HA
        CA      CB
         N      HN
        CB      HB1
        CB      HB2
        CB      CG
        CG      OD1
       OD1      P
         P      OP2
         P      OP3
         O      C
        CG      OD2
         P      OP1
  [ impropers ]
        CG      CB     OD2     OD1
         N      -C      CA      HN
         C      CA      +N       O
  [ cmap ]
         -C       N      CA       C      +N
pckroon commented 10 months ago

Hmmn, that looks fine. It's (very) unfortunate that the RTP parser doesn't give more information about where it's running into trouble (@fgrunewald does your patched version perform better?). I'm afraid there's not much I can contribute without your files. You can try removing residues from the rtp file until the error goes away...

mdsptnlip commented 10 months ago

Thank you for checking the .rtp file.

I redid everything from the scratch, i think I almost fixed it and now the martinize2 started to read the new PHD residue files. But, now there is no error, while the martinize2 produced the output only for the new PHD residue, ignoring every other residue from the .pdb file.

I also noticed the following warning message. WARNING - unmapped-atom - vermouth.processors.do_mapping - These atoms are not covered by a mapping. Either your mappings don't describe all atoms (bad idea), or, there's no mapping available for all residues. ['1A-SER2:N', '2A-SER2:CA', '3A-SER2:C', '4A-SER2:O', '5A-SER2:CB', '6A-SER2:OG', and ...

I cant able to findout what caused this. Can you help me overcome this? Can I share my files, so you to give it a check?

pckroon commented 10 months ago

Copy over the mapping files from the vermouth data files to your own mapping directory that contains the phd mapping. I unfortunately don't have a whole lot of time to support vermouth/martinize2 any more, but if you run into issues that we can't solve like this I can take a look at your files at a later point.

fgrunewald commented 10 months ago

@mdsptnlip I'm happy to take a look at files if you send them to f.grunewald[at]rug.nl. I don't have a whole lot of time but think I can mange this week. Please include all files required to reproduce the mentioned error (ff files, mapping files, rtp files, input pdb file) as well as a README with the command you have been using and the files which martinize2 produced when you run it with the -vv flag in the end.