Beispiel #1
0
    def test_Selection_contains_spin_re2(self):
        """The Selection object "#Ap4Aase:Glu | #RNA@C8" contains the spin '*C*' of the mol 'RNA'."""

        # The Selection object.
        obj = Selection("#Ap4Aase:Glu | #RNA@C8")

        # Check if the molecule is in the selection.
        self.assert_(obj.contains_spin(spin_name='*C*', mol='RNA'))
Beispiel #2
0
    def test_Selection_contains_spin6(self):
        """The Selection object "#Ap4Aase" does contains the spin None."""

        # The Selection object.
        obj = Selection("#Ap4Aase")

        # Check if the molecule is in the selection.
        self.assert_(obj.contains_spin(mol='Ap4Aase'))
Beispiel #3
0
    def test_Selection_contains_spin7(self):
        """The Selection object "#Ap4Aase" does not contain the spin None of the mol 'RNA'."""

        # The Selection object.
        obj = Selection("#Ap4Aase")

        # Check if the molecule is in the selection.
        self.assert_(not obj.contains_spin(mol='RNA'))
Beispiel #4
0
    def test_Selection_contains_spin4(self):
        """The Selection object "#Ap4Aase:Glu | #RNA@C8" does not contain the spin 'N3'."""

        # The Selection object.
        obj = Selection("#Ap4Aase:Glu | #RNA@C8")

        # Check if the molecule is in the selection.
        self.assert_(not obj.contains_spin(spin_name='N3'))
Beispiel #5
0
    def test_Selection_contains_spin5(self):
        """The Selection object "#Ap4Aase:Glu | #RNA:14@C8" does not contain the spin None."""

        # The Selection object.
        obj = Selection("#Ap4Aase:Glu | #RNA:14@C8")

        # Check if the molecule is in the selection.
        self.assert_(not obj.contains_spin())
    def test_Selection_contains_spin_re2(self):
        """The Selection object "#Ap4Aase:Glu | #RNA@C8" contains the spin '*C*' of the mol 'RNA'."""

        # The Selection object.
        obj = Selection("#Ap4Aase:Glu | #RNA@C8")

        # Check if the molecule is in the selection.
        self.assert_(obj.contains_spin(spin_name='*C*', mol='RNA'))
    def test_Selection_contains_spin7(self):
        """The Selection object "#Ap4Aase" does not contain the spin None of the mol 'RNA'."""

        # The Selection object.
        obj = Selection("#Ap4Aase")

        # Check if the molecule is in the selection.
        self.assert_(not obj.contains_spin(mol='RNA'))
    def test_Selection_contains_spin6(self):
        """The Selection object "#Ap4Aase" does contains the spin None."""

        # The Selection object.
        obj = Selection("#Ap4Aase")

        # Check if the molecule is in the selection.
        self.assert_(obj.contains_spin(mol='Ap4Aase'))
    def test_Selection_contains_spin5(self):
        """The Selection object "#Ap4Aase:Glu | #RNA:14@C8" does not contain the spin None."""

        # The Selection object.
        obj = Selection("#Ap4Aase:Glu | #RNA:14@C8")

        # Check if the molecule is in the selection.
        self.assert_(not obj.contains_spin())
    def test_Selection_contains_spin4(self):
        """The Selection object "#Ap4Aase:Glu | #RNA@C8" does not contain the spin 'N3'."""

        # The Selection object.
        obj = Selection("#Ap4Aase:Glu | #RNA@C8")

        # Check if the molecule is in the selection.
        self.assert_(not obj.contains_spin(spin_name='N3'))
