• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Python mock_helper.gen_file函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: test_low_expression

 def test_low_expression(self):
     ts.filter_low_expression = self.mock.mock_filter_low_expression
     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")
     gen_file(os.path.join(self.gffs, "test_TSS.gff"),
              self.example.tss_file)
     os.mkdir(os.path.join(self.out, "statistics"))
     os.mkdir(os.path.join(self.out, "statistics/test"))
     libs = ["test1_TEX_forward.wig:tex:1:a:+",
             "test1_TEX_reverse.wig:tex:1:a:-",
             "test1_forward.wig:notex:1:a:+",
             "test1_reverse.wig:notex:1:a:-"]
     args = self.mock_args.mock()
     args.manual = "manual"
     args.libs = libs
     args.wig_folder = self.wigs
     args.program = "TSS"
     args.cluster = 3
     self.tss._low_expression(args, self.gffs)
     shutil.rmtree("tmp")
     datas = import_data(os.path.join(
         self.out, "statistics/test/stat_test_low_expression_cutoff.csv"))
     self.assertEqual("\n".join(datas),
                      "Genome\tCutoff_coverage\ntest\t100")
开发者ID:Sung-Huan,项目名称:ANNOgesic,代码行数:26,代码来源:test_tsspredator.py


示例2: test_stat_ta_tss

 def test_stat_ta_tss(self):
     tss_file = os.path.join(self.test_folder, "aaa_TSS.gff")
     ta_file = os.path.join(self.test_folder, "aaa_transcript.gff")
     gen_file(tss_file, self.example.tss)
     gen_file(ta_file, self.example.ta)
     stat_file = os.path.join(self.test_folder, "stat")
     out_ta_file = os.path.join(self.test_folder, "out_ta.gff")
     out_tss_file = os.path.join(self.test_folder, "out_tss.gff")
     stc.stat_ta_tss(ta_file, tss_file, stat_file,
                     out_ta_file, out_tss_file, 5)
     datas = import_data(stat_file)
     self.assertEqual("\n".join(datas),
                      "All genomes:\n" + self.example.print_tas)
     datas, attributes = extract_info(out_ta_file, "file")
     self.assertListEqual(
         datas,
         ['aaa\tfragmented_and_normal\tTranscript\t313\t3344\t.\t+\t.'])
     for attribute in attributes:
         if "associated_tss" in attribute:
             self.assertEqual("associated_tss=TSS:2131_f")
     datas, attributes = extract_info(out_tss_file, "file")
     self.assertListEqual(datas,
                          ['aaa\tTSSpredator\tTSS\t2131\t2131\t.\t+\t.'])
     for attribute in attributes:
         if "Parent_tran" in attribute:
             self.assertEqual(attribute, "Parent_tran=tran0")
开发者ID:Sung-Huan,项目名称:ANNOgesic,代码行数:26,代码来源:test_stat_TA_comparison.py


示例3: test_import_bam

 def test_import_bam(self):
     gen_file(os.path.join(self.test_folder, "test_1.bam"), "test")
     gen_file(os.path.join(self.test_folder, "test_2.bam"), "test")
     bams = []
     num_bams = self.snp._import_bam(self.test_folder, bams)
     self.assertEqual(num_bams, 2)
     self.assertListEqual(bams, ['test_folder/test_1.bam', 'test_folder/test_2.bam'])
开发者ID:malvikasharan,项目名称:ANNOgesic,代码行数:7,代码来源:test_snp.py


示例4: test_gene_expression

 def test_gene_expression(self):
     gea.read_wig = MockFunc().mock_read_wig
     gea.read_libs = MockFunc().mock_read_libs
     gea.read_data = MockFunc().mock_read_data
     replicates = {"tex": 1, "frag": 1}
     stat_folder = os.path.join(self.test_folder, "stat")
     gff_folder = os.path.join(self.test_folder, "gff")
     if os.path.exists(gff_folder):
         shutil.rmtree(gff_folder)
     os.mkdir(gff_folder)
     gen_file(os.path.join(gff_folder, "aaa.gff"), "test")
     if not os.path.exists(stat_folder):
         os.mkdir(stat_folder)
     out_gff_folder = os.path.join(self.test_folder, "out_gff")
     if not os.path.exists(out_gff_folder):
         os.mkdir(out_gff_folder)
     gea.gene_expression(None, gff_folder, "all", "all", "test_wig", "test_wig", ["CDS"],
                        "test_wig_folder", 5, 2, replicates, stat_folder, out_gff_folder,
                        "high", 100, 0)
     datas = import_data(os.path.join(stat_folder, "aaa_CDS.csv"))
     dicts = {}
     for data in datas:
         dicts[data] = data
     refs = {}
     for data in self.example.out_stat.split("\n"):
         refs[data] = data
     self.assertDictEqual(dicts, refs)
