Пример #1
0
    def testReadLen(self):
        result = fastq.fastq_readlen(self.ver14_single)
        self.assertEqual(result, 36)

        result = fastq.fastq_readlen(self.ver14_pe_mixed)
        self.assertEqual(result, 72)

        result = fastq.fastq_readlen(self.ver18_pe_mixed)
        self.assertEqual(result, 100)
Пример #2
0
    def testReadLen(self):
        result = fastq.fastq_readlen(self.ver14_single)
        self.assertEqual(result, 36)

        result = fastq.fastq_readlen(self.ver14_pe_mixed)
        self.assertEqual(result, 72)

        result = fastq.fastq_readlen(self.ver18_pe_mixed)
        self.assertEqual(result, 100)
Пример #3
0
def main():
    parse_options(sys.argv[1:])
    
    fastq_ver = fastq.fastq_version(args[0])
    fastq_readlen = fastq.fastq_readlen(args[0])

    callback_func = fastq.fastq_ver_to_callback(fastq_ver)
    phred_offset = fastq.fastq_ver_to_phred(fastq_ver)
    
    if not os.path.exists(options.output_dir):
        os.mkdir(options.output_dir)

    stripped_fname = ".".join(os.path.basename(args[0]).split(".")[:-1])

    if options.paired_end:
        left_out = os.path.join(options.output_dir,
                                stripped_fname + "-left.fastq")
        right_out = os.path.join(options.output_dir,
                                 stripped_fname + "-right.fastq")
        orphan_out = os.path.join(options.output_dir,
                                  stripped_fname + "-orphans.fastq")

        if options.split_sorted:
            parser_func = fastq.split_paired_parser
        else:
            parser_func = fastq.paired_parser
                            
        parser_func(open(args[0], "r"),
                    open(left_out, "w+"),
                    open(right_out, "w+"),
                    open(orphan_out, "w+"),
                    callback_func,
                    phred_offset,
                    25,
                    int(fastq_readlen / 2))
    else:
        filtered_out = os.path.join(options.output_dir,
                                    stripped_fname + "-filtered.fastq")

        fastq.single_parser(open(args[0], "r"),
                            open(filtered_out, "w+"),
                            callback_func,
                            phred_offset,
                            25,
                            int(fastq_readlen / 2))
Пример #4
0
def main():
    parse_options(sys.argv[1:])

    fastq_ver = fastq.fastq_version(args[0])
    fastq_readlen = fastq.fastq_readlen(args[0])

    callback_func = fastq.fastq_ver_to_callback(fastq_ver)
    phred_offset = fastq.fastq_ver_to_phred(fastq_ver)

    if not os.path.exists(options.output_dir):
        os.mkdir(options.output_dir)

    stripped_fname = ".".join(os.path.basename(args[0]).split(".")[:-1])

    if options.paired_end:
        left_out = os.path.join(options.output_dir,
                                stripped_fname + "-left.fastq")
        right_out = os.path.join(options.output_dir,
                                 stripped_fname + "-right.fastq")
        orphan_out = os.path.join(options.output_dir,
                                  stripped_fname + "-orphans.fastq")

        if options.split_sorted:
            parser_func = fastq.split_paired_parser
        else:
            parser_func = fastq.paired_parser

        parser_func(open(args[0], "r"), open(left_out, "w+"),
                    open(right_out, "w+"), open(orphan_out, "w+"),
                    callback_func, phred_offset, 25, int(fastq_readlen / 2))
    else:
        filtered_out = os.path.join(options.output_dir,
                                    stripped_fname + "-filtered.fastq")

        fastq.single_parser(open(args[0], "r"), open(filtered_out, "w+"),
                            callback_func, phred_offset, 25,
                            int(fastq_readlen / 2))