本文整理汇总了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]