Exemplo n.º 1
0
 def check_inside_trusted(self, edge):
     rep_id1, cluster_id1 = edge.begin
     rep_id2, cluster_id2 = edge.end
     if self.evaluator.close_components[rep_id1][cluster_id1] != \
             self.evaluator.close_components[rep_id2][cluster_id2]:
         return False
     if edge.conn_type == ConnectionType.distant and \
             align_sequences(self.evaluator.repertoires[rep_id1].clusters[cluster_id1].seq,
                             self.evaluator.repertoires[rep_id2].clusters[cluster_id2].seq,
                             self.max_errors).errors > self.max_errors:
         return False
     return True
def write_single_alignment(handler, evaluator, rep_id1, cluster_id1,
                           rep_id2, cluster_id2, for_group):
    seq1 = evaluator.repertoires[rep_id1].clusters[cluster_id1].seq
    seq2 = evaluator.repertoires[rep_id2].clusters[cluster_id2].seq
    size2 = evaluator.repertoires[rep_id2].clusters[cluster_id2].size
    alignment = string_utils.align_sequences(seq1, seq2)
    handler.write('    ' +
        ((str(rep_id1 + 1) + '.' + str(cluster_id1) + ' - ') if for_group else '') +
        str(rep_id2 + 1) + '.' + str(cluster_id2) +
        ('' if for_group else '(size = ' + str(size2) + ')') + ' shares ' +
        str(len(evaluator.connections[rep_id1][rep_id2][cluster_id1][cluster_id2].reads)) +
        ': score = ' + str(alignment.score) + ', shift = ' + str(alignment.shift) +
        ', errors = ' + str(alignment.errors) + ', strand = ' + str(alignment.strand) + '\n')