當前位置: 首頁>>代碼示例>>Python>>正文


Python Fragment.create_with_sequence方法代碼示例

本文整理匯總了Python中edge.models.Fragment.create_with_sequence方法的典型用法代碼示例。如果您正苦於以下問題:Python Fragment.create_with_sequence方法的具體用法?Python Fragment.create_with_sequence怎麽用?Python Fragment.create_with_sequence使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在edge.models.Fragment的用法示例。


在下文中一共展示了Fragment.create_with_sequence方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: test_finds_sequence_on_specified_genome

# 需要導入模塊: from edge.models import Fragment [as 別名]
# 或者: from edge.models.Fragment import create_with_sequence [as 別名]
    def test_finds_sequence_on_specified_genome(self):
        s1 = 'atcggtatcttctatgcgtatgcgtcatgattatatatattagcggcatg'
        s2 = 'agcgtcgatgcatgagtcgatcggcagtcgtgtagtcgtcgtatgcgtta'
        g1 = Genome(name='Foo')
        g1.save()
        f1 = Fragment.create_with_sequence('Bar', s1)
        f2 = Fragment.create_with_sequence('Baz', s2)
        Genome_Fragment(genome=g1, fragment=f1, inherited=False).save()
        Genome_Fragment(genome=g1, fragment=f2, inherited=False).save()

        g2 = Genome(name='Far')
        g2.save()
        f3 = Fragment.create_with_sequence('Bar', s1)
        Genome_Fragment(genome=g2, fragment=f3, inherited=False).save()

        try:
            os.unlink(fragment_fasta_fn(f1))
            os.unlink(fragment_fasta_fn(f2))
            os.unlink(fragment_fasta_fn(f3))
        except:
            pass
        build_all_genome_dbs(refresh=True)
        g1 = Genome.objects.get(pk=g1.id)

        query = s1[6:20] + 'aaaaaaaaa'
        r = blast_genome(g1, 'blastn', query)
        # only returns hit from genome
        self.assertEquals(len(r), 1)
        self.assertEquals(r[0].fragment_id, f1.id)
        self.assertEquals(r[0].query_start, 1)
        self.assertEquals(r[0].query_end, 14)
        self.assertEquals(r[0].subject_start, 7)
        self.assertEquals(r[0].subject_end, 20)
        self.assertEquals(r[0].strand(), 1)
開發者ID:ginkgobioworks,項目名稱:edge,代碼行數:36,代碼來源:test_blast.py

示例2: test_can_create_fragment_with_different_chunk_sizes

# 需要導入模塊: from edge.models import Fragment [as 別名]
# 或者: from edge.models.Fragment import create_with_sequence [as 別名]
 def test_can_create_fragment_with_different_chunk_sizes(self):
     s = 'gataccggtactag'
     f = Fragment.create_with_sequence('Foo', s, initial_chunk_size=len(s))
     self.assertEquals(f.sequence, s)
     f = Fragment.create_with_sequence('Foo', s, initial_chunk_size=0)
     self.assertEquals(f.sequence, s)
     f = Fragment.create_with_sequence('Foo', s, initial_chunk_size=1)
     self.assertEquals(f.sequence, s)
     f = Fragment.create_with_sequence('Foo', s, initial_chunk_size=3)
     self.assertEquals(f.sequence, s)
     f = Fragment.create_with_sequence('Foo', s, initial_chunk_size=len(s) * 1000)
     self.assertEquals(f.sequence, s)
開發者ID:ginkgobioworks,項目名稱:edge,代碼行數:14,代碼來源:test_fragment.py

示例3: test_blast_aligns_sequence_to_antisense_strand

