コード例 #1
0
ファイル: sorf.py プロジェクト: Sung-Huan/ANNOgesic
 def run_sorf_detection(self, args_sorf, log):
     if args_sorf.fuzzy_rbs > 6:
         log.write("--fuzzy_rbs should be equal or less than 6!\n")
         print("Error: --fuzzy_rbs should be equal or less than 6!")
         sys.exit()
     self._check_necessary_files(args_sorf, log)
     self.multiparser.parser_gff(args_sorf.trans, "transcript")
     self.multiparser.combine_gff(args_sorf.gffs, self.tran_path,
                                  None, "transcript")
     self.multiparser.parser_fasta(args_sorf.fastas)
     self.multiparser.combine_fasta(args_sorf.gffs, self.fasta_path, None)
     prefixs = self._compare_tran_cds(args_sorf, log)
     self._start_stop_codon(prefixs, args_sorf, log)
     log.write("Running stat_sorf.py to do statistics.\n")
     for sorf in os.listdir(os.path.join(self.gff_output, self.all_cand)):
         print("Running statistics of {0}".format(sorf))
         if sorf.endswith("_sORF.gff"):
             stat_file = os.path.join(args_sorf.out_folder, "statistics",
                         "_".join(["stat", sorf.replace(".gff", ".csv")]))
             stat(os.path.join(self.gff_output, self.all_cand, sorf),
                  os.path.join(self.gff_output, self.best, sorf), stat_file,
                  args_sorf.utr_detect)
             log.write("\t" + stat_file + " is generated.\n")
     self._re_table(args_sorf, prefixs, log)
     self._remove_tmp(args_sorf)
コード例 #2
0
ファイル: sorf.py プロジェクト: VivianMonzon/ANNOgesic
 def run_sorf_detection(self, args_sorf, log):
     if args_sorf.fuzzy_rbs > 6:
         log.write("--fuzzy_rbs should be equal or less than 6!\n")
         print("Error: --fuzzy_rbs should be equal or less than 6!")
         sys.exit()
     self._check_necessary_files(args_sorf, log)
     self.multiparser.parser_gff(args_sorf.trans, "transcript")
     self.multiparser.combine_gff(args_sorf.gffs, self.tran_path, None,
                                  "transcript")
     self.multiparser.parser_fasta(args_sorf.fastas)
     self.multiparser.combine_fasta(args_sorf.gffs, self.fasta_path, None)
     prefixs = self._compare_tran_cds(args_sorf, log)
     self._start_stop_codon(prefixs, args_sorf, log)
     log.write("Running stat_sorf.py to do statistics.\n")
     for sorf in os.listdir(os.path.join(self.gff_output, self.all_cand)):
         print("Running statistics of {0}".format(sorf))
         if sorf.endswith("_sORF.gff"):
             stat_file = os.path.join(
                 args_sorf.out_folder, "statistics",
                 "_".join(["stat", sorf.replace(".gff", ".csv")]))
             stat(os.path.join(self.gff_output, self.all_cand, sorf),
                  os.path.join(self.gff_output, self.best, sorf), stat_file,
                  args_sorf.utr_detect)
             log.write("\t" + stat_file + " is generated.\n")
     self._re_table(args_sorf, prefixs, log)
     self._remove_tmp(args_sorf)
コード例 #3
0
 def test_stat(self):
     sorf_all = os.path.join(self.test_folder, "aaa_all.gff")
     sorf_best = os.path.join(self.test_folder, "aaa_best.gff")
     gen_file(sorf_all, self.example.sorf_all)
     gen_file(sorf_best, self.example.sorf_best)
     stat_file = os.path.join(self.test_folder, "stat")
     ss.stat(sorf_all, sorf_best, stat_file, True)
     datas = import_data(stat_file)
     for data in datas:
         if "total sORF in this strain are " in data:
             self.assertEqual(data, "\ttotal sORF in this strain are 3")
         if "total sORF of intergenic sORF candidates are " in data:
             self.assertEqual(data,
                              ("\ttotal sORF of intergenic sORF candidates "
                               "are 1(for this genome - "
                               "0.3333333333333333)"))
コード例 #4
0
ファイル: test_stat_sorf.py プロジェクト: Sung-Huan/ANNOgesic
 def test_stat(self):
     sorf_all = os.path.join(self.test_folder, "aaa_all.gff")
     sorf_best = os.path.join(self.test_folder, "aaa_best.gff")
     gen_file(sorf_all, self.example.sorf_all)
     gen_file(sorf_best, self.example.sorf_best)
     stat_file = os.path.join(self.test_folder, "stat")
     ss.stat(sorf_all, sorf_best, stat_file, True)
     datas = import_data(stat_file)
     for data in datas:
         if "total sORF in this strain are " in data:
             self.assertEqual(data, "\ttotal sORF in this strain are 3")
         if "total sORF of intergenic sORF candidates are " in data:
             self.assertEqual(data,
                              ("\ttotal sORF of intergenic sORF candidates "
                               "are 1(for this genome - "
                               "0.3333333333333333)"))