Hi,
I'm new to alfred & am trying to make a simple workflow to reverse a string of letters and convert each letter to another letter (eg. convert A to T), then copy the output to the clipboard. I have a python script to do this, but I'm having trouble making it part of an alfred workflow.
Here's the script:
#reversecomplement
def reverse(s):
"""Return the sequence string in reverse order."""
letters = list(s)
letters.reverse()
return ''.join(letters)
def complement(s):
"""Return the complementary sequence string."""
basecomplement = {'A': 'T', 'C': 'G', 'G': 'C', 'T': 'A', 'a': 't', 'c': 'g', 't': 'a', 'g': 'c'}
letters = list(s)
letters = [basecomplement[base] for base in letters]
return ''.join(letters)
def rc(s):
"""Return the reverse complement of the dna string."""
s = reverse(s)
s = complement(s)
return s
Disclaimer: I have very little experience in writing code.
Thanks in advance for your help!