当前位置: 首页>>代码示例>>Python>>正文


Python mock_args_container.MockClass类代码示例

本文整理汇总了Python中mock_args_container.MockClass的典型用法代码示例。如果您正苦于以下问题:Python MockClass类的具体用法?Python MockClass怎么用?Python MockClass使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了MockClass类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: TestScreen

class TestScreen(unittest.TestCase):

    def setUp(self):
        self.example = Example()
        self.mock_args = MockClass()
        self.test_folder = "test_folder"
        self.output = os.path.join(self.test_folder, "output")
        self.tex_wig = os.path.join(self.test_folder, "tex")
        self.frag_wig = os.path.join(self.test_folder, "frag")
        if (not os.path.exists(self.test_folder)):
            os.mkdir(self.test_folder)
            os.mkdir(self.tex_wig)
            os.mkdir(self.frag_wig)
            os.mkdir(self.output)
        self.fasta = os.path.join(self.test_folder, "aaa.fa")
        gen_file(self.fasta, self.example.fasta)
        args = self.mock_args.mock()
        args.output_folder = self.output
        args.fasta = self.fasta
        self.screen = Screen(args)

    def tearDown(self):
        if os.path.exists(self.test_folder):
            shutil.rmtree(self.test_folder)

    def test_screenshot(self):
        gen_file(os.path.join(self.tex_wig, "tex_1_f.wig"), self.example.wig_f)
        gen_file(os.path.join(self.tex_wig, "notex_1_f.wig"), self.example.wig_f)
        gen_file(os.path.join(self.frag_wig, "frag_f.wig"), self.example.wig_f)
        gen_file(os.path.join(self.tex_wig, "tex_1_r.wig"), self.example.wig_r)
        gen_file(os.path.join(self.tex_wig, "notex_1_r.wig"), self.example.wig_r)
        gen_file(os.path.join(self.frag_wig, "frag_r.wig"), self.example.wig_r)
        args = self.mock_args.mock()
        args.fasta = self.fasta
        args.main_gff = os.path.join(self.test_folder, "main.gff")
        gen_file(args.main_gff, self.example.main_gff)
        side_gff = os.path.join(self.test_folder, "side.gff")
        args.side_gffs = [side_gff]
        gen_file(side_gff, self.example.side_gff)
        args.frag_wigs = self.frag_wig
        args.tex_wigs = self.tex_wig
        args.height = 1000
        args.tlibs = ["tex_1_f.wig:tex:1:a:+", "tex_1_r.wig:tex:1:a:-",
                      "notex_1_f.wig:notex:1:a:+", "notex_1_r.wig:notex:1:a:-"]
        args.flibs = ["frag_f.wig:frag:1:a:+", "frag_r.wig:frag:1:a:-"]
        args.present = "expand"
        args.output_folder = self.output
        self.screen.screenshot(args)
        self.assertTrue(os.path.exists(os.path.join(self.output, "screenshots", "aaa", "forward")))
        self.assertTrue(os.path.exists(os.path.join(self.output, "screenshots", "aaa", "reverse")))
        datas = import_data(os.path.join(self.output, "screenshots", "aaa", "forward.txt"))
        datas = import_data(os.path.join(self.output, "screenshots", "aaa", "reverse.txt"))
        self.assertEqual("\n".join(datas), self.example.out_r)

    def test_import_libs(self):
        texs = [["tex_1.wig", "tex", "1", "a", "+"], ["notex_1.wig", "notex", "1", "a", "+"]]
        lib_dict = {"ft": [], "fn": [], "rt": [], "rn": [], "ff": [], "rf": []}
        self.screen._import_libs(texs, "+", self.tex_wig, lib_dict)
        self.assertDictEqual(lib_dict, {'fn': ['test_folder/tex/notex_1.wig'], 'rn': [],
                             'rt': [], 'ft': ['test_folder/tex/tex_1.wig'], 'rf': [], 'ff': []})
