diff --git a/src/g5505_utils.py b/src/g5505_utils.py index 103f529..76f1513 100644 --- a/src/g5505_utils.py +++ b/src/g5505_utils.py @@ -1,6 +1,6 @@ import pandas as pd import os - +import shutil def is_callable_list(x : list): return all([callable(item) for item in x]) @@ -49,3 +49,19 @@ def split_sample_col_into_sample_and_data_quality_cols(input_data: pd.DataFrame) input_data['data_quality'] = sample_quality return input_data + +def make_file_copy(source_file_path): + + pathtail, filename = os.path.split(source_file_path) + backup_filename = 'backup_'+ filename + # Path + ROOT_DIR = os.path.abspath(os.curdir) + + tmp_dirpath = os.path.join(ROOT_DIR,'tmp_files') + if not os.path.exists(tmp_dirpath): + os.mkdir(tmp_dirpath) + + tmp_file_path = os.path.join(tmp_dirpath,backup_filename) + shutil.copy(source_file_path, tmp_file_path) + + return tmp_file_path \ No newline at end of file