Skip to content

Allow fasta_digest to accept Path or bytes #93

Closed
@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

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions