Exemple #1
0
 def run_unit_reconstructor(self, ncrf_fn):
     unit_star_fn = os.path.join(self.params.outdir, 'cons_unit',
                                 'unit_star.fasta')
     unit_star_cmd = [
         "python", "-u", self.unit_reconstructor, "--reads-ncrf", ncrf_fn,
         "--unit", self.params.unit, "-k", self.params.cons_k_mer_len,
         "--output", unit_star_fn
     ]
     unit_star_cmd = listEls2str(unit_star_cmd)
     print("Running unit star reconstruction")
     print(list2str(unit_star_cmd))
     subprocess.call(unit_star_cmd)
     return unit_star_fn
Exemple #2
0
 def run_NCRF(self):
     ncrf_outdir = os.path.join(self.params.outdir, "NCRF")
     ncrf_cmd = [
         "python", "-u", self.ncrf_script, "--reads", self.params.reads,
         "--threads", self.params.threads, "--outdir", ncrf_outdir,
         "--repeat", self.params.unit
     ]
     ncrf_cmd = listEls2str(ncrf_cmd)
     print('Running NCRF:')
     print(list2str(ncrf_cmd))
     subprocess.call(ncrf_cmd)
     ncrf_fn = os.path.join(ncrf_outdir, "report.ncrf")
     return ncrf_fn
Exemple #3
0
 def run_tandemPolisher(self, assembly_fn):
     polisher_outdir = os.path.join(self.params.outdir, "polishing2")
     polisher_cmd = [
         "python", "-u", self.tandemPolisher, "--nano", self.params.reads,
         "-o", polisher_outdir, "--only-polish", "-t", self.params.threads,
         assembly_fn
     ]
     polisher_cmd = listEls2str(polisher_cmd)
     print("Running polishing with tandemMapper")
     print(list2str(polisher_cmd))
     subprocess.call(polisher_cmd)
     polished_assembly_fn = \
         os.path.join(polisher_outdir, 'polished', f'polished_{self.params.num_polish_iters}.fasta')
     return polished_assembly_fn
Exemple #4
0
 def run_read_placer(self, ncrf_fn, kmers_fn):
     placer_outdir = os.path.join(self.params.outdir, "tr_resolution")
     placer_cmd = [
         "python", "-u", self.placer_script, "--ncrf", ncrf_fn,
         "--genomic-kmers", kmers_fn, "--outdir", placer_outdir,
         "--n-motif", self.params.n_motif, "--min-cloud-kmer-freq",
         self.params.min_cloud_kmer_freq, "--min-kmer-mult",
         self.params.min_kmer_mult, "--min-unit", self.params.min_unit,
         "--min-inters", self.params.min_inters
     ]
     placer_cmd = listEls2str(placer_cmd)
     print("Running tandem repeat resolution")
     print(list2str(placer_cmd))
     subprocess.call(placer_cmd)
     read_pos_fn = os.path.join(placer_outdir, "read_positions.csv")
     return read_pos_fn
Exemple #5
0
 def run_polisher(self, ncrf_fn, read_pos_fn, unit_star_fn):
     polisher_outdir = os.path.join(self.params.outdir, "polishing1")
     polisher_cmd = [
         "python", "-u", self.polisher_script, "--read-placement",
         read_pos_fn, "--outdir", polisher_outdir, "--ncrf", ncrf_fn,
         "--error-mode", self.params.error_mode, "--num-iters",
         self.params.num_polish_iters, "--num-threads", self.params.threads,
         "--unit", unit_star_fn, "--min-pos", self.params.min_pos
     ]
     if self.params.max_pos != math.inf:
         polisher_cmd.append("--max-pos")
         polisher_cmd.append(self.params.max_pos)
     polisher_cmd = listEls2str(polisher_cmd)
     print("Running polishing -- first stage")
     print(list2str(polisher_cmd))
     subprocess.call(polisher_cmd)
     assembly_fn = \
         os.path.join(
             polisher_outdir,
             f'final_sequence_{self.params.num_polish_iters}.fasta'
         )
     return assembly_fn
Exemple #6
0
 def run_kmer_recr(self, ncrf_fn):
     recr_outdir = os.path.join(self.params.outdir,
                                "recruited_unique_kmers")
     recr_cmd = [
         "python", "-u", self.recr_script, "--ncrf", ncrf_fn, "--coverage",
         self.params.coverage, "--min-coverage", self.params.min_coverage,
         "--outdir", recr_outdir, "--min-nreads", self.params.min_nreads,
         "--max-nreads", self.params.max_nreads, "--min-distance",
         self.params.min_distance, "--max-distance",
         self.params.max_distance, "--bottom", self.params.bottom, "--top",
         self.params.top, "--kmer-survival-rate",
         self.params.kmer_survival_rate, "--max-nonuniq",
         self.params.max_nonuniq
     ]
     recr_cmd = listEls2str(recr_cmd)
     print("Running unique kmer recruitment")
     print(list2str(recr_cmd))
     subprocess.call(recr_cmd)
     kmers_fn = os.path.join(
         recr_outdir,
         f"unique_kmers_min_edge_cov_{self.params.min_coverage}.txt")
     return kmers_fn