def test_regr(): keys = [ x.strip() for x in 'Effect | Effect_Impact | Functional_Class | Codon_Change | Amino_Acid_change| Amino_Acid_length | Gene_Name | Transcript_BioType | Gene_Coding | Transcript_ID | Exon_Rank | Genotype_Number | ERRORS | WARNINGS' .split("|") ] v = OldSnpEff( 'SPLICE_SITE_REGION+SYNONYMOUS_CODING(LOW|SILENT|acG/acA|T245|1134|ANKS1A|protein_coding|CODING|ENST00000360359|5|A)', keys) assert v.consequences == ['splice_region_variant', 'synonymous_variant'], v.consequences assert v.severity == 2, v.severity assert v.aa_change == 'T245' v = OldSnpEff( 'UPSTREAM(MODIFIER||2771|||PSMB1|processed_transcript|CODING|ENST00000462957||C)', keys) assert v.consequences == ['upstream_gene_variant'], v.consequences assert v.severity == 1, v.severity v = OldSnpEff( 'NEXT_PROT[maturation_peptide](LOW||||241|PSMB1|protein_coding|CODING|||C)', keys) assert v.consequences == ['NEXT_PROT[maturation_peptide]'], v.consequences assert v.severity == 1, v.severity assert v <= v
def test_o2(): keys = [ x.strip() for x in "Effect | Effect_Impact | Functional_Class | Codon_Change | Amino_Acid_change| Amino_Acid_length | Gene_Name | Gene_BioType | Coding | Transcript | Exon | ERRORS | WARNINGS" .split("|") ] effects = [ OldSnpEff(v, keys) for v in "DOWNSTREAM(MODIFIER|||||RP5-902P8.10|processed_transcript|NON_CODING|ENST00000434139|),DOWNSTREAM(MODIFIER|||||RP5-902P8.10|processed_transcript|NON_CODING|ENST00000453732|),INTRON(MODIFIER||||138|SCNN1D|protein_coding|CODING|ENST00000470022|3),INTRON(MODIFIER||||638|SCNN1D|protein_coding|CODING|ENST00000338555|3),INTRON(MODIFIER||||638|SCNN1D|protein_coding|CODING|ENST00000400928|2),INTRON(MODIFIER||||669|SCNN1D|protein_coding|CODING|ENST00000379110|6),INTRON(MODIFIER||||704|SCNN1D|protein_coding|CODING|ENST00000325425|2),INTRON(MODIFIER||||802|SCNN1D|protein_coding|CODING|ENST00000379116|5),INTRON(MODIFIER|||||SCNN1D|nonsense_mediated_decay|CODING|ENST00000379101|5),INTRON(MODIFIER|||||SCNN1D|processed_transcript|CODING|ENST00000467651|3)" .split(",") ] effects = sorted(effects) assert effects[-1].gene == "SCNN1D", effects[-1].gene effects = sorted([ OldSnpEff(v, keys) for v in "DOWNSTREAM(MODIFIER||||85|FAM138A|protein_coding|CODING|ENST00000417324|),DOWNSTREAM(MODIFIER|||||FAM138A|processed_transcript|CODING|ENST00000461467|),DOWNSTREAM(MODIFIER|||||MIR1302-10|miRNA|NON_CODING|ENST00000408384|),EXON(MODIFIER|||||MIR1302-10|antisense|NON_CODING|ENST00000469289|1),INTRON(MODIFIER|||||MIR1302-10|antisense|NON_CODING|ENST00000473358|1),UPSTREAM(MODIFIER|||||WASH7P|unprocessed_pseudogene|NON_CODING|ENST00000423562|),UPSTREAM(MODIFIER|||||WASH7P|unprocessed_pseudogene|NON_CODING|ENST00000430492|),UPSTREAM(MODIFIER|||||WASH7P|unprocessed_pseudogene|NON_CODING|ENST00000438504|),UPSTREAM(MODIFIER|||||WASH7P|unprocessed_pseudogene|NON_CODING|ENST00000488147|),UPSTREAM(MODIFIER|||||WASH7P|unprocessed_pseudogene|NON_CODING|ENST00000538476|)" .split(",") ]) s = "\n".join(e.effect_string for e in effects[::-1]) # reversed so that most significant is first assert s == """\
def test_old(): keys = [ x.strip() for x in 'Effect | Effect_Impact | Functional_Class | Codon_Change | Amino_Acid_change| Amino_Acid_length | Gene_Name | Transcript_BioType | Gene_Coding | Transcript_ID | Exon_Rank | Genotype_Number | ERRORS | WARNINGS' .split("|") ] v = OldSnpEff( 'SPLICE_SITE_REGION+SYNONYMOUS_CODING(LOW|SILENT|acG/acA|T245|1134|ANKS1A|protein_coding|CODING|ENST00000360359|5|A)', keys) assert v.so == "splice_region_variant", v.so v = OldSnpEff( 'SYNONYMOUS_CODING+SPLICE_SITE_REGION(LOW|SILENT|acG/acA|T245|1134|ANKS1A|protein_coding|CODING|ENST00000360359|5|A)', keys) assert v.so == "splice_region_variant", v.so assert v.aa_length == 1134, v.aa_length assert v.exon == "5", v.exon assert v.codon_change == "acG/acA", v.codon_change assert v.transcript == "ENST00000360359", v.transcript
def test_old2(): keys = [ x.strip() for x in 'Effect | Effect_Impact | Functional_Class | Codon_Change | Amino_Acid_change| Amino_Acid_length | Gene_Name | Transcript_BioType | Gene_Coding | Transcript_ID | Exon_Rank | Genotype_Number | ERRORS | WARNINGS' .split("|") ] v = OldSnpEff( 'SPLICE_SITE_REGION+NON_SYNONYMOUS_CODING(LOW|SILENT|acG/acA|T245|1134|ANKS1A|protein_coding|CODING|ENST00000360359|5|A)', keys) assert v.so == "missense_variant", v.so
def test_aa_change(): eff = OldSnpEff( 'NON_SYNONYMOUS_CODING(MODERATE|MISSENSE|Agc/Ggc|S418G|696|C1orf170|protein_coding|CODING|ENST00000433179|3|C)' ) assert eff.aa_change == 'S418G' ann = SnpEff( 'C|missense_variant|MODERATE|C1orf170|ENSG00000187642|transcript|ENST00000433179|protein_coding|3/5|c.1252A>G|p.Ser418Gly|1252/3064|1252/2091|418/696||' ) assert ann.aa_change == 'p.Ser418Gly'
def test_eff_splice(): keys = [ x.strip() for x in "Effect | Effect_Impact | Functional_Class | Codon_Change | Amino_Acid_change| Amino_Acid_length | Gene_Name | Gene_BioType | Coding | Transcript | Exon | ERRORS | WARNINGS" .split("|") ] e = OldSnpEff( "SPLICE_SITE_REGION+SYNONYMOUS_CODING(LOW|SILENT|acG/acA|T245|1134|ANKS1A|protein_coding|CODING|ENST00000360359|5|A)", keys) assert e.aa_change == "T245" # note that we choose splice_site_region over synonymous coding assert e.is_splicing, e.is_splicing assert not e.is_coding e = OldSnpEff( "intergenic_region(MODIFIER|||n.null_nulldelAAGGAAGG|||||||A", keys) assert e.consequences != []
def test_empty_snpeff(): keys = [ x.strip() for x in 'Effect | Effect_Impact | Functional_Class | Codon_Change | Amino_Acid_change| Amino_Acid_length | Gene_Name | Transcript_BioType | Gene_Coding | Transcript_ID | Exon_Rank | Genotype_Number | ERRORS | WARNINGS' .split("|") ] eff = "(MODIFIER||||||||||A|ERROR_CHROMOSOME_NOT_FOUND)" v = OldSnpEff(eff, keys) assert v.impact_severity == "LOW", v.impact_severity