本文整理匯總了Python中edge.models.Fragment.user_defined_fragments方法的典型用法代碼示例。如果您正苦於以下問題:Python Fragment.user_defined_fragments方法的具體用法?Python Fragment.user_defined_fragments怎麽用?Python Fragment.user_defined_fragments使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類edge.models.Fragment
的用法示例。
在下文中一共展示了Fragment.user_defined_fragments方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: test_user_defined_fragments_does_not_include_inactive_fragments
# 需要導入模塊: from edge.models import Fragment [as 別名]
# 或者: from edge.models.Fragment import user_defined_fragments [as 別名]
def test_user_defined_fragments_does_not_include_inactive_fragments(self):
f1 = Fragment.create_with_sequence('Bar', 'aacctaaaattataa')
self.assertEquals(len(Fragment.user_defined_fragments()), 1)
self.assertEquals(Fragment.user_defined_fragments()[0].id, f1.id)
f1.active = False
f1.save()
self.assertEquals(len(Fragment.user_defined_fragments()), 0)
示例2: test_user_defined_fragments_does_not_include_genomic_fragment
# 需要導入模塊: from edge.models import Fragment [as 別名]
# 或者: from edge.models.Fragment import user_defined_fragments [as 別名]
def test_user_defined_fragments_does_not_include_genomic_fragment(self):
genome = Genome.create('Foo')
s = 'atggcatattcgcagct'
genome.add_fragment('chrI', s)
f = Fragment.create_with_sequence('Bar', 'aacctaaaattataa')
self.assertEquals(len(Fragment.user_defined_fragments()), 1)
self.assertEquals(Fragment.user_defined_fragments()[0].name, 'Bar')
self.assertEquals(Fragment.user_defined_fragments()[0].id, f.id)
示例3: on_get
# 需要導入模塊: from edge.models import Fragment [as 別名]
# 或者: from edge.models.Fragment import user_defined_fragments [as 別名]
def on_get(self, request):
q_parser = RequestParser()
q_parser.add_argument('q', field_type=str, location='get')
q_parser.add_argument('s', field_type=int, location='get', default=0)
q_parser.add_argument('p', field_type=int, location='get', default=100)
args = q_parser.parse_args(request)
s = args['s']
p = args['p']
q = args['q']
p = 200 if p > 200 else p
if q is not None and q.strip() != '':
fragments = Fragment.user_defined_fragments(Q(name__icontains=q), s, s + p)
else:
fragments = Fragment.user_defined_fragments(None, s, s + p)
return [FragmentView.to_dict(fragment) for fragment in fragments]