开发者ID:malvikasharan,项目名称:ANNOgesic,代码行数:27,代码来源:test_gene_express_analysis.py


示例5: test_read_gff

 def test_read_gff(self):
     tss_file = os.path.join(self.test_folder, "test.gff")
     gen_file(tss_file, self.example.tss_file)
     tsss, tss_num = ptv.read_gff(tss_file)
     self.assertEqual(tsss["all"][0].start, 140)
     self.assertEqual(tsss["aaa"][0].start, 140)
     self.assertDictEqual(tss_num, {'all': 1, 'aaa': 1})
开发者ID:Sung-Huan,项目名称:ANNOgesic,代码行数:7,代码来源:test_plot_TSS_venn.py


示例6: test_setup_folder_and_read_file

 def test_setup_folder_and_read_file(self):
     paths = {"all": os.path.join(self.test_folder, "all_results"),
              "fig": os.path.join(self.test_folder, "figures"),
              "best": os.path.join(self.test_folder, "best_results")}
     strain_id = {"file": "test.ptt","ptt": "test_ptt",
                  "string": "test_string", "pie": "test_pie"}
     files = {"id_list": self.test_folder, "id_log": "", "pubmed_log": "",
              "all_specific": "", "best_specific": "",
              "all_nospecific": "", "best_nospecific": "", "action_log": ""}
     gen_file(os.path.join(self.test_folder, "test.ptt"),
              self.example.ptt_file)
     args = self.mock_args.mock()
     args.querys = "all"
     args.no_specific = True
     args.out_folder = self.test_folder
     args.ptts = self.test_folder
     genes = self.ppi._setup_folder_and_read_file(strain_id, "",
                                                  files, paths, args)
     for index in ("all_specific", "all_nospecific",
                   "best_specific", "best_nospecific",
                   "id_log", "action_log", "pubmed_log"):
         files[index].close()
     self.assertTrue(os.path.exists("test_folder/best_results/test"))
     self.assertTrue(os.path.exists("test_folder/all_results/test"))
     self.assertListEqual(genes, [
          {'strain': 'Staphylococcus_aureus_HG003', 'locus_tag': 'dnaA', 'gene': 'SAOUHSC_00001'},
          {'strain': 'Staphylococcus_aureus_HG003', 'locus_tag': '-', 'gene': 'SAOUHSC_00002'},
          {'strain': 'Staphylococcus_aureus_HG003', 'locus_tag': '-', 'gene': 'SAOUHSC_00003'}])
开发者ID:Sung-Huan,项目名称:ANNOgesic,代码行数:28,代码来源:test_ppi.py


示例7: 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


示例8: test_convert_embl

 def test_convert_embl(self):
     gen_file(os.path.join(self.test_folder, "aaa.gbk"),
              self.example.gbk_file.split("//")[0])
     log = open(os.path.join(self.test_folder, "test.log"), "w")
     out = self.ratt._convert_embl(self.test_folder, log)
     self.assertEqual(out, "test_folder/gbk/gbk_tmp")
     self.assertTrue(os.path.exists("test_folder/gbk/gbk_tmp"))
开发者ID:Sung-Huan,项目名称:ANNOgesic,代码行数:7,代码来源:test_ratt.py


示例9: test_get_proper_tss

 def test_get_proper_tss(self):
     tss_file = os.path.join(self.test_folder, "tss.gff")
     gen_file(tss_file, self.example.gff_file)
     coverage = {"primary": 0, "secondary": 0, "internal": 0,
                 "antisense": 50, "orphan": 10}
     tsss, num_tss = si.get_proper_tss(tss_file, coverage)
     self.assertEqual(tsss[0].start, 140)
