Skip to content

Allow fasta_digest to accept Path or bytes #93

Open
@nsheff

Description

@nsheff

Right now digest_fasta strictly requires a string.

works:

from gtars.digests import digest_fasta
path_to_fasta_file = "../gtars/gtars/tests/data/base.fa"
df = digest_fasta(path_to_fasta_file)

Doesn't work:

from pathlib import Path
p = Path(path_to_fasta_file)
digest_fasta(p)
# TypeError: argument 'fasta': 'PosixPath' object cannot be converted to 'PyString'

Also fails:

digest_fasta(path_to_fasta_file.encode('utf-8'))
TypeError: argument 'fasta': 'bytes' object cannot be converted to 'PyString'

Would it be easy/possible/advisable to make this friendly enough to convert string-like inputs to string automatically?

Raised by @stolarczyk

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions