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


Python mock_helper.import_data函数代码示例

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


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

示例1: test_screenshot

 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)
开发者ID:malvikasharan,项目名称:ANNOgesic,代码行数:28,代码来源:test_screen.py

示例2: test_convert_circ2gff

 def test_convert_circ2gff(self):
     circ_file = os.path.join(self.test_folder, "circ.csv")
     out_all = os.path.join(self.test_folder, "all.gff")
     out_filter = os.path.join(self.test_folder, "best.gff")  
     with open(circ_file, "w") as ch:
         ch.write(self.circ_file)
     args = self.mock_args.mock()
     args.start_ratio = 0.5
     args.end_ratio = 0.5
     args.support = 5
     self.converter.convert_circ2gff(circ_file, args, out_all, out_filter)
     datas = import_data(out_all)
     f_datas = []
     for data in datas:
         if not data.startswith("#"):
             f_datas.append("\t".join(data.split("\t")[:8]))
     c_datas = []
     for data in self.circ_all.split("\n"):
         if not data.startswith("#"):
             c_datas.append("\t".join(data.split("\t")[:8]))
     self.assertListEqual(f_datas, c_datas)
     datas = import_data(out_filter)
     f_datas = []
     for data in datas:
         if not data.startswith("#"):
             f_datas.append("\t".join(data.split("\t")[:8]))
     c_datas = []
     for data in self.circ_best.split("\n"):
         if not data.startswith("#"):
             c_datas.append("\t".join(data.split("\t")[:8]))
     self.assertListEqual(f_datas, c_datas)
开发者ID:Sung-Huan,项目名称:ANNOgesic,代码行数:31,代码来源:test_converter.py

示例3: test_detect_5utr

 def test_detect_5utr(self):
     args = self.mock_args.mock()
     du.read_file = Mock_func().mock_read_file
     du.plot = Mock_func().mock_plot
     out_file = os.path.join(self.test_folder, "5utr.gff")
     args.source = True
     args.base_5utr = "both"
     args.length = 300
     du.detect_5utr("test.tss", "test.gff", "test.ta", out_file, args)
     header = ["##gff-version 3"]
     args.source = False
     args.base_5utr = "both"
     du.detect_5utr("test.tss", "test.gff", "test.ta", out_file, args)
     datas = import_data(out_file)
     ref = header + [self.example.out_5utr_other]
     self.assertEqual(datas[1], ref[1])
     args.base_5utr = "transcript"
     du.detect_5utr("test.tss", "test.gff", "test.ta", out_file, args)
     self.assertEqual(set(datas), set(ref))
     args.source = True
     args.base_5utr = "both"
     du.detect_5utr("test.tss", "test.gff", "test.ta", out_file, args)
     datas = import_data(out_file)
     ref = header + [self.example.out_5utr_tsspredator]
     self.assertListEqual(datas, ref)
开发者ID:malvikasharan,项目名称:ANNOgesic,代码行数:25,代码来源:test_detect_utr.py

示例4: test_compare_tss

 def test_compare_tss(self):
     tr.stat_ta_tss = self.mock.mock_stat_ta_tss
     self.tran.multiparser = self.mock_parser
     gen_file(os.path.join(self.gffs, "test_TSS.gff"),
              self.example.gff_file)
     gen_file(os.path.join(self.gffs, "tmp/test_TSS.gff"),
              self.example.gff_file)
     gen_file(os.path.join(self.out_gff, "test_transcript.gff"),
              self.example.tran_file)
     gff_out = os.path.join(self.out, "gffs")
     gen_file(os.path.join(gff_out, "tmp_ta_tss"), self.example.tran_file)
     gen_file(os.path.join(gff_out, "tmp_tss_ta"), self.example.gff_file)
     args = self.mock_args.mock()
     args.out_folder = self.out
     args.trans = self.trans
     args.compare_tss = self.gffs
     args.fuzzy = 2
     log = open(os.path.join(self.test_folder, "test.log"), "w")
     self.tran._compare_tss(["test"], args, log)
     datas = import_data(os.path.join(self.gffs, "test_TSS.gff"))
     self.assertEqual("\n".join(datas),
                      "##gff-version 3\n" + self.example.gff_file)
     datas = import_data(os.path.join(self.out_gff, "test_transcript.gff"))
     self.assertEqual("\n".join(datas),
                      "##gff-version 3\n" + self.example.tran_file)
开发者ID:Sung-Huan,项目名称:ANNOgesic,代码行数:25,代码来源:test_transcript.py

示例5: test_parser_embl_gbk

 def test_parser_embl_gbk(self):
     files = [os.path.join(self.test_folder, "aaa.gbk")]
     gen_file(os.path.join(self.test_folder, "aaa.gbk"), self.example.gbk_file)
     self.ratt._parser_embl_gbk(files)
     data = import_data(os.path.join(self.ref_embls, "gbk_tmp/NC_007795.1.gbk"))
     self.assertEqual("\n".join(data), self.example.gbk_file.split("//")[0] + "//")
     data = import_data(os.path.join(self.ref_embls, "gbk_tmp/NC_007799.1.gbk"))
     self.assertEqual("\n".join(data), self.example.gbk_file.split("//")[1].strip() + "\n//")
开发者ID:malvikasharan,项目名称:ANNOgesic,代码行数:8,代码来源:test_ratt.py

示例6: test_modify_seq

 def test_modify_seq(self):
     mod_table = os.path.join(self.test_folder, "mod")
     gen_file(mod_table, self.example.mutation)
     gen_file(os.path.join(self.fasta, "NC_000915.1.fa"), self.example.fasta)
     self.seq.modify_seq(self.fasta, mod_table, self.test_folder)
     datas = import_data(os.path.join(self.test_folder, "NC_test.1.fa"))
     self.assertEqual("\n".join(datas), self.example.out_1)
     datas = import_data(os.path.join(self.test_folder, "test_case2.fa"))
     self.assertEqual("\n".join(datas), self.example.out_2)
开发者ID:malvikasharan,项目名称:ANNOgesic,代码行数:9,代码来源:test_seq_editer.py

示例7: test_convert_to_pttrnt

 def test_convert_to_pttrnt(self):
     files = ["aaa.gff"]
     gen_file(os.path.join(self.test_folder, "aaa.gff"), self.example.gff_file)
     os.mkdir(os.path.join(self.tar_fastas, "tmp"))
     gen_file(os.path.join(self.tar_fastas, "tmp/aaa.fa"), self.example.fasta_file)
     self.ratt._convert_to_pttrnt(self.test_folder, files)
     data = import_data(os.path.join(self.test_folder, "aaa.rnt"))
     self.assertEqual("\n".join(data), self.example.rnt_file)
     data = import_data(os.path.join(self.test_folder, "aaa.ptt"))
     self.assertEqual("\n".join(data), self.example.ptt_file)
开发者ID:malvikasharan,项目名称:ANNOgesic,代码行数:10,代码来源:test_ratt.py

示例8: test_regenerate_seq

 def test_regenerate_seq(self):
     out_table = os.path.join(self.test_folder, "table")
     out_seq = os.path.join(self.test_folder, "seq")
     align_file = os.path.join(self.test_folder, "align")
     seq_file = os.path.join(self.test_folder, "ribo_seq")
     gen_file(align_file, self.example.scan_file)
     gen_file(seq_file, self.example.seq_file)
     rr.regenerate_seq(align_file, seq_file, out_table, out_seq)
     data = import_data(out_table)
     self.assertEqual("\n".join(data), "riboswitch_5\tStaphylococcus_aureus_HG003\t+\tSAOUHSC_00013\t10\t16\tRF00162\t6.2e-18\t5\t12")
     data = import_data(out_seq)
     self.assertEqual("\n".join(data), ">riboswitch_5|Staphylococcus_aureus_HG003|+|SAOUHSC_00013|14|21\nATTATTAC")
开发者ID:malvikasharan,项目名称:ANNOgesic,代码行数:12,代码来源:test_recompute_RBS.py

