Skip to content

Commit

Permalink
Try to build FASTA indexes again on startup
Browse files Browse the repository at this point in the history
  • Loading branch information
mihaitodor committed Aug 31, 2023
1 parent 11b450c commit 5e376b2
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
5 changes: 2 additions & 3 deletions app/fasta.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
from pathlib import Path
from urllib.request import urlretrieve
from utilities.SPDI_Normalization import init_fasta


def download_fasta():
Expand All @@ -16,8 +17,6 @@ def download_fasta():
urlretrieve('https://ftp.ncbi.nlm.nih.gov/refseq/H_sapiens/annotation/' + build + '_latest/refseq_identifiers/' + filename, filepath)

# Build indexes
# Disable this for now
# if not Path(filepath + '.fxi').is_file():
# Fasta(filepath)
init_fasta()
except Exception as error:
print(error)
5 changes: 5 additions & 0 deletions utilities/SPDI_Normalization.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,11 @@ def get_fasta(file):
return fasta_cache[file]


def init_fasta():
get_fasta(BUILD37_FILE)
get_fasta(BUILD38_FILE)


def get_normalized_spdi(ref_seq, pos, ref, alt, build):
if build == 'GRCh37':
GRCh37_ref_seq_fasta = get_fasta(BUILD37_FILE)
Expand Down

0 comments on commit 5e376b2

Please sign in to comment.