Translation DNA to Protein

前端 未结 2 1287
攒了一身酷
攒了一身酷 2021-02-10 06:00

I am a biology graduate student and I taught myself a very limited amount of python in the past few months to deal with some data I have. I am not asking for homework help, this

2条回答
  •  小鲜肉
    小鲜肉 (楼主)
    2021-02-10 06:38

    Your problem stems from the line

    if cds[n:n+3] in codontable == True
    

    This always evaluates to False, and thus you never append to proteinsequence. Just remove the == True portion like so

    if cds[n:n+3] in codontable
    

    and you will get the protein sequence. Also, make sure to return proteinsequence in translate_dna().

提交回复
热议问题