def read_range(self): condition = self.condition_menu.condition() residue_range = (pyutil.string_to_int(self.range_variables[0].get()), pyutil.string_to_int(self.range_variables[1].get())) if residue_range[0] == None or residue_range[1] == None: self.progress_report('Must select residue range.') return 0 reslist = self.range_resonances(condition, residue_range) if len(reslist) == 0: self.progress_report('No residues in selected range.') return 0 seq = sequence.molecule_sequence(condition.molecule) if seq == None: self.progress_report('Molecule sequence unknown.') return 0 self.residue_range = residue_range self.resonances = reslist self.sequence = seq return 1
def start_session(self, write_peak_lists = 1, start_server = 1, start_client = 1): if self.tsp_list == None: return None session = autoassign_session(self.tsp_list, self.tolerances, self.progress_report, self.sparky_session) if write_peak_lists: self.progress_report('Writing peak lists') session.write_autoassign_input_files(self.tolerances, self.temp_directory) server_port = pyutil.string_to_int(self.server_port, default_server_port) if start_server: self.progress_report('Running AutoAssign server') server_lag = pyutil.string_to_int(self.server_lag, 0) session.start_server(self.server_host, server_port, self.server_executable, server_lag) if start_client: self.progress_report('Running AutoAssign client') session.start_client(self.client_executable, self.server_host, server_port) table_path = os.path.join(self.temp_directory, 'table.aat') init_script = 'Execute (Initialize, %s)\n' % table_path output = session.run_script(init_script) self.show_output(output) self.progress_report('') return session
def read_range(self): condition = self.condition_menu.condition() residue_range = (pyutil.string_to_int(self.range_variables[0].get()), pyutil.string_to_int(self.range_variables[1].get())) if residue_range[0] == None or residue_range[1] == None: self.progress_report('Must select residue range.') return 0 reslist = self.range_resonances(condition, residue_range) if len(reslist) == 0: self.progress_report('No residues in selected range.') return 0 seq = sequence.molecule_sequence(condition.molecule) if seq == None: self.progress_report('Molecule sequence unknown.') return 0 self.residue_range = residue_range self.resonances = reslist self.sequence = seq # Compute global ncIDP-based random coil chemical shifts self.RC_prediction = shiftstats_ncIDP.resonance_statistics(reslist) return 1
def get_settings(self): self.spectrum = self.spectrum_widget.spectrum() if self.spectrum == None: self.progress_report('Must select a spectrum.') return 0 anum = pyutil.string_to_int(self.axis_variable.get()) if anum == None: self.progress_report('Must select a spectrum axis.') return 0 else: self.axis = anum - 1 self.min_linewidth = pyutil.string_to_float(self.lw_ranges[0].get()) self.max_linewidth = pyutil.string_to_float(self.lw_ranges[1].get()) self.linewidth_step = pyutil.string_to_float(self.lw_step.get()) if (self.min_linewidth == None or self.max_linewidth == None or self.linewidth_step == None): self.progress_report('Must select linewidth min, max, and step.') return 0 self.atoms_per_line = 1 atoms = tuple(map(string.strip, string.split(self.atoms.get(), ','))) if atoms == ('',): atoms = () self.atoms_to_show = atoms return 1
def get_settings(self): self.spectrum = self.spectrum_widget.spectrum() if self.spectrum == None: self.progress_report('Must select a spectrum.') return 0 anum = pyutil.string_to_int(self.axis_variable.get()) if anum == None: self.progress_report('Must select a spectrum axis.') return 0 else: self.axis = anum - 1 self.min_linewidth = pyutil.string_to_float(self.lw_ranges[0].get()) self.max_linewidth = pyutil.string_to_float(self.lw_ranges[1].get()) self.linewidth_step = pyutil.string_to_float(self.lw_step.get()) if (self.min_linewidth == None or self.max_linewidth == None or self.linewidth_step == None): self.progress_report('Must select linewidth min, max, and step.') return 0 self.atoms_per_line = 1 atoms = tuple(map(string.strip, string.split(self.atoms.get(), ','))) if atoms == ('', ): atoms = () self.atoms_to_show = atoms return 1
def has_attached_proton_axis(spectrum, heavy_axis): key = 'w%d_attached_proton_axis' % (heavy_axis + 1) a = spectrum.saved_value(key) if a: a = pyutil.string_to_int(a) return a
def chosen_axis(self): axis_text = self.get() if len(axis_text) >= 2: anum = pyutil.string_to_int(axis_text[1]) if anum != None: axis = anum - 1 return axis return None
def get_settings(self): match_tolerances = {} for nucleus in ('1H', '13C', '15N'): tol = pyutil.string_to_float(self.tolerances[nucleus].get(), 0) match_tolerances[nucleus] = tol max_unmatched = pyutil.string_to_int(self.max_unmatched.get(), 0) return (match_tolerances, max_unmatched)
def has_molecule_sequence(molecule): if not hasattr(molecule, 'sequence'): s = molecule.saved_value('sequence') f = molecule.saved_value('first_residue_number') if s == None or f == None: molecule.sequence = None else: f = pyutil.string_to_int(f) molecule.sequence = sequence(s, f) return molecule.sequence
def parse_mardi_line(line): atom1 = string.strip(line[0:4]) n1 = pyutil.string_to_int(line[4:7]) atom2 = string.strip(line[8:12]) n2 = pyutil.string_to_int(line[12:15]) if n1 == None or n2 == None: return None bounds = string.split(line[15:]) if len(bounds) < 2: return None lower = pyutil.string_to_float(bounds[0]) upper = pyutil.string_to_float(bounds[1]) if lower == None or upper == None: return None return n1, atom1, n2, atom2, lower, upper
def read_sequence(self): path = self.file_field.get() if path: seqfile = open(path, 'r') seq = seqfile.read() seqfile.close() self.sequence_text.text.delete('0.0', 'end') self.sequence_text.text.insert('0.0', seq) aa_sequence = self.sequence_text.text.get('0.0', 'end') first_residue_number = pyutil.string_to_int(self.first_residue.variable.get(), 1) s = sequence(aa_sequence, first_residue_number) return s
def get_settings(self): swidth = pyutil.string_to_int(self.strip_width.get(), 52) sgap = pyutil.string_to_int(self.strip_gap.get(), 8) return (swidth, sgap)
def get_settings(self): trials = pyutil.string_to_int(self.trials.variable.get(), 0) settings = {'spectrum-times': self.spectrum_times(), 'error-estimate-trials': trials} return settings