Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Any regular expressions gurus here?
#5
Thanks.

This is the python code that did it. I could not do it in one pass. There is no global flag for python for regex.

def trypsinize(proteins):

p = re.compile(r'([K|R])([^P])'Wink
q = re.compile(r'([K|R])([^,P])'Wink

output = []
for protein in proteins:
name = protein[0]
sequence = protein[1]
a = p.sub(r'\1,\2',sequence)
b = q.sub(r'\1,\2',a)
output.append([name,b.split(','Wink])
return output
Reply


Messages In This Thread
Any regular expressions gurus here? - by volcs0 - 12-29-2008, 08:24 AM
Re: Any regular expressions gurus here? - by volcs0 - 12-30-2008, 02:22 AM

Forum Jump:


Users browsing this thread: 1 Guest(s)