def run(self) -> List[str]: self.carried_output: List[str] = [] create_output_dir(self.context.output) self.context.threads = str(self.context.threads) self.context.percent = str(self.context.percent) self.context.taxa = str(get_taxa_from_contigs(self.context.contigs)) self.context.taxon_group = "all" self.output_dirs = { "match_contigs": "uce-search-results", "match_counts": "all-taxa.conf", "incomplete_matrix": "all-taxa.incomplete", "fasta": "all-taxa.fasta", "exploded_fastas": "exploded-fastas", "alignments": "alignments", "alignments_clean": "alignments-clean", "gblocks": "alignments-gblocks", "min_taxa": "alignments-gblocks-clean-min-taxa", "raxml": "alignments-raxml", } # Prefixing with context output for k, v in self.output_dirs.items(): self.output_dirs[k] = f"{self.context.output}/{v}" self.context.locus_db = self.output_dirs[ "match_contigs"] + "/probe.matches.sqlite" self.context.taxon_list_config = f"{self.context.output}/taxon-list.conf" taxon_list_config_dict = parse_taxon_list_config( self.context.contigs, self.context.taxon_group) dump_config_file(self.context.taxon_list_config, taxon_list_config_dict) self._match_contigs_to_probes() self._get_match_counts() self._get_fastas_from_match_counts() self._explode_get_fastas_file() self._secap_align() if self.context.internal_trimming: self._get_gblocks_trimmed_alignments_from_untrimmed() self._remove_locus_name_from_nexus_lines() self._get_only_loci_with_min_taxa() self._nexus_files_to_raxml() return self.carried_output
def run(self) -> List[str]: delete_output_dir_if_exists(self.context.output) # Create and save the configuration file config = "illumiprocessor.conf" csv = load_csv(self.context.csv_file) config_dict = parse_illumiprocessor_config( csv, double_index=not self.context.single_index) dump_config_file(config, config_dict) cmd = [ "--input", self.context.raw_fastq, "--output", self.context.output, "--cores", str(self.context.threads), "--config", config, "--log-path", self.context.log_dir, ] if self.context.min_len: cmd.extend(["--min-len", str(self.context.min_len)]) if self.context.r1_pattern: cmd.extend(["--r1-pattern", self.context.r1_pattern]) if self.context.r2_pattern: cmd.extend(["--r2-pattern", self.context.r2_pattern]) if self.context.phred64: cmd.extend(["--phred", "phred64"]) if self.context.single_end: cmd.append("--se") if self.context.no_merge: cmd.append("--no-merge") return self.adapters["illumiprocessor"]( cmd, capture_output=self.context.capture_output)
def run(self) -> List[str]: delete_output_dir_if_exists(self.context.output) # Create and save the configuration file if not self.context.config: self.context.config = "assembly.conf" config_dict = parse_assembly_config(self.context.clean_fastq) dump_config_file(self.context.config, config_dict) cmd = [ "--output", self.context.output, "--cores", str(self.context.threads), "--config", self.context.config, "--log-path", self.context.log_dir, ] if self.context.assembler == "spades": if self.context.no_clean: cmd.append("--do-not-clean") if self.context.kmer: cmd.extend(["--kmer", str(self.context.kmer)]) elif self.context.assembler == "trinity": if not self.context.no_clean: cmd.append("--clean") if self.context.kmer: cmd.extend(["--min-kmer-coverage", str(self.context.kmer)]) if self.context.subfolder: cmd.extend(["--subfolder", self.context.subfolder]) return self.adapters[self.context.assembler]( cmd, capture_output=self.context.capture_output)
def run(self) -> List[CommandResult]: delete_output_dir_if_exists(self.context.output) # Create and save the configuration file if not self.context.config: self.context.config = "assembly.conf" config_dict = parse_assembly_config(self.context.clean_fastq) dump_config_file(self.context.config, config_dict) cmd = [ "--output", self.context.output, "--cores", str(self.context.threads), "--config", self.context.config, "--log-path", self.context.log_dir, ] if self.context.subfolder: cmd.extend(["--subfolder", self.context.subfolder]) self._parse_command(cmd) return [self.adapters[self.context.assembler](cmd)]
def test_config_file_is_created(context, config_example): dump_config_file(context["output"] + "test.conf", config_example[0]) with open(context["output"] + "test.conf", "r") as fl: assert fl.read() == config_example[1]
def test_config_file_is_created(context, config_example): dump_config_file(context["output"] + "test.conf", config_example) assert os.path.isfile(context["output"] + "test.conf")