Exemple #1
0
            main_neighbor_situations = main_neighbor_situations_inside
        for score_term in interesting_score_terms:
            for neighbor_situation in main_neighbor_situations:
                mean = statistics_collector_from_archive.calculate_averages_and_stddevs_from_subset(aminoacid, score_term, neighbor_situation)[0]
                stddev = statistics_collector_from_archive.calculate_averages_and_stddevs_from_subset(aminoacid, score_term, neighbor_situation)[1]
                number_of_residues = len(statistics_collector_from_archive.restype_av_scores[aminoacid].get_merged_list_for_ncounts(score_term, neighbor_situation))
                statistics_collector_from_archive.restype_av_scores[aminoacid].make_histogram_for_scoreterm_for_ncounts(score_term, neighbor_situation, number_of_residues, histogram_location, mean, stddev)

if not (pdb_file == '' and pdb_file_2 == ''):
    for score_term_z in interesting_score_terms:
        print '\n---------Calculation of z scores for %s-------------------------' % score_term_z
        if '+' in score_term_z or '-' in score_term_z:
            statistics_collector_from_archive.calculate_combined_score_terms(score_term_z)
        if pdb_file != '' and pdb_file_2 == '':
            print 'z-scores:'
            reference_z_scores = ZScoreCalculator(pdb_file, statistics_collector_from_archive)
            zscores = reference_z_scores.calculate_z_scores(score_term_z)
            for i in reference_z_scores.z_sorted:
                print i
        elif pdb_file!= '' and pdb_file_2 != '':
            print 'difference in z scores'
            reference_z_scores = ZScoreCalculator(pdb_file, statistics_collector_from_archive)
            z_scores_after_modification = ZScoreCalculator(pdb_file_2, statistics_collector_from_archive)
            delta_z = reference_z_scores.calculate_differences_in_z_scores(z_scores_after_modification, score_term_z)
            for i in range(len(delta_z)):
                print '%s   %s   %s' %(delta_z[i][0], delta_z[i][1], delta_z[i][2])
            print 'position with worst shift: %s (%s) \nposition with best shift: %s (%s)' %(z_scores_after_modification.position_positive_shift, round(z_scores_after_modification.value_pos,4), z_scores_after_modification.position_negative_shift, round(z_scores_after_modification.value_neg,4))
            if goodz != '':
                z_scores_after_modification.get_goodz(goodz)
            if badz != '':
                z_scores_after_modification.get_badz(badz)

#subtraction of score_terms ----  important for subtraction of fa_dun from total
minuend = 'total'
subtrahend = 'fa_dun'
for aminoacid in aminoacids:
    statistics_collector_from_archive.restype_av_scores[aminoacid].subtract_score_terms(minuend, subtrahend)


error_z = False


pdb_file = '11ba_nohet_1_relax_mod.pdb'
pdb_file_2 = '11ba_nohet_1_relax_mod_for_z_score_calculator.pdb'

reference_z_scores = ZScoreCalculator(pdb_file, statistics_collector_from_archive)
z_scores_after_modification = ZScoreCalculator(pdb_file_2, statistics_collector_from_archive)



mutations = 0
for line in reference_z_scores.calculate_differences_in_z_scores(z_scores_after_modification, 'total'):
    print line
    if line[2] == 'mutation':
        mutations += 1
if mutations != 2:
    error_z = True

#print 'total number of mutations:%s' %mutations

if z_scores_after_modification.position_positive_shift != str(57) or z_scores_after_modification.position_negative_shift != str(23):