示例#1
0
    def run(self):
        reads_order = os.path.join(self.work_dir, "reads_order.fasta")
        asm.assemble(self.args, reads_order, self.log_file)
        contigs_fasta = aln.concatenate_contigs(reads_order)
        fp.write_fasta_dict(contigs_fasta, self.out_assembly)

        Job.run_description["stage_name"] = self.name
示例#2
0
文件: main.py 项目: bioreps/ABruijn
 def run(self):
     logger.info("Computing rough consensus")
     contigs_info = aln.get_contigs_info(self.in_contigs)
     consensus_fasta = cons.get_consensus(self.in_alignment, self.in_contigs,
                                          contigs_info, self.args.threads,
                                          self.args.platform,
                                          self.args.min_overlap)
     fp.write_fasta_dict(consensus_fasta, self.out_consensus)
示例#3
0
文件: main.py 项目: SDquest/ABruijn
    def run(self):
        logger.info("Computing rough consensus")
        contigs_info = aln.get_contigs_info(self.in_contigs)
        consensus_fasta = cons.get_consensus(self.in_alignment, contigs_info,
                                             self.args.threads)
        fp.write_fasta_dict(consensus_fasta, self.out_consensus)

        Job.run_description["stage_name"] = self.name
示例#4
0
def make_blasr_reference(contigs_fasta, out_file):
    """
    Outputs 'reference' for BLASR run, appends a suffix to circular contigs
    """
    circular_window = config.vals["circular_window"]
    for contig_id in contigs_fasta:
        contig_type = contig_id.split("_")[0]
        if (contig_type == "circular"
                and len(contigs_fasta[contig_id]) > circular_window):
            contigs_fasta[contig_id] += \
                    contigs_fasta[contig_id][:circular_window]

    fp.write_fasta_dict(contigs_fasta, out_file)
示例#5
0
文件: main.py 项目: bioreps/ABruijn
    def run(self):
        logger.info("Polishing genome ({0}/{1})".format(self.stage_id,
                                                        self.args.num_iters))
        contigs_info = aln.get_contigs_info(self.in_contigs)

        logger.info("Separating alignment into bubbles")
        bubbles = bbl.get_bubbles(self.in_alignment, contigs_info, self.in_contigs,
                                  self.seq_platform, self.args.threads,
                                  self.args.min_overlap)
        logger.info("Correcting bubbles")
        polished_fasta = pol.polish(bubbles, self.args.threads,
                                    self.seq_platform, self.work_dir,
                                    self.stage_id)
        fp.write_fasta_dict(polished_fasta, self.out_consensus)
示例#6
0
    def run(self):
        alignment, mean_error = aln.parse_alignment(self.in_alignment)
        #if Job.run_description["error_profile"] == "":
        #    Job.run_description["error_profile"] = \
        #                            aln.choose_error_mode(mean_error)

        bubbles = bbl.get_bubbles(alignment, self.seq_platform)
        polished_fasta = pol.polish(bubbles, self.args.threads,
                                    self.seq_platform, self.work_dir,
                                    self.stage_id)
        fp.write_fasta_dict(polished_fasta, self.out_consensus)

        Job.run_description["stage_name"] = self.name
        Job.run_description["stage_id"] = self.stage_id
示例#7
0
def patch_genome(alignment, reference_file, out_patched):
    aln_by_ctg = defaultdict(list)
    for aln in alignment:
        aln_by_ctg[aln.trg_id].append(aln)

    ref_fasta = fp.read_fasta_dict(reference_file)
    fixed_fasta = {}

    for ctg_id, ctg_aln in aln_by_ctg.iteritems():
        patches = _get_patching_alignmemnts(ctg_aln)
        fixed_sequence = _apply_patches(patches, ref_fasta[ctg_id])
        fixed_fasta[ctg_id] = fixed_sequence

    fp.write_fasta_dict(fixed_fasta, out_patched)