def check_map_file(map_file, params):
  if ( (params.map_coefficients_file_name is not None) and
       (params.map_file_name is not None) ):
    raise Sorry('Please use map coefficients or the map, not both.')
  elif (params.map_coefficients_file_name is not None):
    file_handle = any_file(params.map_coefficients_file_name)
    if (file_handle.file_type != 'hkl'):
      raise Sorry('%s is not in MTZ format.' % file_handle.file_name)
    labels = get_mtz_labels(file_handle)
    if (params.map_coefficients_label is None):
      raise Sorry('Data labels for map coefficients are not specified for %s' %
                  params.map_coefficients_file_name)
    elif (params.map_coefficients_label not in labels):
      raise Sorry('%s labels for map_coefficients were not found in %s' %
                  (params.map_coefficients_label,
                   params.map_coefficients_file_name))
  elif (params.map_file_name is not None):
    file_handle = any_file(params.map_file_name)
    if (file_handle.file_type != 'ccp4_map'):
      raise Sorry('%s is not a CCP4-formatted map file.' %
                  file_handle.file_name)
  elif (map_file is not None):
    params.map_file_name = map_file.file_name
Пример #2
0
def check_map_file(map_file, params):
  if ( (params.map_coefficients_file_name is not None) and
       (params.map_file_name is not None) ):
    raise Sorry('Please use map coefficients or the map, not both.')
  elif (params.map_coefficients_file_name is not None):
    file_handle = any_file(params.map_coefficients_file_name)
    if (file_handle.file_type != 'hkl'):
      raise Sorry('%s is not in MTZ format.' % file_handle.file_name)
    labels = get_mtz_labels(file_handle)
    if (params.map_coefficients_label is None):
      raise Sorry('Data labels for map coefficients are not specified for %s' %
                  params.map_coefficients_file_name)
    elif (params.map_coefficients_label not in labels):
      raise Sorry('%s labels for map_coefficients were not found in %s' %
                  (params.map_coefficients_label,
                   params.map_coefficients_file_name))
  elif (params.map_file_name is not None):
    file_handle = any_file(params.map_file_name)
    if (file_handle.file_type != 'ccp4_map'):
      raise Sorry('%s is not a CCP4-formatted map file.' %
                  file_handle.file_name)
  elif (map_file is not None):
    params.map_file_name = map_file.file_name