# 需要導入模塊: from edge.models import Fragment [as 別名]
# 或者: from edge.models.Fragment import create_with_sequence [as 別名]
    def test_blast_aligns_sequence_to_antisense_strand(self):
        s1 = 'atcggtatcttctatgcgtatgcgtcatgattatatatattagcggcatg'
        g1 = Genome(name='Foo')
        g1.save()
        f1 = Fragment.create_with_sequence('Bar', s1)
        Genome_Fragment(genome=g1, fragment=f1, inherited=False).save()

        try:
            os.unlink(fragment_fasta_fn(f1))
        except:
            pass
        build_all_genome_dbs(refresh=True)

        query = str(Seq(s1[6:20]).reverse_complement())+'tttttttttt'

        res = self.client.post('/edge/genomes/%s/blast/' % g1.id,
                               data=json.dumps(dict(program='blastn', query=query)),
                               content_type='application/json')
        self.assertEquals(res.status_code, 200)
        d = json.loads(res.content)

        # only returns hit from genome
        self.assertEquals(len(d), 1)
        self.assertEquals(d[0]['fragment_id'], f1.id)
        self.assertEquals(d[0]['query_start'], 1)
        self.assertEquals(d[0]['query_end'], 14)
        self.assertEquals(d[0]['subject_start'], 20)
        self.assertEquals(d[0]['subject_end'], 7)
開發者ID:cavedweller,項目名稱:edge,代碼行數:30,代碼來源:test_blast.py

示例4: test_insert_existing_fragment_in_middle

# 需要導入模塊: from edge.models import Fragment [as 別名]
# 或者: from edge.models.Fragment import create_with_sequence [as 別名]
 def test_insert_existing_fragment_in_middle(self):
     existing_f = Fragment.create_with_sequence('Test', 'gataca')
     f = self.root.update('Bar')
     f.insert_fragment(3, existing_f)
     self.assertEquals(f.sequence, self.root_sequence[0:2] + 'gataca' + self.root_sequence[2:])
     # does not affect root
     self.assertEquals(self.root.sequence, self.root_sequence)
開發者ID:ginkgobioworks,項目名稱:edge,代碼行數:9,代碼來源:test_fragment.py

示例5: test_does_not_allow_insert_same_fragment_twice_which_creates_loops

# 需要導入模塊: from edge.models import Fragment [as 別名]
# 或者: from edge.models.Fragment import create_with_sequence [as 別名]
 def test_does_not_allow_insert_same_fragment_twice_which_creates_loops(self):
     u = self.root.update('Bar')
     new_f = Fragment.create_with_sequence('Test', 'gataca')
     new_f = new_f.update('Test')
     new_f.insert_bases(2, 'ccc')
     u.insert_fragment(3, new_f)
     self.assertRaises(Exception, u.insert_fragment, 3, new_f)
開發者ID:ginkgobioworks,項目名稱:edge,代碼行數:9,代碼來源:test_fragment.py

示例6: test_user_defined_fragments_does_not_include_inactive_fragments

# 需要導入模塊: from edge.models import Fragment [as 別名]
# 或者: from edge.models.Fragment import create_with_sequence [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)
開發者ID:ginkgobioworks,項目名稱:edge,代碼行數:9,代碼來源:test_user_defined_fragments.py

示例7: test_inherits_new_annotations_on_inserted_fragment

# 需要導入模塊: from edge.models import Fragment [as 別名]
# 或者: from edge.models.Fragment import create_with_sequence [as 別名]
    def test_inherits_new_annotations_on_inserted_fragment(self):
        new_f = Fragment.create_with_sequence('Test', 'gataca')

        self.assertEquals(len(new_f.annotations()), 0)
        self.assertEquals(len(self.root.annotations()), 0)

        f = self.root.update('Bar')
        f.insert_fragment(3, new_f)

        self.assertEquals(len(new_f.annotations()), 0)
        self.assertEquals(len(self.root.annotations()), 0)
        self.assertEquals(len(f.annotations()), 0)

        new_f.annotate(2, 4, 'X1', 'gene', 1)

        self.root = Fragment.objects.get(pk=self.root.pk).indexed_fragment()
        f = Fragment.objects.get(pk=f.pk).indexed_fragment()
        self.assertEquals(len(new_f.annotations()), 1)
        self.assertEquals(len(self.root.annotations()), 0)
        self.assertEquals(len(f.annotations()), 1)

        self.assertEquals(f.annotations()[0].base_first, 4)
        self.assertEquals(f.annotations()[0].base_last, 6)
        self.assertEquals(f.annotations()[0].feature.name, 'X1')
        self.assertEquals(f.annotations()[0].feature_base_first, 1)
        self.assertEquals(f.annotations()[0].feature_base_last, 3)
