From fdf6d29e2664cd4cb6d8c7ef41240a7585c14407 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Tue, 1 Oct 2024 13:36:15 +0200 Subject: [PATCH 01/18] Merge changes from main into hotfix (#195) (#346) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> Co-authored-by: Sara Monzón Co-authored-by: Pablo Mata <76519482+Shettland@users.noreply.github.com> Co-authored-by: Víctor López <98259577+victor5lm@users.noreply.github.com> From e695d0ef925b1b9909a6436a552cf0262353e09e Mon Sep 17 00:00:00 2001 From: Shettland Date: Tue, 15 Oct 2024 13:43:25 +0200 Subject: [PATCH 02/18] Included actions to publish release to pypi --- .github/workflows/pypi_publish.yml | 49 ++++++++++++++++++++++++++++++ 1 file changed, 49 insertions(+) create mode 100755 .github/workflows/pypi_publish.yml diff --git a/.github/workflows/pypi_publish.yml b/.github/workflows/pypi_publish.yml new file mode 100755 index 00000000..0e47ef9b --- /dev/null +++ b/.github/workflows/pypi_publish.yml @@ -0,0 +1,49 @@ +name: Publish package python distribution to Pypi + +on: + release: + types: [published] + workflow_dispatch: + +jobs: + build: + name: Build distribution + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - name: Set up Python + uses: actions/setup-python@v5 + with: + python-version: 3.12.7 + - name: Install pypi/build + run: >- + python3 -m + pip install + build + --user + - name: Build a binary wheel and a source tarball + run: python3 -m build + - name: Store the distribution packages + uses: actions/upload-artifact@v4 + with: + name: python-package-distributions + path: dist/ + + publish-to-pypi: + name: Publish dist to PyPI + needs: + - build + runs-on: ubuntu-latest + environment: + name: pypi + url: https://pypi.org/p/buisciii-tools + permissions: + id-token: write + steps: + - name: Download all the dists + uses: actions/download-artifact@v4 + with: + name: python-package-distributions + path: dist/ + - name: Publish to PyPI + uses: pypa/gh-action-pypi-publish@release/v1 From c34e98af9199202bb2f5482065fc89e9336c2d4e Mon Sep 17 00:00:00 2001 From: Shettland Date: Tue, 15 Oct 2024 13:46:55 +0200 Subject: [PATCH 03/18] Updated CHANGELOG --- CHANGELOG.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index b76da9b9..61cf8d30 100755 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -10,12 +10,16 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), Code contributions to the new version: +- [Pablo Mata](https://github.com/Shettland) + ### Template fixes and updates ### Modules #### Added enhancements +- Included a new github action to automatically publish releases to pypi [#351](https://github.com/BU-ISCIII/buisciii-tools/pull/351) + #### Fixes #### Changed From 7e1b4af287b4aeb7428cd02239853b793fb60ab4 Mon Sep 17 00:00:00 2001 From: Shettland Date: Tue, 15 Oct 2024 13:55:21 +0200 Subject: [PATCH 04/18] Updated new pip instructions --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index da5522a9..dddebc62 100644 --- a/README.md +++ b/README.md @@ -31,7 +31,7 @@ BU-ISCIII provides a serie or services in its portfolio for supporting bioinform ```bash micromamba create -n buisciii -f environment.yml micromamba activate buisciii -pip install --force-reinstall --upgrade git+https://github.com/bu-isciii/buisciii-tools.git@main +pip install buisciii-tools ``` or @@ -40,7 +40,7 @@ or git checkout main conda create -n buisciii -f environment.yml conda activate -pip install . +pip install buisciii-tools ``` ### Dev version From e53ee656b416c42913ef7d84cee7e52ce449531d Mon Sep 17 00:00:00 2001 From: victor5lm Date: Mon, 28 Oct 2024 12:14:34 +0100 Subject: [PATCH 05/18] Updated the fix-permissions module in __main__.py --- bu_isciii/__main__.py | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/bu_isciii/__main__.py b/bu_isciii/__main__.py index 1aebd780..a1cf21be 100755 --- a/bu_isciii/__main__.py +++ b/bu_isciii/__main__.py @@ -655,6 +655,7 @@ def autoclean_sftp(ctx, sftp_folder, days): "-d", "--input_directory", type=click.Path(), + multiple=True, default=None, required=True, help="Input directory to fix permissions (absolute path)", @@ -664,15 +665,18 @@ def fix_permissions(ctx, input_directory): """ Fix permissions """ - if not os.path.isdir(input_directory): - exit("Invalid input directory") conf = bu_isciii.config_json.ConfigJson() permissions = conf.get_configuration("global").get("permissions") - bu_isciii.utils.remake_permissions(input_directory, permissions) stderr = rich.console.Console( stderr=True, force_terminal=bu_isciii.utils.rich_force_colors() ) - stderr.print(f"[green]Correct permissions were applied to {input_directory}") + + for directory in input_directory: + if not os.path.isdir(directory): + stderr.print(f"[red]Invalid input directory: {directory}") + continue + bu_isciii.utils.remake_permissions(directory, permissions) + stderr.print(f"[green]Correct permissions were applied to {directory}") if __name__ == "__main__": From a454e5af9feadc79b2e811628de141b3eb0e1db1 Mon Sep 17 00:00:00 2001 From: victor5lm Date: Mon, 28 Oct 2024 12:18:34 +0100 Subject: [PATCH 06/18] Updated taxprofiler.config --- bu_isciii/templates/mag/DOC/taxprofiler.config | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bu_isciii/templates/mag/DOC/taxprofiler.config b/bu_isciii/templates/mag/DOC/taxprofiler.config index 60569c0a..1d05137f 100644 --- a/bu_isciii/templates/mag/DOC/taxprofiler.config +++ b/bu_isciii/templates/mag/DOC/taxprofiler.config @@ -5,7 +5,7 @@ singularity { enabled = true autoMounts = true - singularity.cacheDir = '/data/cnm/ratb/pipelines/singularity-images/' + singularity.cacheDir = '/data/bi/pipelines/singularity-images/' } process { From dd1fa022952cd1f7ea70116a8d9a5dcf4af1dfce Mon Sep 17 00:00:00 2001 From: victor5lm Date: Mon, 28 Oct 2024 12:19:05 +0100 Subject: [PATCH 07/18] Updated sftp_user.json --- bu_isciii/templates/sftp_user.json | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/bu_isciii/templates/sftp_user.json b/bu_isciii/templates/sftp_user.json index 344c8b49..a9cb6309 100755 --- a/bu_isciii/templates/sftp_user.json +++ b/bu_isciii/templates/sftp_user.json @@ -54,5 +54,6 @@ "bbaladron": ["SpainUDP"], "bioinfoadm": ["test"], "s.varona": ["misc"], - "nlabiod": ["Labarbovirus"] + "nlabiod": ["Labarbovirus"], + "jmgonzalez": ["Lablegionella"], } From 6cd5112dfece8ebb3e9d88ea9f833225b8c14d4a Mon Sep 17 00:00:00 2001 From: victor5lm Date: Mon, 28 Oct 2024 12:21:27 +0100 Subject: [PATCH 08/18] Fixed viralrecon's lablog and remove_columns script --- bu_isciii/templates/viralrecon/ANALYSIS/lablog_viralrecon | 1 + .../viralrecon/ANALYSIS/remove_columns_mapping_table.sh | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/bu_isciii/templates/viralrecon/ANALYSIS/lablog_viralrecon b/bu_isciii/templates/viralrecon/ANALYSIS/lablog_viralrecon index ec944be3..f80d4524 100644 --- a/bu_isciii/templates/viralrecon/ANALYSIS/lablog_viralrecon +++ b/bu_isciii/templates/viralrecon/ANALYSIS/lablog_viralrecon @@ -479,6 +479,7 @@ do cp create_summary_report.sh ${FOLDER_NAME}/ cp deduplicate_long_table.sh ${FOLDER_NAME}/ cp percentajeNs.py ${FOLDER_NAME}/ + cp remove_columns_mapping_table.sh ${FOLDER_NAME}/ grep -i ${in} samples_ref.txt | cut -f1,2 > ${FOLDER_NAME}/samples_ref.txt echo "ln -s ../00-reads ." > ${FOLDER_NAME}/lablog printf "ln -s ../samples_id.txt .\n\n" >> ${FOLDER_NAME}/lablog diff --git a/bu_isciii/templates/viralrecon/ANALYSIS/remove_columns_mapping_table.sh b/bu_isciii/templates/viralrecon/ANALYSIS/remove_columns_mapping_table.sh index 434c51c9..97e769d8 100644 --- a/bu_isciii/templates/viralrecon/ANALYSIS/remove_columns_mapping_table.sh +++ b/bu_isciii/templates/viralrecon/ANALYSIS/remove_columns_mapping_table.sh @@ -3,7 +3,7 @@ output_file=$(echo processed_mapping_illumina_$(date '+%Y%m%d').tab) # Removal of the first three columns of the mapping illumina tab file -cut --complement -f1-3 mapping_*.tab > output_file +cut --complement -f1-3 mapping_*.tab > $output_file mv $output_file mapping_illumina_$(date '+%Y%m%d').tab # Success message From 7c0522c2248e35d54bb33b787248f793cf66bc59 Mon Sep 17 00:00:00 2001 From: victor5lm Date: Mon, 28 Oct 2024 12:22:16 +0100 Subject: [PATCH 09/18] Updated mtbseq templates --- .../ANALYSIS/ANALYSIS01_MTBSEQ/03-MTBSeq/all_samples/lablog | 6 +++--- .../mtbseq/ANALYSIS/ANALYSIS01_MTBSEQ/03-MTBSeq/lablog | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/bu_isciii/templates/mtbseq/ANALYSIS/ANALYSIS01_MTBSEQ/03-MTBSeq/all_samples/lablog b/bu_isciii/templates/mtbseq/ANALYSIS/ANALYSIS01_MTBSEQ/03-MTBSeq/all_samples/lablog index d00741df..99a74d18 100644 --- a/bu_isciii/templates/mtbseq/ANALYSIS/ANALYSIS01_MTBSEQ/03-MTBSeq/all_samples/lablog +++ b/bu_isciii/templates/mtbseq/ANALYSIS/ANALYSIS01_MTBSEQ/03-MTBSeq/all_samples/lablog @@ -14,9 +14,9 @@ cd Mpileup; ln -s ../../*/Mpileup/* . ; cd - cd Position_Tables; ln -s ../../*/Position_Tables/* . ; cd - ##### Create join scripts -echo "srun --job-name MTBSEQ_JOIN --output logs/MTBSEQ_JOIN.%j.log --partition middle_obx --mem 48G --chdir ${scratch_dir} --cpus-per-task 10 singularity exec -B ${scratch_dir}/../../../../ /data/bi/pipelines/singularity-images/mtbseq:1.0.4—hdfd78af_2 MTBseq --step TBjoin --threads 5 --samples ${scratch_dir}/samples.txt &" > _01_tb_join.sh -echo "srun --job-name MTBSEQ_AMEND --output logs/MTBSEQ_AMEND.%j.log --partition middle_obx --mem 48G --chdir ${scratch_dir} --cpus-per-task 10 singularity exec -B ${scratch_dir}/../../../../ /data/bi/pipelines/singularity-images/mtbseq:1.0.4—hdfd78af_2 MTBseq --step TBamend --threads 5 --samples ${scratch_dir}/samples.txt &" > _02_tb_amend.sh -echo "srun --job-name MTBSEQ_GROUPS --output logs/MTBSEQ_GROUPS.%j.log --partition middle_obx --mem 48G --chdir ${scratch_dir} --cpus-per-task 10 singularity exec -B ${scratch_dir}/../../../../ /data/bi/pipelines/singularity-images/mtbseq:1.0.4—hdfd78af_2 MTBseq --step TBgroups --threads 5 --samples ${scratch_dir}/samples.txt &" > _03_tb_groups.sh +echo "srun --job-name MTBSEQ_JOIN --output logs/MTBSEQ_JOIN.%j.log --partition middle_obx --mem 48G --chdir ${scratch_dir} --cpus-per-task 10 singularity exec -B ${scratch_dir}/../../../../ /data/bi/pipelines/singularity-images/mtbseq:1.1.0--hdfd78af_0 MTBseq --step TBjoin --threads 5 --samples ${scratch_dir}/samples.txt &" > _01_tb_join.sh +echo "srun --job-name MTBSEQ_AMEND --output logs/MTBSEQ_AMEND.%j.log --partition middle_obx --mem 48G --chdir ${scratch_dir} --cpus-per-task 10 singularity exec -B ${scratch_dir}/../../../../ /data/bi/pipelines/singularity-images/mtbseq:1.1.0--hdfd78af_0 MTBseq --step TBamend --threads 5 --samples ${scratch_dir}/samples.txt &" > _02_tb_amend.sh +echo "srun --job-name MTBSEQ_GROUPS --output logs/MTBSEQ_GROUPS.%j.log --partition middle_obx --mem 48G --chdir ${scratch_dir} --cpus-per-task 10 singularity exec -B ${scratch_dir}/../../../../ /data/bi/pipelines/singularity-images/mtbseq:1.1.0--hdfd78af_0 MTBseq --step TBgroups --threads 5 --samples ${scratch_dir}/samples.txt &" > _03_tb_groups.sh #### Execute iqtree echo "srun --chdir ${scratch_dir} --output logs/IQTREEFULLALIGN.%j.log --job-name IQTREEFULLALIGN --cpus-per-task 20 --mem 15G --partition short_idx --time 08:00:00 singularity exec -B ${scratch_dir}/../../../../ /data/bi/pipelines/singularity-images/iqtree:2.1.4_beta--hdcc8f71_0 iqtree -s ${scratch_dir}/Amend/*amended_u95_phylo_w12.plainIDs.fasta -m K3Pu+F+I -T 20 -B 1000 -pre phylo.iqtree.bootstrap &" > _04_iqtreeall.sh diff --git a/bu_isciii/templates/mtbseq/ANALYSIS/ANALYSIS01_MTBSEQ/03-MTBSeq/lablog b/bu_isciii/templates/mtbseq/ANALYSIS/ANALYSIS01_MTBSEQ/03-MTBSeq/lablog index 0eff7900..55345c6d 100644 --- a/bu_isciii/templates/mtbseq/ANALYSIS/ANALYSIS01_MTBSEQ/03-MTBSeq/lablog +++ b/bu_isciii/templates/mtbseq/ANALYSIS/ANALYSIS01_MTBSEQ/03-MTBSeq/lablog @@ -9,7 +9,7 @@ cat ../samples_id.txt | xargs -I % echo "mkdir %; ln -s ../../01-preprocessing/% cat ../samples_id.txt | xargs -I % echo "ln -s ../../01-preprocessing/%/%_R2_filtered.fastq.gz %/%_lib1_R2.fastq.gz" >> _00_prepareRaw.sh cat ../samples_id.txt | xargs -I % echo "cd %;ls *.fastq.gz | tr '_' '\t' | cut -f 1,2 | sort -u > samples.txt;cd -" > _01_preparesamples.sh -cat ../samples_id.txt | xargs -I @@ echo -e "srun --job-name MTBSEQ.@@ --output logs/MTBSEQ.@@.%j.log --partition middle_idx --mem 48G --chdir ${scratch_dir}/@@ --cpus-per-task 10 singularity exec -B ${scratch_dir}/../../../ /data/bi/pipelines/singularity-images/mtbseq:1.0.4--hdfd78af_2 MTBseq --step TBfull --threads 10 --samples samples.txt &" > _02_mtbseq.sh +cat ../samples_id.txt | xargs -I @@ echo -e "srun --job-name MTBSEQ.@@ --output logs/MTBSEQ.@@.%j.log --partition middle_idx --mem 48G --chdir ${scratch_dir}/@@ --cpus-per-task 10 singularity exec -B ${scratch_dir}/../../../ /data/bi/pipelines/singularity-images/mtbseq:1.1.0--hdfd78af_0 MTBseq --step TBfull --threads 10 --samples samples.txt &" > _02_mtbseq.sh # classification echo "mkdir classification_all" > _03_gather_results.sh From 7db149e982ce1247133245e5f4b8007414ce40a2 Mon Sep 17 00:00:00 2001 From: victor5lm Date: Mon, 28 Oct 2024 12:23:18 +0100 Subject: [PATCH 10/18] Updated bioinfo_doc.py to handle the Unable to send e-mail error message --- bu_isciii/bioinfo_doc.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bu_isciii/bioinfo_doc.py b/bu_isciii/bioinfo_doc.py index 519cb382..4654f9ed 100644 --- a/bu_isciii/bioinfo_doc.py +++ b/bu_isciii/bioinfo_doc.py @@ -715,7 +715,7 @@ def send_email(self, html_text, results_pdf_file): server.ehlo() server.login(user=email_host_user, password=email_host_password) except Exception as e: - stderr.print("[red] Unable to send e-mail" + e) + stderr.print("[red] Unable to send e-mail: " + str(e)) default_cc = "bioinformatica@isciii.es" msg = MIMEMultipart("alternative") msg["To"] = self.resolution_info["service_user_id"]["email"] From ced57ba26a59773df2e2361c30bad6d6bf410f6f Mon Sep 17 00:00:00 2001 From: victor5lm Date: Mon, 28 Oct 2024 12:28:08 +0100 Subject: [PATCH 11/18] Updated new_service.py to check FASTQ integrity --- bu_isciii/new_service.py | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) diff --git a/bu_isciii/new_service.py b/bu_isciii/new_service.py index 0bcf6556..9cb4bca6 100755 --- a/bu_isciii/new_service.py +++ b/bu_isciii/new_service.py @@ -8,6 +8,7 @@ import json import shutil import rich +import subprocess # Local imports import bu_isciii @@ -88,7 +89,35 @@ def __init__( ) self.full_path = os.path.join(self.path, self.service_folder) + def check_md5(self): + # Path to the .md5 file + project_name = self.service_samples[0]["project_name"] + md5_file_path = f"/srv/fastq_repo/{project_name}/md5sum_{project_name}.md5" + if not os.path.exists(md5_file_path): + stderr.print(f"[red]ERROR: .md5 file not found at {md5_file_path}") + sys.exit(1) + + original_dir = os.getcwd() + md5_dir = os.path.dirname(md5_file_path) + os.chdir(md5_dir) + + # md5sum command + stderr.print(f"[blue]Checking MD5 integrity for {md5_file_path}") + try: + result = subprocess.run( + ['md5sum', '-c', os.path.basename(md5_file_path)], + check=True, + ) + stderr.print(f"[green]MD5 check passed!") + except subprocess.CalledProcessError as e: + stderr.print(f"[red]ERROR: MD5 check failed: {e.stderr}") + sys.exit(1) + finally: + os.chdir(original_dir) + + def create_folder(self): + self.check_md5() if not self.no_create_folder: stderr.print( "[blue]I will create the service folder for " + self.resolution_id + "!" From 8a2462137206a7f0a5f562f4f8040b973ae3ee57 Mon Sep 17 00:00:00 2001 From: victor5lm Date: Mon, 28 Oct 2024 12:42:18 +0100 Subject: [PATCH 12/18] Updated CHANGELOG.md, setup.py and __main__.py --- CHANGELOG.md | 45 +++++++++++++++++++++++++++++++++++++++++++ bu_isciii/__main__.py | 2 +- setup.py | 2 +- 3 files changed, 47 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 61cf8d30..2050d306 100755 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,12 +8,57 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), ### Credits +### Template fixes and updates + +### Modules + +#### Added enhancements + +#### Fixes + +#### Changed + +#### Removed + +### Requirements + +## [2.X.Xhot] - 2024-0X-0X : https://github.com/BU-ISCIII/buisciii-tools/releases/tag/2.X.2 + +### Credits + +### Template fixes and updates + +### Modules + +#### Added enhancements + +#### Fixes + +#### Changed + +#### Removed + +### Requirements + +## [2.2.2] - 2024-10-28 : https://github.com/BU-ISCIII/buisciii-tools/releases/tag/2.2.2 + +### Credits + Code contributions to the new version: - [Pablo Mata](https://github.com/Shettland) +- [Victor Lopez](https://github.com/victor5lm) ### Template fixes and updates +- Updated the fix-permissions module in __main__.py [#356](https://github.com/BU-ISCIII/buisciii-tools/pull/356). +- Fixed the singularity cache directory in taxprofiler.config [#356](https://github.com/BU-ISCIII/buisciii-tools/pull/356). +- Updated sftp_user.json [#356](https://github.com/BU-ISCIII/buisciii-tools/pull/356). +- Fixed viralrecon's lablog and the remove_columns_mapping_table.sh auxiliary script [#356](https://github.com/BU-ISCIII/buisciii-tools/pull/356). +- Updated the singularity image in the mtbseq templates [#356](https://github.com/BU-ISCIII/buisciii-tools/pull/356). +- Fixed a bug in bioinfo_doc.py [#356](https://github.com/BU-ISCIII/buisciii-tools/pull/356). +- Updated new_service.py to check FASTQ integrity via md5sum [#356](https://github.com/BU-ISCIII/buisciii-tools/pull/356). + ### Modules #### Added enhancements diff --git a/bu_isciii/__main__.py b/bu_isciii/__main__.py index a1cf21be..a7e958ae 100755 --- a/bu_isciii/__main__.py +++ b/bu_isciii/__main__.py @@ -57,7 +57,7 @@ def run_bu_isciii(): ) # stderr.print("[green] `._,._,'\n", highlight=False) - __version__ = "2.2.1" + __version__ = "2.2.2" stderr.print( "[grey39] BU-ISCIII-tools version {}".format(__version__), highlight=False ) diff --git a/setup.py b/setup.py index 50fdff3d..67938626 100755 --- a/setup.py +++ b/setup.py @@ -2,7 +2,7 @@ from setuptools import setup, find_packages -version = "2.2.1" +version = "2.2.2" with open("README.md") as f: readme = f.read() From 04615c7278860c9bc011b4e5e6f370fa9e101d62 Mon Sep 17 00:00:00 2001 From: victor5lm Date: Mon, 28 Oct 2024 12:58:30 +0100 Subject: [PATCH 13/18] Fixed some linting mistakes in new_service.py --- bu_isciii/new_service.py | 44 +++++++++++++++++++--------------------- 1 file changed, 21 insertions(+), 23 deletions(-) diff --git a/bu_isciii/new_service.py b/bu_isciii/new_service.py index 9cb4bca6..a974d4f6 100755 --- a/bu_isciii/new_service.py +++ b/bu_isciii/new_service.py @@ -90,31 +90,29 @@ def __init__( self.full_path = os.path.join(self.path, self.service_folder) def check_md5(self): - # Path to the .md5 file - project_name = self.service_samples[0]["project_name"] - md5_file_path = f"/srv/fastq_repo/{project_name}/md5sum_{project_name}.md5" - if not os.path.exists(md5_file_path): - stderr.print(f"[red]ERROR: .md5 file not found at {md5_file_path}") - sys.exit(1) - - original_dir = os.getcwd() - md5_dir = os.path.dirname(md5_file_path) - os.chdir(md5_dir) + # Path to the .md5 file + project_name = self.service_samples[0]["project_name"] + md5_file_path = f"/srv/fastq_repo/{project_name}/md5sum_{project_name}.md5" + if not os.path.exists(md5_file_path): + stderr.print(f"[red]ERROR: .md5 file not found at {md5_file_path}") + sys.exit(1) - # md5sum command - stderr.print(f"[blue]Checking MD5 integrity for {md5_file_path}") - try: - result = subprocess.run( - ['md5sum', '-c', os.path.basename(md5_file_path)], - check=True, - ) - stderr.print(f"[green]MD5 check passed!") - except subprocess.CalledProcessError as e: - stderr.print(f"[red]ERROR: MD5 check failed: {e.stderr}") - sys.exit(1) - finally: - os.chdir(original_dir) + original_dir = os.getcwd() + md5_dir = os.path.dirname(md5_file_path) + os.chdir(md5_dir) + # md5sum command + stderr.print(f"[blue]Checking MD5 integrity for {md5_file_path}") + try: + subprocess.run( + ['md5sum', '-c', os.path.basename(md5_file_path)], + check=True) + stderr.print("[green]MD5 check passed!") + except subprocess.CalledProcessError as e: + stderr.print(f"[red]ERROR: MD5 check failed: {e.stderr}") + sys.exit(1) + finally: + os.chdir(original_dir) def create_folder(self): self.check_md5() From cb6a877bfff81d90516bf6a61c825f51bc43dc11 Mon Sep 17 00:00:00 2001 From: victor5lm Date: Mon, 28 Oct 2024 13:00:18 +0100 Subject: [PATCH 14/18] Ran black on new_service.py --- bu_isciii/new_service.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/bu_isciii/new_service.py b/bu_isciii/new_service.py index a974d4f6..cb1ecb92 100755 --- a/bu_isciii/new_service.py +++ b/bu_isciii/new_service.py @@ -105,8 +105,8 @@ def check_md5(self): stderr.print(f"[blue]Checking MD5 integrity for {md5_file_path}") try: subprocess.run( - ['md5sum', '-c', os.path.basename(md5_file_path)], - check=True) + ["md5sum", "-c", os.path.basename(md5_file_path)], check=True + ) stderr.print("[green]MD5 check passed!") except subprocess.CalledProcessError as e: stderr.print(f"[red]ERROR: MD5 check failed: {e.stderr}") From 7a529bfe808b16387567a1d747d83e4b67e9d385 Mon Sep 17 00:00:00 2001 From: victor5lm Date: Mon, 28 Oct 2024 13:03:08 +0100 Subject: [PATCH 15/18] Removed an extra comma from sftp_user.json --- bu_isciii/templates/sftp_user.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bu_isciii/templates/sftp_user.json b/bu_isciii/templates/sftp_user.json index a9cb6309..ba627858 100755 --- a/bu_isciii/templates/sftp_user.json +++ b/bu_isciii/templates/sftp_user.json @@ -55,5 +55,5 @@ "bioinfoadm": ["test"], "s.varona": ["misc"], "nlabiod": ["Labarbovirus"], - "jmgonzalez": ["Lablegionella"], + "jmgonzalez": ["Lablegionella"] } From 34f9590b60651a24f6c25abaa042f036f60c2205 Mon Sep 17 00:00:00 2001 From: victor5lm Date: Tue, 29 Oct 2024 09:44:34 +0100 Subject: [PATCH 16/18] Removed conda env line from viralrecon's results lablog --- bu_isciii/templates/viralrecon/RESULTS/lablog_viralrecon_results | 1 - 1 file changed, 1 deletion(-) diff --git a/bu_isciii/templates/viralrecon/RESULTS/lablog_viralrecon_results b/bu_isciii/templates/viralrecon/RESULTS/lablog_viralrecon_results index d05b2ab7..31bbdfd1 100755 --- a/bu_isciii/templates/viralrecon/RESULTS/lablog_viralrecon_results +++ b/bu_isciii/templates/viralrecon/RESULTS/lablog_viralrecon_results @@ -25,7 +25,6 @@ ln -s ../../ANALYSIS/*/mapping_illumina*.tab ./mapping_illumina.csv ln -s ../../ANALYSIS/*/assembly_stats.csv ./assembly_stats.csv ln -s ../../ANALYSIS/*/01-PikaVirus-results/all_samples_virus_table_filtered.tsv ./pikavirus_table.tsv -#conda activate viralrecon_report echo "python ./excel_generator.py -r ./references.tmp --merge_lineage_files" > _01_generate_excel_files.sh #Cleaning temp files and broken symbolic links echo "find . -xtype l -delete" > _02_clean_folders.sh From b5317ade83e81b3bb54545ec4c08fdd2ab814f80 Mon Sep 17 00:00:00 2001 From: victor5lm Date: Tue, 29 Oct 2024 10:17:40 +0100 Subject: [PATCH 17/18] Substituted /srv/fastq_repo by its variable name --- bu_isciii/new_service.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bu_isciii/new_service.py b/bu_isciii/new_service.py index cb1ecb92..ac43fd85 100755 --- a/bu_isciii/new_service.py +++ b/bu_isciii/new_service.py @@ -92,7 +92,7 @@ def __init__( def check_md5(self): # Path to the .md5 file project_name = self.service_samples[0]["project_name"] - md5_file_path = f"/srv/fastq_repo/{project_name}/md5sum_{project_name}.md5" + md5_file_path = f'{self.conf["fastq_repo"]}/{project_name}/md5sum_{project_name}.md5' if not os.path.exists(md5_file_path): stderr.print(f"[red]ERROR: .md5 file not found at {md5_file_path}") sys.exit(1) From 4d4da2e03a7247a349a015259f3a6754ec7a576b Mon Sep 17 00:00:00 2001 From: victor5lm Date: Tue, 29 Oct 2024 10:19:12 +0100 Subject: [PATCH 18/18] Ran black on new_service.py --- bu_isciii/new_service.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/bu_isciii/new_service.py b/bu_isciii/new_service.py index ac43fd85..e22bcde1 100755 --- a/bu_isciii/new_service.py +++ b/bu_isciii/new_service.py @@ -92,7 +92,9 @@ def __init__( def check_md5(self): # Path to the .md5 file project_name = self.service_samples[0]["project_name"] - md5_file_path = f'{self.conf["fastq_repo"]}/{project_name}/md5sum_{project_name}.md5' + md5_file_path = ( + f'{self.conf["fastq_repo"]}/{project_name}/md5sum_{project_name}.md5' + ) if not os.path.exists(md5_file_path): stderr.print(f"[red]ERROR: .md5 file not found at {md5_file_path}") sys.exit(1)