开发者ID:Sung-Huan,项目名称:ANNOgesic,代码行数:7,代码来源:test_sRNA_intergenic.py


示例10: test_sort_srna_fasta

 def test_sort_srna_fasta(self):
     fasta = os.path.join(self.fastas, "test.fa")
     gen_file(fasta, ">aaa\nAAAAAAAA\n>bbb\nCCCC\n>ccc\nGGGGGGGGGGGG")
     self.star._sort_srna_fasta(fasta, "test", self.test_folder)
     datas = import_data(os.path.join(self.test_folder, "tmp_srna_target_test_sRNA.fa"))
     self.assertListEqual(datas, ['>bbb', 'CCCC', '>aaa', 'AAAAAAAA',
                                  '>ccc', 'GGGGGGGGGGGG'])
开发者ID:Sung-Huan,项目名称:ANNOgesic,代码行数:7,代码来源:test_srna_target.py


示例11: test_import_data

 def test_import_data(self):
     mod_table = os.path.join(self.test_folder, "mod")
     gen_file(mod_table, self.example.mutation)
     datas = self.seq._import_data(mod_table, "test")
     self.assertListEqual(datas, [{'target_id': 'test_NC_000915.1',
          'datas': [{'ref_nt': 'c', 'tar_nt': '', 'position': '3'},
          {'ref_nt': '-', 'tar_nt': 'deletion', 'position': '6'}], 'ref_id': 'NC_000915.1'}])
开发者ID:Sung-Huan,项目名称:ANNOgesic,代码行数:7,代码来源:test_seq_editer.py


示例12: test_change_format

 def test_change_format(self):
     input_file = os.path.join(self.test_folder, "input")
     output_file = os.path.join(self.test_folder, "output")
     gen_file(input_file, ">srna_1|Staphylococcus|Aar|12314|12444|forward\nATAGATTCCCGCGTATAGTCATCATTGTAC")
     cdf.change_format(input_file, output_file)
     data = import_data(output_file)
     self.assertListEqual(data, ['>srna_1|Staphylococcus|Aar', 'ATAGATTCCCGCGTATAGTCATCATTGTAC'])
开发者ID:malvikasharan,项目名称:ANNOgesic,代码行数:7,代码来源:test_change_db_format.py


示例13: test_stat_ta_gff

 def test_stat_ta_gff(self):
     gff_file = os.path.join(self.test_folder, "aaa.gff")
     ta_file = os.path.join(self.test_folder, "aaa_transcript.gff")
     gen_file(gff_file, self.example.gff)
     gen_file(ta_file, self.example.ta)
     stat_file = os.path.join(self.test_folder, "stat")
     out_ta_file = os.path.join(self.test_folder, "out_ta.gff")
     out_gff_file = os.path.join(self.test_folder, "out.gff")
     stc.stat_ta_gff(ta_file, gff_file, stat_file,
                     out_ta_file, out_gff_file, ["gene"])
     datas = import_data(stat_file)
     self.assertEqual("\n".join(datas),
                      ("For gene:\n\tAll genomes:\n\tThe transcript "
                       "information compares with gene:\n" + \
                       self.example.print_tag))
     datas, attributes = extract_info(out_ta_file, "file")
     self.assertListEqual(
         datas,
         ['aaa\tfragmented_and_normal\tTranscript\t313\t3344\t.\t+\t.'])
     for attribute in attributes:
         if "type" in attribute:
             self.assertEqual(attribute, "type=cover_CDS")
         if "associated_cds=" in attribute:
             self.assertEqual(attribute, "associated_cds=YP_498609.1")
     datas, attributes = extract_info(out_gff_file, "file")
     self.assertListEqual(datas, ['aaa\tRefseq\tgene\t517\t1878\t.\t+\t.',
                                  'aaa\tRefseq\tCDS\t517\t1878\t.\t+\t.'])
     for attribute in attributes:
         if "Parent_tran" in attribute:
             self.assertEqual(attribute, "Parent_tran=tran0")
开发者ID:Sung-Huan,项目名称:ANNOgesic,代码行数:30,代码来源:test_stat_TA_comparison.py


