def test_present_for_all_same_seq(): yaml_file = load_yaml_file(os.path.join(base_dir,"mdl_dir","project.yaml")) aligned_dict={} for protein in yaml_file["protein_list"]: t = load_random_traj(yaml_file, protein) aligned_dict[protein] = t.top.to_fasta(chain=0) for protein in yaml_file["protein_list"]: aligned_seq = aligned_dict[protein] prt_mapping, prt_seq =_map_residue_ind_seq_ind(yaml_file, protein, aligned_seq) assert(len(_present_for_all(protein, prt_mapping, prt_seq, aligned_dict))==len(prt_seq)) return
def test_map_residue_seq_with_insert(): yaml_file = load_yaml_file(os.path.join(base_dir,"mdl_dir","project.yaml")) aligned_dict={} for protein in yaml_file["protein_list"]: expected = {} t = load_random_traj(yaml_file, protein) expected[protein] = [i.index+3 for i in t.top.residues if i.is_protein] aligned_dict[protein] = "---"+ t.top.to_fasta(chain=0) aligned_seq = aligned_dict[protein] actual,_ =_map_residue_ind_seq_ind(yaml_file, protein, aligned_seq) assert expected[protein] == list(actual.values()) return
def test_map_residue_seq_with_insert_at_end(): yaml_file = load_yaml_file(os.path.join(base_dir,"mdl_dir","project.yaml")) aligned_dict={} for protein in yaml_file["protein_list"]: expected = {} t = load_random_traj(yaml_file, protein) #add an insertion AFTER 10 residues. We expect all but the 10 have expected[protein] = [i for i in range(t.n_residues) if t.top.residue(i).code is not None] aligned_dict[protein] = t.top.to_fasta(chain=0)+"---" aligned_seq = aligned_dict[protein] actual,_ =_map_residue_ind_seq_ind(yaml_file, protein, aligned_seq) assert expected[protein] == list(actual.values()) return
def test_map_residue_seq_with_two_inserts(): yaml_file = load_yaml_file(os.path.join(base_dir,"mdl_dir","project.yaml")) aligned_dict={} for protein in yaml_file["protein_list"]: expected = {} t = load_random_traj(yaml_file, protein) #add an insertion AFTER 10 residues. and then again at 20 expected[protein] = [i for i in range(10) if t.top.residue(i).code is not None] + \ [i+3 for i in range(10, 20) if t.top.residue(i).code is not None]+\ [i+5 for i in range(20, t.n_residues) if t.top.residue(i).code is not None] prt_code = t.top.to_fasta(chain=0) aligned_dict[protein] = prt_code[:10]+\ "---"+ \ prt_code[10:20]+\ "--"+ \ prt_code[20:] aligned_seq = aligned_dict[protein] actual,_ =_map_residue_ind_seq_ind(yaml_file, protein, aligned_seq) assert expected[protein] == list(actual.values()) return