Beispiel #11
0
def sel_domain(domain_id=None, boolean='OR', change_all=False):
    """Select all spins and interatomic data containers of the given domain.

    @keyword domain_id:     The domain ID string.
    @type domain_id:        str or None
    @param boolean:         The boolean operator used to select the spin systems with.  It can be one of 'OR', 'NOR', 'AND', 'NAND', 'XOR', or 'XNOR'. This will be ignored if the change_all flag is set.
    @type boolean:          str
    @keyword change_all:    A flag which if True will cause all spins and interatomic data containers outside of the domain to be deselected.
    @type change_all:       bool
    """

    # Test if the current data pipe exists.
    pipes.test()

    # Test if the domain is defined.
    if not hasattr(cdp, 'domain') or domain_id not in cdp.domain:
        raise RelaxNoDomainError(domain_id)

    # The domain selection object.
    domain = Selection(cdp.domain[domain_id])

    # Loop over the spins and select as required.
    for spin, mol_name, res_num, res_name in spin_loop(full_info=True):
        # Inside the domain.
        if domain.contains_spin(spin_name=spin.name, spin_num=spin.num, res_name=res_name, res_num=res_num, mol=mol_name):
            spin.select = boolean_select(current=spin.select, boolean=boolean)

        # Deselect spins outside of the domain.
        elif change_all:
            spin.select = False

    # Interatomic data loop.
    for interatom in interatomic_loop():
        # Decode the spin ids.
        mol_name1, res_num1, res_name1, spin_num1, spin_name1 = spin_id_to_data_list(interatom.spin_id1)
        mol_name2, res_num2, res_name2, spin_num2, spin_name2 = spin_id_to_data_list(interatom.spin_id2)

        # Inside the domain.
        if domain.contains_spin(spin_name=spin_name1, spin_num=spin_num1, res_name=res_name1, res_num=res_num1, mol=mol_name1) or domain.contains_spin(spin_name=spin_name2, spin_num=spin_num2, res_name=res_name2, res_num=res_num2, mol=mol_name2):
            interatom.select = boolean_select(current=interatom.select, boolean=boolean)

        # Deselect containers outside of the domain.
        elif change_all:
            interatom.select = False
Beispiel #12
0
def sel_domain(domain_id=None, boolean='OR', change_all=False):
    """Select all spins and interatomic data containers of the given domain.

    @keyword domain_id:     The domain ID string.
    @type domain_id:        str or None
    @param boolean:         The boolean operator used to select the spin systems with.  It can be one of 'OR', 'NOR', 'AND', 'NAND', 'XOR', or 'XNOR'. This will be ignored if the change_all flag is set.
    @type boolean:          str
    @keyword change_all:    A flag which if True will cause all spins and interatomic data containers outside of the domain to be deselected.
    @type change_all:       bool
    """

    # Test if the current data pipe exists.
    check_pipe()

    # Test if the domain is defined.
    if not hasattr(cdp, 'domain') or domain_id not in cdp.domain:
        raise RelaxNoDomainError(domain_id)

    # The domain selection object.
    domain = Selection(cdp.domain[domain_id])

    # Loop over the spins and select as required.
    for spin, mol_name, res_num, res_name in spin_loop(full_info=True):
        # Inside the domain.
        if domain.contains_spin(spin_name=spin.name, spin_num=spin.num, res_name=res_name, res_num=res_num, mol=mol_name):
            spin.select = boolean_select(current=spin.select, boolean=boolean)

        # Deselect spins outside of the domain.
        elif change_all:
            spin.select = False

    # Interatomic data loop.
    for interatom in interatomic_loop():
        # Decode the spin ids.
        mol_name1, res_num1, res_name1, spin_num1, spin_name1 = spin_id_to_data_list(interatom.spin_id1)
        mol_name2, res_num2, res_name2, spin_num2, spin_name2 = spin_id_to_data_list(interatom.spin_id2)

        # Inside the domain.
        if domain.contains_spin(spin_name=spin_name1, spin_num=spin_num1, res_name=res_name1, res_num=res_num1, mol=mol_name1) or domain.contains_spin(spin_name=spin_name2, spin_num=spin_num2, res_name=res_name2, res_num=res_num2, mol=mol_name2):
            interatom.select = boolean_select(current=interatom.select, boolean=boolean)

        # Deselect containers outside of the domain.
        elif change_all:
            interatom.select = False