示例9: test_convert_to_gff

    def test_convert_to_gff(self):
        files = ["aaa.gff"]
        ratt_result = "chromosome.aaa.final.embl"
        gen_file(os.path.join(self.output_path, ratt_result), self.example.embl_file)
        args = self.mock_args.mock()
        args.output_path = self.output_path
        args.gff_outfolder = self.gff_outfolder
        self.ratt._convert_to_gff(ratt_result, args, files)
#        self.ratt._convert_to_gff(ratt_result, self.output_path, self.gff_outfolder, files)
        data = import_data(os.path.join(self.output_path, "aaa.gff"))
        self.assertEqual("\n".join(data), self.example.embl_gff)
        data = import_data(os.path.join(self.gff_outfolder, "aaa.gff"))
        self.assertEqual("\n".join(data), self.example.embl_gff)
开发者ID:malvikasharan,项目名称:ANNOgesic,代码行数:13,代码来源:test_ratt.py

示例10: test_modify_table

    def test_modify_table(self):
        result = """#ID\tGenome\tStrand\tAssociated_CDS\tStart_genome\tEnd_genome\tRfam\tE_value\tScore\tStart_align\tEnd_align
riboswitch_5\tStaphylococcus_aureus_HG003\t+\tSAOUHSC_00013\t15948\t16046\tRF00162\t1.6e-18\t74\t1\t99
riboswitch_11\tStaphylococcus_aureus_HG003\t-\tSAOUHSC_00007\t27955\t28053\tRF00162\t1.6e-18\t74\t1\t99
riboswitch_183\tStaphylococcus_aureus_HG003\t+\tSAOUHSC_00372\t377996\t378098\tRF00167\t2.2e-18\t45\t1\t103"""
        table = os.path.join(self.test_folder, "test")
        gen_file(table, self.example.ribos)
        mrt.modify_table(table, True)
        data = import_data(table)
        self.assertEqual("\n".join(data), result)
        gen_file(table, self.example.ribos)
        mrt.modify_table(table, False)
        data = import_data(table)
        self.assertEqual("\n".join(data), result)
开发者ID:Sung-Huan,项目名称:ANNOgesic,代码行数:14,代码来源:test_modify_rbs_table.py

示例11: test_detect_circrna

 def test_detect_circrna(self):
     out_file = os.path.join(self.test_folder, "out_all.csv")
     stat_file = os.path.join(self.test_folder, "stat.csv")
     circ.read_file = Mock_read_file().read_file
     args = self.mock_args.mock()
     args.start_ratio = 0.5
     args.end_ratio = 0.5
     args.support = 5
     args.hypo = True
     circ.detect_circrna("test.circ", "test.gff", out_file, args, stat_file)
     circs = import_data(out_file)
     stats = import_data(stat_file)
     self.assertEqual(set(circs), set(self.example.out_file.split("\n")))
     self.assertEqual(set(stats), set(self.example.stat_file.split("\n")))
开发者ID:malvikasharan,项目名称:ANNOgesic,代码行数:14,代码来源:test_circRNA.py

示例12: test_convert_circ2gff

 def test_convert_circ2gff(self):
     circ_file = os.path.join(self.test_folder, "circ.csv")
     out_all = os.path.join(self.test_folder, "all.gff")
     out_filter = os.path.join(self.test_folder, "best.gff")  
     with open(circ_file, "w") as ch:
         ch.write(self.circ_file)
     args = self.mock_args.mock()
     args.start_ratio = 0.5
     args.end_ratio = 0.5
     args.support = 5
     self.converter.convert_circ2gff(circ_file, args, out_all, out_filter)
     datas = import_data(out_all)
     self.assertEqual(set(datas), set(self.circ_all.split("\n")))
     datas = import_data(out_filter)
     self.assertEqual(set(datas), set(self.circ_best.split("\n")))
开发者ID:malvikasharan,项目名称:ANNOgesic,代码行数:15,代码来源:test_converter.py

