def raw_dir(self, value): """ Sets the directory where PerkinElmer or Waters .RAW Files are stored :param value: :type value: str or :class:`pathlib.Path` """ self._raw_dir = str(relpath2(value))
def log_dir(self, value): """ Sets the directory where log files will be stored. The directory will be created if it does not already exist. :param value: :type value: str or :class:`pathlib.Path` """ self._log_dir = str(relpath2(value)) maybe_make(self._log_dir)
def msp_dir(self, value): """ Sets the directory where MSP files for NIST MS Search will be stored. The directory will be created if it does not already exist. :param value: :type value: str or :class:`pathlib.Path` """ self._msp_dir = str(relpath2(value)) maybe_make(self._msp_dir)
def process_path(path): return str(relpath2(path)).replace("\\", "/")
def save_config(self, configfile=None): """ Saves the configuration to the given filename, or to self.configfile if no filename is given :param configfile: Filename to save the configuration to :type configfile: str, optional """ if configfile is None: configfile = self.configfile # Configuration Config = configparser.ConfigParser() Config.read(configfile) if platform.system() == "Linux": Config.set("main", "LinuxNistPath", self.nist_path) else: Config.set("main", "NistPath", self.nist_path.replace("\\", "/")) Config.set("main", "rawpath", str(relpath2(self.raw_dir)).replace("\\", "/")) Config.set("main", "CSVpath", str(relpath2(self.csv_dir)).replace("\\", "/")) Config.set("main", "SPECTRApath", str(relpath2(self.spectra_dir)).replace("\\", "/")) Config.set("main", "CHARTSpath", str(relpath2(self.charts_dir)).replace("\\", "/")) Config.set("main", "MSPpath", str(relpath2(self.msp_dir)).replace("\\", "/")) Config.set("main", "RESULTSpath", str(relpath2(self.results_dir)).replace("\\", "/")) Config.set("main", "MSPpath", str(relpath2(self.msp_dir)).replace("\\", "/")) Config.set("main", "exprdir", str(relpath2(self.expr_dir)).replace("\\", "/")) Config.set("samples", "samples", ",".join(self.prefixList)) Config.set("import", "bb_points", str(self.bb_points)) Config.set("import", "bb_scans", str(self.bb_scans)) Config.set("import", "noise_thresh", str(self.noise_thresh)) Config.set("import", "target_range", "{},{}".format(*self.target_range)) Config.set("import", "exclude_ions", list2str(self.base_peak_filter)) Config.set("import", "tophat", str(self.tophat)) Config.set("import", "tophat_unit", self.tophat_unit) Config.set("import", "mass_range", "{},{}".format(*self.mass_range)) Config.set("alignment", "rt_modulation", str(self.rt_modulation)) Config.set("alignment", "gap_penalty", str(self.gap_penalty)) Config.set("alignment", "min_peaks", str(self.min_peaks)) Config.set("analysis", "do_quantitative", str(self.do_quantitative)) Config.set("analysis", "do_qualitative", str(self.do_qualitative)) Config.set("analysis", "do_merge", str(self.do_merge)) Config.set("analysis", "do_counter", str(self.do_counter)) Config.set("analysis", "do_spectra", str(self.do_spectra)) Config.set("analysis", "do_charts", str(self.do_charts)) Config.set("comparison", "a", str(self.comparison_a)) Config.set("comparison", "rt_modulation", str(self.comparison_rt_modulation)) Config.set("comparison", "gap_penalty", str(self.comparison_gap_penalty)) Config.set("comparison", "min_peaks", str(self.comparison_min_peaks)) with open(configfile, "w") as f: Config.write(f)