def test_sulphur_bridge(): """Test sulphur bridges retention""" molfile = os.path.join(test_dir, '2qwe_Sbridge.pdb') mol = Chem.MolFromPDBFile(molfile, sanitize=False, removeHs=False) mol = PreparePDBMol(mol) atom1 = mol.GetAtomWithIdx(5) atom2 = mol.GetAtomWithIdx(11) bond = mol.GetBondBetweenAtoms(atom1.GetIdx(), atom2.GetIdx()) assert atom1.GetPDBResidueInfo().GetName().strip() == 'SG' assert atom1.GetPDBResidueInfo().GetResidueNumber() == 92 assert atom2.GetPDBResidueInfo().GetName().strip() == 'SG' assert atom2.GetPDBResidueInfo().GetResidueNumber() == 417 assert bond is not None
def test_intraresidue_bonding(): """Test if fixer removes wrong connections within single residue""" molfile = os.path.join(test_dir, '1idg_connectivity.pdb') mol = Chem.MolFromPDBFile(molfile, sanitize=False, removeHs=False) mol = PreparePDBMol(mol) # check if N and C from GLU20 are not connected atom1 = mol.GetAtomWithIdx(11) assert atom1.GetAtomicNum() == 7 assert atom1.GetPDBResidueInfo().GetResidueName() == 'GLU' assert atom1.GetPDBResidueInfo().GetResidueNumber() == 20 atom2 = mol.GetAtomWithIdx(13) assert atom2.GetAtomicNum() == 6 assert atom2.GetPDBResidueInfo().GetResidueName() == 'GLU' assert atom2.GetPDBResidueInfo().GetResidueNumber() == 20 assert mol.GetBondBetweenAtoms(11, 13) is None # mol can be sanitized assert Chem.SanitizeMol(mol) == Chem.SanitizeFlags.SANITIZE_NONE
def test_interresidue_bonding(): """Test if fixer removes wrong connections between residues""" molfile = os.path.join(test_dir, '4e6d_residues.pdb') mol = Chem.MolFromPDBFile(molfile, sanitize=False, removeHs=False) mol = PreparePDBMol(mol) # check if O from PRO atom1 = mol.GetAtomWithIdx(11) assert atom1.GetAtomicNum() == 8 assert atom1.GetPDBResidueInfo().GetResidueName() == 'PRO' # ...and N from GLN atom2 = mol.GetAtomWithIdx(22) assert atom2.GetAtomicNum() == 7 assert atom2.GetPDBResidueInfo().GetResidueName() == 'GLN' # ...are not connected assert mol.GetBondBetweenAtoms(11, 22) is None # mol can be sanitized assert Chem.SanitizeMol(mol) == Chem.SanitizeFlags.SANITIZE_NONE
def test_ring(): """Test if fixer adds missing bond in ring""" molfile = os.path.join(test_dir, '4yzm_ring.pdb') mol = Chem.MolFromPDBFile(molfile, sanitize=False, removeHs=False) mol = PreparePDBMol(mol) # check if there is double bond between N and C from MSE atom1 = mol.GetAtomWithIdx(12) assert atom1.GetAtomicNum() == 6 assert atom1.GetPDBResidueInfo().GetResidueName() == 'PHE' atom2 = mol.GetAtomWithIdx(13) assert atom2.GetAtomicNum() == 6 assert atom2.GetPDBResidueInfo().GetResidueName() == 'PHE' # there is a bond and it is aromatic bond = mol.GetBondBetweenAtoms(12, 13) assert bond is not None assert_almost_equal(bond.GetBondTypeAsDouble(), 1.5) # mol can be sanitized assert Chem.SanitizeMol(mol) == Chem.SanitizeFlags.SANITIZE_NONE
def test_bondtype(): """Test if fixer deals with non-standard residue and fixes bond types""" molfile = os.path.join(test_dir, '3rsb_bondtype.pdb') mol = Chem.MolFromPDBFile(molfile, sanitize=False, removeHs=False) mol = PreparePDBMol(mol) # check if there is double bond between N and C from MSE atom1 = mol.GetAtomWithIdx(13) assert atom1.GetAtomicNum() == 6 assert atom1.GetPDBResidueInfo().GetResidueName() == 'MSE' atom2 = mol.GetAtomWithIdx(14) assert atom2.GetAtomicNum() == 8 assert atom2.GetPDBResidueInfo().GetResidueName() == 'MSE' # there is a bond and it is double bond = mol.GetBondBetweenAtoms(13, 14) assert bond is not None assert_almost_equal(bond.GetBondTypeAsDouble(), 2.0) # mol can be sanitized assert Chem.SanitizeMol(mol) == Chem.SanitizeFlags.SANITIZE_NONE