[英]input of txt file (codon) to a dict and if there is a similarity print the aminoacid
Here is my code so far.到目前为止,这是我的代码。
I have a dict with two txt files as strings.我有一个带有两个 txt 文件作为字符串的字典。 Now I want to import the triplets file again, but with the function, that the output will return only the amino acids as string.
现在我想再次导入三元组文件,但是使用 function,output 将只返回氨基酸作为字符串。 How can I do that?
我怎样才能做到这一点? Any Ideas?
有任何想法吗? Thank you
谢谢
You can use dict comprehension:您可以使用 dict 理解:
translation_dict = { t : a for t, a in zip(triplets, aa) if a.isalpha()}
Then, your dictionary won't have irrelevant characters as values.然后,您的字典不会将不相关的字符作为值。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.