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
def test_fromgff1(gff_file): ann = gff.from_gff(gff_file[0]) assert "KMSRIGKLPITVPAGVTVTVDENNLVTVKGPKGTLSQQVNPDITLKQEGNILTLERPTDSKPHKAMHGL" == ann.attr['aa_seq']
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
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']
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'])
def test_Annotation_ec1(gff_file): ann = gff.from_gff(gff_file[1]) assert ann.get_ec() == set(['1.1.-', '2.2.3.4'])
def test_fromgff_uid1(gff_file): ann = gff.from_gff(gff_file[1]) assert ann.uid == '32ea1cc8-9e76-4310-8d1c-8e7890734a6b'
def test_fromgff_nouid1(gff_file): ann = gff.from_gff(gff_file[0]) assert len(ann.uid) != len('K02933.12503')
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)
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)
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)
def test_Annotation_get_mapping2(gff_file): ann = gff.from_gff(gff_file[0]) assert ann.get_mapping('test') == []
def test_Annotation_get_mapping1(gff_file): ann = gff.from_gff(gff_file[2]) assert ann.get_mapping('test') == ['12345']
def test_Annotation_ec3(gff_file): ann = gff.from_gff(gff_file[0]) assert ann.get_ec() == set()
def test_fromgff2(gff_file): ann = gff.from_gff(gff_file[0]) assert 3 == ann.start
def test_fromgff3(gff_file): ann = gff.from_gff(gff_file[0]) assert 209 == ann.end
def test_Annotation_to_gff(gff_file): ann = gff.from_gff(gff_file[0]) assert gff.from_gff(ann.to_gff()).attr == ann.attr
def test_fromgff_nouid2(gff_file): ann = gff.from_gff(gff_file[0]) assert ann.uid != '32ea1cc8-9e76-4310-8d1c-8e7890734a6b'
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
def test_Annotation_dbq(gff_file): ann = gff.from_gff(gff_file[0]) assert ann.dbq == 10
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
def test_Annotation_ec2(gff_file): ann = gff.from_gff(gff_file[1]) assert ann.get_ec(level=2) == set(['1.1', '2.2'])
def test_create_gff_data3(annotations, dbm_file): assert from_gff(dbm_file['u3']) == annotations[2]