def test_basic(self): seq_str = 'ATGCATGCATGCACTG' filters = 'hola' alleles1 = {('A', SNP):{'read_groups': {'hola_illumina':2, 'hola2':3}}, ('T', INVARIANT):{'read_groups': {'sanger':5, 'hola2':4}}, ('C', SNP):{'read_groups': {'hola_illumina':6}}} read_groups = {'hola_illumina':{'LB':'lib1'}, 'hola2':{'LB':'lib2'}, 'sanger': {'LB': 'lib3'}} snv1 = SeqFeature(type='snv', location=FeatureLocation(4, 4), qualifiers={'alleles':alleles1, 'reference_allele':'T', 'filters':filters, 'read_groups':read_groups}) alleles2 = {('T', INVARIANT):{'read_groups': {'hola_illumina':1}}, ('---', DELETION):{'read_groups': {'hola_illumina':1}}} snv2 = SeqFeature(type='snv', location=FeatureLocation(8, 8), qualifiers={'alleles':alleles2, 'reference_allele':'T', 'read_groups':read_groups}) alleles3 = {('AT', INSERTION):{'read_groups': {'hola_illumina':1}}, ('T', INVARIANT):{'read_groups': {'hola_illumina':1}}} snv3 = SeqFeature(type='snv', location=FeatureLocation(12, 12), qualifiers={'alleles':alleles3, 'reference_allele':'T'}) seq = SeqWithQuality(seq=Seq(seq_str), qual=[30] * len(seq_str), name='AT1G55265.1', features=[snv1, snv2, snv3]) # try with SNP fhand = NamedTemporaryFile(mode='a') writer = SnvSequenomWriter(fhand) position = 4 writer.write(seq, position) sequenom_snv = open(fhand.name).read() assert 'ATGC[T/A/C]TGCNNNCANNCTG' in sequenom_snv # try with Deletion fhand = NamedTemporaryFile(mode='a') writer = SnvSequenomWriter(fhand) position = 8 writer.write(seq, position) sequenom_snv = open(fhand.name).read() assert 'ATGCHTGC[ATG/-]CANNCTG' in sequenom_snv # try with Insertion fhand = NamedTemporaryFile(mode='a') writer = SnvSequenomWriter(fhand) position = 12 writer.write(seq, position) sequenom_snv = open(fhand.name).read() assert 'ATGCHTGCNNNC[-/AT]CTG' in sequenom_snv
def test_basic(self): seq_str = "ATGCATGCATGCACTG" # 'ATGCATGCATGCA-CTG' # 'ATGCNTGCA---ATCTG' filters = "hola" alleles1 = { ("T", SNP): {"read_groups": {"hola_illumina": 2, "hola2": 3}}, ("A", INVARIANT): {"read_groups": {"sanger": 5, "hola2": 4}}, ("C", SNP): {"read_groups": {"hola_illumina": 6}}, } read_groups = {"hola_illumina": {"LB": "lib1"}, "hola2": {"LB": "lib2"}, "sanger": {"LB": "lib3"}} snv1 = SeqFeature( type="snv", location=FeatureLocation(4, 5), qualifiers={"alleles": alleles1, "reference_allele": "A", "filters": filters, "read_groups": read_groups}, ) alleles2 = { ("ATGC", INVARIANT): {"read_groups": {"hola_illumina": 1}}, ("A", DELETION): {"read_groups": {"hola_illumina": 1}}, } snv2 = SeqFeature( type="snv", location=FeatureLocation(8, 12), qualifiers={"alleles": alleles2, "reference_allele": "ATGC", "read_groups": read_groups}, ) alleles3 = { ("AT", INSERTION): {"read_groups": {"hola_illumina": 1}}, ("A", INVARIANT): {"read_groups": {"hola_illumina": 1}}, } snv3 = SeqFeature( type="snv", location=FeatureLocation(12, 13), qualifiers={"alleles": alleles3, "reference_allele": "A"} ) seq = SeqWithQuality( seq=Seq(seq_str), qual=[30] * len(seq_str), name="AT1G55265.1", features=[snv1, snv2, snv3] ) # try with SNP fhand = NamedTemporaryFile(mode="a") writer = SnvSequenomWriter(fhand) position = 4 writer.write(seq, position) sequenom_snv = open(fhand.name).read() # print sequenom_snv assert "ATGC[C/A/T]TGCANNNNCTG" in sequenom_snv # untill we solve the sequenom format for not SNP we can not do this test return # try with Deletion fhand = NamedTemporaryFile(mode="a") writer = SnvSequenomWriter(fhand) position = 8 writer.write(seq, position) sequenom_snv = open(fhand.name).read() # print sequenom_snv assert "ATGCHTGC[ATGC/A]NCTG" in sequenom_snv # try with Insertion fhand = NamedTemporaryFile(mode="a") writer = SnvSequenomWriter(fhand) position = 12 writer.write(seq, position) sequenom_snv = open(fhand.name).read() assert "ATGCHTGCNNNC[A/AT]CTG" in sequenom_snv