Skip to content

Commit

Permalink
Major update on code structure
Browse files Browse the repository at this point in the history
  • Loading branch information
youyupei committed Jun 21, 2024
1 parent 65a392e commit 0d12d05
Show file tree
Hide file tree
Showing 5 changed files with 90 additions and 419 deletions.
3 changes: 1 addition & 2 deletions blaze/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -81,5 +81,4 @@ def high_sensitivity_threshold_calculation(count_array, exp_cells):
BBBBB BBBB LLLLLAAAAAA AAAAAZZZZZZZZZZZZEEEEEEEEEEEEEEE
BBBBBBBBBBBBBBBB LLLLLLLLLLLLLLLLLLLL . ^PPPPPPY. ^PPPPPPY. 7PPP
BBBBBBBBBBBBBBB LLLLLLLLLLLLLLLLLLLL...!BBBBBBP:...!BBBBBBP:.::.?BBB
"""

"""
16 changes: 11 additions & 5 deletions blaze/helper.py
Original file line number Diff line number Diff line change
Expand Up @@ -236,26 +236,32 @@ def concatenate_files(output_file, *input_files):
os.remove(input_file)

# get file with a certian extensions
def get_files(search_dir, extensions, recursive=True):
def get_files_by_suffix(search_dir, suffix, recursive=True):
files = []
if isinstance(suffix, str):
suffix = [suffix]
if recursive:
for i in extensions:
for i in suffix:
files.extend(Path(search_dir).rglob(i))
return sorted(files)
else:
for i in extensions:
for i in suffix:
files.extend(Path(search_dir).glob(i))
return sorted(files)

# check file exist. Exit if not
def check_exist(file_list):
def check_files_exist(file_list):
if isinstance(file_list, str):
file_list = [file_list]
exit_code = 0
for fn in file_list:
if not os.path.exists(fn):
exit_code = 1
err_msg(f'Error: can not find {fn}')
if exit_code == 1:
sys.exit()
sys.exit(1)
else:
return True

# split any iterator in to batches
def batch_iterator(iterator, batch_size):
Expand Down
Loading

0 comments on commit 0d12d05

Please sign in to comment.