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

时间:2013-11-02 22:23:44

标签: python string list

我在输入两个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()

1 个答案:

答案 0 :(得分:0)

可能是这样的:

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()