开发者ID:malvikasharan,项目名称:ANNOgesic,代码行数:60,代码来源:test_screen.py

示例2: setUp

 def setUp(self):
     self.example = Example()
     self.mock_args = MockClass()
     self.test_folder = "test_folder"
     self.fasta = os.path.join(self.test_folder, "fasta")
     self.snp_folder = os.path.join(self.test_folder, "snp")
     self.table = os.path.join(self.test_folder, "table")
     if (not os.path.exists(self.test_folder)):
         os.mkdir(self.test_folder)
         os.mkdir(self.fasta)
         os.mkdir(self.snp_folder)
         os.mkdir(self.table)
         os.mkdir(os.path.join(
             self.test_folder,
             "compare_related_and_reference_genomes"))
         os.mkdir(os.path.join(
             self.test_folder,
             "compare_related_and_reference_genomes/seqs"))
         os.mkdir(os.path.join(
             self.test_folder,
             "compare_related_and_reference_genomes/seqs/with_BAQ"))
         os.mkdir(os.path.join(
             self.test_folder,
             "compare_related_and_reference_genomes/statistics"))
         os.mkdir(os.path.join(
             self.test_folder,
             "compare_related_and_reference_genomes/SNP_raw_outputs"))
     args = self.mock_args.mock()
     args.types = "related_genome"
     args.out_folder = self.test_folder
     args.fastas = self.fasta
     self.snp = SNPCalling(args)
     self.mock = Mock_func()
开发者ID:Sung-Huan,项目名称:ANNOgesic,代码行数:33,代码来源:test_snp.py

示例3: setUp

 def setUp(self):
     self.mock_args = MockClass()
     self.mock = Mock_func()
     self.mock_parser = Mock_Multiparser()
     self.example = Example()
     self.test_folder = "test_folder"
     self.trans = "test_folder/trans"
     self.out = "test_folder/output"
     self.wigs = "test_folder/wigs"
     self.gffs = "test_folder/gffs"
     self.tsss = "test_folder/tsss"
     self.fastas = "test_folder/fastas"
     self.manual = "test_folder/manuals"
     if (not os.path.exists(self.test_folder)):
         os.mkdir(self.test_folder)
         os.mkdir(self.trans)
         os.mkdir(self.out)
         os.mkdir(self.wigs)
         os.mkdir(self.gffs)
         os.mkdir(self.tsss)
         os.mkdir(self.fastas)
         os.mkdir(self.manual)
     args = self.mock_args.mock()
     args.out_folder = self.out
     args.ta_files = self.trans
     args.gffs = self.gffs
     args.wig_folder = self.wigs
     args.fastas = self.fastas
     args.manual = self.manual
     self.tss = TSSpredator(args)
开发者ID:Sung-Huan,项目名称:ANNOgesic,代码行数:30,代码来源:test_tsspredator.py

示例4: setUp

 def setUp(self):
     self.mock = Mock_func()
     self.mock_args = MockClass()
     self.test_folder = "test_folder"
     self.tsss = "test_folder/tsss"
     self.srnas = "test_folder/sRNA"
     self.out = "test_folder/output"
     self.trans = "test_folder/trans"
     self.fastas = "test_folder/fastas"
     self.tex = "test_folder/tex"
     self.frag = "test_folder/frag"
     self.gffs = "test_folder/gffs"
     if (not os.path.exists(self.test_folder)):
         os.mkdir(self.test_folder)
         os.mkdir(self.tsss)
         os.mkdir(self.out)
         os.mkdir(self.trans)
         os.mkdir(self.fastas)
         os.mkdir(self.tex)
         os.mkdir(self.frag)
         os.mkdir(self.srnas)
         os.mkdir(self.gffs)
     args = self.mock_args.mock()
     args.tsss = self.tsss
     args.srnas = self.srnas
     args.out_folder = self.out
     args.trans = self.trans
     args.fastas = self.fastas
     self.sorf = sORFDetection(args)
开发者ID:Sung-Huan,项目名称:ANNOgesic,代码行数:29,代码来源:test_sorf.py

示例5: TestGenScreenshots

class TestGenScreenshots(unittest.TestCase):

    def setUp(self):
        self.example = Example()
        self.mock_args = MockClass()
        self.test_folder = "test_folder"
        if (not os.path.exists(self.test_folder)):
            os.mkdir(self.test_folder)

    def tearDown(self):
        if os.path.exists(self.test_folder):
            shutil.rmtree(self.test_folder)

    def test_set_data_range(self):
        gff_dict = {"seq_id": "aaa", "source": "Refseq",
                    "feature": "CDS", "start": 3,
                    "end": 6, "phase": ".", "strand": "+", "score": "."}
        attributes_gff = {"ID": "CDS0", "Name": "CDS_0",
                          "locus_tag": "AAA_00001"}
        gff = Create_generator(gff_dict, attributes_gff, "gff")
        out = StringIO()
        gs.set_data_range(out, gff, self.example.wigs_low, "+")
        self.assertEqual(out.getvalue(), "setDataRange 0,20\n")
        out.close()
        out = StringIO()
        gs.set_data_range(out, gff, self.example.wigs_high, "+")
        self.assertEqual(out.getvalue(), "setDataRange 0,510\n")

    def test_print_batch(self):
        out = StringIO()
        lib_t = "wig1 wig2"
        lib_n = "wig3 wig4"
        lib_f = "wig5"
        args = self.mock_args.mock()
        args.fasta = "fasta"
        args.main_gff = "main_gff"
        args.present = "expend"
        args.height = 1000
        args.side_gffs = ["test_folder/side1", "test_folder/side2"]
        gen_file("test_folder/side1", "test")
        gen_file("test_folder/side2", "test")
        args.output_folder = self.test_folder
        gs.print_batch(args, out, "+", lib_t, lib_n, lib_f, "test")
        self.assertEqual(out.getvalue(), self.example.out)

    def test_gen_batch(self):
        gs.import_wig = Mock_func().mock_import_wig
        out = StringIO()
        lib_t = "wig1 wig2"
        lib_n = "wig3 wig4"
        lib_f = "wig5"
        gff_dict = {"seq_id": "aaa", "source": "Refseq",
                    "feature": "CDS", "start": 3,
                    "end": 6, "phase": ".", "strand": "+", "score": "."}
        attributes_gff = {"ID": "CDS0", "Name": "CDS_0",
                          "locus_tag": "AAA_00001"}
        gff = Create_generator(gff_dict, attributes_gff, "gff")
        seq = {"aaa": "ATATGGCCGACGAGTTCGACGATACAACCCGTGGGG"}
        gs.gen_batch(lib_t, lib_n, lib_f, "+", [gff], out, seq)
        self.assertEqual(out.getvalue(), self.example.out_print_wig)
开发者ID:Sung-Huan,项目名称:ANNOgesic,代码行数:60,代码来源:test_gen_screenshots.py

示例6: setUp

 def setUp(self):
     self.mock_args = MockClass()
     self.example = Example()
     self.mock = Mock_func()
     self.test_folder = "test_folder"
     self.gffs = "test_folder/gffs"
     self.srnas = "test_folder/srnas"
     self.out = "test_folder/output"
     self.fastas = "test_folder/fastas"
     self.seq = "test_folder/output/sRNA_seqs"
     self.rnaup = "test_folder/output/RNAup"
     self.rnaplex = "test_folder/output/RNAplex"
     self.merge = "test_folder/output/merge"
     if (not os.path.exists(self.test_folder)):
         os.mkdir(self.test_folder)
         os.mkdir(self.gffs)
         os.mkdir(self.out)
         os.mkdir(self.srnas)
         os.mkdir(self.fastas)
         os.mkdir(self.rnaup)
         os.mkdir(self.rnaplex)
         os.mkdir(self.seq)
         os.mkdir(self.merge)
         os.mkdir(os.path.join(self.rnaup, "test"))
     args = self.mock_args.mock()
     args.out_folder = self.out
     args.srnas = self.srnas
     args.fastas = self.fastas
     args.gffs = self.gffs
     self.star = sRNATargetPrediction(args)
