예제 #1
0
    def test_parse_beta_significance_output_each_sample(self):
        """The each sample beta significance parser works"""
        out = open(self.input_file, "w")
        out.write(bs_lines_each_sample)
        out.close()

        self._paths_to_clean_up = [self.input_file]

        bs_lines = open(self.input_file, "U")

        obs_dict, obs_test_name = parse_beta_significance_output_each_sample(bs_lines)

        exp_dict = {"s1": (0.01, 0.15), "s2": (0.0, 0.01), "s3": (0.02, 0.3), "s4": (0.82, 1.0)}
        exp_test_name = "Comment with the name of the test realized"

        self.assertEqual(obs_dict, exp_dict)
        self.assertEqual(obs_test_name, exp_test_name)
예제 #2
0
    def test_parse_beta_significance_output_each_sample(self):
        """The each sample beta significance parser works"""
        out = open(self.input_file, 'w')
        out.write(bs_lines_each_sample)
        out.close()

        self._paths_to_clean_up = [self.input_file]

        bs_lines = open(self.input_file, 'U')

        obs_dict, obs_test_name = \
            parse_beta_significance_output_each_sample(bs_lines)

        exp_dict = {
            's1': (0.01, 0.15),
            's2': (0.0, 0.01),
            's3': (0.02, 0.3),
            's4': (0.82, 1.0)
        }
        exp_test_name = "Comment with the name of the test realized"

        self.assertEqual(obs_dict, exp_dict)
        self.assertEqual(obs_test_name, exp_test_name)
 generates a html file containing a table showing the results."""
script_info['script_usage'] = [
    ("Example",
     "Generate a html file named 'index.html' with a table showing " +
     "the beta significance test results represented in 'beta_output.txt'",
     "%prog -i beta_output.txt -o index.html")
]
script_info['output_description'] = ""
script_info['required_options'] = [
    make_option('-i',
                '--input_fp',
                type="existing_filepath",
                help='Beta significance output filepath'),
    make_option('-o',
                '--output_html_fp',
                type="new_filepath",
                help='Html filepath')
]
script_info['optional_options'] = []
script_info['version'] = __version__

if __name__ == '__main__':
    option_parser, opts, args = parse_command_line_parameters(**script_info)
    bs_fp = opts.input_fp
    html_fp = opts.output_html_fp

    bs_lines = open(bs_fp, 'U')

    dict_data, test_name = parse_beta_significance_output_each_sample(bs_lines)

    make_html_file(dict_data, test_name, html_fp)
script_info = {}
script_info['brief_description'] = """Generates a html file with a table\
 showing the beta significance output test (each sample individually)."""
script_info['script_description'] = """Takes a beta significance each sample\
 individually test output file (file output of beta_significance.py) and\
 generates a html file containing a table showing the results."""
script_info['script_usage'] = [
    ("Example", "Generate a html file named 'index.html' with a table showing "+
        "the beta significance test results represented in 'beta_output.txt'",
        "%prog -i beta_output.txt -o index.html")
]
script_info['output_description'] = ""
script_info['required_options'] = [
    make_option('-i', '--input_fp', type="existing_filepath",
                help='Beta significance output filepath'),
    make_option('-o', '--output_html_fp', type="new_filepath",
                help='Html filepath')
]
script_info['optional_options'] = []
script_info['version'] = __version__

if __name__ == '__main__':
    option_parser, opts, args = parse_command_line_parameters(**script_info)
    bs_fp = opts.input_fp
    html_fp = opts.output_html_fp

    bs_lines = open(bs_fp, 'U')

    dict_data, test_name = parse_beta_significance_output_each_sample(bs_lines)

    make_html_file(dict_data, test_name, html_fp)