Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

mmcif files overwrite or skip load function's object argument. #312

Open
TristynAlxander opened this issue Sep 20, 2023 · 3 comments
Open

Comments

@TristynAlxander
Copy link

The first line of a structure.mmcif file is something like "data_xxxx" and the "xxxx" is used for the object name regardless of whether the object argument is present. I'm not familiar enough with the source code to know how to fix it, but for other's who need a quick hack:

def load(filename, object='', state=0, format='', finish=1, discrete=-1, quiet=1, multiplex=None, zoom=-1, partial=0, mimic=1, object_props=None, atom_props=None):
  if(object!=''):
    pre_load_list = cmd.get_object_list()
    cmd.load(filename, state=state, format=format, finish=finish, discrete=discrete, quiet=quiet, multiplex=multiplex, zoom=zoom, partial=partial, mimic=mimic, object_props=object_props, atom_props=atom_props)
    post_load_list = cmd.get_object_list()
    loaded_list = [x for x in post_load_list if x not in pre_load_list]
    cmd.set_name(loaded_list[0], object)
  else:
    cmd.load(filename,object=object, state=state, format=format, finish=finish, discrete=discrete, quiet=quiet, multiplex=multiplex, zoom=zoom, partial=partial, mimic=mimic, object_props=object_props, atom_props=atom_props)

Again I reiterate this is not good code, but it works.

@JarrettSJohnson
Copy link
Member

Might need more information so I can reproduce. Are your cif files multiblock?

@TristynAlxander
Copy link
Author

TristynAlxander commented Oct 3, 2023

Apologies I expected it to be more easily reproducible. Download your favorite (PDB: 1ZKZ) structure and its phases from the pdb and run it through REFMAC. The resulting mmcif can be opened but does not use the given object name. That should be sufficient, but I'll include more detail below.

After activating the CCP4 environment, REMAC was ran in my downloads directory with the following:

OLD=1zkz.cif
NEW=test
iter=./.
reduced=./1zkz_phases.mtz


if ! [ -d "$iter/" ]; then mkdir "$iter/"; fi
mkdir $iter/$NEW.refmac

# Make Keywords
touch $iter/$NEW.refmac/refmac_keywords.txt
echo "LABIN FP=FP SIGFP=SIGFP"                   > $iter/$NEW.refmac/refmac_keywords.txt
echo "WEIGHT MATRIX 0.0001"                     >> $iter/$NEW.refmac/refmac_keywords.txt
echo "NCYC 0"                                   >> $iter/$NEW.refmac/refmac_keywords.txt
echo "MAKE_restraints SYMM Y"                   >> $iter/$NEW.refmac/refmac_keywords.txt 

# Run Script
refmac5 HKLIN $reduced XYZIN $iter/$OLD  \
HKLOUT $iter/$NEW.refmac/0_refmac.mtz    \
XYZOUT $iter/$NEW.refmac/0_refmac.pdb    \
< $iter/$NEW.refmac/refmac_keywords.txt  \
> $iter/$NEW.refmac/refmac.log

I then open pymol and ran cmd.load("~/downloads/test.refmac/0_refmac.mmcif",object="test") The expected behavior was to produce an object named test. Instead an object named 1ZKZ is produced.

@TristynAlxander
Copy link
Author

Also I pressed the wrong button so I closed and re-opened the issue. My bad.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants