Beispiel #1
0
def test_Annotation_to_file(gff_file, tmpdir):

    ann = gff.from_gff(gff_file[0])

    file_name = (tmpdir / 'test-write.gff').strpath
    file_handle = open_file(file_name, 'wb')
    ann.to_file(file_handle)
    file_handle.close()

    ann2 = next(gff.parse_gff(file_name))

    assert ann == ann2
Beispiel #2
0
def test_fromgff1(gff_file):

    ann = gff.from_gff(gff_file[0])

    assert "KMSRIGKLPITVPAGVTVTVDENNLVTVKGPKGTLSQQVNPDITLKQEGNILTLERPTDSKPHKAMHGL" ==  ann.attr['aa_seq']
Beispiel #3
0
def test_Annotation_get_number_of_samples2(gff_file):

    ann = gff.from_gff(gff_file[0])

    assert ann.get_number_of_samples(min_cov=15) == 8
Beispiel #4
0
def test_Annotation_sample_coverage(gff_file):

    ann = gff.from_gff(gff_file[0])

    assert int(ann.attr['t1_b3_cov']) == ann.sample_coverage['t1_b3']
Beispiel #5
0
def test_Annotation_ec2_dup(gff_file):

    ann = gff.from_gff(gff_file[1])
    ann.attr['EC'] = ann.attr['EC'] + ',2.2.3.1'

    assert ann.get_ec(level=2) == set(['1.1', '2.2'])
Beispiel #6
0
def test_Annotation_ec1(gff_file):

    ann = gff.from_gff(gff_file[1])

    assert ann.get_ec() == set(['1.1.-', '2.2.3.4'])
Beispiel #7
0
def test_fromgff_uid1(gff_file):

    ann = gff.from_gff(gff_file[1])

    assert ann.uid == '32ea1cc8-9e76-4310-8d1c-8e7890734a6b'
Beispiel #8
0
def test_fromgff_nouid1(gff_file):

    ann = gff.from_gff(gff_file[0])

    assert len(ann.uid) != len('K02933.12503')
Beispiel #9
0
def test_Annotation_add_gc_ratio(gff_file, nucseq):

    ann = gff.from_gff(gff_file[0])
    ann.add_gc_ratio(nucseq['contig-1327918'])

    assert 0.8818181818181818 == ann.get_attr('gc_ratio', float)
Beispiel #10
0
def test_Annotation_add_gc_content(gff_file, nucseq):

    ann = gff.from_gff(gff_file[0])
    ann.add_gc_content(nucseq['contig-1327918'])

    assert 0.5314009661835749 == ann.get_attr('gc_cont', float)
Beispiel #11
0
def test_Annotation_add_exp_syn_count(gff_file, nucseq):

    ann = gff.from_gff(gff_file[0])
    ann.add_exp_syn_count(nucseq['contig-1327918'])

    assert (141, 480) == (ann.exp_syn, ann.exp_nonsyn)
Beispiel #12
0
def test_Annotation_get_mapping2(gff_file):

    ann = gff.from_gff(gff_file[0])

    assert ann.get_mapping('test') == []
Beispiel #13
0
def test_Annotation_get_mapping1(gff_file):

    ann = gff.from_gff(gff_file[2])

    assert ann.get_mapping('test') == ['12345']
Beispiel #14
0
def test_Annotation_ec3(gff_file):

    ann = gff.from_gff(gff_file[0])

    assert ann.get_ec() == set()
Beispiel #15
0
def test_fromgff2(gff_file):

    ann = gff.from_gff(gff_file[0])

    assert 3 == ann.start
Beispiel #16
0
def test_fromgff3(gff_file):

    ann = gff.from_gff(gff_file[0])

    assert 209 == ann.end
Beispiel #17
0
def test_Annotation_to_gff(gff_file):

    ann = gff.from_gff(gff_file[0])

    assert gff.from_gff(ann.to_gff()).attr == ann.attr
Beispiel #18
0
def test_fromgff_nouid2(gff_file):

    ann = gff.from_gff(gff_file[0])

    assert ann.uid != '32ea1cc8-9e76-4310-8d1c-8e7890734a6b'
Beispiel #19
0
def test_Annotation_to_gtf1(gff_file):

    ann = gff.from_gff(gff_file[0])

    assert gff.from_gff(ann.to_gtf()).attr['transcript_id'] == ann.uid
Beispiel #20
0
def test_Annotation_dbq(gff_file):

    ann = gff.from_gff(gff_file[0])

    assert ann.dbq == 10
Beispiel #21
0
def test_Annotation_to_gtf2(gff_file):

    ann = gff.from_gff(gff_file[0])

    assert gff.from_gff(ann.to_gtf(gene_id_attr='ko')).attr['transcript_id'] == ann.gene_id
Beispiel #22
0
def test_Annotation_ec2(gff_file):

    ann = gff.from_gff(gff_file[1])

    assert ann.get_ec(level=2) == set(['1.1', '2.2'])
Beispiel #23
0
def test_create_gff_data3(annotations, dbm_file):
    assert from_gff(dbm_file['u3']) == annotations[2]