示例13: test_merge_wigs

 def test_merge_wigs(self):
     gen_file(os.path.join(self.wigs, "test1_forward.wig"), "test_f")
     gen_file(os.path.join(self.wigs, "test1_reverse.wig"), "test_r")
     gen_file(os.path.join(self.wigs, "test1_TEX_forward.wig"), "test_f")
     gen_file(os.path.join(self.wigs, "test1_TEX_reverse.wig"), "test_r")
     libs = ["test1_forward.wig:notex:1:a:+",
             "test1_reverse.wig:notex:1:a:-",
             "test1_TEX_forward.wig:tex:1:a:+",
             "test1_TEX_reverse.wig:tex:1:a:-"]
     self.tss._merge_wigs(self.wigs, "test", libs)
     datas = import_data(os.path.join("tmp", "merge_forward.wig"))
     self.assertEqual("\n".join(datas), "test_ftest_f")
     datas = import_data(os.path.join("tmp", "merge_reverse.wig"))
     self.assertEqual("\n".join(datas), "test_rtest_r")
     shutil.rmtree("tmp")
开发者ID:Sung-Huan,项目名称:ANNOgesic,代码行数:15,代码来源:test_tsspredator.py

示例14: test_stat_term

 def test_stat_term(self):
     term_gff = os.path.join(self.test_folder, "aaa_term.gff")
     term_table = os.path.join(self.test_folder, "aaa_term.csv")
     stat = os.path.join(self.test_folder, "stat")
     output_decrease = os.path.join(self.test_folder, "decrease")
     output_expression = os.path.join(self.test_folder, "expression")
     output_non = os.path.join(self.test_folder, "non_expressed")
     gen_file(term_gff, self.example.gff)
     gen_file(term_table, self.example.table)
     st.stat_term(term_gff, term_table, stat, output_decrease, output_expression, output_non)
     self.assertTrue(stat)
     datas = import_data(output_decrease + ".csv")
     self.assertEqual("\n".join(datas), self.example.table)
     datas = import_data(output_expression + ".csv")
     self.assertEqual("\n".join(datas), self.example.table)
开发者ID:malvikasharan,项目名称:ANNOgesic,代码行数:15,代码来源:test_stat_term.py

示例15: test_set_gen_config

 def test_set_gen_config(self):
     os.mkdir(os.path.join(self.fastas, "tmp"))
     os.mkdir(os.path.join(self.gffs, "tmp"))
     os.mkdir(os.path.join(self.wigs, "tmp"))
     os.mkdir(os.path.join(self.out, "MasterTables"))
     gen_file(os.path.join(self.fastas, "tmp/test.fa"), "test")
     gen_file(os.path.join(self.gffs, "tmp/test.gff"), "test")
     gen_file(os.path.join(self.wigs, "tmp/test1_forward.wig_STRAIN_test.wig"), "test")
     gen_file(os.path.join(self.wigs, "tmp/test1_reverse.wig_STRAIN_test.wig"), "test")
     gen_file(os.path.join(self.wigs, "tmp/test1_TEX_forward.wig_STRAIN_test.wig"), "test")
     gen_file(os.path.join(self.wigs, "tmp/test1_TEX_reverse.wig_STRAIN_test.wig"), "test")
     libs = ["test1_forward.wig:notex:1:a:+",
             "test1_reverse.wig:notex:1:a:-",
             "test1_TEX_forward.wig:tex:1:a:+",
             "test1_TEX_reverse.wig:tex:1:a:-"]
     args = self.mock_args.mock()
     args.program = "TSS"
     args.height = 0.3
     args.height_reduction = 0.2
     args.factor = 2.0
     args.factor_reduction = 0.5
     args.base_height = 0.00
     args.enrichment_factor = 2.0
     args.processing_factor = 1.5
     args.utr_length = 300
     args.libs = libs
     args.out_folder = self.out
     args.cluster = 3
     args.repmatch = 2
     args.output_prefixs = ["test1"]
     self.tss._set_gen_config(args, self.test_folder)
     datas = import_data(os.path.join(self.test_folder, "config_test.ini"))
     self.assertEqual("\n".join(datas), self.example.config)
开发者ID:malvikasharan,项目名称:ANNOgesic,代码行数:33,代码来源:test_tsspredator.py


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