示例14: test_plot_ppi

 def test_plot_ppi(self):
     ppi_file = os.path.join(self.test_folder, "test_ppi")
     gen_file(ppi_file, self.example.ppi_file)
     pp.plot_ppi(ppi_file, 0, self.test_folder, 1000)
     strain = "Helicobacter pylori 26695 chromosome"
     self.assertTrue(os.path.exists(
         "test_folder/" + strain + "/HP0001_nusB.png"))
开发者ID:Sung-Huan,项目名称:ANNOgesic,代码行数:7,代码来源:test_plot_PPI.py


示例15: test_read_wig

 def test_read_wig(self):
     libs = [{"name": "test1", "type": "frag",
              "cond": "1", "strand": "+", "rep": "a"}]
     filename = os.path.join(self.test_folder, "test_f.wig")
     gen_file(filename, self.example.wig_f)
     wigs = ta.read_wig(filename, libs, "+")
     self.assertDictEqual(wigs, self.example.wigs_f)
开发者ID:malvikasharan,项目名称:ANNOgesic,代码行数:7,代码来源:test_transcript_assembly.py


示例16: test_stat

 def test_stat(self):
     op.stat = self.mock.mock_stat
     table_file = os.path.join(self.output, "tables", "operon_test.csv")
     if not os.path.exists(table_file):
         gen_file(table_file, "test")
     self.operon._stat(os.path.join(self.output, "tables"), self.stat)
     self.assertTrue(os.path.exists(os.path.join(self.stat, "stat_operon_test.csv")))
开发者ID:malvikasharan,项目名称:ANNOgesic,代码行数:7,代码来源:test_operon.py


示例17: test_merge_sRNA

 def test_merge_sRNA(self):
     os.mkdir(os.path.join(self.srnas, "tmp"))
     self.term.multiparser = self.mock_parser
     gen_file(os.path.join(self.gffs, "aaa.gff"), self.example.gff_file)
     gen_file(os.path.join(self.srnas, "tmp/aaa_sRNA.gff"), self.example.srna_file)
     merge = self.term._merge_sRNA(self.srnas, ["aaa"], self.gffs)
     self.assertEqual(merge.split("/")[-1], "tmp_merge_gff")
     shutil.rmtree("tmp_merge_gff")
开发者ID:malvikasharan,项目名称:ANNOgesic,代码行数:8,代码来源:test_terminator.py


示例18: test_compare_cds_tran

 def test_compare_cds_tran(self):
     gff_file = os.path.join(self.test_folder, "aaa.gff")
     tran_file = os.path.join(self.test_folder, "aaa_transcript.gff")
     gen_file(gff_file, self.example.gff_file)
     gen_file(tran_file, self.example.tran_file)
     self.sub._compare_cds_tran(gff_file, tran_file)
     datas, string = extract_info("test_folder/output/all_CDS/tmp_cds.gff", "file")
     self.assertEqual("\n".join(datas), 'aaa\tRefSeq\tCDS\t3\t17\t.\t+\t.')
开发者ID:malvikasharan,项目名称:ANNOgesic,代码行数:8,代码来源:test_sublocal.py


示例19: 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, "test")
     datas = import_data(os.path.join(self.test_folder, "test_NC_000915.1.fa"))
     self.assertEqual("\n".join(datas), self.example.out_1)
开发者ID:Sung-Huan,项目名称:ANNOgesic,代码行数:8,代码来源:test_seq_editer.py


示例20: mock_run_infernal

 def mock_run_infernal(self, e_value,
                       seq, type_, prefix):
     if type_ == "txt":
         gen_file("test_folder/output/test_RBS.txt", self.example.scan_file)
         return "test_folder/output/test_RBS.txt"
     else:
         gen_file("test_folder/output/test_RBS_rescan.txt", self.example.rescan_file)
         return "test_folder/output/test_RBS_rescan.txt"
开发者ID:malvikasharan,项目名称:ANNOgesic,代码行数:8,代码来源:test_ribos.py



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Python mock_helper.import_data函数代码示例发布时间:2022-05-27
下一篇:
Python mock_args_container.MockClass类代码示例发布时间:2022-05-27
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap