Given: A DNA string s of length at most 1000 bp.
Return: The reverse complement of s.
import sys
import re
def rev_comp(s):
res = ''
for i in s:
if i == 'A':
res += 'T'
elif i == 'G':
res += 'C'
elif i == 'T':
res += 'A'
elif i == 'C':
res += 'G'
return res[::-1]
def main():
if len(sys.argv) > 1:
print rev_comp(sys.argv[1])
else:
print 'Enter your sequence!'
if __name__ == '__main__':
main()
Return: The reverse complement of s.
import sys
import re
def rev_comp(s):
res = ''
for i in s:
if i == 'A':
res += 'T'
elif i == 'G':
res += 'C'
elif i == 'T':
res += 'A'
elif i == 'C':
res += 'G'
return res[::-1]
def main():
if len(sys.argv) > 1:
print rev_comp(sys.argv[1])
else:
print 'Enter your sequence!'
if __name__ == '__main__':
main()
Комментариев нет:
Отправить комментарий