def generate_data_make_html(bs_lines):
    """Parses the beta significance file and returns the info in a list of dicts

    Inputs:
        bs_lines: beta significance results open file object

    Returns list of dicts of:
        {
            LD_NAME: plot_name,
            LD_HEADERS: {LD_HEADERS_VER:[], LD_HEADERS_HOR:[]},
            LD_MATRIX : list of lists containing the float values to plot
            LD_TRANSFORM_VALUES: {(val1, val2) : (plot_value, label)}
                must have a key of form (None, None)
                Is a dictionary which allows to transform the continue
                matrix values into a discrete values to plot.
            LD_TABLE_TITLE: table_title
        }
        Contains all the needed information to generate the html file.
    """
    result = []

    dict_data, test_name = parse_beta_significance_output_pairwise(bs_lines)

    raw_headers, raw_matrix = generate_headers_and_matrix(dict_data, 0)
    corr_headers, corr_matrix = generate_headers_and_matrix(dict_data, 1)

    result.append(
        generate_dict_data("Raw values", raw_headers, raw_matrix, test_name))
    result.append(
        generate_dict_data("Corrected values", corr_headers, corr_matrix,
                           test_name))

    return result
def generate_data_make_html(bs_lines):
    """Parses the beta significance file and returns the info in a list of dicts

    Inputs:
        bs_lines: beta significance results open file object

    Returns list of dicts of:
        {
            LD_NAME: plot_name,
            LD_HEADERS: {LD_HEADERS_VER:[], LD_HEADERS_HOR:[]},
            LD_MATRIX : list of lists containing the float values to plot
            LD_TRANSFORM_VALUES: {(val1, val2) : (plot_value, label)}
                must have a key of form (None, None)
                Is a dictionary which allows to transform the continue
                matrix values into a discrete values to plot.
            LD_TABLE_TITLE: table_title
        }
        Contains all the needed information to generate the html file.
    """
    result = []

    dict_data, test_name = parse_beta_significance_output_pairwise(bs_lines)

    raw_headers, raw_matrix = generate_headers_and_matrix(dict_data, 0)
    corr_headers, corr_matrix = generate_headers_and_matrix(dict_data, 1)

    result.append(generate_dict_data("Raw values", raw_headers, raw_matrix,
        test_name))
    result.append(generate_dict_data("Corrected values", corr_headers,
        corr_matrix, test_name))

    return result
Пример #3
0
    def test_parse_beta_significance_output_pairwise(self):
        """The pairwise beta significance parser works"""
        out = open(self.input_file, 'w')
        out.write(bs_lines_pairwise)
        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_pairwise(bs_lines)

        exp_dict = {
            ('s1', 's2'): (0.01, 0.15),
            ('s1', 's3'): (0.0, 0.01),
            ('s1', 's4'): (0.02, 0.3),
            ('s2', 's3'): (0.82, 1.0),
            ('s2', 's4'): (0.4, 1.0),
            ('s3', 's4'): (0.0, 0.01)
        }
        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)
Пример #4
0
    def test_parse_beta_significance_output_pairwise(self):
        """The pairwise beta significance parser works"""
        out = open(self.input_file, "w")
        out.write(bs_lines_pairwise)
        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_pairwise(bs_lines)

        exp_dict = {
            ("s1", "s2"): (0.01, 0.15),
            ("s1", "s3"): (0.0, 0.01),
            ("s1", "s4"): (0.02, 0.3),
            ("s2", "s3"): (0.82, 1.0),
            ("s2", "s4"): (0.4, 1.0),
            ("s3", "s4"): (0.0, 0.01),
        }
        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)