mmcif files overwrite or skip load function's object argument.
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.
Might need more information so I can reproduce. Are your cif files multiblock?
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.
Also I pressed the wrong button so I closed and re-opened the issue. My bad.