Пример #1
0
    def _parseCif(self, cifFile ):

        self.hasRfree      = False
        self.reflnStatus   = False
        self.hasAmplitudes = False
        
        cifObject = cif_reader(file_path=cifFile).model()
        
        # For now assume only one dataSet
        assert len(cifObject.keys()) == 1,"More than one data set in sf_cif - not sure what to do!"
        data = cifObject[ cifObject.keys()[0] ]
        
        # See if any of the _refln.status columns are 'f' - indicating they've been set aside for RFree
        if "_refln.status" in data:
            self.reflnStatus = True
            self.hasRfree = any( map( lambda x: x=='f', data[ "_refln.status" ] ) )
        
        # Need to check we have structure factor amplitudes. For now just check - we
        # need to add code to use ctrunctate to convert if we only have intensities
        #
        # http://mmcif.pdb.org/dictionaries/mmcif_pdbx.dic/Categories/refln.html
        if ( "_refln.F_meas" in data or "_refln.F_meas_au" in data ):
            self.hasAmplitudes = True
        
        return
Пример #2
0
    def _parseCif(self, cifFile):

        self.hasRfree = False
        self.reflnStatus = False
        self.hasAmplitudes = False

        cifObject = cif_reader(file_path=cifFile).model()

        # For now assume only one dataSet
        assert len(cifObject.keys(
        )) == 1, "More than one data set in sf_cif - not sure what to do!"
        data = cifObject[cifObject.keys()[0]]

        # See if any of the _refln.status columns are 'f' - indicating they've been set aside for RFree
        if "_refln.status" in data:
            self.reflnStatus = True
            self.hasRfree = any(map(lambda x: x == 'f', data["_refln.status"]))

        # Need to check we have structure factor amplitudes. For now just check - we
        # need to add code to use ctrunctate to convert if we only have intensities
        #
        # http://mmcif.pdb.org/dictionaries/mmcif_pdbx.dic/Categories/refln.html
        if ("_refln.F_meas" in data or "_refln.F_meas_au" in data):
            self.hasAmplitudes = True

        return
def try_all_readers(file_name):
  try: content = mtz.object(file_name=file_name)
  except RuntimeError: pass
  else: return ("ccp4_mtz", content)
  if (detect_binary_file.from_initial_block(file_name=file_name)):
    try: content = unpickle_miller_arrays(file_name=file_name)
    except KeyboardInterrupt: raise
    except Exception: pass
    else: return ("cctbx.miller.array", content)
    return (None, None)
  try: content = cns_reflection_reader.cns_reflection_file(
    open(file_name))
  except cns_reflection_reader.CNS_input_Error: pass
  else: return ("cns_reflection_file", content)
  try: content = cns_index_fobs_sigma_reader.reader(
    file_name=file_name)
  except RuntimeError: pass
  else: return ("cns_index_fobs_sigma", content)
  try: content = scalepack_merge.reader(
    open(file_name))
  except scalepack_merge.FormatError: pass
  else: return ("scalepack_merge", content)
  try: content = scalepack_no_merge.reader(file_name)
  except KeyboardInterrupt: raise
  except Exception: pass
  else: return ("scalepack_no_merge_original_index", content)
  try: content = dtrek_reflnlist_reader.reflnlist(
    open(file_name))
  except KeyboardInterrupt: raise
  except Exception: pass
  else: return ("dtrek_reflnlist", content)
  try: content = shelx_hklf.reader(
    file_name=file_name)
  except KeyboardInterrupt: raise
  except Exception: pass
  else: return ("shelx_hklf", content)
  try:
    content = cif_reader(file_path=file_name)
    looks_like_a_reflection_file = False
    for block in content.model().values():
      if '_refln_index_h' in block or '_refln.index_h' in block:
        looks_like_a_reflection_file = True
        break
    if not looks_like_a_reflection_file:
      raise RuntimeError
  except KeyboardInterrupt: raise
  except Exception: pass
  else: return ("cif", content)
  try: content = xds_ascii_reader(
    open(file_name))
  except KeyboardInterrupt: raise
  except Exception: pass
  else: return ("xds_ascii", content)
  try:
    content = xds_integrate_hkl_reader()
    content.read_file(file_name)
  except KeyboardInterrupt: raise
  except Exception: pass
  else: return ("xds_integrate_hkl", content)
  try: content = solve_fpfm_reader(file_name=file_name)
  except KeyboardInterrupt: raise
  except Exception: pass
  else: return ("solve_fpfm", content)
  return (None, None)
Пример #4
0
def try_all_readers(file_name):
    try:
        content = mtz.object(file_name=file_name)
    except RuntimeError:
        pass
    else:
        return ("ccp4_mtz", content)
    if (detect_binary_file.from_initial_block(file_name=file_name)):
        try:
            content = unpickle_miller_arrays(file_name=file_name)
        except KeyboardInterrupt:
            raise
        except Exception:
            pass
        else:
            return ("cctbx.miller.array", content)
        return (None, None)
    try:
        content = cns_reflection_reader.cns_reflection_file(open(file_name))
    except cns_reflection_reader.CNS_input_Error:
        pass
    else:
        return ("cns_reflection_file", content)
    try:
        content = cns_index_fobs_sigma_reader.reader(file_name=file_name)
    except RuntimeError:
        pass
    else:
        return ("cns_index_fobs_sigma", content)
    try:
        content = scalepack_merge.reader(open(file_name))
    except scalepack_merge.FormatError:
        pass
    else:
        return ("scalepack_merge", content)
    try:
        content = scalepack_no_merge.reader(file_name)
    except KeyboardInterrupt:
        raise
    except Exception:
        pass
    else:
        return ("scalepack_no_merge_original_index", content)
    try:
        content = dtrek_reflnlist_reader.reflnlist(open(file_name))
    except KeyboardInterrupt:
        raise
    except Exception:
        pass
    else:
        return ("dtrek_reflnlist", content)
    try:
        content = shelx_hklf.reader(file_name=file_name)
    except KeyboardInterrupt:
        raise
    except Exception:
        pass
    else:
        return ("shelx_hklf", content)
    try:
        content = cif_reader(file_path=file_name)
        looks_like_a_reflection_file = False
        for block in content.model().values():
            if '_refln_index_h' in block or '_refln.index_h' in block:
                looks_like_a_reflection_file = True
                break
        if not looks_like_a_reflection_file:
            raise RuntimeError
    except KeyboardInterrupt:
        raise
    except Exception:
        pass
    else:
        return ("cif", content)
    try:
        content = xds_ascii_reader(open(file_name))
    except KeyboardInterrupt:
        raise
    except Exception:
        pass
    else:
        return ("xds_ascii", content)
    try:
        content = xds_integrate_hkl_reader()
        content.read_file(file_name)
    except KeyboardInterrupt:
        raise
    except Exception:
        pass
    else:
        return ("xds_integrate_hkl", content)
    try:
        content = solve_fpfm_reader(file_name=file_name)
    except KeyboardInterrupt:
        raise
    except Exception:
        pass
    else:
        return ("solve_fpfm", content)
    return (None, None)