Hi All,

I'm attaching the script the way I'd write it and that works for me.

Pavel

On 2/13/25 14:48, Enrico Ravera wrote:
Hi Billy, hi all, 
I had set the environment variable for CCP4 (it is a new pc, and I did not have phenix installed yet), but getting chem_data solved the problem. I still have to figure out the next steps to saving the files, but for today I am happy, many thanks for your help!
All the best, 

Enrico

Il giorno gio 13 feb 2025 alle ore 23:40 Billy Poon <[email protected]> ha scritto:
Hi Enrico,

Do you have chem_data or access to some restraints library? It looks like you are using the conda version of cctbx which does not have any restraints.

You can get a recent version of chem_data as a conda package here

https://cci.lbl.gov/~bkpoon/chem_data-2.0rc1.5606-pyh507b02e_0.conda

Download the file and then in your active conda environment with cctbx, run

conda install chem_data-2.0rc1.5606-pyh507b02e_0.conda

I can confirm that with a newly created cctbx conda environment,

mmtbx.reduce2 2gim.cif

will fail. After installing chem_data, that command works.

We may have to start providing the chem_data conda package on the cctbx GitHub release pages.

--
Billy K. Poon
Research Scientist, Molecular Biophysics and Integrated Bioimaging
Lawrence Berkeley National Laboratory
1 Cyclotron Road, M/S 33R0345
Berkeley, CA 94720
Fax: (510) 486-5909


On Thu, Feb 13, 2025 at 2:14 PM Enrico Ravera <[email protected]> wrote:
import sys
from iotbx import pdb as pdb
from mmtbx import model as mdl
from mmtbx.command_line import reduce2

# Load the mmcif file
model_filename = sys.argv[1]                       # Get the model file name from the command line
protein = pdb.input(file_name=model_filename) # Load the model
model = mdl.manager(model_input=protein)   # Create the model manager
#trim hidrogen atoms and solvent
model_no_H = model.remove_hydrogens()           # Remove hydrogen atoms
model_no_H_no_solvent = model_no_H.remove_solvent() # Remove solvent
# add hydrogens using reduce in nuclear position
model_clean = reduce2(model = model_no_H_no_solvent, mode = 'nuclear') # Add hydrogens
hierarchy = model_clean.get_hierarchy().expand_to_p1()         # Get the hierarchy


Il giorno gio 13 feb 2025 alle ore 23:08 Pavel Afonine <[email protected]> ha scritto:

Hi Enrico,

this works for me:

phenix.fetch_pdb 2gim

phenix.model_statistics 2gim.cif

mmtbx.reduce2 2gim.cif

Something must be lost in communication. Can you provide complete set of steps that lead to the crash?

Pavel

On 2/13/25 13:55, Enrico Ravera wrote:
Dear Pavel, many thanks. It ran until the reduce2 part, where it gives the following error:
  File "/home/ravera/miniconda3/envs/cctbx/lib/python3.13/site-packages/mmtbx/monomer_library/pdb_interpretation.py", line 1572, in resolve_unexpected
    mod_mod_id = mod_dict["NH1NOTPRO"]
the file i am parsing is https://files.rcsb.org/view/2GIM.cif

Any clues?

Cheers, 

E.


Il giorno gio 13 feb 2025 alle ore 20:42 Pavel Afonine <[email protected]> ha scritto:
Enrico,

here are the steps (check for typos as I was typing all the below from
memory):

> 1) read in a mmcif file (which I think I can do following the tutorial);

pdb_inp = iotbx.pdb.input(file_name = "4znn.pdb") # can be PDB or mmCIF
model = mmtbx.model.manager(model_input = pdb_inp)

> 2) trim the solvent and hydrogen atoms (probably I can do it following
> the tutorial);

model_no_H = model.remove_hydrogens()

model_no_water = model.remove_solvent()

though better:

selection = model.selection("not (element H or element D or water)")

model_trimmed = model.select(selection)

> 3) run reduce2 to get hydrogens in the nuclear positions (no clue);

Run
mmtbx.reduce OR
mmtbx.reduce2 OR
mmtbx.hydrogenate

to add H. I have no idea about the difference between the three commands
(perhaps just the mess that someone has to finally get brave enough to
clean!), but all three are supposed to add H.

Also, you should be able to access the above calls programmatically, at
Python script level, not running in the CL.

> 4) get the full content of the unit cell (no clue).

Do you mean expand to P1 (if original symmetry is not P1)? If so, then

hierarchy = model.get_hierarchy().expand_to_p1()

Happy to answer questions!
Pavel

_______________________________________________
cctbxbb mailing list -- [email protected]
To unsubscribe send an email to [email protected]
_______________________________________________
cctbxbb mailing list -- [email protected]
To unsubscribe send an email to [email protected]

_______________________________________________
cctbxbb mailing list -- [email protected]
To unsubscribe send an email to [email protected]