匹配两个RNA序列并打印出匹配碱基对长度的程序

2024-09-28 03:16:30 发布

您现在位置:Python中文网/ 问答频道 /正文

我在一个程序中遇到了一些问题,在这个程序中,你输入两个RNA序列,然后打印出匹配碱基对的长度。你知道吗

以下是我目前掌握的情况:

def main():

    Sequence1 = ""
    Sequence2 = ""
    print("MatchSequences(Sequence1,Sequence2)")
    MatchSequence = input("Enter the subsequences with each base in single quotes and the subsequences separated a comma")
    input = (x,y)
    x = ([])
    y = ([])
    for i in range(0,len(Sequence1)):
        if x == A

main()

Tags: thein程序inputmaindef情况序列
1条回答
网友
1楼 · 发布于 2024-09-28 03:16:30

可能是这样的:

from string import join

def main():
    pairs = {'G':'C', 'C':'G', 'A':'U', 'U':'A'}
    print("MatchSequences(Sequence1, Sequence2)")
    x, y = input("Enter the subsequences with each base in single quotes and the subsequences separated a comma")
    matched = join([a  if pairs[a]==b else '-' for (a, b) in zip(x, y)], sep='')

if __name__=='__main__':
    main()

相关问题 更多 >

    热门问题