diff --git a/src/autobigs/engine/reading.py b/src/autobigs/engine/reading.py index 9949da4..61e998e 100644 --- a/src/autobigs/engine/reading.py +++ b/src/autobigs/engine/reading.py @@ -1,5 +1,6 @@ import asyncio from io import TextIOWrapper +from os import path from typing import Any, AsyncGenerator, Iterable, Union from Bio import SeqIO @@ -9,7 +10,7 @@ async def read_fasta(handle: Union[str, TextIOWrapper]) -> Iterable[NamedString] fasta_sequences = asyncio.to_thread(SeqIO.parse, handle=handle, format="fasta") results = [] for fasta_sequence in await fasta_sequences: - results.append(NamedString(fasta_sequence.id, str(fasta_sequence.seq))) + results.append(NamedString("{0}:{1}".format(path.basename(handle.name if isinstance(handle, TextIOWrapper) else handle), fasta_sequence.id), str(fasta_sequence.seq))) return results async def read_multiple_fastas(handles: Iterable[Union[str, TextIOWrapper]]) -> AsyncGenerator[Iterable[NamedString], Any]: