Esempio n. 1
0
 def _try_as_cif(self):
     # XXX hack to avoid choking on CCP4 maps and images
     file_ext = os.path.splitext(self.file_name)[1]
     assert (not file_ext in [".ccp4", ".img", ".osc", ".mccd"])
     import iotbx.cif
     from iotbx.reflection_file_reader import any_reflection_file
     cif_file = any_reflection_file(str(self.file_name))
     if cif_file.file_type() is not None:
         self._file_object = cif_file
         self._file_type = "hkl"
     else:
         from iotbx.pdb.mmcif import cif_input
         from iotbx.pdb.hierarchy import input_hierarchy_pair
         try:
             cif_in = cif_input(file_name=self.file_name)
             self._file_object = input_hierarchy_pair(
                 cif_in, cif_in.hierarchy)
             self._file_type = "pdb"
         except Exception as e:
             if (str(e).startswith("Space group is incompatible")
                     or str(e).startswith("The space group")):
                 raise
             else:
                 self._file_object = iotbx.cif.reader(
                     file_path=self.file_name, strict=False)
                 self._file_type = "cif"
Esempio n. 2
0
 def _try_as_cif (self) :
   # XXX hack to avoid choking on CCP4 maps and images
   file_ext = os.path.splitext(self.file_name)[1]
   assert (not file_ext in [".ccp4", ".img", ".osc", ".mccd"])
   import iotbx.cif
   from iotbx.reflection_file_reader import any_reflection_file
   cif_file = any_reflection_file(str(self.file_name))
   if cif_file.file_type() is not None:
     self._file_object = cif_file
     self._file_type = "hkl"
   else:
     from iotbx.pdb.mmcif import cif_input
     from iotbx.pdb.hierarchy import input_hierarchy_pair
     try:
       cif_in = cif_input(file_name=self.file_name)
       self._file_object = input_hierarchy_pair(cif_in, cif_in.hierarchy)
       self._file_type = "pdb"
     except Exception, e:
       self._file_object = iotbx.cif.reader(file_path=self.file_name,
         strict=False)
       self._file_type = "cif"