Example #1
0
    def test_zscore(self):
        #TODO split plate control and vehicle control into two functions
        r = norm.normalize(l)
        zv = zscore.calculate_zscore(r, plate_control=False)
        zp = zscore.calculate_zscore(r, plate_control=True)

        assert round(zv.data_df['test_CS0_X1:A'][0], 4) == -10.0
        assert round(zv.data_df['test_CS0_X1:B'][2], 4) == -5.5729
        assert round(zv.data_df['test_CS0_X1:D'][1], 4) == 0.6745

        assert round(zp.data_df['test_CS0_X1:A'][0], 4) == -0.903
        assert round(zp.data_df['test_CS0_X1:B'][2], 4) == -0.7558
        assert round(zp.data_df['test_CS0_X1:D'][1], 4) == 0.8159
Example #2
0
def normalize_data():

    global data_matrix
    global progressbar_total

    sample_length = len(data_matrix[0])
    sample_count = len(data_matrix)

    for attribute_index in range(sample_length - 1):

        attribute_list = list()
        normalized_attribute_list = list()

        for sample_index in range(sample_count):
            attribute_list.append(data_matrix[sample_index][attribute_index])

        for attribute in attribute_list:

            z_score = zscore.calculate_zscore(attribute, attribute_list)
            rounded_zscore = math.ceil(z_score * 100000) / 100000
            normalized_attribute_list.append(rounded_zscore)

        for sample_index in range(sample_count):
            data_matrix[sample_index][
                attribute_index] = normalized_attribute_list[sample_index]

    progressbar.show(7,
                     progressbar_total,
                     prefix='Progress:',
                     suffix='Complete',
                     length=50)
Example #3
0
    def test_modz(self):
        l2 = pe(
            'functional_tests/test_merino/assemble/test_CS0_X2/test_CS0_X2_MEDIAN.gct'
        )
        l3 = pe(
            'functional_tests/test_merino/assemble/test_CS0_X3/test_CS0_X3_MEDIAN.gct'
        )

        r = norm.normalize(l)
        r2 = norm.normalize(l2)
        r3 = norm.normalize(l3)

        z = zscore.calculate_zscore(r, plate_control=True)
        z2 = zscore.calculate_zscore(r2, plate_control=True)
        z3 = zscore.calculate_zscore(r3, plate_control=True)

        modz_gct, ccq74, weights = distil.calculate_modz([z, z2, z3])

        assert round(modz_gct.data_df['test_CS0X1:A'][0], 4) == -0.5816
        assert round(modz_gct.data_df['test_CS0X1:B'][2], 4) == -0.4991
        assert round(modz_gct.data_df['test_CS0X1:D'][1], 4) == 1.001