def test_dihedral_backbone_result(file_name): import mdtraj mmtf_file = mmtf.MMTFFile() mmtf_file.read(file_name) array = mmtf.get_structure(mmtf_file, model=1) array = array[struc.filter_amino_acids(array)] for chain in struc.chain_iter(array): print("Chain: ", chain.chain_id[0]) if len(struc.check_id_continuity(chain)) != 0: # Do not test discontinuous chains return test_phi, test_psi, test_ome = struc.dihedral_backbone(chain) temp_file_name = biotite.temp_file("pdb") strucio.save_structure(temp_file_name, chain) traj = mdtraj.load(temp_file_name) _, ref_phi = mdtraj.compute_phi(traj) _, ref_psi = mdtraj.compute_psi(traj) _, ref_ome = mdtraj.compute_omega(traj) ref_phi, ref_psi, ref_ome = ref_phi[0], ref_psi[0], ref_ome[0] assert test_phi[1:] == pytest.approx(ref_phi, abs=1e-5, rel=5e-3) assert test_psi[:-1] == pytest.approx(ref_psi, abs=1e-5, rel=5e-3) assert test_ome[:-1] == pytest.approx(ref_ome, abs=1e-5, rel=5e-3)
def test_id_continuity_check(gapped_sample_array): discon = struc.check_id_continuity(gapped_sample_array) discon_array = gapped_sample_array[discon] assert discon_array.res_id.tolist() == [6]