开发者ID:malvikasharan,项目名称:ANNOgesic,代码行数:30,代码来源:test_srna_target.py

示例7: setUp

 def setUp(self):
     self.example = Example()
     self.mock = Mock_func()
     self.mock_args = MockClass()
     self.test_folder = "test_folder"
     if (not os.path.exists(self.test_folder)):
         os.mkdir(self.test_folder)
开发者ID:Sung-Huan,项目名称:ANNOgesic,代码行数:7,代码来源:test_sRNA_utr_derived.py

示例8: setUp

 def setUp(self):
     self.example = Example()
     self.mock_args = MockClass()
     self.mock = Mock_func()
     self.test_folder = "test_folder"
     self.out = "test_folder/output"
     self.fastas = "test_folder/fastas"
     self.gffs = "test_folder/gffs"
     self.stat = "test_folder/stat"
     self.trans = "test_folder/tran"
     if (not os.path.exists(self.test_folder)):
         os.mkdir(self.test_folder)
         os.mkdir(self.out)
         os.mkdir(self.fastas)
         os.mkdir(os.path.join(self.fastas, "tmp"))
         os.mkdir(self.gffs)
         os.mkdir(os.path.join(self.gffs, "tmp"))
         os.mkdir(self.stat)
         os.mkdir(self.trans)
     args = self.mock_args.mock()
     args.gffs = self.gffs
     args.fastas = self.fastas
     args.out_folder = self.out
     args.trans = self.trans
     self.sub = SubLocal(args)
开发者ID:malvikasharan,项目名称:ANNOgesic,代码行数:25,代码来源:test_sublocal.py

示例9: setUp

 def setUp(self):
     self.test_folder = "test_folder"
     self.mock_args = MockClass()
     self.mock = Mock_func()
     self.tsss = os.path.join(self.test_folder, "tsss")
     self.trans = os.path.join(self.test_folder, "trans")
     self.utr5s = os.path.join(self.test_folder, "utr5s")
     self.utr3s = os.path.join(self.test_folder, "utr3s")
     self.output = os.path.join(self.test_folder, "output")
     self.gffs = os.path.join(self.test_folder, "gffs")
     self.out_gff = os.path.join(self.output, "gffs")
     self.stat = os.path.join(self.test_folder, "stat")
     if (not os.path.exists(self.test_folder)):
         os.mkdir(self.test_folder)
         os.mkdir(self.gffs)
         os.mkdir(self.tsss)
         os.mkdir(self.stat)
         os.mkdir(os.path.join(self.tsss, "tmp"))
         os.mkdir(self.trans)
         os.mkdir(os.path.join(self.trans, "tmp"))
         os.mkdir(self.utr5s)
         os.mkdir(os.path.join(self.utr5s, "tmp"))
         os.mkdir(self.utr3s)
         os.mkdir(os.path.join(self.utr3s, "tmp"))
         os.mkdir(self.output)
         os.mkdir(self.out_gff)
         os.mkdir(os.path.join(self.output, "tables"))
     args = self.mock_args.mock()
     args.tsss = self.tsss
     args.trans = self.trans
     args.utr5s = self.utr5s
     args.utr3s = self.utr3s
     args.output_folder = self.output
     args.terms = None
     self.operon = OperonDetection(args)
开发者ID:Sung-Huan,项目名称:ANNOgesic,代码行数:35,代码来源:test_operon.py

示例10: setUp

 def setUp(self):
     self.converter = Converter()
     self.example = Example()
     self.converter.gff3parser = Mock_gff3_parser
     self.converter._print_rntptt_title = Mock_func().print_rntptt_title
     self.converter.tsspredator = Mock_TSSPredatorReader()
     self.converter._read_file = Mock_func().mock_read_file
     self.gff_file = self.example.gff_file
     self.ptt_out = self.example.ptt_out
     self.rnt_out = self.example.rnt_out
     self.srna_out = self.example.srna_out
     self.embl_file = self.example.embl_file
     self.embl_out = self.example.embl_out
     self.multi_embl = self.example.multi_embl
     self.gff_out = self.example.gff_out
     self.mastertable = self.example.mastertable
     self.tss_file = self.example.tss_file
     self.fasta_file = self.example.fasta_file
     self.transterm = self.example.transterm
     self.term_file = self.example.term_file
     self.circ_file = self.example.circrna_table
     self.circ_all = self.example.circrna_all
     self.circ_best = self.example.circrna_best
     self.test_folder = "test_folder"
     self.mock_args = MockClass()
     if (not os.path.exists(self.test_folder)):
         os.mkdir(self.test_folder)
开发者ID:Sung-Huan,项目名称:ANNOgesic,代码行数:27,代码来源:test_converter.py

示例11: setUp

 def setUp(self):
     self.segemehl = Mock_segemehl()
     self.samtools = Mock_samtools()
     self.mock_args = MockClass()
     self.example = Example()
     self.test_folder = "test_folder"
     self.fasta_folder = os.path.join(self.test_folder, "fasta")
     self.gff_folder = os.path.join(self.test_folder, "gff")
     self.out_folder = os.path.join(self.test_folder, "output")
     self.read_folder = os.path.join(self.test_folder, "read")
     if (not os.path.exists(self.test_folder)):
         os.mkdir(self.test_folder)
     if (not os.path.exists(self.fasta_folder)):
         os.mkdir(self.fasta_folder)
         os.mkdir(os.path.join(self.fasta_folder, "tmp"))
     if (not os.path.exists(self.gff_folder)):
         os.mkdir(self.gff_folder)
     if (not os.path.exists(self.out_folder)):
         os.mkdir(self.out_folder)
     if (not os.path.exists(self.read_folder)):
         os.mkdir(self.read_folder)
     args = self.mock_args.mock()
     args.output_folder = self.out_folder
     args.gffs = self.gff_folder
     args.align = True
     args.fastas = self.fasta_folder
     self.circ = CircRNADetection(args)
开发者ID:malvikasharan,项目名称:ANNOgesic,代码行数:27,代码来源:test_circrna.py

示例12: setUp

 def setUp(self):
     self.example = Example()
     self.mock_args = MockClass()
     self.mock = Mock_func()
     self.mock_parser = Mock_Multiparser()
     self.test_folder = "test_folder"
     self.out = "test_folder/output"
     self.fastas = "test_folder/fastas"
     self.gffs = "test_folder/gffs"
     self.srnas = "test_folder/srnas"
     self.trans = "test_folder/trans"
     if (not os.path.exists(self.test_folder)):
         os.mkdir(self.test_folder)
         os.mkdir(self.out)
         os.mkdir(self.fastas)
         os.mkdir(self.gffs)
         os.mkdir(self.srnas)
         os.mkdir(self.trans)
         os.mkdir(os.path.join(self.out, "tables"))
         os.mkdir(os.path.join(self.out, "gffs"))
         os.mkdir(os.path.join(self.gffs, "tmp"))
         os.mkdir(os.path.join(self.fastas, "tmp"))
     args = self.mock_args.mock()
     args.gffs = self.gffs
     args.fastas = self.fastas
     args.trans = self.trans
     args.out_folder = self.out
     args.srnas = self.srnas
     self.term = Terminator(args)
开发者ID:malvikasharan,项目名称:ANNOgesic,代码行数:29,代码来源:test_terminator.py

