本文整理匯總了Python中xia2.Handlers.Flags.Flags.get_small_molecule方法的典型用法代碼示例。如果您正苦於以下問題:Python Flags.get_small_molecule方法的具體用法?Python Flags.get_small_molecule怎麽用?Python Flags.get_small_molecule使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類xia2.Handlers.Flags.Flags
的用法示例。
在下文中一共展示了Flags.get_small_molecule方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: _prepare_pointless_hklin
# 需要導入模塊: from xia2.Handlers.Flags import Flags [as 別名]
# 或者: from xia2.Handlers.Flags.Flags import get_small_molecule [as 別名]
def _prepare_pointless_hklin(working_directory,
hklin,
phi_width):
'''Prepare some data for pointless - this will take only 180 degrees
of data if there is more than this (through a "rebatch" command) else
will simply return hklin.'''
# also remove blank images?
if not Flags.get_microcrystal() and not Flags.get_small_molecule():
Debug.write('Excluding blank images')
hklout = os.path.join(
working_directory,
'%s_noblank.mtz' % (os.path.split(hklin)[-1][:-4]))
FileHandler.record_temporary_file(hklout)
hklin = remove_blank(hklin, hklout)
# find the number of batches
md = Mtzdump()
md.set_working_directory(working_directory)
auto_logfiler(md)
md.set_hklin(hklin)
md.dump()
batches = max(md.get_batches()) - min(md.get_batches())
phi_limit = 180
if batches * phi_width < phi_limit or Flags.get_small_molecule():
return hklin
hklout = os.path.join(
working_directory,
'%s_prepointless.mtz' % (os.path.split(hklin)[-1][:-4]))
rb = Rebatch()
rb.set_working_directory(working_directory)
auto_logfiler(rb)
rb.set_hklin(hklin)
rb.set_hklout(hklout)
first = min(md.get_batches())
last = first + int(phi_limit / phi_width)
Debug.write('Preparing data for pointless - %d batches (%d degrees)' % \
((last - first), phi_limit))
rb.limit_batches(first, last)
# we will want to delete this one exit
FileHandler.record_temporary_file(hklout)
return hklout
示例2: _updated_aimless
# 需要導入模塊: from xia2.Handlers.Flags import Flags [as 別名]
# 或者: from xia2.Handlers.Flags.Flags import get_small_molecule [as 別名]
def _updated_aimless(self):
'''Generate a correctly configured Aimless...'''
aimless = None
if not self._scalr_corrections:
aimless = self._factory.Aimless()
else:
aimless = self._factory.Aimless(
partiality_correction = self._scalr_correct_partiality,
absorption_correction = self._scalr_correct_absorption,
decay_correction = self._scalr_correct_decay)
if Flags.get_microcrystal():
# fiddly little data sets - allow more rapid scaling...
aimless.set_scaling_parameters('rotation', 2.0)
if self._scalr_correct_decay:
aimless.set_bfactor(bfactor=True, brotation = 2.0)
if Flags.get_small_molecule():
aimless.set_scaling_parameters('rotation', 15.0)
aimless.set_bfactor(bfactor=False)
aimless.set_surface_tie(PhilIndex.params.ccp4.aimless.surface_tie)
aimless.set_surface_link(PhilIndex.params.ccp4.aimless.surface_link)
return aimless
示例3: merge
# 需要導入模塊: from xia2.Handlers.Flags import Flags [as 別名]
# 或者: from xia2.Handlers.Flags.Flags import get_small_molecule [as 別名]
def merge(self):
'''Actually merge the already scaled reflections.'''
self.check_hklin()
self.check_hklout()
if not self._onlymerge:
raise RuntimeError, 'for scaling use scale()'
if not self._scalepack:
self.set_task('Merging scaled reflections from %s => %s' % \
(os.path.split(self.get_hklin())[-1],
os.path.split(self.get_hklout())[-1]))
else:
self.set_task('Merging reflections from %s => scalepack %s' % \
(os.path.split(self.get_hklin())[-1],
os.path.split(self.get_hklout())[-1]))
self._xmlout = os.path.join(self.get_working_directory(),
'%d_aimless.xml' % self.get_xpid())
self.start()
self.input('xmlout %d_aimless.xml' % self.get_xpid())
if not Flags.get_small_molecule():
self.input('bins 20')
self.input('run 1 all')
self.input('scales constant')
self.input('initial unity')
self.input('sdcorrection both noadjust 1.0 0.0 0.0')
if self._anomalous:
self.input('anomalous on')
else:
self.input('anomalous off')
if self._scalepack:
self.input('output polish unmerged')
self.input('output unmerged')
self.close_wait()
# check for errors
try:
self.check_for_errors()
self.check_ccp4_errors()
self.check_aimless_errors()
status = self.get_ccp4_status()
if 'Error' in status:
raise RuntimeError, '[AIMLESS] %s' % status
except RuntimeError, e:
try:
os.remove(self.get_hklout())
except:
pass
raise e
示例4: reindex
# 需要導入模塊: from xia2.Handlers.Flags import Flags [as 別名]
# 或者: from xia2.Handlers.Flags.Flags import get_small_molecule [as 別名]
def reindex(self):
'''Actually perform the reindexing.'''
if PhilIndex.params.ccp4.reindex.program == 'reindex':
return self.reindex_old()
self.check_hklin()
self.check_hklout()
if not self._spacegroup and not self._operator:
raise RuntimeError, 'reindex requires spacegroup or operator'
if self._operator:
self._operator = self._operator.replace('[', '').replace(']', '')
Debug.write('Reindex... %s %s' % (self._spacegroup, self._operator))
if self._spacegroup and Flags.get_small_molecule() and False:
if not self._operator or self._operator.replace(' ', '') == 'h,k,l':
return self.cctbx_reindex()
self.start()
if self._spacegroup:
if type(self._spacegroup) == type(0):
spacegroup = Syminfo.spacegroup_number_to_name(
self._spacegroup)
elif self._spacegroup[0] in '0123456789':
spacegroup = Syminfo.spacegroup_number_to_name(
int(self._spacegroup))
else:
spacegroup = self._spacegroup
self.input('spacegroup \'%s\'' % spacegroup)
if self._operator:
# likewise
self.input('reindex \'%s\'' % self._operator)
else:
self.input('reindex \'h,k,l\'')
self.close_wait()
# check for errors
try:
self.check_for_errors()
except RuntimeError, e:
try:
os.remove(self.get_hklout())
except:
pass
raise e
示例5: _estimate_resolution_limit
# 需要導入模塊: from xia2.Handlers.Flags import Flags [as 別名]
# 或者: from xia2.Handlers.Flags.Flags import get_small_molecule [as 別名]
def _estimate_resolution_limit(self, hklin, batch_range=None):
params = PhilIndex.params.xia2.settings.resolution
m = Merger()
m.set_working_directory(self.get_working_directory())
from xia2.lib.bits import auto_logfiler
auto_logfiler(m)
m.set_hklin(hklin)
m.set_limit_rmerge(params.rmerge)
m.set_limit_completeness(params.completeness)
m.set_limit_cc_half(params.cc_half)
m.set_limit_isigma(params.isigma)
m.set_limit_misigma(params.misigma)
if Flags.get_small_molecule():
m.set_nbins(20)
if batch_range is not None:
start, end = batch_range
m.set_batch_range(start, end)
m.run()
if params.completeness:
r_comp = m.get_resolution_completeness()
else:
r_comp = 0.0
if params.cc_half:
r_cc_half = m.get_resolution_cc_half()
else:
r_cc_half = 0.0
if params.rmerge:
r_rm = m.get_resolution_rmerge()
else:
r_rm = 0.0
if params.isigma:
r_uis = m.get_resolution_isigma()
else:
r_uis = 0.0
if params.misigma:
r_mis = m.get_resolution_misigma()
else:
r_mis = 0.0
resolution = max([r_comp, r_rm, r_uis, r_mis, r_cc_half])
return resolution
示例6: _do_indexing
# 需要導入模塊: from xia2.Handlers.Flags import Flags [as 別名]
# 或者: from xia2.Handlers.Flags.Flags import get_small_molecule [as 別名]
def _do_indexing(self, method=None):
indexer = self.Index()
for indxr in self._indxr_indexers:
indexer.add_spot_filename(indxr._indxr_payload["spot_list"])
indexer.add_sweep_filename(indxr._indxr_payload["datablock.json"])
if PhilIndex.params.dials.index.phil_file is not None:
indexer.set_phil_file(PhilIndex.params.dials.index.phil_file)
if PhilIndex.params.dials.index.max_cell:
indexer.set_max_cell(PhilIndex.params.dials.index.max_cell)
if Flags.get_small_molecule():
indexer.set_min_cell(3)
if PhilIndex.params.dials.fix_geometry:
indexer.set_detector_fix('all')
indexer.set_beam_fix('all')
if self._indxr_input_lattice:
indexer.set_indexer_input_lattice(self._indxr_input_lattice)
Debug.write('Set lattice: %s' % self._indxr_input_lattice)
if self._indxr_input_cell:
indexer.set_indexer_input_cell(self._indxr_input_cell)
Debug.write('Set cell: %f %f %f %f %f %f' % \
self._indxr_input_cell)
original_cell = self._indxr_input_cell
if method is None:
if PhilIndex.params.dials.index.method is None:
method = 'fft3d'
Debug.write('Choosing indexing method: %s' % method)
else:
method = PhilIndex.params.dials.index.method
indexer.run(method)
if not os.path.exists(indexer.get_experiments_filename()):
raise RuntimeError("Indexing has failed: %s does not exist."
%indexer.get_experiments_filename())
elif not os.path.exists(indexer.get_indexed_filename()):
raise RuntimeError("Indexing has failed: %s does not exist."
%indexer.get_indexed_filename())
return indexer
示例7: _index_select_images
# 需要導入模塊: from xia2.Handlers.Flags import Flags [as 別名]
# 或者: from xia2.Handlers.Flags.Flags import get_small_molecule [as 別名]
def _index_select_images(self):
'''Select correct images based on image headers.'''
if Flags.get_small_molecule():
return self._index_select_images_small_molecule()
if Flags.get_microcrystal():
return self._index_select_images_microcrystal()
phi_width = self.get_phi_width()
images = self.get_matching_images()
if Flags.get_interactive():
selected_images = index_select_images_user(phi_width, images,
Chatter)
else:
selected_images = index_select_images_lone(phi_width, images)
for image in selected_images:
Debug.write('Selected image %s' % image)
self.add_indexer_image_wedge(image)
return
示例8: run
# 需要導入模塊: from xia2.Handlers.Flags import Flags [as 別名]
# 或者: from xia2.Handlers.Flags.Flags import get_small_molecule [as 別名]
def run(self):
'''Run colspot.'''
#image_header = self.get_header()
## crank through the header dictionary and replace incorrect
## information with updated values through the indexer
## interface if available...
## need to add distance, wavelength - that should be enough...
#if self.get_distance():
#image_header['distance'] = self.get_distance()
#if self.get_wavelength():
#image_header['wavelength'] = self.get_wavelength()
#if self.get_two_theta():
#image_header['two_theta'] = self.get_two_theta()
header = imageset_to_xds(self.get_imageset())
xds_inp = open(os.path.join(self.get_working_directory(),
'XDS.INP'), 'w')
# what are we doing?
xds_inp.write('JOB=COLSPOT\n')
xds_inp.write('MAXIMUM_NUMBER_OF_PROCESSORS=%d\n' % \
self._parallel)
#if image_header['detector'] in ('pilatus', 'dectris'):
if self.get_imageset().get_detector()[0].get_type() == 'SENSOR_PAD':
xds_inp.write('MINIMUM_NUMBER_OF_PIXELS_IN_A_SPOT=%d\n' %
self._params.minimum_pixels_per_spot)
for record in header:
xds_inp.write('%s\n' % record)
name_template = os.path.join(self.get_directory(),
self.get_template().replace('#', '?'))
record = 'NAME_TEMPLATE_OF_DATA_FRAMES=%s\n' % \
name_template
xds_inp.write(record)
xds_inp.write('DATA_RANGE=%d %d\n' % self._data_range)
for spot_range in self._spot_range:
xds_inp.write('SPOT_RANGE=%d %d\n' % spot_range)
xds_inp.write('BACKGROUND_RANGE=%d %d\n' % \
self._background_range)
# microcrystals have very mall spots, perhaps?
if Flags.get_microcrystal():
xds_inp.write('MINIMUM_NUMBER_OF_PIXELS_IN_A_SPOT=1\n')
if Flags.get_small_molecule():
xds_inp.write('STRONG_PIXEL=5\n')
# FIXME should probably be moved to a phil parameter
xds_inp.close()
# copy the input file...
shutil.copyfile(os.path.join(self.get_working_directory(),
'XDS.INP'),
os.path.join(self.get_working_directory(),
'%d_COLSPOT.INP' % self.get_xpid()))
# write the input data files...
for file_name in self._input_data_files_list:
src = self._input_data_files[file_name]
dst = os.path.join(
self.get_working_directory(), file_name)
if src != dst:
shutil.copyfile(src, dst)
self.start()
self.close_wait()
xds_check_version_supported(self.get_all_output())
# copy the LP file
shutil.copyfile(os.path.join(self.get_working_directory(),
'COLSPOT.LP'),
os.path.join(self.get_working_directory(),
'%d_COLSPOT.LP' % self.get_xpid()))
# gather the output files
for file in self._output_data_files_list:
self._output_data_files[file] = os.path.join(
self.get_working_directory(), file)
return
示例9: decide_spacegroup
# 需要導入模塊: from xia2.Handlers.Flags import Flags [as 別名]
# 或者: from xia2.Handlers.Flags.Flags import get_small_molecule [as 別名]
def decide_spacegroup(self):
'''Given data indexed in the correct pointgroup, have a
guess at the spacegroup.'''
if not self._xdsin:
self.check_hklin()
self.set_task('Computing the correct spacegroup for %s' % \
self.get_hklin())
else:
Debug.write('Pointless using XDS input file %s' % \
self._xdsin)
self.set_task('Computing the correct spacegroup for %s' % \
self.get_xdsin())
# FIXME this should probably be a standard CCP4 keyword
if self._xdsin:
self.add_command_line('xdsin')
self.add_command_line(self._xdsin)
self.add_command_line('xmlout')
self.add_command_line('%d_pointless.xml' % self.get_xpid())
self.add_command_line('hklout')
self.add_command_line('pointless.mtz')
self.start()
self.input('lauegroup hklin')
self.input('setting symmetry-based')
if Flags.get_small_molecule():
self.input('chirality nonchiral')
self.close_wait()
# check for errors
self.check_for_errors()
hklin_spacegroup = ''
xml_file = os.path.join(self.get_working_directory(),
'%d_pointless.xml' % self.get_xpid())
mend_pointless_xml(xml_file)
if not os.path.exists(xml_file) and \
os.path.exists('%s.xml' % xml_file):
xml_file = '%s.xml' % xml_file
dom = xml.dom.minidom.parse(xml_file)
sg_list = dom.getElementsByTagName('SpacegroupList')[0]
sg_node = sg_list.getElementsByTagName('Spacegroup')[0]
best_prob = float(sg_node.getElementsByTagName(
'TotalProb')[0].childNodes[0].data.strip())
# FIXME 21/NOV/06 in here record a list of valid spacegroups
# (that is, those which are as likely as the most likely)
# for later use...
self._spacegroup = sg_node.getElementsByTagName(
'SpacegroupName')[0].childNodes[0].data.strip()
self._spacegroup_reindex_operator = sg_node.getElementsByTagName(
'ReindexOperator')[0].childNodes[0].data.strip()
self._spacegroup_reindex_matrix = tuple(
map(float, sg_node.getElementsByTagName(
'ReindexMatrix')[0].childNodes[0].data.split()))
# get a list of "equally likely" spacegroups
for node in sg_list.getElementsByTagName('Spacegroup'):
prob = float(node.getElementsByTagName(
'TotalProb')[0].childNodes[0].data.strip())
name = node.getElementsByTagName(
'SpacegroupName')[0].childNodes[0].data.strip()
if math.fabs(prob - best_prob) < 0.01:
# this is jolly likely!
self._likely_spacegroups.append(name)
# now parse the output looking for the unit cell information -
# this should look familiar from mtzdump
output = self.get_all_output()
length = len(output)
a = 0.0
b = 0.0
c = 0.0
alpha = 0.0
beta = 0.0
gamma = 0.0
self._cell_info['datasets'] = []
self._cell_info['dataset_info'] = { }
for i in range(length):
#.........這裏部分代碼省略.........
示例10: decide_pointgroup
# 需要導入模塊: from xia2.Handlers.Flags import Flags [as 別名]
# 或者: from xia2.Handlers.Flags.Flags import get_small_molecule [as 別名]
def decide_pointgroup(self):
'''Decide on the correct pointgroup for hklin.'''
if not self._xdsin:
self.check_hklin()
self.set_task('Computing the correct pointgroup for %s' % \
self.get_hklin())
else:
Debug.write('Pointless using XDS input file %s' % \
self._xdsin)
self.set_task('Computing the correct pointgroup for %s' % \
self.get_xdsin())
# FIXME this should probably be a standard CCP4 keyword
if self._xdsin:
self.add_command_line('xdsin')
self.add_command_line(self._xdsin)
self.add_command_line('xmlout')
self.add_command_line('%d_pointless.xml' % self.get_xpid())
if self._hklref:
self.add_command_line('hklref')
self.add_command_line(self._hklref)
self.start()
self.input('systematicabsences off')
self.input('setting symmetry-based')
if self._hklref:
from xia2.Handlers.Phil import PhilIndex
dev = PhilIndex.params.xia2.settings.developmental
if dev.pointless_tolerance > 0.0:
self.input('tolerance %f' % dev.pointless_tolerance)
# may expect more %age variation for small molecule data
if Flags.get_small_molecule() and self._hklref:
self.input('tolerance 5.0')
if Flags.get_small_molecule():
self.input('chirality nonchiral')
if self._input_laue_group:
self.input('lauegroup %s' % self._input_laue_group)
self.close_wait()
# check for errors
self.check_for_errors()
# check for fatal errors
output = self.get_all_output()
for j, record in enumerate(output):
if 'FATAL ERROR message:' in record:
raise RuntimeError, 'Pointless error: %s' % output[j+1].strip()
hklin_spacegroup = ''
hklin_lattice = ''
for o in self.get_all_output():
if 'Spacegroup from HKLIN file' in o:
# hklin_spacegroup = o.split(':')[-1].strip()
hklin_spacegroup = spacegroup_name_xHM_to_old(
o.replace(
'Spacegroup from HKLIN file :', '').strip())
hklin_lattice = Syminfo.get_lattice(hklin_spacegroup)
if 'No alternative indexing possible' in o:
# then the XML file will be broken - no worries...
self._pointgroup = hklin_spacegroup
self._confidence = 1.0
self._totalprob = 1.0
self._reindex_matrix = [1.0, 0.0, 0.0,
0.0, 1.0, 0.0,
0.0, 0.0, 1.0]
self._reindex_operator = 'h,k,l'
return 'ok'
if '**** Incompatible symmetries ****' in o:
raise RuntimeError, \
'reindexing against a reference with different symmetry'
if '***** Stopping because cell discrepancy between files' in o:
raise RuntimeError, 'incompatible unit cells between data sets'
if 'L-test suggests that the data may be twinned' in o:
self._probably_twinned = True
# parse the XML file for the information I need...
xml_file = os.path.join(self.get_working_directory(),
'%d_pointless.xml' % self.get_xpid())
mend_pointless_xml(xml_file)
#.........這裏部分代碼省略.........
示例11: run
# 需要導入模塊: from xia2.Handlers.Flags import Flags [as 別名]
# 或者: from xia2.Handlers.Flags.Flags import get_small_molecule [as 別名]
def run(self):
'''Run integrate.'''
#image_header = self.get_header()
## crank through the header dictionary and replace incorrect
## information with updated values through the indexer
## interface if available...
## need to add distance, wavelength - that should be enough...
#if self.get_distance():
#image_header['distance'] = self.get_distance()
#if self.get_wavelength():
#image_header['wavelength'] = self.get_wavelength()
#if self.get_two_theta():
#image_header['two_theta'] = self.get_two_theta()
header = imageset_to_xds(self.get_imageset())
xds_inp = open(os.path.join(self.get_working_directory(),
'XDS.INP'), 'w')
# what are we doing?
xds_inp.write('JOB=INTEGRATE\n')
xds_inp.write('MAXIMUM_NUMBER_OF_PROCESSORS=%d\n' % \
self._parallel)
from xia2.Handlers.Phil import PhilIndex
xds_params = PhilIndex.params.xds
if xds_params.profile_grid_size:
ab, c = xds_params.profile_grid_size
assert(ab > 0 and ab < 22 and (ab % 2) == 1)
assert(c > 0 and c < 22 and (c % 2) == 1)
xds_inp.write(
'NUMBER_OF_PROFILE_GRID_POINTS_ALONG_ALPHA/BETA= %d\n' % ab)
xds_inp.write(
'NUMBER_OF_PROFILE_GRID_POINTS_ALONG_GAMMA= %d\n' % c)
if Flags.get_xparallel() > 1:
xds_inp.write('MAXIMUM_NUMBER_OF_JOBS=%d\n' % \
Flags.get_xparallel())
elif Flags.get_xparallel() == -1:
chunk_width = 30.0
phi_width = self.get_phi_width()
nchunks = int(
(self._data_range[1] - self._data_range[0] + 1) * \
phi_width / chunk_width)
Debug.write('Xparallel: -1 using %d chunks' % nchunks)
xds_inp.write('MAXIMUM_NUMBER_OF_JOBS=%d\n' % nchunks)
profile_fitting = PhilIndex.params.xds.integrate.profile_fitting
if not profile_fitting:
xds_inp.write('PROFILE_FITTING=FALSE\n')
# write out lots of output
xds_inp.write('TEST=2\n')
if self._params.delphi:
xds_inp.write('DELPHI=%.1f\n' % self._params.delphi)
elif Flags.get_small_molecule():
xds_inp.write('DELPHI=%.1f\n' % \
xds_params.delphi_small)
else:
xds_inp.write('DELPHI=%.1f\n' % \
xds_params.delphi)
if self._refined_xparm:
xds_inp.write('REFINE(INTEGRATE)=%s\n' %
' '.join(self._params.refine_final))
else:
xds_inp.write('REFINE(INTEGRATE)=%s\n' %
' '.join(self._params.refine))
if self._params.fix_scale:
if _running_xds_version() >= 20130330:
xds_inp.write('DATA_RANGE_FIXED_SCALE_FACTOR= %d %d 1\n' %
self._data_range)
else:
xds_inp.write('FIXED_SCALE_FACTOR=TRUE\n')
# check for updated input parameters or ones from phil
if self._updates.has_key('BEAM_DIVERGENCE') and \
self._updates.has_key('BEAM_DIVERGENCE_E.S.D.'):
xds_inp.write(
'BEAM_DIVERGENCE=%f BEAM_DIVERGENCE_E.S.D.=%f\n' % \
(self._updates['BEAM_DIVERGENCE'],
self._updates['BEAM_DIVERGENCE_E.S.D.']))
elif self._params.beam_divergence and self._params.beam_divergence_esd:
xds_inp.write(
'BEAM_DIVERGENCE=%f BEAM_DIVERGENCE_E.S.D.=%f\n' % \
(self._params.beam_divergence,
self._params.beam_divergence_esd))
#.........這裏部分代碼省略.........
示例12: run
# 需要導入模塊: from xia2.Handlers.Flags import Flags [as 別名]
# 或者: from xia2.Handlers.Flags.Flags import get_small_molecule [as 別名]
def run(self, method):
from xia2.Handlers.Streams import Debug
Debug.write('Running dials.index')
self.clear_command_line()
for f in self._sweep_filenames:
self.add_command_line(f)
for f in self._spot_filenames:
self.add_command_line(f)
self.add_command_line('indexing.method=%s' % method)
nproc = Flags.get_parallel()
self.set_cpu_threads(nproc)
self.add_command_line('indexing.nproc=%i' % nproc)
if Flags.get_small_molecule():
self.add_command_line('filter_ice=false')
if self._reflections_per_degree is not None:
self.add_command_line(
'reflections_per_degree=%i' %self._reflections_per_degree)
if self._fft3d_n_points is not None:
self.add_command_line(
'fft3d.reciprocal_space_grid.n_points=%i' %self._fft3d_n_points)
if self._close_to_spindle_cutoff is not None:
self.add_command_line(
'close_to_spindle_cutoff=%f' %self._close_to_spindle_cutoff)
if self._outlier_algorithm:
self.add_command_line('outlier.algorithm=%s' % self._outlier_algorithm)
if self._max_cell:
self.add_command_line('max_cell=%d' % self._max_cell)
if self._min_cell:
self.add_command_line('min_cell=%d' % self._min_cell)
if self._d_min_start:
self.add_command_line('d_min_start=%f' % self._d_min_start)
if self._indxr_input_lattice is not None:
from xia2.Experts.SymmetryExpert import lattice_to_spacegroup_number
self._symm = lattice_to_spacegroup_number(
self._indxr_input_lattice)
self.add_command_line('known_symmetry.space_group=%s' % self._symm)
if self._indxr_input_cell is not None:
self.add_command_line(
'known_symmetry.unit_cell="%s,%s,%s,%s,%s,%s"' %self._indxr_input_cell)
if self._maximum_spot_error:
self.add_command_line('maximum_spot_error=%.f' %
self._maximum_spot_error)
if self._detector_fix:
self.add_command_line('detector.fix=%s' % self._detector_fix)
if self._beam_fix:
self.add_command_line('beam.fix=%s' % self._beam_fix)
if self._phil_file is not None:
self.add_command_line("%s" %self._phil_file)
self._experiment_filename = os.path.join(
self.get_working_directory(), '%d_experiments.json' %self.get_xpid())
self._indexed_filename = os.path.join(
self.get_working_directory(), '%d_indexed.pickle' %self.get_xpid())
self.add_command_line("output.experiments=%s" %self._experiment_filename)
self.add_command_line("output.reflections=%s" %self._indexed_filename)
self.start()
self.close_wait()
self.check_for_errors()
records = self.get_all_output()
for i, record in enumerate(records):
if 'Unit cell:' in record:
self._p1_cell = map(float, record.replace('(', '').replace(
')', '').replace(',', '').split()[-6:])
if 'Final RMSDs by experiment' in record:
values = records[i+6].strip().strip('|').split('|')
if len(values):
values = [float(v) for v in values]
if values[0] == 0:
self._nref = int(values[1])
self._rmsd_x = values[2]
self._rmsd_y = values[3]
self._rmsd_z = values[4]
return
示例13: multi_merge
# 需要導入模塊: from xia2.Handlers.Flags import Flags [as 別名]
# 或者: from xia2.Handlers.Flags.Flags import get_small_molecule [as 別名]
def multi_merge(self):
'''Merge data from multiple runs - this is very similar to
the scaling subroutine...'''
self.check_hklin()
self.check_hklout()
if not self._scalepack:
self.set_task('Scaling reflections from %s => %s' % \
(os.path.split(self.get_hklin())[-1],
os.path.split(self.get_hklout())[-1]))
else:
self.set_task('Scaling reflections from %s => scalepack %s' % \
(os.path.split(self.get_hklin())[-1],
os.path.split(self.get_hklout())[-1]))
self.start()
self._xmlout = os.path.join(self.get_working_directory(),
'%d_aimless.xml' % self.get_xpid())
self.input('xmlout %d_aimless.xml' % self.get_xpid())
if not Flags.get_small_molecule():
self.input('bins 20')
if self._new_scales_file:
self.input('dump %s' % self._new_scales_file)
if self._resolution:
self.input('resolution %f' % self._resolution)
run_number = 0
for run in self._runs:
run_number += 1
if not run[5]:
self.input('run %d batch %d to %d' % (run_number,
run[0], run[1]))
if run[6] != 0.0 and not run[5]:
self.input('resolution run %d high %f' % \
(run_number, run[6]))
# put in the pname, xname, dname stuff
run_number = 0
for run in self._runs:
run_number += 1
if run[7]:
Debug.write('Run %d corresponds to sweep %s' % \
(run_number, run[7]))
if run[5]:
continue
# we are only merging here so the scales command is
# dead simple...
self.input('scales constant')
if self._anomalous:
self.input('anomalous on')
else:
self.input('anomalous off')
# FIXME this is probably not ready to be used yet...
if self._scalepack:
self.input('output polish unmerged')
self.input('output unmerged')
if self._scales_file:
self.input('onlymerge')
self.input('restore %s' % self._scales_file)
self.close_wait()
# check for errors
try:
self.check_for_errors()
self.check_ccp4_errors()
self.check_aimless_errors()
status = 'OK'
Debug.write('Aimless status: %s' % status)
if 'Error' in status:
raise RuntimeError, '[AIMLESS] %s' % status
except RuntimeError, e:
try:
os.remove(self.get_hklout())
except:
pass
raise e
示例14: scale
# 需要導入模塊: from xia2.Handlers.Flags import Flags [as 別名]
# 或者: from xia2.Handlers.Flags.Flags import get_small_molecule [as 別名]
def scale(self):
'''Actually perform the scaling.'''
self.check_hklin()
self.check_hklout()
if self._chef_unmerged and self._scalepack:
raise RuntimeError, 'CHEF and scalepack incompatible'
if self._onlymerge:
raise RuntimeError, 'use merge() method'
if not self._scalepack:
self.set_task('Scaling reflections from %s => %s' % \
(os.path.split(self.get_hklin())[-1],
os.path.split(self.get_hklout())[-1]))
else:
self.set_task('Scaling reflections from %s => scalepack %s' % \
(os.path.split(self.get_hklin())[-1],
os.path.split(self.get_hklout())[-1]))
self._xmlout = os.path.join(self.get_working_directory(),
'%d_aimless.xml' % self.get_xpid())
self.start()
nproc = Flags.get_parallel()
if nproc > 1:
self.set_working_environment('OMP_NUM_THREADS', '%d' %nproc)
self.input('refine parallel')
self.input('xmlout %d_aimless.xml' % self.get_xpid())
if not Flags.get_small_molecule():
self.input('bins 20')
self.input('intensities %s' %self._intensities)
if self._new_scales_file:
self.input('dump %s' % self._new_scales_file)
run_number = 0
for run in self._runs:
run_number += 1
if not run[5]:
self.input('run %d batch %d to %d' % (run_number,
run[0], run[1]))
if run[6] != 0.0 and not run[5]:
self.input('resolution run %d high %f' % \
(run_number, run[6]))
run_number = 0
for run in self._runs:
run_number += 1
if run[7]:
Debug.write('Run %d corresponds to sweep %s' % \
(run_number, run[7]))
if run[5]:
continue
self.input('sdcorrection same')
# FIXME this is a bit of a hack - should be better determined
# than this...
if Flags.get_small_molecule():
#self.input('sdcorrection tie sdfac 0.707 0.3 tie sdadd 0.01 0.05')
#self.input('reject all 30')
self.input('sdcorrection fixsdb')
if self._secondary and self._surface_tie:
self.input('tie surface %.4f' % self._surface_tie)
if not self._surface_link:
self.input('unlink all')
# assemble the scales command
if self._mode == 'rotation':
scale_command = 'scales rotation spacing %f' % self._spacing
if self._secondary:
nterm = int(self._secondary)
if self._fixed_secondary_lmax:
scale_command += ' secondary %d %d absorption %d %d' % \
(nterm, nterm - 1, nterm, nterm - 1)
else:
scale_command += ' secondary %d absorption %d' % \
(nterm, nterm)
if self._bfactor:
scale_command += ' bfactor on'
if self._brotation:
scale_command += ' brotation %f' % \
self._brotation
else:
scale_command += ' bfactor off'
if self._tails:
scale_command += ' tails'
#.........這裏部分代碼省略.........
示例15: _sort_together_data_ccp4
# 需要導入模塊: from xia2.Handlers.Flags import Flags [as 別名]
# 或者: from xia2.Handlers.Flags.Flags import get_small_molecule [as 別名]
def _sort_together_data_ccp4(self):
'''Sort together in the right order (rebatching as we go) the sweeps
we want to scale together.'''
max_batches = 0
for e in self._sweep_handler.get_epochs():
if Flags.get_small_molecule():
continue
si = self._sweep_handler.get_sweep_information(e)
pname, xname, dname = si.get_project_info()
sname = si.get_sweep_name()
for epoch in self._sweep_handler.get_epochs():
si = self._sweep_handler.get_sweep_information(epoch)
hklin = si.get_reflections()
# limit the reflections - e.g. if we are re-running the scaling step
# on just a subset of the integrated data
hklin = si.get_reflections()
limit_batch_range = None
for sweep in PhilIndex.params.xia2.settings.sweep:
if sweep.id == sname and sweep.range is not None:
limit_batch_range = sweep.range
break
if limit_batch_range is not None:
Debug.write('Limiting batch range for %s: %s' %(sname, limit_batch_range))
start, end = limit_batch_range
hklout = os.path.splitext(hklin)[0] + '_tmp.mtz'
FileHandler.record_temporary_file(hklout)
rb = self._factory.Pointless()
rb.set_hklin(hklin)
rb.set_hklout(hklout)
rb.limit_batches(start, end)
si.set_reflections(hklout)
si.set_batches(limit_batch_range)
# keep a count of the maximum number of batches in a block -
# this will be used to make rebatch work below.
hklin = si.get_reflections()
md = self._factory.Mtzdump()
md.set_hklin(hklin)
md.dump()
batches = md.get_batches()
if 1 + max(batches) - min(batches) > max_batches:
max_batches = max(batches) - min(batches) + 1
datasets = md.get_datasets()
Debug.write('In reflection file %s found:' % hklin)
for d in datasets:
Debug.write('... %s' % d)
dataset_info = md.get_dataset_info(datasets[0])
Debug.write('Biggest sweep has %d batches' % max_batches)
max_batches = nifty_power_of_ten(max_batches)
# then rebatch the files, to make sure that the batch numbers are
# in the same order as the epochs of data collection.
counter = 0
for epoch in self._sweep_handler.get_epochs():
si = self._sweep_handler.get_sweep_information(epoch)
rb = self._factory.Rebatch()
hklin = si.get_reflections()
pname, xname, dname = si.get_project_info()
sname = si.get_sweep_name()
hklout = os.path.join(self.get_working_directory(),
'%s_%s_%s_%s_integrated.mtz' % \
(pname, xname, dname, sname))
first_batch = min(si.get_batches())
si.set_batch_offset(counter * max_batches - first_batch + 1)
rb.set_hklin(hklin)
rb.set_first_batch(counter * max_batches + 1)
rb.set_project_info(pname, xname, dname)
rb.set_hklout(hklout)
new_batches = rb.rebatch()
# update the "input information"
si.set_reflections(hklout)
si.set_batches(new_batches)
#.........這裏部分代碼省略.........