開發者ID:ginkgobioworks,項目名稱:edge,代碼行數:28,代碼來源:test_annotations.py

示例8: test_blast_finds_sequence_on_specified_genome

# 需要導入模塊: from edge.models import Fragment [as 別名]
# 或者: from edge.models.Fragment import create_with_sequence [as 別名]
    def test_blast_finds_sequence_on_specified_genome(self):
        s1 = 'atcggtatcttctatgcgtatgcgtcatgattatatatattagcggcatg'
        s2 = 'agcgtcgatgcatgagtcgatcggcagtcgtgtagtcgtcgtatgcgtta'
        g1 = Genome(name='Foo')
        g1.save()
        f1 = Fragment.create_with_sequence('Bar', s1)
        f2 = Fragment.create_with_sequence('Baz', s2)
        Genome_Fragment(genome=g1, fragment=f1, inherited=False).save()
        Genome_Fragment(genome=g1, fragment=f2, inherited=False).save()

        g2 = Genome(name='Far')
        g2.save()
        f3 = Fragment.create_with_sequence('Bar', s1)
        Genome_Fragment(genome=g2, fragment=f3, inherited=False).save()

        try:
            os.unlink(fragment_fasta_fn(f1))
            os.unlink(fragment_fasta_fn(f2))
            os.unlink(fragment_fasta_fn(f3))
        except:
            pass
        build_all_genome_dbs(refresh=True)

        query = s1[6:20]+'aaaaaaaaa'

        res = self.client.post('/edge/genomes/%s/blast/' % g1.id,
                               data=json.dumps(dict(program='blastn', query=query)),
                               content_type='application/json')
        self.assertEquals(res.status_code, 200)
        d = json.loads(res.content)

        # only returns hit from genome
        self.assertEquals(len(d), 1)
        self.assertEquals(d[0]['fragment_id'], f1.id)
        self.assertEquals(d[0]['query_start'], 1)
        self.assertEquals(d[0]['query_end'], 14)
        self.assertEquals(d[0]['subject_start'], 7)
        self.assertEquals(d[0]['subject_end'], 20)

        # blast in other genome works too
        res = self.client.post('/edge/genomes/%s/blast/' % g2.id,
                               data=json.dumps(dict(program='blastn', query=query)),
                               content_type='application/json')
        self.assertEquals(res.status_code, 200)
        d = json.loads(res.content)
        self.assertEquals(len(d), 1)
        self.assertEquals(d[0]['fragment_id'], f3.id)
開發者ID:cavedweller,項目名稱:edge,代碼行數:49,代碼來源:test_blast.py

示例9: test_insert_fragment_inherits_annotations_from_new_fragment

# 需要導入模塊: from edge.models import Fragment [as 別名]
# 或者: from edge.models.Fragment import create_with_sequence [as 別名]
 def test_insert_fragment_inherits_annotations_from_new_fragment(self):
     f = self.root.update('Bar')
     self.assertEquals([a for a in f.annotations() if a.name == 'Uma'], [])
     new_f = Fragment.create_with_sequence('Test', 'gataca')
     new_f.annotate(2, 4, 'Uma', 'feature', 1)
     f.insert_fragment(2, new_f)
     self.assertEquals([a for a in f.annotations() if a.feature.name == 'Uma'][0].base_first, 3)
     self.assertEquals([a for a in f.annotations() if a.feature.name == 'Uma'][0].base_last, 5)
開發者ID:ginkgobioworks,項目名稱:edge,代碼行數:10,代碼來源:test_fragment.py

示例10: test_insert_new_fragment_at_end

# 需要導入模塊: from edge.models import Fragment [as 別名]
# 或者: from edge.models.Fragment import create_with_sequence [as 別名]
 def test_insert_new_fragment_at_end(self):
     f = self.root.update('Bar')
     new_f = Fragment.create_with_sequence('Test', 'gataca')
     new_f = new_f.update('Test')
     new_f.insert_bases(2, 'ccc')
     f.insert_fragment(None, new_f)
     self.assertEquals(f.sequence, self.root_sequence + 'gcccataca')
     # does not affect root
     self.assertEquals(self.root.sequence, self.root_sequence)
