Skip to content
This repository has been archived by the owner on Feb 14, 2024. It is now read-only.

Commit

Permalink
order
Browse files Browse the repository at this point in the history
  • Loading branch information
nsheff committed Sep 14, 2023
1 parent 0ed6ec7 commit 5a55798
Showing 1 changed file with 6 additions and 9 deletions.
15 changes: 6 additions & 9 deletions seqcol/utilities.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,6 @@
_LOGGER = logging.getLogger(__name__)


# Refget digests from published seqcol v1.0 protocol
# Retrieved July 2019
# http://samtools.github.io/hts-specs/refget.html
def trunc512_digest(seq, offset=24) -> str:
"""Deprecated GA4GH digest function"""
digest = hashlib.sha512(seq.encode()).digest()
Expand Down Expand Up @@ -89,12 +86,6 @@ def format_itemwise(csc: SeqCol) -> list:
return {"sequences": list_of_dicts}


def fasta_file_to_digest(fa_file_path: str) -> str:
"""Given a fasta, return a digest"""
seqcol_obj = fasta_file_to_seqcol(fa_file_path)
return seqcol_digest(seqcol_obj)


def parse_fasta(fa_file) -> pyfaidx.Fasta:
"""
Read in a gzipped or not gzipped FASTA file
Expand All @@ -114,6 +105,12 @@ def parse_fasta(fa_file) -> pyfaidx.Fasta:
return pyfaidx.Fasta(f_out.name)


def fasta_file_to_digest(fa_file_path: str) -> str:
"""Given a fasta, return a digest"""
seqcol_obj = fasta_file_to_seqcol(fa_file_path)
return seqcol_digest(seqcol_obj)


def fasta_file_to_seqcol(fa_file_path: str) -> dict:
"""Given a fasta, return a canonical seqcol object"""
fa_obj = parse_fasta(fa_file_path)
Expand Down

0 comments on commit 5a55798

Please sign in to comment.