def test_stat(self): input_file = os.path.join(self.test_folder, "input_file") output_file = os.path.join(self.test_folder, "output_file") gen_file(input_file, self.example.operon) so.stat(input_file, output_file) datas = import_data(output_file) for data in datas: if "the number of operons which have sub-operons and " in data: self.assertEqual( data, "\tthe number of operons which have sub-operons and start with tss = 1 (1.0)" ) if "the number of operons which have sub-operons = " in data: self.assertEqual( data, "\tthe number of operons which have sub-operons = 1 (1.0)") if "the number of operons which start with tss = " in data: self.assertEqual( data, "\tthe number of operons which start with tss = 1 (1.0)") if "no associated with CDS: " in data: self.assertEqual(data, "\tno associated with CDS: 0 (0.0)") if "monocistronic: " in data: self.assertEqual(data, "\tmonocistronic: 0 (0.0)") if "polycistronic: " in data: self.assertEqual(data, "\tpolycistronic: 1 (1.0)")
def _stat(self, table_path, stat_folder, log): log.write("Running stat_operon.py to do statistics.\n") for table in os.listdir(table_path): if table.endswith("_operon.csv"): filename = "_".join(["stat", table]) out_stat = os.path.join(stat_folder, filename) stat(os.path.join(table_path, table), out_stat) log.write("\t" + out_stat + "\n")
def test_stat(self): input_file = os.path.join(self.test_folder, "input_file") output_file = os.path.join(self.test_folder, "output_file") gen_file(input_file, self.example.operon) so.stat(input_file, output_file) datas = import_data(output_file) for data in datas: if "the number of operons which have sub-operons and " in data: self.assertEqual(data, "\tthe number of operons which have sub-operons and start with tss = 1 (1.0)") if "the number of operons which have sub-operons = " in data: self.assertEqual(data, "\tthe number of operons which have sub-operons = 1 (1.0)") if "the number of operons which start with tss = " in data: self.assertEqual(data, "\tthe number of operons which start with tss = 1 (1.0)") if "no associated with CDS: " in data: self.assertEqual(data, "\tno associated with CDS: 0 (0.0)") if "monocistronic: " in data: self.assertEqual(data, "\tmonocistronic: 0 (0.0)") if "polycistronic: " in data: self.assertEqual(data, "\tpolycistronic: 1 (1.0)")
def _stat(self, table_path, stat_folder): for table in os.listdir(table_path): if table.startswith("operon_") and table.endswith(".csv"): filename = "_".join(["stat", table]) out_stat = os.path.join(stat_folder, filename) stat(os.path.join(table_path, table), out_stat)