Esempio n. 1
0
    def run_(self):

        try:
            if self.expt == 'native-sad':
                self.xscale_for_sad()
                self.Isa_select(6.0)
                shutil.copyfile('XSCALE.LP', 'ISa_Select.LP')
                shutil.copyfile('XSCALE.HKL', 'ISa_Select.HKL')
                state, stats = parse_xscale_output("ISa_Select.LP")
                self.scale_results['ISa_selection'] = stats

            elif self.expt == 'serial-xtal':
                self.xscale_for_sx()
                if self.status == True:
                    xscale = ASCII('noSelect.HKL')
                    xscale.multiplicity_check()
                    self.scale_results['multiplicity'] = xscale.mult_list
                    # self.isocluster('noSelect.HKL')
                    self.aniso_check()
                    self.create_mtzs()

            elif self.expt == 'inverse-beam' or self.expt == 'interleave-and-inverse-first':
                pass
            else:
                logger.info('Error: experiment type not supported %s' %
                            self.expt)
                self.scale_results['info'].append('Expt. type not supported')
                self.scale_results['status'] = False
        except Exception as e:
            self.scale_results['status'] = False
            logger.info('Error:{}'.format(e))
            self.scale_results['info'].append(e)
        return
Esempio n. 2
0
def similar_symmetry(hkl1, hklref):
    refdata = ASCII(hklref)
    tstdata = ASCII(hkl1)
    try:
        return refdata.symm.is_similar_symmetry(tstdata.symm,
                                                relative_length_tolerance=0.05,
                                                absolute_angle_tolerance=1.5)
    except Exception:
        return False
Esempio n. 3
0
	def calc_CCset(self, hkl1, hkl2):
		f1 = ASCII(hkl1)
		f2 = ASCII(hkl2); cclst = []

		for index in set(f1.data_dict).intersection(set(f2.data_dict)):
			I1 = f1.data_dict[index][0]; sigI1 = f1.data_dict[index][1];
			I2 = f2.data_dict[index][0]; sigI2 = f2.data_dict[index][1];
			cc = (I1*I2)/(sigI1*sigI2)
			cclst.append(cc)
		return cclst
Esempio n. 4
0
 def create_mtzs(self):
     lst_of_hkls = [
         'noSelect.HKL', 'ISa_Select.HKL', 'Cell_Select.HKL',
         'pCC_Select.HKL'
     ]
     for hklfile in lst_of_hkls:
         if os.path.isfile(hklfile):
             hkl = ASCII(hklfile)
             hkl.xdsconv('CCP4_I+F',
                         res=self.res_cut,
                         dirname=self.subadm,
                         user=self.user)
         else:
             logger.info('mtz-create-info:{}'.format(
                 'could not create mtz; file may not exist'))
             pass
     return
Esempio n. 5
0
def mousePosition():
    count = 16
    print('Move mouse to quit.')

    while len(position) != count:
        x, y = pyautogui.position()
        positionX = str(x).rjust(4)
        positionY = str(y).rjust(4)

        if int(positionX) > 126 or int(positionY) > 126:
            positionX = int(positionX[:-1])
            positionY = int(positionY[:-1])

            if positionX in ASCII.showASCITable(
            ) and positionY in ASCII.showASCITable():
                position.append(ASCII.showASCITable()[positionX])

                position.append(ASCII.showASCITable()[positionY])
Esempio n. 6
0
 def __init__(self, xds_ascii, **kwargs):
     self.hklfile = xds_ascii
     self.hkldata = ASCII(self.hklfile)
     self.mtzfile = None
     self.seq_file = kwargs.get('seq_file', None)
     self.solvent_content = kwargs.get('solvent_content', '0.50')
     self.hres = kwargs.get('hres', '1.0')
     self.substr = kwargs.get('substr', "None")
     self.native = kwargs.get('native', None)
     self.fmt = ['CCP4_I+F', 'CCP4']
     self.cell = None
     self.symm = None
     self.sites = kwargs.get('sites', 0)
     self.atomtype = kwargs.get('atomtype', 'S')
     self.nres = kwargs.get('nres', 0)
Esempio n. 7
0
    def __init__(self, ref_file, symm):
        self.ref_file = ref_file
        if not self.ref_file.endswith('.sca'):
            self.hkl = ASCII(self.ref_file)
            self.cell = self.hkl.header['!UNIT_CELL_CONSTANTS']
        else:

            self.cell = sub.check_output([
                "cat " + self.ref_file +
                " | awk 'NR>2 && NR<4 {print $1, $2, $3, $4, $5, $6}'"
            ],
                                         shell=True)

        self.symm = symm
        self.sites = []
        self.reso = []
        self.ntries = [10000, 30000]
        self.emins = [1.2, 1.3, 1.4, 1.5, 1.6]
        self.super_sulfur = False
Esempio n. 8
0
    def xscale_for_sad(self):
        self.find_HKLs()
        if self.status is False:
            logger.info('Error: no hkls found\n')
            self.scale_results['status'] = self.status
            return
        try:
            self.outdir_make()
            os.chdir(self.subadm)
        except OSError:
            err = "adm folder either not there or not accessible\n"
            logger.info('OSError:{}'.format(err))
            self.scale_results['info'].append(err)
            self.status = False
            self.scale_results['status'] = self.status
        if len(self.hklpaths) > 0:
            if len(self.hklpaths) < 1000:
                self.indexing_()
            else:
                logger.info('Too many hkls, so skipping the indexing check')
                pass
            self.create_file_links()
            state, self.reference = ref_choice(self.hklpaths, fom='bfac')
            if state == False and self.reference == None:
                self.status = False
                self.scale_results['status'] = self.status
                logging.info(
                    'Error: bfactor-based reference choice did not work')

            elif state == True and self.reference != None:
                logging.info('lowest-Bfactor file: %s' % self.reference)
                ref_for_cell_sg = ASCII(self.reference)
                self.scale_results['space_group'] = space_group[
                    ref_for_cell_sg.spg][0]
                self.scale_results['unit-cell'] = ref_for_cell_sg.unit_cell
                self.friedel = ref_for_cell_sg.anom
                self.create_inp(self.filelinks,
                                refs=self.reference,
                                reso=self.res_cut)
            else:
                self.create_inp(self.filelinks)

            msg = "xscale-ing of native SAD data\n"
            logger.info('MSG:{}'.format(msg))
            try:
                run_command("Scale&Merge", self.subadm, self.user,
                            self.xscale_cmd, 'merge.log')
            except Exception:
                sub.call(self.xscale_cmd, shell=True)

            try:
                state, stats = parse_xscale_output("XSCALE.LP")
                if state is False:
                    self.status = False
                    self.scale_results['status'] = self.status
                    return
                else:

                    logger.info('stat_dict:{}'.format(stats))
                    self.scale_results['nSAD_xscale_stats'] = stats
                    shutil.copyfile('XSCALE.HKL', 'nSAD.HKL')
                    shutil.copyfile('XSCALE.LP', 'nSAD.LP')
                    self.status = True
            except Exception as err:
                logger.info('Error: {}'.format(err))
                self.scale_results['info'].append(err)
                self.status = False
                self.scale_results['status'] = self.status
            return