def test_get_structure_alignment_molsysmt_MolSys_1(): molsys_1 = msm.convert(msm.demo['T4 lysozyme L99A']['181l.msmpk'], to_form='molsysmt.MolSys') molsys_1 = msm.extract(molsys_1, selection='molecule_type=="protein"') molsys_2 = msm.convert(msm.demo['T4 lysozyme L99A']['1l17.msmpk'], to_form='molsysmt.MolSys') molsys_2 = msm.convert(molsys_2, to_form='molsysmt.MolSys', selection='molecule_type=="protein"') molsys_2on1 = msm.structure.align(molsys_2, selection='backbone', reference_molecular_system=molsys_1, reference_selection='backbone') identity, int2, int1 = msm.topology.get_sequence_identity( molsys_2, reference_molecular_system=molsys_1) aux1 = msm.select(molsys_1, selection='group_index==@int1') sel1 = msm.select(molsys_1, selection='backbone', mask=aux1) aux2 = msm.select(molsys_2, selection='group_index==@int2') sel2 = msm.select(molsys_2, selection='backbone', mask=aux2) rmsd = msm.structure.get_rmsd(molsys_2on1, selection=sel2, reference_molecular_system=molsys_1, reference_selection=sel1) check = math.isclose(0.021332505947, msm.puw.get_value(rmsd, to_unit='nm')[0]) print(msm.puw.get_value(rmsd, to_unit='nm')[0]) assert check
def set_parameters(self, selection='atom_type!="H"', syntaxis='MolSysMT'): from molsysmt import select self._selection = selection self._syntaxis = syntaxis self._atom_indices = select(self._explorer, selection=selection, syntaxis=syntaxis)
def test_select_12(): molsys = msm.convert(msm.demo['TcTIM']['1tcd.msmpk'], to_form='molsysmt.MolSys') output = msm.select( molsys, 'molecule_type=="water" and molecule_index==[100,101]') true_output = np.array([3917, 3918]) assert np.all(output == true_output)
def test_select_9(): molsys = msm.convert(msm.demo['TcTIM']['1tcd.msmpk'], to_form='molsysmt.MolSys') output = msm.select(molsys, 'atom_name!=["CA","CB","C"] and group_index==[2,3]') true_output = np.array([16, 19, 21, 22, 23, 24, 25, 28, 30, 31]) assert np.all(output == true_output)
def _initialize(self, exploration_campaign): topology = exploration_campaign.explorer.topology if self._selection is not 'all': self._atom_indices = msm.select(topology, selection=self._selection, syntaxis=self._syntaxis) self.topology = msm.convert(topology, to_form='molsysmt.Topology', selection=self._atom_indices) else: self._atom_indices = 'all' self.topology = msm.convert(topology, to_form='molsysmt.Topology') if self._step: self.step = [] if self._coordinates: self.coordinates = [] * unit.nanometers if self._boxVectors: self.box = [] * unit.nanometers if self._potentialEnergy: self.potential_energy = [] * unit.kilojoules_per_mole self._initialized = True
def test_select_32(): molsys = msm.convert(msm.demo['TcTIM']['1tcd.msmpk'], to_form='molsysmt.MolSys') output = msm.select( molsys, 'chain_id=="A" within 0.3 nm with pbc of chain_id=="B"') true_output = np.array([89, 480, 527, 547, 550, 552, 554, 566, 723, 734]) assert np.all(output == true_output)
def test_select_5(): molsys = msm.convert(msm.demo['TcTIM']['1tcd.msmpk'], to_form='molsysmt.MolSys') output = msm.select( molsys, 'atom_name in ["CA","CB"] and group_index == [0,1,2,3]') true_output = np.array([1, 4, 10, 13, 17, 20, 26, 29]) assert np.all(output == true_output)
def test_select_18(): molsys = msm.convert(msm.demo['TcTIM']['1tcd.msmpk'], to_form='molsysmt.MolSys') indices = list(range(10, 30)) output = msm.select(molsys, 'atom_name=="C" and atom_index in @indices') true_output = np.array([11, 18, 27]) assert np.all(output == true_output)
def test_select_19(): molsys = msm.convert(msm.demo['TcTIM']['1tcd.msmpk'], to_form='molsysmt.MolSys') indices = [0, 100, 200] output = msm.select(molsys, 'group_index==@indices', target='group') true_output = np.array([0, 100, 200]) assert np.all(output == true_output)
def test_select_15(): molsys = msm.convert(msm.demo['TcTIM']['1tcd.msmpk'], to_form='molsysmt.MolSys') indices = [10, 11, 12] output = msm.select(molsys, 'group_index==@indices and atom_name=="N"') true_output = np.array([77, 86, 92]) assert np.all(output == true_output)
def test_select_4(): molsys = msm.convert(msm.demo['TcTIM']['1tcd.msmpk'], to_form='molsysmt.MolSys') output = msm.select(molsys, 'atom_name == "C" and group_index == [0,1,2,3]') true_output = np.array([2, 11, 18, 27]) assert np.all(output == true_output)
def test_select_30(): molsys = msm.convert(msm.demo['TcTIM']['1tcd.msmpk'], to_form='molsysmt.MolSys') output = msm.select( molsys, 'chain_id=="A" not within 7.8 nanometers of chain_id=="B"') true_output = np.array([1521, 1522, 1723, 1724]) assert np.all(output == true_output)
def test_select_3(): molsys = msm.convert(msm.demo['TcTIM']['1tcd.msmpk'], to_form='molsysmt.MolSys') output = msm.select(molsys, target='molecule', selection=[3900, 3910, 3920]) true_output = np.array([83, 93, 103]) assert np.all(output == true_output)
def test_select_22(): molsys = msm.convert(msm.demo['TcTIM']['1tcd.msmpk'], to_form='molsysmt.MolSys') output = msm.select(molsys, 'chain_id==["A","C"] and molecule_type!="water"', target='group') true_output = np.array(list(range(248))) assert np.all(output == true_output)
def test_select_20(): molsys = msm.convert(msm.demo['TcTIM']['1tcd.msmpk'], to_form='molsysmt.MolSys') output = msm.select(molsys, 'group_name=="ALA" and group_index==[2,3,4,5,6,7]', target='group') true_output = np.array([5, 6, 7]) assert np.all(output == true_output)
def test_select_2(): molsys = msm.convert(msm.demo['TcTIM']['1tcd.msmpk'], to_form='molsysmt.MolSys') output = msm.select(molsys, target='group', selection=[0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11]) true_output = np.array([0, 1]) assert np.all(output == true_output)
def test_select_16(): molsys = msm.convert(msm.demo['TcTIM']['1tcd.msmpk'], to_form='molsysmt.MolSys') indices = list(range(10, 20)) atoms = ["CA", "C", "O", "N"] output = msm.select(molsys, 'atom_name==@atoms & atom_index==@indices') true_output = np.array([10, 11, 12, 16, 17, 18, 19]) assert np.all(output == true_output)
def test_select_13(): molsys = msm.convert(msm.demo['TcTIM']['1tcd.msmpk'], to_form='molsysmt.MolSys') output = msm.select( molsys, 'molecule_type=="protein" and atom_type!="H" and group_index==3') true_output = np.array([25, 26, 27, 28, 29, 30, 31]) assert np.all(output == true_output)
def test_select_39(): molsys = msm.convert(msm.demo['TcTIM']['1tcd.msmpk'], to_form='molsysmt.MolSys') output = msm.select(molsys, selection='group_index==[3,4,5]', to_syntaxis='NGLView') true_output = '@25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44' assert np.all(output == true_output)
def test_select_8(): molsys = msm.convert(msm.demo['TcTIM']['1tcd.msmpk'], to_form='molsysmt.MolSys') output = msm.select( molsys, 'atom_type=="C" and not atom_name=="CA" and group_index==[2,3]') true_output = np.array([18, 20, 21, 22, 27, 29, 30, 31]) assert np.all(output == true_output)
def test_select_40(): molsys = msm.convert(msm.demo['TcTIM']['1tcd.msmpk'], to_form='molsysmt.MolSys') output = msm.select(molsys, selection='group_index==[3,4,5]', to_syntaxis='MDTraj') true_output = 'index 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44' assert np.all(output == true_output)
def test_select_34(): molsys = msm.convert(msm.demo['TcTIM']['1tcd.msmpk'], to_form='molsysmt.MolSys') output = msm.select( molsys, '(atom_name=="CA" and chain_id=="A") within 0.5 nm of (atom_name=="CA" and chain_id=="B")', target='group') true_output = np.array([10, 42, 62, 72, 73]) assert np.all(output == true_output)
def test_select_28(): molsys = msm.convert(msm.demo['TcTIM']['1tcd.msmpk'], to_form='molsysmt.MolSys') output = msm.select(molsys, 'group_index in [0,1,2,3,4]', mask=[0, 1, 2], target='group') true_output = np.array([0, 1, 2]) assert np.all(output == true_output)
def test_select_42(): molsys = msm.convert(msm.demo['TcTIM']['1tcd.msmpk'], to_form='molsysmt.MolSys') output = msm.select(molsys, target='group', selection='group_index==[3,4,5]', to_syntaxis='MDTraj') true_output = 'resid 3 4 5' assert np.all(output == true_output)
def test_select_41(): molsys = msm.convert(msm.demo['TcTIM']['1tcd.msmpk'], to_form='molsysmt.MolSys') output = msm.select(molsys, target='group', selection='group_index==[3,4,5]', to_syntaxis='NGLView') true_output = '7:A 8:A 9:A' assert np.all(output == true_output)
def test_select_14(): molsys = msm.convert(msm.demo['TcTIM']['1tcd.msmpk'], to_form='molsysmt.MolSys') output = msm.select( molsys, 'group_name==["GLY","ALA","VAL"] and chain_id=="A" and group_index==[2,3,4,5,6]' ) true_output = np.array([40, 41, 42, 43, 44, 45, 46, 47, 48, 49]) assert np.all(output == true_output)
def test_select_38(): molsys = msm.convert(msm.demo['TcTIM']['1tcd.msmpk'], to_form='molsysmt.MolSys') output = msm.select( molsys, '((atom_name=="N" and chain_id=="A") bonded to atom_type=="C") within 3 angstroms of (atom_type=="O" and molecule_type=="water")' ) true_output = np.array([119, 213, 473, 531, 654, 696, 799, 1049]) assert np.all(output == true_output)
def test_select_37(): molsys = msm.convert(msm.demo['TcTIM']['1tcd.msmpk'], to_form='molsysmt.MolSys') output = msm.select( molsys, '((atom_type=="O" and chain_id=="A") bonded to (atom_type=="C" and chain_id=="A")) and group_index==[3,4]' ) true_output = np.array([28, 35]) assert np.all(output == true_output)
def test_select_36(): molsys = msm.convert(msm.demo['TcTIM']['1tcd.msmpk'], to_form='molsysmt.MolSys') output = msm.select( molsys, '(all not bonded to atom_type==["H","N","C","O"]) and molecule_type=="protein"' ) true_output = np.array([363, 1714, 2275, 3626]) assert np.all(output == true_output)
def test_select_35(): molsys = msm.convert(msm.demo['TcTIM']['1tcd.msmpk'], to_form='molsysmt.MolSys') output = msm.select( molsys, '(atom_name=="N" bonded to atom_type=="C") and group_index==[10, 11, 12]' ) true_output = np.array([77, 86, 92]) assert np.all(output == true_output)