示例13: setUp

 def setUp(self):
     self.mock_args = MockClass()
     self.mock = Mock_func()
     self.mock_parser = Mock_Multiparser()
     self.example = Example()
     self.test_folder = "test_folder"
     self.trans = "test_folder/trans"
     self.out = "test_folder/output"
     self.gffs = "test_folder/gffs"
     self.tsss = "test_folder/tsss"
     self.terms = "test_folder/terms"
     if (not os.path.exists(self.test_folder)):
         os.mkdir(self.test_folder)
         os.mkdir(self.trans)
         os.mkdir(os.path.join(self.trans, "tmp"))
         os.mkdir(self.out)
         os.mkdir(self.gffs)
         os.mkdir(self.tsss)
         os.mkdir(os.path.join(self.tsss, "tmp"))
         os.mkdir(self.terms)
     args = self.mock_args.mock()
     args.tsss = self.tsss
     args.trans = self.trans
     args.out_folder = self.out
     self.utr = UTRDetection(args)
开发者ID:malvikasharan,项目名称:ANNOgesic,代码行数:25,代码来源:test_utr.py

示例14: TestOptimizeTSS

class TestOptimizeTSS(unittest.TestCase):

    def setUp(self):
        self.mock_args = MockClass()
        self.test_folder = "test_folder"
        self.fastas = os.path.join(self.test_folder, "fasta")
        self.wigs = os.path.join(self.test_folder, "wigs")
        self.gffs = os.path.join(self.test_folder, "gffs")
        self.manuals = os.path.join(self.test_folder, "manuals")
        if (not os.path.exists(self.test_folder)):
            os.mkdir(self.test_folder)
            os.mkdir(self.fastas)
            os.mkdir(os.path.join(self.fastas, "tmp"))
            os.mkdir(self.wigs)
            os.mkdir(os.path.join(self.wigs, "tmp"))
            os.mkdir(self.gffs)
            os.mkdir(os.path.join(self.gffs, "tmp"))
            os.mkdir(self.manuals)
            os.mkdir(os.path.join(self.manuals, "tmp"))

    def tearDown(self):
        if os.path.exists(self.test_folder):
            shutil.rmtree(self.test_folder)

    def test_optimize_tss(self):
        opt.Helper = Mock_helper
        opt.Multiparser = Mock_multiparser
        opt.optimization = Mock_func().mock_optimization
        gen_file(os.path.join(self.gffs, "tmp", "test.gff"), "test")
        gen_file(os.path.join(self.fastas, "tmp", "test.fa"), "test")
        args = self.mock_args.mock()
        args.fastas = self.fastas
        args.gffs = self.gffs
        args.wigs = self.wigs
        args.tsspredator_path = "test"
        args.manuals = self.manuals
        gen_file(os.path.join(self.manuals, "tmp", "test.gff"), "test")
        args.output_folder = self.test_folder
        args.project_strain = "test"
        args.height = 9
        args.height_reduction = 9
        args.factor = 9
        args.factor_reduction = 9
        args.base_height = 9
        args.enrichment = 9
        args.processing = 9
        args.utr = 200
        args.libs = "test"
        args.replicate_name = "test"
        args.cluster = 2
        args.strain_lengths = {"test": 100}
        args.cores = 4
        args.program = "TSS"
        args.replicate = 2
        args.steps = 2000
        log = open(os.path.join(self.test_folder, "test.log"), "w")
        opt.optimize_tss(args, log)
        self.assertTrue(os.path.exists(os.path.join(
            self.test_folder, "test.csv")))
        log.close()
开发者ID:Sung-Huan,项目名称:ANNOgesic,代码行数:60,代码来源:test_optimize.py

示例15: setUp

 def setUp(self):
     self.test_folder = "test_project"
     if os.path.exists(self.test_folder):
         shutil.rmtree(self.test_folder)
     os.mkdir(self.test_folder)
     self.example = Example()
     self.mock_args = MockClass()
开发者ID:malvikasharan,项目名称:ANNOgesic,代码行数:7,代码来源:test_merge_rnaplex_rnaup.py


注:本文中的mock_args_container.MockClass类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。