# Initialize a calculator: normalize = False params_file = 'published params.csv' with open(params_file, 'rb') as f: reader = csv.reader(f) calc = zenergy.Calculator(reader, normalize = normalize) print('Calculator created with normalize set to {}, ' + 'and parameters from {}... '.format(normalize, params_file) \ + repr(type(calc))) # Load matrix: matrix_file = 'identity.csv' with open(matrix_file, 'rb') as f: reader = csv.reader(f) identity = matrices.retrieve_matrix(reader) print('Retrieved matrix from {}... '.format(matrix_file) \ + repr(type(identity))) # The slow part, open the structures: structure_files = file_dict('structures with 1qd5', ['aligned_(1QD6).pdb', 'aligned_(1QJP).pdb', 'aligned_(1A0S).pdb']) parser = PDBParser() with warnings.catch_warnings(): warnings.simplefilter('ignore') structures = [parser.get_structure(id_, path) \ for id_, path in structure_files.items()]
for filename in (protein + ' bbtm.aln', protein + ' gonnet.aln'): alignment = Bio.AlignIO.read(filename, 'clustal') oracle = AlignmentOracle(alignment, pdb_name = 'chaina') abridged = dict() for i in range(len(alignment)): abridged.update({oracle.data[i].id: (''.join(oracle.sequence(i)))}) abridged_dicts.append(abridged) bbtm_alignments.update({protein: abridged_dicts[0]}) gonnet_alignments.update({protein: abridged_dicts[1]}) with open('identity.csv', 'rb') as f: id_matrix = matrices.retrieve_matrix(csv.reader(f)) def check_range(start, end, protein): # Observe what positions of each protein in the gonnet alignment and the # bbtm alignment correspond to a given range in the pdb sequence. # Positions ocrresponding to gaps in the pdb sequence not shown. print('name then seq distance then bbtm segment then gonnet segment') pdb_seq_name = 'chaina_' + protein.lower() for name in bbtm_alignments[protein].keys(): print(name) print(matrices.compare(bbtm_alignments[protein][name], bbtm_alignments[protein][pdb_seq_name], id_matrix)) print(matrices.compare(gonnet_alignments[protein][name], gonnet_alignments[protein][pdb_seq_name], id_matrix))