Verified Commit 0a0f10a1 authored by Bertrand  NÉRON's avatar Bertrand NÉRON
Browse files

improve rev_comp2

parent dd61ff44
Pipeline #10239 passed with stages
in 22 seconds
......@@ -5,13 +5,9 @@ def rev_comp(seq):
return the reverse complement of seq
the case is respect but if the sequence mix upper and lower case the function will failed
"""
upper = seq.isupper()
reverse = seq[::-1]
direct = 'acgt'
comp = 'tgca'
if upper:
table = string.maketrans(direct.upper(), comp.upper())
else:
table = string.maketrans(direct, comp)
direct = 'acgtATCG'
comp = 'tgcaTGCA'
table = string.maketrans(direct, comp)
rev_comp = reverse.translate(table)
return rev_comp
\ No newline at end of file
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment