comparison snpEff_cds_report.py @ 7:fbb6510186df default tip

when codon has ambiguous nucleotide translate to X
author Jim Johnson <jj@umn.edu>
date Mon, 15 Sep 2014 06:13:47 -0500
parents a64ef0611117
children
comparison
equal deleted inserted replaced
6:a64ef0611117 7:fbb6510186df
35 35
36 def translate(seq) : 36 def translate(seq) :
37 rna = seq.upper().replace('T','U') 37 rna = seq.upper().replace('T','U')
38 aa = [] 38 aa = []
39 for i in range(0,len(rna) - 2, 3): 39 for i in range(0,len(rna) - 2, 3):
40 aa.append(codon_map[rna[i:i+3]]) 40 codon = rna[i:i+3]
41 aa.append(codon_map[codon] if codon in codon_map else 'X')
41 return ''.join(aa) 42 return ''.join(aa)
42 43
43 """ 44 """
44 SNfEffect vcf reported variations to the reference sequence, so need to reverse complement for coding sequences on the negative strand 45 SNfEffect vcf reported variations to the reference sequence, so need to reverse complement for coding sequences on the negative strand
45 Queries that request a sequence always return the sequence in the first column regardless of the order of attributes. 46 Queries that request a sequence always return the sequence in the first column regardless of the order of attributes.