def _align_paired_end_reads(self):
     """Manage the actual alignemnt of paired end reads."""
     read_aligner = Segemehl(self._args.segemehl_bin, self._args.progress)
     if self._helpers.file_needs_to_be_created(self._paths.index_path):
         read_aligner.build_index(self._paths.ref_seq_paths,
                                  self._paths.index_path)
     for read_path_pair, output_path, nomatch_path, bam_path in zip(
             self._paths.processed_read_path_pairs,
             self._paths.primary_read_aligner_sam_paths,
             self._paths.unaligned_reads_paths,
             self._paths.primary_read_aligner_bam_paths):
         if not self._helpers.file_needs_to_be_created(output_path):
             continue
         elif not self._helpers.file_needs_to_be_created(bam_path):
             continue
         read_aligner.run_alignment(read_path_pair,
                                    self._paths.index_path,
                                    self._paths.ref_seq_paths,
                                    output_path,
                                    int(self._args.processes),
                                    nomatch_path,
                                    int(self._args.hit_strategy),
                                    int(self._args.segemehl_accuracy),
                                    float(self._args.segemehl_evalue),
                                    self._args.split,
                                    paired_end=True)
class ReadAligner(object):
    """An abstraction layer for different short read aligners."""

    def __init__(self, segemehl_bin, show_progress):
        self.segemehl = Segemehl(segemehl_bin, show_progress=show_progress)

    def build_index(self, ref_seq_paths, index_path):
        self.segemehl.build_index(ref_seq_paths, index_path)

    def run_alignment(
        self,
        read_path_or_pair,
        index_path,
        ref_seq_path,
        output_path,
        nomatch_path,
        threads,
        accuracy,
        evalue,
        split,
        paired_end=False,
    ):
        self.segemehl.align_reads(
            read_path_or_pair,
            index_path,
            ref_seq_path,
            output_path,
            nonmatch_file=nomatch_path,
            threads=threads,
            accuracy=accuracy,
            evalue=evalue,
            split=split,
            paired_end=paired_end,
        )
class ReadAligner(object):
    """An abstraction layer for different short read aligners."""

    def __init__(self, segemehl_bin, show_progress):
        self.segemehl = Segemehl(segemehl_bin, show_progress=show_progress)
    
    def build_index(self, ref_seq_paths, index_path):
        self.segemehl.build_index(ref_seq_paths, index_path)

    def run_alignment(self, read_path_or_pair, index_path, ref_seq_path, output_path, 
                      nomatch_path, threads, accuracy, evalue, split, paired_end=False):
        self.segemehl.align_reads(read_path_or_pair, index_path, ref_seq_path,
                                  output_path, nonmatch_file=nomatch_path,
                                  threads=threads, accuracy=accuracy, 
                                  evalue=evalue, split=split, paired_end=paired_end)
Exemple #4
0
 def _align_single_end_reads(self):
     """Manage the actual alignment of single end reads."""
     read_aligner = Segemehl(
         self._args.segemehl_bin, self._args.progress)
     if self._file_needs_to_be_created(self._paths.index_path):
         read_aligner.build_index(
             self._paths.ref_seq_paths, self._paths.index_path)
     for read_path, output_path, nomatch_path, bam_path in zip(
         self._paths.processed_read_paths,
         self._paths.primary_read_aligner_sam_paths,
         self._paths.unaligned_reads_paths,
             self._paths.read_alignment_bam_paths):
         if not self._file_needs_to_be_created(output_path):
             continue
         elif not self._file_needs_to_be_created(bam_path):
             continue
         read_aligner.run_alignment(
             read_path, self._paths.index_path, self._paths.ref_seq_paths,
             output_path, int(self._args.processes), nomatch_path,
             int(self._args.hit_strategy),
             int(self._args.segemehl_accuracy),
             float(self._args.segemehl_evalue), self._args.split,
             paired_end=False)