From 05e95d2800d795b65f1a20fd7072803bb124f604 Mon Sep 17 00:00:00 2001 From: luissian Date: Sat, 28 Sep 2024 11:25:57 +0200 Subject: [PATCH] Solved issue #312 warnings when running the install.sh --- wetlab/utils/collection_index.py | 4 ++-- wetlab/utils/common.py | 2 +- wetlab/utils/crontab_process.py | 2 +- wetlab/utils/library.py | 2 +- wetlab/utils/samplesheet.py | 12 ++++++------ 5 files changed, 11 insertions(+), 11 deletions(-) diff --git a/wetlab/utils/collection_index.py b/wetlab/utils/collection_index.py index e5d2e8e1c..f00c5c919 100644 --- a/wetlab/utils/collection_index.py +++ b/wetlab/utils/collection_index.py @@ -73,7 +73,7 @@ def get_collection_index_name(input_file): collection_name = "" with open(input_file, encoding="utf-8") as fh: for line in fh: - found_collection_name = re.search("^\[Name\]", line) + found_collection_name = re.search(r"^\[Name\]", line) if found_collection_name: found_name = True continue @@ -305,7 +305,7 @@ def store_collection_kits_file(collection_file): # fetch the file from user form and build the file name including # the date and time on now to store in database - split_filename = re.search("(.*)(\.\w+$)", collection_file.name) + split_filename = re.search(r"(.*)(\.\w+$)", collection_file.name) f_name = split_filename[1] f_extension = split_filename[2] fs_index_lib = FileSystemStorage() diff --git a/wetlab/utils/common.py b/wetlab/utils/common.py index b779a8e4a..c2590ad4b 100644 --- a/wetlab/utils/common.py +++ b/wetlab/utils/common.py @@ -186,7 +186,7 @@ def find_xml_tag_text(input_file, search_tag): fh = open(input_file, "r") search_line = "<" + search_tag + ">(.*)" for line in fh: - found_tag = re.search("^\s+ %s" % search_line, line) + found_tag = re.search(r"^\s+ %s" % search_line, line) if found_tag: fh.close() return found_tag.group(1) diff --git a/wetlab/utils/crontab_process.py b/wetlab/utils/crontab_process.py index 094b3b015..3033496ef 100644 --- a/wetlab/utils/crontab_process.py +++ b/wetlab/utils/crontab_process.py @@ -720,7 +720,7 @@ def get_latest_run_procesing_log(conn, log_folder, experiment_name): continue file_remote = sfh.filename if file_remote.endswith(".log"): - log_file = re.search(".*_Cycle(\d+)_.*", file_remote) + log_file = re.search(r".*_Cycle(\d+)_.*", file_remote) cycle_number = int(log_file.group(1)) if cycle_number > max_cycle: diff --git a/wetlab/utils/library.py b/wetlab/utils/library.py index 7f0f26aea..6a99fbe20 100644 --- a/wetlab/utils/library.py +++ b/wetlab/utils/library.py @@ -804,7 +804,7 @@ def get_library_code_and_unique_id(sample_id, molecule_id): sample_id=sample_obj, molecule_id=molecule_obj ).last() last_lib_prep_code_id = lib_prep_obj.get_lib_prep_code() - split_code = re.search("(.*_)(\d+)$", last_lib_prep_code_id) + split_code = re.search(r"(.*_)(\d+)$", last_lib_prep_code_id) index_val = int(split_code.group(2)) new_index = str(index_val + 1).zfill(2) lib_prep_code_id = split_code.group(1) + new_index diff --git a/wetlab/utils/samplesheet.py b/wetlab/utils/samplesheet.py index ca4c7b900..a7b04e1b5 100644 --- a/wetlab/utils/samplesheet.py +++ b/wetlab/utils/samplesheet.py @@ -106,7 +106,7 @@ def get_adapters(file_lines): else: adapter2 = adapter_code break - data_found = re.search("^\[Data]", line) + data_found = re.search(r"^\[Data]", line) if data_found: break @@ -205,7 +205,7 @@ def get_reads(file_lines): continue if "[Settings]" in line: break - if read_found and re.search("^\w+", line): + if read_found and re.search(r"^\w+", line): reads.append(line.split(",")[0]) return reads @@ -392,7 +392,7 @@ def get_projects_in_run(in_file: str) -> dict: continue else: # ignore the empty lines separated by commas - valid_line = re.search("^\w+", line) + valid_line = re.search(r"^\w+", line) if not valid_line: continue # store the project name and the user name (Description) inside projects dict @@ -442,7 +442,7 @@ def get_index_library_name(in_file): def update_library_kit_field(library_file_name, library_kit_name, library_name): # result_directory='documents/wetlab/BaseSpaceMigrationFiles/' timestr = time.strftime("%Y%m%d-%H%M%S") - tmp = re.search("(.*)\d{8}-\d+.*\.csv", library_file_name) + tmp = re.search(r"(.*)\d{8}-\d+.*\.csv", library_file_name) absolute_path = str(settings.BASE_DIR + "/") out_file = str( absolute_path @@ -517,7 +517,7 @@ def create_unique_sample_id_values(infile, index_file): continue if found_sample_line: # discard the empty lines or the lines that contains empty lines separated by comma - if line == "\n" or re.search("^\W", line): + if line == "\n" or re.search(r"^\W", line): continue data_line = line.split(",") @@ -592,7 +592,7 @@ def set_user_names_in_sample_sheet(in_file, user_names): continue if found_sample_line: # discard the empty lines or the lines that contains empty lines separated by comma - if line == "\n" or re.search("^\W", line): + if line == "\n" or re.search(r"^\W", line): continue data_line = line.split(",")