Пример #1
0
def consensus_alignment(scoring_matrix, align_sequence):
    '''
    compute the similarity of the two sequences in the local alignment computed to
    the PAX Domain.
    global alignment of local align_x vs PAX Domain, local align_y vs PAX Domain
    return the alignment and the persentage of elements in these two sequences that agree
    '''
    pax_domain = read_protein('ConsensusPAXDomain.txt')

    align_sequence = align_sequence.replace("-", "")
    alignment_matrix = compute_alignment_matrix(seq_x=align_sequence,
                                                seq_y=pax_domain,
                                                scoring_matrix=scoring_matrix,
                                                global_flag=True)
    score, global_align_sequence, global_align_pax = compute_global_alignment(
        seq_x=align_sequence,
        seq_y=pax_domain,
        scoring_matrix=scoring_matrix,
        alignment_matrix=alignment_matrix)
    seq = difflib.SequenceMatcher(None, global_align_sequence,
                                  global_align_pax)
    ratio = seq.ratio()
    #import pdb; pdb.set_trace()

    return global_align_sequence, ratio
Пример #2
0
def get_edit_distance(seq_x, seq_y, scoring_matrix):
    '''
    compute the seq_x and seq_y global alignment with scoring matrix
    return the edit distance can be expressed in term of:
    |x| + |y| - score(x, y)
    '''
    alignment_matrix = compute_alignment_matrix(seq_x, seq_y, scoring_matrix, True)
    score, align_x, align_y = compute_global_alignment(seq_x, seq_y, scoring_matrix, alignment_matrix)
    return len(seq_x) + len(seq_y) - score
Пример #3
0
def get_edit_distance(seq_x, seq_y, scoring_matrix):
    '''
    compute the seq_x and seq_y global alignment with scoring matrix
    return the edit distance can be expressed in term of:
    |x| + |y| - score(x, y)
    '''
    alignment_matrix = compute_alignment_matrix(seq_x, seq_y, scoring_matrix,
                                                True)
    score, align_x, align_y = compute_global_alignment(seq_x, seq_y,
                                                       scoring_matrix,
                                                       alignment_matrix)
    return len(seq_x) + len(seq_y) - score
Пример #4
0
def consensus_alignment(scoring_matrix, align_sequence):
    '''
    compute the similarity of the two sequences in the local alignment computed to
    the PAX Domain.
    global alignment of local align_x vs PAX Domain, local align_y vs PAX Domain
    return the alignment and the persentage of elements in these two sequences that agree
    '''
    pax_domain = read_protein('ConsensusPAXDomain.txt')

    align_sequence = align_sequence.replace("-", "")
    alignment_matrix = compute_alignment_matrix(seq_x=align_sequence, seq_y=pax_domain, scoring_matrix=scoring_matrix, global_flag=True)
    score, global_align_sequence, global_align_pax = compute_global_alignment(seq_x=align_sequence, seq_y=pax_domain, scoring_matrix=scoring_matrix, alignment_matrix=alignment_matrix)
    seq = difflib.SequenceMatcher(None, global_align_sequence, global_align_pax)
    ratio = seq.ratio()
    #import pdb; pdb.set_trace()

    
    return global_align_sequence, ratio