Trees | Indices | Help |
|
---|
|
1 ############################################################################### 2 # # 3 # Copyright (C) 2012 Edward d'Auvergne # 4 # # 5 # This file is part of the program relax (http://www.nmr-relax.com). # 6 # # 7 # This program is free software: you can redistribute it and/or modify # 8 # it under the terms of the GNU General Public License as published by # 9 # the Free Software Foundation, either version 3 of the License, or # 10 # (at your option) any later version. # 11 # # 12 # This program is distributed in the hope that it will be useful, # 13 # but WITHOUT ANY WARRANTY; without even the implied warranty of # 14 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # 15 # GNU General Public License for more details. # 16 # # 17 # You should have received a copy of the GNU General Public License # 18 # along with this program. If not, see <http://www.gnu.org/licenses/>. # 19 # # 20 ############################################################################### 21 22 """System tests for testing the select and deselect user functions.""" 23 24 # relax module imports. 25 from pipe_control.mol_res_spin import spin_loop 26 from test_suite.system_tests.base_classes import SystemTestCase 27 2830 """Class for testing the select and deselect user functions.""" 3112733 """Initialise some molecule, residue and spin data for testing.""" 34 35 # Create a data pipe. 36 self.interpreter.pipe.create('spin data', 'mf') 37 38 # Add a molecule. 39 self.interpreter.molecule.create(mol_name='X', mol_type='protein') 40 41 # Add some residues. 42 self.interpreter.residue.create(1, 'a') 43 self.interpreter.residue.create(2, 'b') 44 self.interpreter.residue.create(3, 'c') 45 46 # Add some spins. 47 for i in range(3): 48 self.interpreter.spin.create('C', res_num=i+1) 49 self.interpreter.spin.create('N', res_num=i+1) 50 self.interpreter.spin.create('H', res_num=i+1)51 5254 """Check if the given selection matches the spin selections. 55 56 @param selection: The list of spin selections in the spin order created in the setUp() method. 57 @type selection: list of bool 58 """ 59 60 # Loop over the spins. 61 i = 0 62 for spin, spin_id in spin_loop(return_id=True): 63 # Print out. 64 print("Checking the selection state of spin '%s'." % spin_id) 65 66 # Check. 67 self.assertEqual(selection[i], spin.select) 68 69 # Increment the counter. 70 i += 171 7274 """Check the operation of the deselect.all user function.""" 75 76 # The user function. 77 self.interpreter.deselect.all() 78 79 # Check the data. 80 self.check_spin_selection([False]*9)81 8284 """Check the operation of the select.domain user function using the AND boolean.""" 85 86 # First deselect some spins. 87 self.interpreter.deselect.spin(":1@C") 88 self.interpreter.deselect.spin(":2@H") 89 self.interpreter.deselect.spin(":2@C") 90 self.interpreter.deselect.spin(":3@H") 91 92 # Display the sequence. 93 self.interpreter.sequence.display() 94 95 # Define the domain. 96 self.interpreter.domain(id='N', spin_id=":1-2") 97 98 # Select the domain. 99 self.interpreter.select.domain(domain_id='N', boolean="AND") 100 101 # Check the selections. 102 selection = [False, True, True, False, True, False] + [False]*3 103 self.check_spin_selection(selection)104 105107 """Check the operation of the select.domain user function using the OR boolean.""" 108 109 # First deselect some spins. 110 self.interpreter.deselect.spin(":1@C") 111 self.interpreter.deselect.spin(":2@H") 112 self.interpreter.deselect.spin(":2@C") 113 self.interpreter.deselect.spin(":3@H") 114 115 # Display the sequence. 116 self.interpreter.sequence.display() 117 118 # Define the domain. 119 self.interpreter.domain(id='N', spin_id=":1-2") 120 121 # Select the domain. 122 self.interpreter.select.domain(domain_id='N', boolean="OR", change_all=False) 123 124 # Check the selections. 125 selection = [True]*6 + [True, True, False] 126 self.check_spin_selection(selection)
Trees | Indices | Help |
|
---|
Generated by Epydoc 3.0.1 on Sat Jun 8 10:45:18 2024 | http://epydoc.sourceforge.net |