コード例 #1
0
    def testSingleParser_v18(self):
        fastq.single_parser(open(self.ver18_single, "r"), self.left_tempfile,
                            fastq._illumina18, 33, 25, 18)

        self.left_tempfile.seek(0)

        self.assertTrue(
            filecmp.cmp(self.left_tempfile.name,
                        "./filter_reads/ver18_single-FILTERED.fastq"))
コード例 #2
0
ファイル: test_FASTQ.py プロジェクト: polyatail/lincrna
    def testSingleParser_v18(self):
        fastq.single_parser(open(self.ver18_single, "r"),
                            self.left_tempfile,
                            fastq._illumina18,
                            33, 25, 18)

        self.left_tempfile.seek(0)

        self.assertTrue(filecmp.cmp(self.left_tempfile.name,
                                    "./filter_reads/ver18_single-FILTERED.fastq"))
コード例 #3
0
ファイル: filter_reads.py プロジェクト: polyatail/lincrna
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))