Commit 2beb9fe7 authored by Mikaël Salson's avatar Mikaël Salson Committed by Mathieu Giraud Pasting upstream and downstream sequence data

See #3009
parent d76a9e45
......@@ -93,10 +93,24 @@ def get_gene_coord(imgt_line):
'imgt_name': elements[1],
'imgt_data': '|'.join(elements[1:5])}
def paste_updown_on_fasta(fasta, up, down):
Put upstream and/or downstream data on an existing FASTA sequences
>>> paste_updown_on_fasta('>seq\\nAAAAAAAAAAAAAAAAAAA\\nTTTTTTTTTTT', 'CCCC', 'GGGG')
>>> paste_updown_on_fasta('>seq\\nAAAAAAAAAAAAAAAAAAA\\nTTTTTTTTTTT\\n', '', 'GGGG')
>>> paste_updown_on_fasta('>seq\\nAAAAAAAAAAAAAAAAAAA\\nTTTTTTTTTTT', 'CCCC', '')
lines = fasta.split('\n')
return lines[0]+'\n' + (up+'\n' if up else '') + '\n'.join(filter(None, lines[1:])) + '\n'\
+ (down+'\n' if down else '')
def store_data_if_updownstream(fasta_header, path, data, genes):
for gene in gene_matches(fasta_header, genes):
gene_name, gene_coord = get_gene_coord(fasta_header)
if gene_name:
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