Exemple #1
0
    def test01(self):
        alphabet = "ACTG"
        matrix = build_scoring_matrix(alphabet, 10, 4, -2)

        S = compute_alignment_matrix("AA", "TAAT", matrix, True)

        (score, x, y) = compute_local_alignment("AA", "TAAT", matrix, S)

        self.assertEqual(score, 20)
        self.assertEquals(x, "AA")
        self.assertEquals(y, "AA")
Exemple #2
0
 def test01(self):
     alphabet= "ACTG"
     matrix = build_scoring_matrix(alphabet, 10,4,-2)
     
     S = compute_alignment_matrix("AA", "TAAT", matrix, True)
     
     (score,x,y) = compute_local_alignment("AA", "TAAT", matrix, S)
     
     self.assertEqual(score,20)
     self.assertEquals(x,"AA")
     self.assertEquals(y,"AA")
                     
Exemple #3
0
def question1():
    human_eyeless_protein = read_protein(HUMAN_EYELESS_URL)
    fruitfly_eyeless_protein = read_protein(FRUITFLY_EYELESS_URL)
    
    scoring_matrix = read_scoring_matrix(PAM50_URL)
    
    alignment_matrix = compute_alignment_matrix(human_eyeless_protein, fruitfly_eyeless_protein, scoring_matrix, False)
    (score, align_human, align_fruitfly) = compute_local_alignment(human_eyeless_protein, fruitfly_eyeless_protein, scoring_matrix, alignment_matrix)
    
    print score
    print align_human
    print align_fruitfly
Exemple #4
0
def generate_null_distribution(seq_x, seq_y, scoring_matrix, num_trials):
    
    scoring_distributions = {}
    for _ in range(0,num_trials):
        l_seq_y = list(seq_y)
        random.shuffle(l_seq_y)
    
        alignment_matrix = compute_alignment_matrix(seq_x, l_seq_y, scoring_matrix, False)
        (score, _, _) = compute_local_alignment(seq_x, l_seq_y, scoring_matrix, alignment_matrix)
        
        if (score in scoring_distributions):
            scoring_distributions[score] = scoring_distributions[score] + 1
        else:
             scoring_distributions[score] = 1
             
    return scoring_distributions