lmdu/pyfastx

Slice feature for keys

sanjaysrikakulam opened this issue · 4 comments

Hi,

Thank you for this handy tool, really useful!

I am writing a tool that uses pyfastx and was wondering that it would be really nice to have a slice feature for keys instead of iterating over every key and saving it in a list object.

from pyfastx import Fasta
fasta_obj = Fasta("fasta_file.fasta", build_index=True)
fasta_keys = fasta_obj.keys()

fasta_keys[0:10]

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
TypeError: sequence index must be integer, not 'slice'

Thanks in advance!

lmdu commented

Thank you for your advice. I will added this feature to the next version.

Hi @lmdu ,

Thank you very much!

lmdu commented

We have added slice feature in the new version. But there may be performance issue when processing large files (e.g. has sequence count > 10 million).

Great, thank you very much. I really appreciate it!