Exemplo n.º 1
0
def main():
    # parse command line parameters
    option_parser, opts, args = parse_command_line_parameters(**script_info)

    # Create local copy of options
    forward_reads_fp = opts.forward_reads_fp
    reverse_reads_fp = opts.reverse_reads_fp
    pe_join_method = opts.pe_join_method
    output_dir = opts.output_dir
    # fastq-join only options:
    perc_max_diff = opts.perc_max_diff
    # SeqPrep only options:
    max_ascii_score = opts.max_ascii_score
    min_frac_match = opts.min_frac_match
    max_good_mismatch = opts.max_good_mismatch
    phred_64 = opts.phred_64
    # both fastq-join & SeqPrep options
    min_overlap = opts.min_overlap

    create_dir(output_dir, fail_on_exist=False)

    # send parameters to appropriate join method
    # currently only two join methods exist:
    # 'fastq-join' and 'SeqPrep'
    if pe_join_method == "fastq-join":
        join_func = join_method_names["fastq-join"]
        paths = join_func(
            forward_reads_fp,
            reverse_reads_fp,
            perc_max_diff=perc_max_diff,
            min_overlap=min_overlap,
            working_dir=output_dir,
        )

    if pe_join_method == "SeqPrep":
        join_func = join_method_names["SeqPrep"]
        paths = join_func(
            forward_reads_fp,
            reverse_reads_fp,
            max_overlap_ascii_q_score=max_ascii_score,
            min_overlap=min_overlap,
            max_mismatch_good_frac=max_good_mismatch,
            min_frac_matching=min_frac_match,
            phred_64=phred_64,
            working_dir=output_dir,
        )

    # If index / barcode file is supplied, filter unused barcode reads
    # and write them to a new file. Name based on joined-pairs / assembled
    # outfile
    if opts.index_reads_fp:
        index_reads = opts.index_reads_fp
        assembly_fp = paths["Assembled"]  # grab joined-pairs output path
        write_synced_barcodes_fastq(assembly_fp, index_reads)
Exemplo n.º 2
0
def main():
    # parse command line parameters
    option_parser, opts, args = parse_command_line_parameters(**script_info)

    # Create local copy of options
    forward_reads_fp = opts.forward_reads_fp
    reverse_reads_fp = opts.reverse_reads_fp
    pe_join_method = opts.pe_join_method
    output_dir = opts.output_dir
    # fastq-join only options:
    perc_max_diff = opts.perc_max_diff
    # SeqPrep only options:
    max_ascii_score = opts.max_ascii_score
    min_frac_match = opts.min_frac_match
    max_good_mismatch = opts.max_good_mismatch
    phred_64 = opts.phred_64
    # both fastq-join & SeqPrep options
    min_overlap = opts.min_overlap

    create_dir(output_dir, fail_on_exist=False)

    # send parameters to appropriate join method
    # currently only two join methods exist:
    # 'fastq-join' and 'SeqPrep'
    if pe_join_method == "fastq-join":
        join_func = join_method_names["fastq-join"]
        paths = join_func(forward_reads_fp,
                          reverse_reads_fp,
                          perc_max_diff=perc_max_diff,
                          min_overlap=min_overlap,
                          working_dir=output_dir)

    if pe_join_method == "SeqPrep":
        join_func = join_method_names["SeqPrep"]
        paths = join_func(forward_reads_fp,
                          reverse_reads_fp,
                          max_overlap_ascii_q_score=max_ascii_score,
                          min_overlap=min_overlap,
                          max_mismatch_good_frac=max_good_mismatch,
                          min_frac_matching=min_frac_match,
                          phred_64=phred_64,
                          working_dir=output_dir)

    # If index / barcode file is supplied, filter unused barcode reads
    # and write them to a new file. Name based on joined-pairs / assembled
    # outfile
    if opts.index_reads_fp:
        index_reads = opts.index_reads_fp
        assembly_fp = paths['Assembled']  # grab joined-pairs output path
        write_synced_barcodes_fastq(assembly_fp, index_reads)
Exemplo n.º 3
0
    def test_write_synced_barcodes_fastq(self):
        """write_synced_barcodes_fastq: should work properly.
           This function expects the barcodes.fastq and joined_pairs.fastq
           files to be in the same order except for those missing data
           that could not be joined. That is, not all paired-ends will
           assemble.
        """
        filtered_bc_path = write_synced_barcodes_fastq(self.jpe_fp, self.all_bc_fp)

        observed_barcodes = open(filtered_bc_path, "U").read()
        self.assertEqual(observed_barcodes, synced_barcodes)

        os.remove(filtered_bc_path)
Exemplo n.º 4
0
    def test_write_synced_barcodes_fastq(self):
        """write_synced_barcodes_fastq: should work properly.
           This function expects the barcodes.fastq and joined_pairs.fastq
           files to be in the same order except for those missing data
           that could not be joined. That is, not all paired-ends will
           assemble.
        """
        filtered_bc_path = write_synced_barcodes_fastq(self.jpe_fp,
                                                       self.all_bc_fp)

        observed_barcodes = open(filtered_bc_path, 'U').read()
        self.assertEqual(observed_barcodes, synced_barcodes)

        os.remove(filtered_bc_path)