Skip to content

Instantly share code, notes, and snippets.

@tbrittoborges
Last active August 29, 2015 14:06
Show Gist options
  • Save tbrittoborges/d4704b71edcfb4ff847c to your computer and use it in GitHub Desktop.
Save tbrittoborges/d4704b71edcfb4ff847c to your computer and use it in GitHub Desktop.
def remove_description_from_fasta(input, output, regex):
with open(input,) as input_stream, open(output , 'w') as output_stream:
for line in input_stream:
if line.startswith('>'):
if regex in line:
output_stream.write(line)
write = True
else:
write = False
elif write:
output_stream.write(line)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment