コード例 #1
0
ファイル: tests_legacy.py プロジェクト: husince/glypy
 def test_is_n_glycan(self):
     core = glycans['N-Linked Core']
     tree = glycoct.loads(broad_n_glycan)
     result = (subtree_search.subtree_of(core, tree))
     self.assertTrue(result == 1)
     tree = glycoct.loads(complex_glycan)
     result = (subtree_search.subtree_of(core, tree, exact=False))
     self.assertTrue(result == 1)
     result = (subtree_search.subtree_of(core, tree, exact=True))
     self.assertTrue(result == 1)
     tree = glycoct.loads(branchy_glycan)
     result = (subtree_search.subtree_of(core, tree, exact=False))
     self.assertTrue(result is None)
コード例 #2
0
 def matches(self, other):
     motif = self.structure()
     target = other.structure()
     ix = subtree_search.subtree_of(motif, target, exact=True)
     if self.is_core_motif:
         return ix == 1
     else:
         return ix is not None
コード例 #3
0
ファイル: database.py プロジェクト: husince/glypy
def is_n_glycan(record):
    '''
    A predicate testing if the :title:`N-linked Glycan` core motif is present in `record.structure`.

    Returns
    -------
    int:
        0 if |False|, 1 if |True|. Sqlite doesn't have a dedicated |bool| data type.

    See Also
    --------
    :func:`glypy.algorithms.subtree_search.subtree_of`
    '''
    return int(subtree_search.subtree_of(
        n_glycan_core, record.structure, exact=False) == 1)
コード例 #4
0
ファイル: tests_legacy.py プロジェクト: husince/glypy
 def test_subtree_inclusion(self):
     core = glycans['N-Linked Core']
     tree = glycoct.loads(broad_n_glycan)
     self.assertTrue(subtree_search.subtree_of(core, tree))
     self.assertTrue(subtree_search.subtree_of(tree, core) is None)