Skip to content

Commit

Permalink
unzip using python instead of command line tool
Browse files Browse the repository at this point in the history
  • Loading branch information
jboktor committed Dec 17, 2024
1 parent ae03617 commit 08ab0d0
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions scripts/reference.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
import argparse
import logging as log
import numpy as np
import zipfile

from argparse import RawTextHelpFormatter
from os.path import isfile, isdir, dirname, realpath
Expand Down Expand Up @@ -96,8 +97,12 @@ def fetch_hla_dat():

# Check if hla.dat is zipped and unzip it if needed
if isfile(hla_dat + '.zip'):
run_command(['unzip', '-o', hla_dat + '.zip', '-d', dirname(hla_dat)],
'[reference] Unzipping hla.dat file:')
log.info('[reference] Unzipping hla.dat file')
try:
with zipfile.ZipFile(hla_dat + '.zip', 'r') as zip_ref:
zip_ref.extractall(dirname(hla_dat))
except zipfile.BadZipFile:
sys.exit('[reference] Error: hla.dat.zip is corrupted')

def checkout_version(commithash, verbose = True):
'''Checks out a specific IMGTHLA github version given a commithash.'''
Expand Down

0 comments on commit 08ab0d0

Please sign in to comment.