|
5 | 5 | from sire.legacy.Mol import AtomIdx, Element, PartialMolecule |
6 | 6 |
|
7 | 7 | import BioSimSpace as BSS |
8 | | -from tests.conftest import has_amber |
| 8 | +from tests.conftest import has_amber, has_openff |
9 | 9 |
|
10 | 10 | # Store the tutorial URL. |
11 | 11 | url = BSS.tutorialUrl() |
@@ -695,3 +695,137 @@ def test_ion_merge(system): |
695 | 695 | water_coords = water._sire_object.property("coordinates").to_vector()[0] |
696 | 696 | assert coords0 == coords1 |
697 | 697 | assert coords0 == water_coords |
| 698 | + |
| 699 | + |
| 700 | +@pytest.mark.skipif(has_openff is False, reason="Requires OpenFF to be installed.") |
| 701 | +@pytest.mark.parametrize( |
| 702 | + "ligands, mapping", |
| 703 | + [ |
| 704 | + ( |
| 705 | + ("Schindler_SYK_CHEMBL3265035", "Schindler_SYK_CHEMBL3265033"), |
| 706 | + { |
| 707 | + 5: 8, |
| 708 | + 6: 32, |
| 709 | + 7: 31, |
| 710 | + 8: 11, |
| 711 | + 9: 12, |
| 712 | + 10: 13, |
| 713 | + 11: 14, |
| 714 | + 12: 15, |
| 715 | + 13: 16, |
| 716 | + 14: 17, |
| 717 | + 15: 18, |
| 718 | + 16: 19, |
| 719 | + 17: 20, |
| 720 | + 18: 21, |
| 721 | + 19: 22, |
| 722 | + 20: 23, |
| 723 | + 21: 24, |
| 724 | + 22: 25, |
| 725 | + 23: 26, |
| 726 | + 24: 27, |
| 727 | + 25: 28, |
| 728 | + 26: 29, |
| 729 | + 27: 30, |
| 730 | + 28: 10, |
| 731 | + 29: 9, |
| 732 | + 38: 53, |
| 733 | + 39: 52, |
| 734 | + 40: 43, |
| 735 | + 41: 44, |
| 736 | + 42: 45, |
| 737 | + 43: 46, |
| 738 | + 44: 47, |
| 739 | + 45: 48, |
| 740 | + 46: 49, |
| 741 | + 47: 50, |
| 742 | + 48: 51, |
| 743 | + 49: 42, |
| 744 | + 50: 41, |
| 745 | + 1: 1, |
| 746 | + 2: 4, |
| 747 | + 34: 36, |
| 748 | + 33: 35, |
| 749 | + 3: 3, |
| 750 | + 4: 34, |
| 751 | + 35: 1, |
| 752 | + 0: 6, |
| 753 | + 32: 37, |
| 754 | + 31: 7, |
| 755 | + 36: 33, |
| 756 | + }, |
| 757 | + ), |
| 758 | + ( |
| 759 | + ("Schindler_SYK_CHEMBL3265035", "Schindler_SYK_CHEMBL3265036"), |
| 760 | + { |
| 761 | + 5: 7, |
| 762 | + 6: 31, |
| 763 | + 7: 30, |
| 764 | + 8: 10, |
| 765 | + 9: 11, |
| 766 | + 10: 12, |
| 767 | + 11: 13, |
| 768 | + 12: 14, |
| 769 | + 13: 15, |
| 770 | + 14: 16, |
| 771 | + 15: 17, |
| 772 | + 16: 18, |
| 773 | + 17: 19, |
| 774 | + 18: 20, |
| 775 | + 19: 21, |
| 776 | + 20: 22, |
| 777 | + 21: 23, |
| 778 | + 22: 24, |
| 779 | + 23: 25, |
| 780 | + 24: 26, |
| 781 | + 25: 27, |
| 782 | + 26: 28, |
| 783 | + 27: 29, |
| 784 | + 28: 9, |
| 785 | + 29: 8, |
| 786 | + 38: 54, |
| 787 | + 39: 53, |
| 788 | + 40: 44, |
| 789 | + 41: 45, |
| 790 | + 42: 46, |
| 791 | + 43: 47, |
| 792 | + 44: 48, |
| 793 | + 45: 49, |
| 794 | + 46: 50, |
| 795 | + 47: 51, |
| 796 | + 48: 52, |
| 797 | + 49: 43, |
| 798 | + 50: 42, |
| 799 | + 0: 4, |
| 800 | + 1: 5, |
| 801 | + 2: 6, |
| 802 | + 3: 0, |
| 803 | + 4: 1, |
| 804 | + 30: 3, |
| 805 | + 31: 39, |
| 806 | + 32: 38, |
| 807 | + 33: 40, |
| 808 | + 34: 41, |
| 809 | + 35: 32, |
| 810 | + 36: 33, |
| 811 | + 37: 34, |
| 812 | + }, |
| 813 | + ), |
| 814 | + ], |
| 815 | +) |
| 816 | +def test_ring_opening_and_size_change(ligands, mapping): |
| 817 | + # These perturbations involve ring formation (acyclic atoms in mol0 become |
| 818 | + # ring members in mol1) combined with ring size changes in the existing |
| 819 | + # fused bicyclic core. Check that the merge succeeds when both flags are |
| 820 | + # allowed. |
| 821 | + m0 = BSS.IO.readMolecules(f"{url}/{ligands[0]}.sdf.bz2")[0] |
| 822 | + m1 = BSS.IO.readMolecules(f"{url}/{ligands[1]}.sdf.bz2")[0] |
| 823 | + |
| 824 | + m0 = BSS.Parameters.openff_unconstrained_2_1_1(m0).getMolecule() |
| 825 | + m1 = BSS.Parameters.openff_unconstrained_2_1_1(m1).getMolecule() |
| 826 | + |
| 827 | + m0 = BSS.Align.rmsdAlign(m0, m1, mapping) |
| 828 | + |
| 829 | + BSS.Align.merge( |
| 830 | + m0, m1, mapping, allow_ring_breaking=True, allow_ring_size_change=True |
| 831 | + ) |
0 commit comments