開發者ID:ginkgobioworks,項目名稱:edge,代碼行數:11,代碼來源:test_fragment.py

示例11: test_user_defined_fragments_does_not_include_genomic_fragment

# 需要導入模塊: from edge.models import Fragment [as 別名]
# 或者: from edge.models.Fragment import create_with_sequence [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)
開發者ID:ginkgobioworks,項目名稱:edge,代碼行數:11,代碼來源:test_user_defined_fragments.py

示例12: test_replace_fragment_past_end

# 需要導入模塊: from edge.models import Fragment [as 別名]
# 或者: from edge.models.Fragment import create_with_sequence [as 別名]
 def test_replace_fragment_past_end(self):
     f = self.root.update('Bar')
     new_f = Fragment.create_with_sequence('Test', 'gataca')
     new_f = new_f.update('Test')
     new_f.insert_bases(2, 'ccc')
     f.replace_with_fragment(len(self.root_sequence) - 3, 6, new_f)
     self.assertEquals(f.name, 'Bar')
     self.assertEquals(f.sequence, self.root_sequence[:-4] + 'gcccataca')
     # does not affect root
     self.assertEquals(self.root.sequence, self.root_sequence)
開發者ID:ginkgobioworks,項目名稱:edge,代碼行數:12,代碼來源:test_fragment.py

示例13: test_insert_new_fragment_in_middle

# 需要導入模塊: from edge.models import Fragment [as 別名]
# 或者: from edge.models.Fragment import create_with_sequence [as 別名]
 def test_insert_new_fragment_in_middle(self):
     f = self.root.update('Bar')
     new_f = Fragment.create_with_sequence('Test', 'gataca')
     new_f = new_f.update('Test')
     new_f.insert_bases(2, 'ccc')
     f.insert_fragment(3, new_f)
     self.assertEquals(
         f.sequence, self.root_sequence[0: 2] + 'gcccataca' + self.root_sequence[2:])
     # does not affect root
     self.assertEquals(self.root.sequence, self.root_sequence)
開發者ID:ginkgobioworks,項目名稱:edge,代碼行數:12,代碼來源:test_fragment.py

示例14: test_annotate_circular_fragment_ending_at_base_last

# 需要導入模塊: from edge.models import Fragment [as 別名]
# 或者: from edge.models.Fragment import create_with_sequence [as 別名]
 def test_annotate_circular_fragment_ending_at_base_last(self):
     f = Fragment.create_with_sequence('Foo', self.root_sequence, circular=True)
     f.annotate(9, len(self.root_sequence), 'A1', 'gene', 1)
     self.assertEquals(len(f.annotations()), 1)
     self.assertEquals(f.annotations()[0].base_first, 9)
     self.assertEquals(f.annotations()[0].base_last, len(self.root_sequence))
     self.assertEquals(f.annotations()[0].feature.name, 'A1')
     self.assertEquals(f.annotations()[0].feature_base_first, 1)
     self.assertEquals(f.annotations()[0].feature_base_last, len(self.root_sequence) - 9 + 1)
     self.assertEquals(f.annotations()[0].feature.length, len(self.root_sequence) - 9 + 1)
開發者ID:ginkgobioworks,項目名稱:edge,代碼行數:12,代碼來源:test_annotations.py

示例15: build_genome

# 需要導入模塊: from edge.models import Fragment [as 別名]
# 或者: from edge.models.Fragment import create_with_sequence [as 別名]
 def build_genome(self, circular, *templates):
     g = Genome(name='Foo')
     g.save()
     for seq in templates:
         f = Fragment.create_with_sequence('Bar', seq, circular=circular)
         Genome_Fragment(genome=g, fragment=f, inherited=False).save()
         try:
             os.unlink(fragment_fasta_fn(f))
         except:
             pass
     build_all_genome_dbs(refresh=True)
     return Genome.objects.get(pk=g.id)
開發者ID:Chris7,項目名稱:edge,代碼行數:14,代碼來源:test_primer.py


注:本文中的edge.models.Fragment.create_with_sequence方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。