Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support zero-length sequences #155

Merged
merged 5 commits into from
Nov 22, 2019
Merged

Support zero-length sequences #155

merged 5 commits into from
Nov 22, 2019

Conversation

prihoda
Copy link
Contributor

@prihoda prihoda commented Nov 21, 2019

Add support for zero-length sequences.

Example FASTA file:

>A
ABC
>B
>C

>D
DEF
GH

Result: ['ABC', '', '', 'DEFGH']

Also enables slicing sequences to zero length, which corresponds to slicing python lists:

from pyfaidx import Fasta
a = Fasta('example.fa')[0]
print(a[0:])
# >A:1-3
# ABC
print(a[100:]
#>A:101-101
#

Please review all the changes, I tested on an example dataset but I cannot be sure that this will always work.

@prihoda
Copy link
Contributor Author

prihoda commented Nov 21, 2019

Fixes #93

@mdshw5
Copy link
Owner

mdshw5 commented Nov 21, 2019

I'll take a look today. On first glance this makes sense, and I'll add at least one test case before merging.

@mdshw5 mdshw5 self-assigned this Nov 21, 2019
@mdshw5
Copy link
Owner

mdshw5 commented Nov 22, 2019

It looks like this change not only fixes #93, but it doesn't break existing tests either. Great job @prihoda!. I'll merge and tag a new version (0.5.6) which will push to PyPI within the next hour.

@mdshw5 mdshw5 merged commit f1668d2 into mdshw5:master Nov 22, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants