From 7839afabd5393f8a27567f47be951357ca2a0b5e Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Thu, 12 Sep 2024 12:51:12 +0200 Subject: [PATCH 01/19] Merge changes from main into hotfix (#195) (#337) 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 21eac2f0ad35ca064850e2697f0d353623bd14b2 Mon Sep 17 00:00:00 2001 From: Dani VM Date: Thu, 12 Sep 2024 13:21:21 +0200 Subject: [PATCH 02/19] fixed path database and update emmtyper params --- .../ANALYSIS01_CHARACTERIZATION/04-emmtyper/lablog | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/bu_isciii/templates/characterization/ANALYSIS/ANALYSIS01_CHARACTERIZATION/04-emmtyper/lablog b/bu_isciii/templates/characterization/ANALYSIS/ANALYSIS01_CHARACTERIZATION/04-emmtyper/lablog index d5897933..342dcfbd 100644 --- a/bu_isciii/templates/characterization/ANALYSIS/ANALYSIS01_CHARACTERIZATION/04-emmtyper/lablog +++ b/bu_isciii/templates/characterization/ANALYSIS/ANALYSIS01_CHARACTERIZATION/04-emmtyper/lablog @@ -53,7 +53,7 @@ cat < _01_emmtyper.sbatch # create results folder mkdir -p 01-typing mkdir -p 01-typing/tmps -blastdb_path=/data/bi/references/cdc_emm_blastdb +blastdb_path=/data/bi/references/cdc_emm_blastdb/20240509 # Run emmtyper singularity exec \\ @@ -63,9 +63,9 @@ singularity exec \\ /data/bi/pipelines/singularity-images/singularity-emmtyper.0.2.0--py_0 emmtyper \\ -w blast \\ --keep \\ - --blast_db "\${blastdb_path}/cdc_emm_database29042024" \\ - --percent-identity 95 \\ - --culling-limit 5 \\ + --blast_db "\${blastdb_path}/cdc_emm_database" \\ + --percent-identity 100 \\ + --culling-limit 5 \ --output 01-typing/results_emmtyper.out \\ --output-format verbose \\ ./fasta_inputs/*.fasta From 34ac552e868dd7ed0434dcbedfa868f7b655145d Mon Sep 17 00:00:00 2001 From: Dani VM Date: Thu, 12 Sep 2024 13:31:09 +0200 Subject: [PATCH 03/19] update changelog #339 --- CHANGELOG.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 4ee3575e..35bd7363 100755 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,8 +9,11 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), ### Credits Code contributions to the new version: +- [Daniel Valle](https://github.com/Daniel-VM) + ### Template fixes and updates +- Fixed path to blast database and update Emmtyper params [#339](https://github.com/BU-ISCIII/buisciii-tools/pull/339) ### Modules From 3a5b57116bc1be78fe8269fc71a9ec90f56e992c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sergio=20Olmos=20Pi=C3=B1ero?= <103578874+OPSergio@users.noreply.github.com> Date: Thu, 19 Sep 2024 16:20:00 +0200 Subject: [PATCH 04/19] update sarek version in exomeeb (#341) * update sarek version in exomeeb * Updated sarek version (v3.4.4) in ExomeEB-ExomeTrio-WGSTrio templates * Current version Nextflow --- CHANGELOG.md | 2 +- bu_isciii/templates/exomeeb/ANALYSIS/ANALYSIS01_EXOME/lablog | 4 ++-- .../templates/exometrio/ANALYSIS/ANALYSIS01_EXOME/lablog | 2 +- bu_isciii/templates/wgstrio/ANALYSIS/ANALYSIS01_GENOME/lablog | 4 ++-- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 35bd7363..c899f7d9 100755 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -14,7 +14,7 @@ Code contributions to the new version: ### Template fixes and updates - Fixed path to blast database and update Emmtyper params [#339](https://github.com/BU-ISCIII/buisciii-tools/pull/339) - +- Updated sarek version (v3.4.4) in ExomeEB-ExomeTrio-WGSTrio templates [#341] (https://github.com/BU-ISCIII/buisciii-tools/pull/341) ### Modules #### Added enhancements diff --git a/bu_isciii/templates/exomeeb/ANALYSIS/ANALYSIS01_EXOME/lablog b/bu_isciii/templates/exomeeb/ANALYSIS/ANALYSIS01_EXOME/lablog index 22502631..edc5cd0e 100755 --- a/bu_isciii/templates/exomeeb/ANALYSIS/ANALYSIS01_EXOME/lablog +++ b/bu_isciii/templates/exomeeb/ANALYSIS/ANALYSIS01_EXOME/lablog @@ -1,4 +1,4 @@ -# module load Nextflow/22.10.1 singularity +# module load Nextflow singularity ln -s ../00-reads/ . ln -s ../samples_id.txt . @@ -28,7 +28,7 @@ cat < sarek.sbatch export NXF_OPTS="-Xms500M -Xmx4G" -nextflow run /data/bi/pipelines/nf-core-sarek/nf-core-sarek-3.4.2/workflow/main.nf \\ +nextflow run /data/bi/pipelines/nf-core-sarek/nf-core-sarek_3.4.4/3_4_4/main.nf \\ -c ../../DOC/hpc_slurm_sarek.config \\ --input 'samplesheet.csv' \\ --outdir 01-sarek \\ diff --git a/bu_isciii/templates/exometrio/ANALYSIS/ANALYSIS01_EXOME/lablog b/bu_isciii/templates/exometrio/ANALYSIS/ANALYSIS01_EXOME/lablog index 179c7493..a7081ffe 100755 --- a/bu_isciii/templates/exometrio/ANALYSIS/ANALYSIS01_EXOME/lablog +++ b/bu_isciii/templates/exometrio/ANALYSIS/ANALYSIS01_EXOME/lablog @@ -42,7 +42,7 @@ cat < sarek.sbatch export NXF_OPTS="-Xms500M -Xmx4G" -nextflow run /data/bi/pipelines/nf-core-sarek/nf-core-sarek-3.4.2/workflow/main.nf \\ +nextflow run /data/bi/pipelines/nf-core-sarek/nf-core-sarek_3.4.4/3_4_4/main.nf \\ -c ../../DOC/hpc_slurm_sarek.config \\ --input 'samplesheet.csv' \\ --outdir 01-sarek \\ diff --git a/bu_isciii/templates/wgstrio/ANALYSIS/ANALYSIS01_GENOME/lablog b/bu_isciii/templates/wgstrio/ANALYSIS/ANALYSIS01_GENOME/lablog index cb6d1330..14528c4f 100755 --- a/bu_isciii/templates/wgstrio/ANALYSIS/ANALYSIS01_GENOME/lablog +++ b/bu_isciii/templates/wgstrio/ANALYSIS/ANALYSIS01_GENOME/lablog @@ -1,4 +1,4 @@ -# module load Nextflow/22.10.1 singularity +# module load Nextflow singularity ln -s ../00-reads/ . ln -s ../samples_id.txt . @@ -44,7 +44,7 @@ cat < sarek.sbatch export NXF_OPTS="-Xms500M -Xmx4G" -nextflow run /data/bi/pipelines/nf-core-sarek/nf-core-sarek-3.4.2/workflow/main.nf \\ +nextflow run /data/bi/pipelines/nf-core-sarek/nf-core-sarek_3.4.4/3_4_4/main.nf \\ -c ../../DOC/hpc_slurm_sarek.config \\ --input 'samplesheet.csv' \\ --outdir 01-sarek \\ From 84809b103c073cd2cf4bdfb5d7d53cebdde00605 Mon Sep 17 00:00:00 2001 From: svarona Date: Fri, 30 Aug 2024 08:57:56 +0200 Subject: [PATCH 05/19] Created code to generate amended consensus without ambiguities but masked --- bu_isciii/templates/IRMA/DOC/irma_config.sh | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/bu_isciii/templates/IRMA/DOC/irma_config.sh b/bu_isciii/templates/IRMA/DOC/irma_config.sh index 145da9b3..bcaba2ab 100644 --- a/bu_isciii/templates/IRMA/DOC/irma_config.sh +++ b/bu_isciii/templates/IRMA/DOC/irma_config.sh @@ -5,3 +5,7 @@ MATCH_PROC=8 # grid maximum processes for the MATCH SORT_PROC=8 # currently not used ALIGN_PROC=8 # grid maximum processes for the rough align ASSEM_PROC=8 # grid maximum processes for assembly + +### AMENDED CONSENSUS ### +MIN_AMBIG=0.75 # Sets ambiguities to off +MIN_CONS_SUPPORT=9 # Mask low coverage <= 9 (10 is ok) From bd85c054d67ec400f562d03b7c4f75b386fedfc6 Mon Sep 17 00:00:00 2001 From: svarona Date: Fri, 30 Aug 2024 09:00:37 +0200 Subject: [PATCH 06/19] Updated changelog --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index c899f7d9..72314508 100755 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -114,6 +114,7 @@ Code contributions to the new version: - Added permissions fixing after running scratch_copy, as well as a new fix-permissions module in the tools [#332](https://github.com/BU-ISCIII/buisciii-tools/pull/332). - Updated MAG lablogs and utils.py [#334](https://github.com/BU-ISCIII/buisciii-tools/pull/334). - Updated some files (setup.py, __main__.py, README, etc) for the 2.2.0 release [#335](https://github.com/BU-ISCIII/buisciii-tools/pull/335). +- Fixed IRMAs config for amended consensus [#325](https://github.com/BU-ISCIII/buisciii-tools/pull/325). ### Modules From b584e753c03fba47fcaa4e5a64fc4ebbf33139f8 Mon Sep 17 00:00:00 2001 From: svarona Date: Thu, 19 Sep 2024 15:49:44 +0200 Subject: [PATCH 07/19] Fixd changelog --- CHANGELOG.md | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 72314508..8b7e3f90 100755 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,12 +9,16 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), ### Credits Code contributions to the new version: -- [Daniel Valle](https://github.com/Daniel-VM) +- [Daniel Valle](https://github.com/Daniel-VM) +- [Sarai Varona](https://github.com/svarona) ### Template fixes and updates + - Fixed path to blast database and update Emmtyper params [#339](https://github.com/BU-ISCIII/buisciii-tools/pull/339) - Updated sarek version (v3.4.4) in ExomeEB-ExomeTrio-WGSTrio templates [#341] (https://github.com/BU-ISCIII/buisciii-tools/pull/341) +- Fixed IRMAs config for amended consensus [#325](https://github.com/BU-ISCIII/buisciii-tools/pull/325). + ### Modules #### Added enhancements @@ -114,7 +118,6 @@ Code contributions to the new version: - Added permissions fixing after running scratch_copy, as well as a new fix-permissions module in the tools [#332](https://github.com/BU-ISCIII/buisciii-tools/pull/332). - Updated MAG lablogs and utils.py [#334](https://github.com/BU-ISCIII/buisciii-tools/pull/334). - Updated some files (setup.py, __main__.py, README, etc) for the 2.2.0 release [#335](https://github.com/BU-ISCIII/buisciii-tools/pull/335). -- Fixed IRMAs config for amended consensus [#325](https://github.com/BU-ISCIII/buisciii-tools/pull/325). ### Modules From bc1a72f699e4fe87524487361ffe2fc7bfe5456d Mon Sep 17 00:00:00 2001 From: svarona Date: Thu, 19 Sep 2024 15:50:58 +0200 Subject: [PATCH 08/19] Created postprocessing script for amended files --- .../04-irma/postprocessing.sh | 71 +++++++++++++++++++ 1 file changed, 71 insertions(+) create mode 100644 bu_isciii/templates/IRMA/ANALYSIS/ANALYSIS01_FLU_IRMA/04-irma/postprocessing.sh diff --git a/bu_isciii/templates/IRMA/ANALYSIS/ANALYSIS01_FLU_IRMA/04-irma/postprocessing.sh b/bu_isciii/templates/IRMA/ANALYSIS/ANALYSIS01_FLU_IRMA/04-irma/postprocessing.sh new file mode 100644 index 00000000..051b6117 --- /dev/null +++ b/bu_isciii/templates/IRMA/ANALYSIS/ANALYSIS01_FLU_IRMA/04-irma/postprocessing.sh @@ -0,0 +1,71 @@ +#CLEAN +if test -f all_samples_completo.txt; then rm all_samples_completo.txt; fi +if test -d A_*; then rm -rf A_*; fi +if test -d B; then rm -rf B; fi +if test -d C; then rm -rf C; fi +if test -d D; then rm -rf D; fi + +cat ../samples_id.txt | while read sample; do + FLUSUBTYPE=$(ls ${sample}/*H*.fasta | cut -d '/' -f2 | cut -d '.' -f1 | cut -d '_' -f1,3 | sort -u) + FLUTYPE=$(ls ${sample}/*H*.fasta | cut -d '/' -f2 | cut -d '.' -f1 | cut -d '_' -f1 | sort -u) + mkdir -p $FLUSUBTYPE + ls ${sample}/amended_consensus/*.fa | cut -d '_' -f3 | cut -d '.' -f1 | while read fragment; do + if [ $fragment == 1 ]; then + if [ $FLUTYPE == "B" ]; then + cat ${sample}/amended_consensus/*_${fragment}.fa | sed 's/-/\//g' | sed 's/_1/_PB1/' >> ${FLUSUBTYPE}/B_PB1.txt + cat ${sample}/amended_consensus/*_${fragment}.fa | sed 's/-/\//g' | sed 's/_1/_PB1/' >> all_samples_completo.txt + else + cat ${sample}/amended_consensus/*_${fragment}.fa | sed 's/-/\//g' | sed 's/_1/_PB2/' >> ${FLUSUBTYPE}/${FLUTYPE}_PB2.txt + cat ${sample}/amended_consensus/*_${fragment}.fa | sed 's/-/\//g' | sed 's/_1/_PB2/' >> all_samples_completo.txt + fi + elif [ $fragment == 2 ]; then + if [ $FLUTYPE == "B" ]; then + cat ${sample}/amended_consensus/*_${fragment}.fa | sed 's/-/\//g' | sed 's/_2/_PB2/' >> ${FLUSUBTYPE}/B_PB2.txt + cat ${sample}/amended_consensus/*_${fragment}.fa | sed 's/-/\//g' | sed 's/_2/_PB2/' >> all_samples_completo.txt + else + cat ${sample}/amended_consensus/*_${fragment}.fa | sed 's/-/\//g' | sed 's/_2/_PB1/' >> ${FLUSUBTYPE}/${FLUTYPE}_PB1.txt + cat ${sample}/amended_consensus/*_${fragment}.fa | sed 's/-/\//g' | sed 's/_2/_PB1/' >> all_samples_completo.txt + fi + elif [ $fragment == 3 ]; then + if [ $FLUTYPE == "B" ] || [ $FLUTYPE == "A" ]; then + cat ${sample}/amended_consensus/*_${fragment}.fa | sed 's/-/\//g' | sed 's/_3/_PA/' >> ${FLUSUBTYPE}/${FLUTYPE}_PA.txt + cat ${sample}/amended_consensus/*_${fragment}.fa | sed 's/-/\//g' | sed 's/_3/_PA/' >> all_samples_completo.txt + else + cat ${sample}/amended_consensus/*_${fragment}.fa | sed 's/-/\//g' | sed 's/_3/_P3/' >> ${FLUSUBTYPE}/${FLUTYPE}_P3.txt + cat ${sample}/amended_consensus/*_${fragment}.fa | sed 's/-/\//g' | sed 's/_3/_P3/' >> all_samples_completo.txt + fi + elif [ $fragment == 4 ]; then + if [ $FLUTYPE == "B" ] || [ $FLUTYPE == "A" ]; then + cat ${sample}/amended_consensus/*_${fragment}.fa | sed 's/-/\//g' | sed 's/_4/_HA/' >> ${FLUSUBTYPE}/${FLUTYPE}_HA.txt + cat ${sample}/amended_consensus/*_${fragment}.fa | sed 's/-/\//g' | sed 's/_4/_HA/' >> all_samples_completo.txt + else + cat ${sample}/amended_consensus/*_${fragment}.fa | sed 's/-/\//g' | sed 's/_4/_HE/' >> ${FLUSUBTYPE}/${FLUTYPE}_HE.txt + cat ${sample}/amended_consensus/*_${fragment}.fa | sed 's/-/\//g' | sed 's/_4/_HE/' >> all_samples_completo.txt + fi + elif [ $fragment == 5 ]; then + cat ${sample}/amended_consensus/*_${fragment}.fa | sed 's/-/\//g' | sed 's/_5/_NP/' >> ${FLUSUBTYPE}/${FLUTYPE}_NP.txt + cat ${sample}/amended_consensus/*_${fragment}.fa | sed 's/-/\//g' | sed 's/_5/_NP/' >> all_samples_completo.txt + elif [ $fragment == 6 ]; then + if [ $FLUTYPE == "B" ] || [ $FLUTYPE == "A" ]; then + cat ${sample}/amended_consensus/*_${fragment}.fa | sed 's/-/\//g' | sed 's/_6/_NA/' >> ${FLUSUBTYPE}/${FLUTYPE}_NA.txt + cat ${sample}/amended_consensus/*_${fragment}.fa | sed 's/-/\//g' | sed 's/_6/_NA/' >> all_samples_completo.txt + else + cat ${sample}/amended_consensus/*_${fragment}.fa | sed 's/-/\//g' | sed 's/_6/_MP/' >> ${FLUSUBTYPE}/${FLUTYPE}_MP.txt + cat ${sample}/amended_consensus/*_${fragment}.fa | sed 's/-/\//g' | sed 's/_6/_MP/' >> all_samples_completo.txt + fi + elif [ $fragment == 7 ]; then + if [ $FLUTYPE == "B" ] || [ $FLUTYPE == "A" ]; then + cat ${sample}/amended_consensus/*_${fragment}.fa | sed 's/-/\//g' | sed 's/_7/_MP/' >> ${FLUSUBTYPE}/${FLUTYPE}_MP.txt + cat ${sample}/amended_consensus/*_${fragment}.fa | sed 's/-/\//g' | sed 's/_7/_MP/' >> all_samples_completo.txt + else + cat ${sample}/amended_consensus/*_${fragment}.fa | sed 's/-/\//g' | sed 's/_7/_NS/' >> ${FLUSUBTYPE}/${FLUTYPE}_NS.txt + cat ${sample}/amended_consensus/*_${fragment}.fa | sed 's/-/\//g' | sed 's/_7/_NS/' >> all_samples_completo.txt + fi + elif [ $fragment == 8 ]; then + cat ${sample}/amended_consensus/*_${fragment}.fa | sed 's/-/\//g' | sed 's/_8/_NS/' >> ${FLUSUBTYPE}/${FLUTYPE}_NS.txt + cat ${sample}/amended_consensus/*_${fragment}.fa | sed 's/-/\//g' | sed 's/_8/_NS/' >> all_samples_completo.txt + else + echo "The sample $sample has a segment with number $fragment, but I don't know which segment it is." + fi + done +done From 1b59d9a23b50cfa9d6c698e758e98c472318e9d0 Mon Sep 17 00:00:00 2001 From: svarona Date: Thu, 19 Sep 2024 15:51:08 +0200 Subject: [PATCH 09/19] included postprocessing script in lablog --- .../ANALYSIS01_FLU_IRMA/04-irma/lablog | 29 ++----------------- 1 file changed, 2 insertions(+), 27 deletions(-) diff --git a/bu_isciii/templates/IRMA/ANALYSIS/ANALYSIS01_FLU_IRMA/04-irma/lablog b/bu_isciii/templates/IRMA/ANALYSIS/ANALYSIS01_FLU_IRMA/04-irma/lablog index 5e9d933b..be910a9e 100644 --- a/bu_isciii/templates/IRMA/ANALYSIS/ANALYSIS01_FLU_IRMA/04-irma/lablog +++ b/bu_isciii/templates/IRMA/ANALYSIS/ANALYSIS01_FLU_IRMA/04-irma/lablog @@ -9,31 +9,6 @@ cat ../samples_id.txt | while read in; do echo "srun --partition short_idx --cpu echo 'bash create_irma_stats.sh' > _02_create_stats.sh -echo "ls */*HA*.fasta | cut -d '/' -f2 | cut -d '.' -f1 | sort -u | cut -d '_' -f3 | sed '/^\$/d' | sed 's/^/A_/g' > HA_types.txt" > _03_post_processing.sh +echo 'bash postprocessing.sh' > _03_post_processing.sh -echo 'cat HA_types.txt | while read type; do if test -d ${type}; then rm -rf ${type}; fi; done; if test -d B ; then rm -rf B; fi; if test -d C; then rm -rf C; fi' >> _03_post_processing.sh - -echo 'if test -f all_samples_completo.txt; then rm all_samples_completo.txt; fi' >> _03_post_processing.sh - -echo "cat HA_types.txt | while read in; do mkdir \${in}; done" >> _03_post_processing.sh - -echo "if grep -qw 'B__' irma_stats.txt; then mkdir B; fi" >> _03_post_processing.sh - -echo "if grep -qw 'C__' irma_stats.txt; then mkdir C; fi" >> _03_post_processing.sh - -echo "ls */*.fasta | cut -d '/' -f2 | cut -d '.' -f1 | cut -d '_' -f1,2 | sort -u | grep 'A_' > A_fragment_list.txt" >> _03_post_processing.sh - -echo "ls */*.fasta | cut -d '/' -f2 | cut -d '.' -f1 | cut -d '_' -f1,2 | sort -u | grep 'B_' > B_fragment_list.txt" >> _03_post_processing.sh - -echo "ls */*.fasta | cut -d '/' -f2 | cut -d '.' -f1 | cut -d '_' -f1,2 | sort -u | grep 'C_' > C_fragment_list.txt" >> _03_post_processing.sh - -echo 'cat HA_types.txt | while read type; do grep ${type} irma_stats.txt | cut -f1 | while read sample; do cat A_fragment_list.txt | while read fragment; do if test -f ${sample}/${fragment}*.fasta; then cat ${sample}/${fragment}*.fasta | sed "s/^>/\>${sample}_/g" | sed 's/_H1//g' | sed 's/_H3//g' | sed 's/_N1//g' | sed 's/_N2//g' | sed s@-@/@g | sed s/_A_/_/g ; fi >> ${type}/${fragment}.txt; done; done; done' >> _03_post_processing.sh - -echo 'grep -w 'B__' irma_stats.txt | cut -f1 | while read sample; do cat B_fragment_list.txt | while read fragment; do if test -f ${sample}/${fragment}*.fasta; then cat ${sample}/${fragment}*.fasta | sed "s/^>/\>${sample}_/g" | sed s/_H1//g | sed s/_H3//g | sed s/_N1//g | sed s/_N2//g | sed s@-@/@g | sed s/_B_/_/g ; fi >> B/${fragment}.txt; done; done' >> _03_post_processing.sh - -echo 'grep -w 'C__' irma_stats.txt | cut -f1 | while read sample; do cat C_fragment_list.txt | while read fragment; do if test -f ${sample}/${fragment}*.fasta; then cat ${sample}/${fragment}*.fasta | sed "s/^>/\>${sample}_/g" | sed s/_H1//g | sed s/_H3//g | sed s/_N1//g | sed s/_N2//g | sed s@-@/@g | sed s/_C_/_/g ; fi >> C/${fragment}.txt; done; done' >> _03_post_processing.sh - -echo 'cat ../samples_id.txt | while read in; do cat ${in}/*.fasta | sed "s/^>/\>${in}_/g" | sed 's/_H1//g' | sed 's/_H3//g' | sed 's/_N1//g' | sed 's/_N2//g' | sed 's@-@/@g' | sed 's/_A_/_/g' | sed 's/_B_/_/g' | sed 's/_C_/_/g' >> all_samples_completo.txt; done' >> _03_post_processing.sh - -echo 'sed "s/__//g" irma_stats.txt > clean_irma_stats.txt' >> _03_post_processing.sh -echo 'sed "s/_\t/\t/g" irma_stats.txt > clean_irma_stats.txt' >> _03_post_processing.sh +echo 'sed "s/__//g" irma_stats.txt | sed "s/_\t/\t/g" > clean_irma_stats.txt' >> _03_post_processing.sh From ac6f23eb7b70c67ae0e0fff08ac6d954c9eac2c3 Mon Sep 17 00:00:00 2001 From: svarona Date: Thu, 19 Sep 2024 16:37:14 +0200 Subject: [PATCH 10/19] Shortened code to look better --- .../04-irma/postprocessing.sh | 42 +++++++------------ 1 file changed, 14 insertions(+), 28 deletions(-) diff --git a/bu_isciii/templates/IRMA/ANALYSIS/ANALYSIS01_FLU_IRMA/04-irma/postprocessing.sh b/bu_isciii/templates/IRMA/ANALYSIS/ANALYSIS01_FLU_IRMA/04-irma/postprocessing.sh index 051b6117..2ef0e02c 100644 --- a/bu_isciii/templates/IRMA/ANALYSIS/ANALYSIS01_FLU_IRMA/04-irma/postprocessing.sh +++ b/bu_isciii/templates/IRMA/ANALYSIS/ANALYSIS01_FLU_IRMA/04-irma/postprocessing.sh @@ -12,58 +12,44 @@ cat ../samples_id.txt | while read sample; do ls ${sample}/amended_consensus/*.fa | cut -d '_' -f3 | cut -d '.' -f1 | while read fragment; do if [ $fragment == 1 ]; then if [ $FLUTYPE == "B" ]; then - cat ${sample}/amended_consensus/*_${fragment}.fa | sed 's/-/\//g' | sed 's/_1/_PB1/' >> ${FLUSUBTYPE}/B_PB1.txt - cat ${sample}/amended_consensus/*_${fragment}.fa | sed 's/-/\//g' | sed 's/_1/_PB1/' >> all_samples_completo.txt + cat ${sample}/amended_consensus/*_${fragment}.fa | sed 's/-/\//g' | sed 's/_1/_PB1/' | tee -a ${FLUSUBTYPE}/B_PB1.txt all_samples_completo.txt > /dev/null else - cat ${sample}/amended_consensus/*_${fragment}.fa | sed 's/-/\//g' | sed 's/_1/_PB2/' >> ${FLUSUBTYPE}/${FLUTYPE}_PB2.txt - cat ${sample}/amended_consensus/*_${fragment}.fa | sed 's/-/\//g' | sed 's/_1/_PB2/' >> all_samples_completo.txt + cat ${sample}/amended_consensus/*_${fragment}.fa | sed 's/-/\//g' | sed 's/_1/_PB2/' | tee -a ${FLUSUBTYPE}/${FLUTYPE}_PB2.txt all_samples_completo.txt > /dev/null fi elif [ $fragment == 2 ]; then if [ $FLUTYPE == "B" ]; then - cat ${sample}/amended_consensus/*_${fragment}.fa | sed 's/-/\//g' | sed 's/_2/_PB2/' >> ${FLUSUBTYPE}/B_PB2.txt - cat ${sample}/amended_consensus/*_${fragment}.fa | sed 's/-/\//g' | sed 's/_2/_PB2/' >> all_samples_completo.txt + cat ${sample}/amended_consensus/*_${fragment}.fa | sed 's/-/\//g' | sed 's/_2/_PB2/' | tee -a ${FLUSUBTYPE}/B_PB2.txt all_samples_completo.txt > /dev/null else - cat ${sample}/amended_consensus/*_${fragment}.fa | sed 's/-/\//g' | sed 's/_2/_PB1/' >> ${FLUSUBTYPE}/${FLUTYPE}_PB1.txt - cat ${sample}/amended_consensus/*_${fragment}.fa | sed 's/-/\//g' | sed 's/_2/_PB1/' >> all_samples_completo.txt + cat ${sample}/amended_consensus/*_${fragment}.fa | sed 's/-/\//g' | sed 's/_2/_PB1/' | tee -a ${FLUSUBTYPE}/${FLUTYPE}_PB1.txt all_samples_completo.txt > /dev/null fi elif [ $fragment == 3 ]; then if [ $FLUTYPE == "B" ] || [ $FLUTYPE == "A" ]; then - cat ${sample}/amended_consensus/*_${fragment}.fa | sed 's/-/\//g' | sed 's/_3/_PA/' >> ${FLUSUBTYPE}/${FLUTYPE}_PA.txt - cat ${sample}/amended_consensus/*_${fragment}.fa | sed 's/-/\//g' | sed 's/_3/_PA/' >> all_samples_completo.txt + cat ${sample}/amended_consensus/*_${fragment}.fa | sed 's/-/\//g' | sed 's/_3/_PA/' | tee -a ${FLUSUBTYPE}/${FLUTYPE}_PA.txt all_samples_completo.txt > /dev/null else - cat ${sample}/amended_consensus/*_${fragment}.fa | sed 's/-/\//g' | sed 's/_3/_P3/' >> ${FLUSUBTYPE}/${FLUTYPE}_P3.txt - cat ${sample}/amended_consensus/*_${fragment}.fa | sed 's/-/\//g' | sed 's/_3/_P3/' >> all_samples_completo.txt + cat ${sample}/amended_consensus/*_${fragment}.fa | sed 's/-/\//g' | sed 's/_3/_P3/' | tee -a ${FLUSUBTYPE}/${FLUTYPE}_P3.txt all_samples_completo.txt > /dev/null fi elif [ $fragment == 4 ]; then if [ $FLUTYPE == "B" ] || [ $FLUTYPE == "A" ]; then - cat ${sample}/amended_consensus/*_${fragment}.fa | sed 's/-/\//g' | sed 's/_4/_HA/' >> ${FLUSUBTYPE}/${FLUTYPE}_HA.txt - cat ${sample}/amended_consensus/*_${fragment}.fa | sed 's/-/\//g' | sed 's/_4/_HA/' >> all_samples_completo.txt + cat ${sample}/amended_consensus/*_${fragment}.fa | sed 's/-/\//g' | sed 's/_4/_HA/' | tee -a ${FLUSUBTYPE}/${FLUTYPE}_HA.txt all_samples_completo.txt > /dev/null else - cat ${sample}/amended_consensus/*_${fragment}.fa | sed 's/-/\//g' | sed 's/_4/_HE/' >> ${FLUSUBTYPE}/${FLUTYPE}_HE.txt - cat ${sample}/amended_consensus/*_${fragment}.fa | sed 's/-/\//g' | sed 's/_4/_HE/' >> all_samples_completo.txt + cat ${sample}/amended_consensus/*_${fragment}.fa | sed 's/-/\//g' | sed 's/_4/_HE/' | tee -a ${FLUSUBTYPE}/${FLUTYPE}_HE.txt all_samples_completo.txt > /dev/null fi elif [ $fragment == 5 ]; then - cat ${sample}/amended_consensus/*_${fragment}.fa | sed 's/-/\//g' | sed 's/_5/_NP/' >> ${FLUSUBTYPE}/${FLUTYPE}_NP.txt - cat ${sample}/amended_consensus/*_${fragment}.fa | sed 's/-/\//g' | sed 's/_5/_NP/' >> all_samples_completo.txt + cat ${sample}/amended_consensus/*_${fragment}.fa | sed 's/-/\//g' | sed 's/_5/_NP/' | tee -a ${FLUSUBTYPE}/${FLUTYPE}_NP.txt all_samples_completo.txt > /dev/null elif [ $fragment == 6 ]; then if [ $FLUTYPE == "B" ] || [ $FLUTYPE == "A" ]; then - cat ${sample}/amended_consensus/*_${fragment}.fa | sed 's/-/\//g' | sed 's/_6/_NA/' >> ${FLUSUBTYPE}/${FLUTYPE}_NA.txt - cat ${sample}/amended_consensus/*_${fragment}.fa | sed 's/-/\//g' | sed 's/_6/_NA/' >> all_samples_completo.txt + cat ${sample}/amended_consensus/*_${fragment}.fa | sed 's/-/\//g' | sed 's/_6/_NA/' | tee -a ${FLUSUBTYPE}/${FLUTYPE}_NA.txt all_samples_completo.txt > /dev/null else - cat ${sample}/amended_consensus/*_${fragment}.fa | sed 's/-/\//g' | sed 's/_6/_MP/' >> ${FLUSUBTYPE}/${FLUTYPE}_MP.txt - cat ${sample}/amended_consensus/*_${fragment}.fa | sed 's/-/\//g' | sed 's/_6/_MP/' >> all_samples_completo.txt + cat ${sample}/amended_consensus/*_${fragment}.fa | sed 's/-/\//g' | sed 's/_6/_MP/' | tee -a ${FLUSUBTYPE}/${FLUTYPE}_MP.txt all_samples_completo.txt > /dev/null fi elif [ $fragment == 7 ]; then if [ $FLUTYPE == "B" ] || [ $FLUTYPE == "A" ]; then - cat ${sample}/amended_consensus/*_${fragment}.fa | sed 's/-/\//g' | sed 's/_7/_MP/' >> ${FLUSUBTYPE}/${FLUTYPE}_MP.txt - cat ${sample}/amended_consensus/*_${fragment}.fa | sed 's/-/\//g' | sed 's/_7/_MP/' >> all_samples_completo.txt + cat ${sample}/amended_consensus/*_${fragment}.fa | sed 's/-/\//g' | sed 's/_7/_MP/' | tee -a ${FLUSUBTYPE}/${FLUTYPE}_MP.txt all_samples_completo.txt > /dev/null else - cat ${sample}/amended_consensus/*_${fragment}.fa | sed 's/-/\//g' | sed 's/_7/_NS/' >> ${FLUSUBTYPE}/${FLUTYPE}_NS.txt - cat ${sample}/amended_consensus/*_${fragment}.fa | sed 's/-/\//g' | sed 's/_7/_NS/' >> all_samples_completo.txt + cat ${sample}/amended_consensus/*_${fragment}.fa | sed 's/-/\//g' | sed 's/_7/_NS/' | tee -a ${FLUSUBTYPE}/${FLUTYPE}_NS.txt all_samples_completo.txt > /dev/null fi elif [ $fragment == 8 ]; then - cat ${sample}/amended_consensus/*_${fragment}.fa | sed 's/-/\//g' | sed 's/_8/_NS/' >> ${FLUSUBTYPE}/${FLUTYPE}_NS.txt - cat ${sample}/amended_consensus/*_${fragment}.fa | sed 's/-/\//g' | sed 's/_8/_NS/' >> all_samples_completo.txt + cat ${sample}/amended_consensus/*_${fragment}.fa | sed 's/-/\//g' | sed 's/_8/_NS/' | tee -a ${FLUSUBTYPE}/${FLUTYPE}_NS.txt all_samples_completo.txt > /dev/null else echo "The sample $sample has a segment with number $fragment, but I don't know which segment it is." fi From 89469fd9bd891b56f6305db711a08385c6908b87 Mon Sep 17 00:00:00 2001 From: victor5lm Date: Mon, 30 Sep 2024 16:42:43 +0200 Subject: [PATCH 11/19] Updated the 03-annotation/lablogs in exomeeb, exometrio and wgstrio services to have all the necessary -bind routes --- .../exomeeb/ANALYSIS/ANALYSIS01_EXOME/03-annotation/lablog | 2 +- .../exometrio/ANALYSIS/ANALYSIS01_EXOME/03-annotation/lablog | 2 +- .../wgstrio/ANALYSIS/ANALYSIS01_GENOME/03-annotation/lablog | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/bu_isciii/templates/exomeeb/ANALYSIS/ANALYSIS01_EXOME/03-annotation/lablog b/bu_isciii/templates/exomeeb/ANALYSIS/ANALYSIS01_EXOME/03-annotation/lablog index 61892d9b..ef8d93ad 100644 --- a/bu_isciii/templates/exomeeb/ANALYSIS/ANALYSIS01_EXOME/03-annotation/lablog +++ b/bu_isciii/templates/exomeeb/ANALYSIS/ANALYSIS01_EXOME/03-annotation/lablog @@ -22,7 +22,7 @@ echo "srun --partition short_idx --time 2:00:00 --chdir ${scratch_dir} --output ## 4-5. Lablog for annotating whole genome samples using Variant Effect Predictor (VEP). -echo "srun --partition short_idx --mem 100G --time 4:00:00 --chdir ${scratch_dir} --output logs/VEP.log --job-name VEP singularity exec -B ${scratch_dir}/../../../ /data/bi/pipelines/singularity-images/ensembl-vep:103.1--pl5262h4a94de4_2 vep --fasta /data/bi/references/eukaria/homo_sapiens/hg19/1000genomes_b37/genome/human_g1k_v37.fasta -i ${scratch_dir}/vep/variants_fil_mod.vcf -o ${scratch_dir}/vep/vep_annot.vcf --cache --offline --dir_cache /data/bi/references/eukaria/homo_sapiens/cache_vep/ --everything --dir_plugins /data/bi/references/eukaria/homo_sapiens/cache_vep/Plugins/ --assembly GRCh37 --tab --plugin dbNSFP,/data/bi/references/eukaria/homo_sapiens/cache_vep/custom_databases/dbNSFP/GRCh37/dbNSFP4.1a_grch37.gz,clinvar_id,clinvar_trait,clinvar_OMIM_id,clinvar_Orphanet_id,HGVSc_snpEff,HGVSp_snpEff,SIFT_score,SIFT_pred,Polyphen2_HDIV_score,Polyphen2_HDIV_pred,Polyphen2_HVAR_score,Polyphen2_HVAR_pred,MutationTaster_score,MutationTaster_pred,MutationAssessor_score,MutationAssessor_pred,FATHMM_score,FATHMM_pred,PROVEAN_score,PROVEAN_pred,VEST4_score,MetaSVM_score,MetaSVM_pred,MetaLR_score,MetaLR_pred,CADD_raw,CADD_phred,CADD_raw_hg19,CADD_phred_hg19,GERP++_NR,GERP++_RS,phyloP100way_vertebrate,phastCons100way_vertebrate &" > _02_vep_annotation.sh +echo "srun --partition short_idx --mem 100G --time 4:00:00 --chdir ${scratch_dir} --output logs/VEP.log --job-name VEP singularity exec -B /data/bi/references/eukaria/homo_sapiens/hg19/1000genomes_b37/genome/ -B /data/bi/references/eukaria/homo_sapiens/cache_vep/homo_sapiens -B /data/bi/references/eukaria/homo_sapiens/cache_vep/custom_databases/dbNSFP/GRCh37/ -B ${scratch_dir}/../../../ /data/bi/pipelines/singularity-images/ensembl-vep:103.1--pl5262h4a94de4_2 vep --fasta /data/bi/references/eukaria/homo_sapiens/hg19/1000genomes_b37/genome/human_g1k_v37.fasta -i ${scratch_dir}/vep/variants_fil_mod.vcf -o ${scratch_dir}/vep/vep_annot.vcf --cache --offline --dir_cache /data/bi/references/eukaria/homo_sapiens/cache_vep/ --everything --dir_plugins /data/bi/references/eukaria/homo_sapiens/cache_vep/Plugins/ --assembly GRCh37 --tab --plugin dbNSFP,/data/bi/references/eukaria/homo_sapiens/cache_vep/custom_databases/dbNSFP/GRCh37/dbNSFP4.1a_grch37.gz,clinvar_id,clinvar_trait,clinvar_OMIM_id,clinvar_Orphanet_id,HGVSc_snpEff,HGVSp_snpEff,SIFT_score,SIFT_pred,Polyphen2_HDIV_score,Polyphen2_HDIV_pred,Polyphen2_HVAR_score,Polyphen2_HVAR_pred,MutationTaster_score,MutationTaster_pred,MutationAssessor_score,MutationAssessor_pred,FATHMM_score,FATHMM_pred,PROVEAN_score,PROVEAN_pred,VEST4_score,MetaSVM_score,MetaSVM_pred,MetaLR_score,MetaLR_pred,CADD_raw,CADD_phred,CADD_raw_hg19,CADD_phred_hg19,GERP++_NR,GERP++_RS,phyloP100way_vertebrate,phastCons100way_vertebrate &" > _02_vep_annotation.sh echo "grep -v '^##' ./vep/vep_annot.vcf > ./vep/vep_annot_head.txt" > _03_merge_data1.sh echo "sed -i 's/#Uploaded_variation/ID/' ./vep/vep_annot_head.txt" >> _03_merge_data1.sh diff --git a/bu_isciii/templates/exometrio/ANALYSIS/ANALYSIS01_EXOME/03-annotation/lablog b/bu_isciii/templates/exometrio/ANALYSIS/ANALYSIS01_EXOME/03-annotation/lablog index 063393c2..e771e6dc 100644 --- a/bu_isciii/templates/exometrio/ANALYSIS/ANALYSIS01_EXOME/03-annotation/lablog +++ b/bu_isciii/templates/exometrio/ANALYSIS/ANALYSIS01_EXOME/03-annotation/lablog @@ -28,7 +28,7 @@ echo "srun --partition short_idx --time 2:00:00 --chdir ${scratch_dir} --output # 3. Lablog for annotating whole genome samples using Variant Effect Predictor (VEP). # Run Vep without the plugin columns -echo "srun --partition short_idx --mem 100G --time 12:00:00 --chdir ${scratch_dir} --output logs/VEP.log --job-name VEP singularity exec -B ${scratch_dir}/../../../ /data/bi/pipelines/singularity-images/ensembl-vep:103.1--pl5262h4a94de4_2 vep --fasta /data/bi/references/eukaria/homo_sapiens/hg19/1000genomes_b37/genome/human_g1k_v37.fasta -i ${scratch_dir}/vep/variants_fil_mod.vcf -o ${scratch_dir}/vep/vep_annot.vcf --cache --offline --dir_cache /data/bi/references/eukaria/homo_sapiens/cache_vep/ --everything --assembly GRCh37 --tab &" > _02_vep_annotation.sh +echo "srun --partition short_idx --mem 100G --time 12:00:00 --chdir ${scratch_dir} --output logs/VEP.log --job-name VEP singularity exec -B /data/bi/references/eukaria/homo_sapiens/hg19/1000genomes_b37/genome -B /data/bi/references/eukaria/homo_sapiens/cache_vep -B ${scratch_dir}/../../../ /data/bi/pipelines/singularity-images/ensembl-vep:103.1--pl5262h4a94de4_2 vep --fasta /data/bi/references/eukaria/homo_sapiens/hg19/1000genomes_b37/genome/human_g1k_v37.fasta -i ${scratch_dir}/vep/variants_fil_mod.vcf -o ${scratch_dir}/vep/vep_annot.vcf --cache --offline --dir_cache /data/bi/references/eukaria/homo_sapiens/cache_vep/ --everything --assembly GRCh37 --tab &" > _02_vep_annotation.sh #-------------------------------------------------------------------------------------------------------------------- diff --git a/bu_isciii/templates/wgstrio/ANALYSIS/ANALYSIS01_GENOME/03-annotation/lablog b/bu_isciii/templates/wgstrio/ANALYSIS/ANALYSIS01_GENOME/03-annotation/lablog index 50d87f79..c6a964bd 100644 --- a/bu_isciii/templates/wgstrio/ANALYSIS/ANALYSIS01_GENOME/03-annotation/lablog +++ b/bu_isciii/templates/wgstrio/ANALYSIS/ANALYSIS01_GENOME/03-annotation/lablog @@ -31,7 +31,7 @@ echo "srun --partition short_idx --time 2:00:00 --chdir ${scratch_dir} --output # Run Vep without the plugin columns -echo "srun --partition short_idx --mem 100G --time 12:00:00 --chdir ${scratch_dir} --output logs/VEP.log --job-name VEP singularity exec -B ${scratch_dir}/../../../ /data/bi/pipelines/singularity-images/ensembl-vep:103.1--pl5262h4a94de4_2 vep --fasta /data/bi/references/eukaria/homo_sapiens/hg19/1000genomes_b37/genome/human_g1k_v37.fasta -i ${scratch_dir}/vep/variants_fil_mod.vcf -o ${scratch_dir}/vep/vep_annot.vcf --cache --offline --dir_cache /data/bi/references/eukaria/homo_sapiens/cache_vep/ --everything --assembly GRCh37 --tab &" > _02_vep_annotation.sh +echo "srun --partition short_idx --mem 100G --time 12:00:00 --chdir ${scratch_dir} --output logs/VEP.log --job-name VEP singularity exec -B /data/bi/references/eukaria/homo_sapiens/hg19/1000genomes_b37/genome/ -B /data/bi/references/eukaria/homo_sapiens/cache_vep/ -B ${scratch_dir}/../../../ /data/bi/pipelines/singularity-images/ensembl-vep:103.1--pl5262h4a94de4_2 vep --fasta /data/bi/references/eukaria/homo_sapiens/hg19/1000genomes_b37/genome/human_g1k_v37.fasta -i ${scratch_dir}/vep/variants_fil_mod.vcf -o ${scratch_dir}/vep/vep_annot.vcf --cache --offline --dir_cache /data/bi/references/eukaria/homo_sapiens/cache_vep/ --everything --assembly GRCh37 --tab &" > _02_vep_annotation.sh #-------------------------------------------------------------------------------------------------------------------- From 14bd968dfe5b52b349cac3a2a9d8ba2e192de20f Mon Sep 17 00:00:00 2001 From: victor5lm Date: Mon, 30 Sep 2024 16:50:49 +0200 Subject: [PATCH 12/19] Updated bioinfo_doc.py to allow more options when creating the delivery email --- bu_isciii/bioinfo_doc.py | 30 +++++++++++++++++++++++++++--- 1 file changed, 27 insertions(+), 3 deletions(-) mode change 100755 => 100644 bu_isciii/bioinfo_doc.py diff --git a/bu_isciii/bioinfo_doc.py b/bu_isciii/bioinfo_doc.py old mode 100755 new mode 100644 index 4da84672..458dd899 --- a/bu_isciii/bioinfo_doc.py +++ b/bu_isciii/bioinfo_doc.py @@ -646,10 +646,34 @@ def email_creation(self): email_data["email_notes"] = self.delivery_notes.replace( "\n", "
" ) + else: + email_data["email_notes"] = bu_isciii.utils.ask_for_some_text( + msg="Write email notes" + ).replace("\n", "
") else: - email_data["email_notes"] = bu_isciii.utils.ask_for_some_text( - msg="Write email notes" - ).replace("\n", "
") + if bu_isciii.utils.prompt_yn_question( + msg="Do you wish to provide a text file for email notes?", dflt=False + ): + for i in range(3, -1, -1): + email_data["email_notes"] = bu_isciii.utils.prompt_path( + msg="Write the path to the file with RAW text as email notes" + ) + if not os.path.isfile(os.path.expanduser(email_data["email_notes"])): + stderr.print(f"Provided file doesn't exist. Attempts left: {i}") + else: + stderr.print(f"File selected: {email_data["email_notes"]}") + break + else: + stderr.print("No more attempts. Email notes will be given by prompt") + email_data["email_notes"] = None + else: + email_data["email_notes"] = None + + if email_data["email_notes"]: + with open(os.path.expanduser(email_data["email_notes"])) as f: + email_data["email_notes"] = f.read().replace("\n", "
") + else: + email_data["email_notes"] = bu_isciii.utils.ask_for_some_text(msg="Write email notes").replace("\n", "
") email_data["user_data"] = self.resolution_info["service_user_id"] email_data["service_id"] = self.service_name.split("_", 5)[0] From db6aa1996b01336167f7300e704bf86fdc93cac8 Mon Sep 17 00:00:00 2001 From: victor5lm Date: Mon, 30 Sep 2024 16:54:57 +0200 Subject: [PATCH 13/19] Updated excel_generator.py to be more informative --- .../viralrecon/RESULTS/excel_generator.py | 32 ++++++++++++------- 1 file changed, 20 insertions(+), 12 deletions(-) diff --git a/bu_isciii/templates/viralrecon/RESULTS/excel_generator.py b/bu_isciii/templates/viralrecon/RESULTS/excel_generator.py index 8467c414..ffeece39 100755 --- a/bu_isciii/templates/viralrecon/RESULTS/excel_generator.py +++ b/bu_isciii/templates/viralrecon/RESULTS/excel_generator.py @@ -68,7 +68,7 @@ def merge_lineage_tables( csvs_in_folder=csvs_in_folder, merged_csv_name=merged_csv_name ) else: - print(f"No pangolin folder could be found for {ref}, omitting") + print(f"\033[93mNo pangolin folder could be found for {ref}, omitting\033[0m") if os.path.isdir(os.path.abspath(folder + "/nextclade")): nextcl_dir = os.path.join(folder, "nextclade") @@ -82,17 +82,18 @@ def merge_lineage_tables( csvs_in_folder=csvs_in_folder, merged_csv_name=merged_csv_name ) else: - print(f"No nextclade folder could be found for {ref}, omitting") + print(f"\033[93mNo nextclade folder could be found for {ref}, omitting\033[0m\n") return def excel_generator(csv_files: List[str]): + #print("Proceeding") for file in csv_files: if not os.path.exists(file): - print(f"File {file} does not exist, omitting...") + print(f"\033[91mFile {file} does not exist, omitting...\033[0m") continue - print(f"Generating excel file for {file}") + print(f"\033[92mGenerating excel file for {file}\033[0m") output_name = os.path.splitext(os.path.basename(file))[0] + ".xlsx" # workbook = openpyxl.Workbook(output_name) if "nextclade" in str(file): @@ -108,7 +109,7 @@ def excel_generator(csv_files: List[str]): try: table = pd.read_csv(file) except pd.errors.EmptyDataError: - print("Could not parse table from ", str(file)) + print("\033[91mCould not parse table from ", str(file), "\033[0m") continue table = table.drop(["index"], axis=1, errors="ignore") table.to_excel(output_name, index=False) @@ -119,22 +120,22 @@ def single_csv_to_excel(csv_file: str): try: excel_generator([csv_file]) except FileNotFoundError as e: - print(f"Could not find file {e}") + print(f"\033[91mCould not find file {e}\033[0m") def main(args): if args.single_csv: # If single_csv is called, just convert target csv to excel and skip the rest - print("Single file convertion selected. Skipping main process...") + print("\033[92mSingle file convertion selected. Skipping main process...\033[0m") single_csv_to_excel(args.single_csv) exit(0) print( - "Extracting references used for analysis and the samples associated with each reference\n" + "\033[92mExtracting references used for analysis and the samples associated with each reference\033[0m" ) with open(args.reference_file, "r") as file: references = [line.rstrip() for line in file] - print(f"\nFound {len(references)} references: {str(references).strip('[]')}") + print(f"\n\033[92mFound {len(references)} references: {str(references).strip('[]')}\033[0m") reference_folders = {ref: str("excel_files_" + ref) for ref in references} samples_ref_files = { @@ -145,7 +146,7 @@ def main(args): # Merge pangolin and nextclade csv files separatedly and create excel files for them merge_lineage_tables(reference_folders, samples_ref_files) for reference, folder in reference_folders.items(): - print(f"Creating excel files for reference {reference}") + print(f"\033[92mCreating excel files for reference {reference}\033[0m") csv_files = [ file.path for file in os.scandir(folder) if file.path.endswith(".csv") ] @@ -160,8 +161,9 @@ def main(args): csvs_in_folder=variants_tables, merged_csv_name="variants_long_table.csv" ) except FileNotFoundError as e: - print(str(e)) - print("Merged variants_long_table.csv might be empty") + print("\033[93mWARNING!\033[0m") + print("\033[93mAt least one variants_long_table.csv file could not be found. Therefore, merged variants_long_table.csv will be incomplete.\033[0m") + print("\033[93mPlease, check the following report in order to know which links are broken and, therefore, which tables could not be found:\033[0m\n") # Create excel files for individual tables valid_extensions = [".csv", ".tsv", ".tab"] @@ -173,6 +175,12 @@ def main(args): link_csvs = [file for file in rest_of_csvs if os.path.islink(file)] broken_links = [file for file in link_csvs if not os.path.exists(os.readlink(file))] valid_csvs = [file for file in rest_of_csvs if file not in broken_links] + + if broken_links: + print(f"\033[93mWARNING! {len(broken_links)} broken links found (for .csv, .tsv or .tab files). Please fix them.\033[0m") + for broken_link in broken_links: + print(f"\033[93mBroken link: {broken_link} (target: {os.readlink(broken_link)})\033[0m") + excel_generator(valid_csvs) From 7038b86232082607471fcea237fbd3d417c6048b Mon Sep 17 00:00:00 2001 From: victor5lm Date: Mon, 30 Sep 2024 16:55:21 +0200 Subject: [PATCH 14/19] Updated 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 bc7f4528..344c8b49 100755 --- a/bu_isciii/templates/sftp_user.json +++ b/bu_isciii/templates/sftp_user.json @@ -44,7 +44,7 @@ "sara.perez": ["GeneticDiagnosis"], "sbarturen": ["Labvirushep"], "sergio.sanchez": ["LabFWDB_ssanchez"], - "sherrera": ["LabFWBD", "LabFWBD_ext"], + "sherrera": ["LabFWBD", "LabFWBD_ext", "Labtuberculosis"], "sresino": ["Labvirushep"], "svaldezate": ["Labtaxonomia"], "svazquez": ["Labvirusres"], From 99edee6ad07ea0e4553886cfd8c92f59ad0f8b21 Mon Sep 17 00:00:00 2001 From: victor5lm Date: Mon, 30 Sep 2024 16:56:29 +0200 Subject: [PATCH 15/19] Updated 03-MTBSeq/lablog to handle the first sample name appropriately --- .../mtbseq/ANALYSIS/ANALYSIS01_MTBSEQ/03-MTBSeq/lablog | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) 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 e5bdac16..0eff7900 100644 --- a/bu_isciii/templates/mtbseq/ANALYSIS/ANALYSIS01_MTBSEQ/03-MTBSeq/lablog +++ b/bu_isciii/templates/mtbseq/ANALYSIS/ANALYSIS01_MTBSEQ/03-MTBSeq/lablog @@ -13,9 +13,9 @@ cat ../samples_id.txt | xargs -I @@ echo -e "srun --job-name MTBSEQ.@@ --output # classification echo "mkdir classification_all" > _03_gather_results.sh -echo "FIRST_SAMPLE=$(head -n1 ../samples_id.txt); head -n 1 ${FIRST_SAMPLE}/Classification/Strain_Classification.tab > classification_all/strain_classification_all.tab; grep \"^'$analysis_year\" */Classification/Strain_Classification.tab | cut -d \":\" -f 2 >> classification_all/strain_classification_all.tab" >> _03_gather_results.sh +echo 'FIRST_SAMPLE=$(head -n1 samples_id.txt); head -n 1 ${FIRST_SAMPLE}/Classification/Strain_Classification.tab > classification_all/strain_classification_all.tab; grep "^'\'''"$analysis_year"'" */Classification/Strain_Classification.tab | cut -d ":" -f 2 >> classification_all/strain_classification_all.tab' >> _03_gather_results.sh # resistances echo "mkdir resistances_all" >> _03_gather_results.sh cat ../samples_id.txt | xargs -I % echo "cp %/Amend/NONE_joint_cf4_cr4_fr75_ph4_samples1_amended.tab resistances_all/%_var_res.tab" >> _03_gather_results.sh # stats -echo "mkdir stats_all; FIRST_SAMPLE=$(head -n1 ../samples_id.txt); head -n 1 ${FIRST_SAMPLE}/Statistics/Mapping_and_Variant_Statistics.tab > stats_all/statistics_all.tab; grep \"^'$analysis_year\" */Statistics/Mapping_and_Variant_Statistics.tab | cut -d \":\" -f 2 >> stats_all/statistics_all.tab" >> _03_gather_results.sh +echo 'mkdir stats_all; FIRST_SAMPLE=$(head -n1 ../samples_id.txt); head -n 1 ${FIRST_SAMPLE}/Statistics/Mapping_and_Variant_Statistics.tab > stats_all/statistics_all.tab; grep "^'\'''"$analysis_year"'" */Statistics/Mapping_and_Variant_Statistics.tab | cut -d ":" -f 2 >> stats_all/statistics_all.tab' >> _03_gather_results.sh From baa1925d6045f833e24813f7af5e76a3d1a3affb Mon Sep 17 00:00:00 2001 From: victor5lm Date: Mon, 30 Sep 2024 17:16:18 +0200 Subject: [PATCH 16/19] Fixed linting mistakes --- bu_isciii/bioinfo_doc.py | 21 +++++++--- .../viralrecon/RESULTS/excel_generator.py | 38 +++++++++++++------ 2 files changed, 42 insertions(+), 17 deletions(-) diff --git a/bu_isciii/bioinfo_doc.py b/bu_isciii/bioinfo_doc.py index 458dd899..519cb382 100644 --- a/bu_isciii/bioinfo_doc.py +++ b/bu_isciii/bioinfo_doc.py @@ -652,19 +652,26 @@ def email_creation(self): ).replace("\n", "
") else: if bu_isciii.utils.prompt_yn_question( - msg="Do you wish to provide a text file for email notes?", dflt=False + msg="Do you wish to provide a text file for email notes?", + dflt=False, ): for i in range(3, -1, -1): email_data["email_notes"] = bu_isciii.utils.prompt_path( msg="Write the path to the file with RAW text as email notes" ) - if not os.path.isfile(os.path.expanduser(email_data["email_notes"])): - stderr.print(f"Provided file doesn't exist. Attempts left: {i}") + if not os.path.isfile( + os.path.expanduser(email_data["email_notes"]) + ): + stderr.print( + f"Provided file doesn't exist. Attempts left: {i}" + ) else: - stderr.print(f"File selected: {email_data["email_notes"]}") + stderr.print(f"File selected: {email_data['email_notes']}") break else: - stderr.print("No more attempts. Email notes will be given by prompt") + stderr.print( + "No more attempts. Email notes will be given by prompt" + ) email_data["email_notes"] = None else: email_data["email_notes"] = None @@ -673,7 +680,9 @@ def email_creation(self): with open(os.path.expanduser(email_data["email_notes"])) as f: email_data["email_notes"] = f.read().replace("\n", "
") else: - email_data["email_notes"] = bu_isciii.utils.ask_for_some_text(msg="Write email notes").replace("\n", "
") + email_data["email_notes"] = bu_isciii.utils.ask_for_some_text( + msg="Write email notes" + ).replace("\n", "
") email_data["user_data"] = self.resolution_info["service_user_id"] email_data["service_id"] = self.service_name.split("_", 5)[0] diff --git a/bu_isciii/templates/viralrecon/RESULTS/excel_generator.py b/bu_isciii/templates/viralrecon/RESULTS/excel_generator.py index ffeece39..2cdb83b4 100755 --- a/bu_isciii/templates/viralrecon/RESULTS/excel_generator.py +++ b/bu_isciii/templates/viralrecon/RESULTS/excel_generator.py @@ -68,7 +68,9 @@ def merge_lineage_tables( csvs_in_folder=csvs_in_folder, merged_csv_name=merged_csv_name ) else: - print(f"\033[93mNo pangolin folder could be found for {ref}, omitting\033[0m") + print( + f"\033[93mNo pangolin folder could be found for {ref}, omitting\033[0m" + ) if os.path.isdir(os.path.abspath(folder + "/nextclade")): nextcl_dir = os.path.join(folder, "nextclade") @@ -82,13 +84,15 @@ def merge_lineage_tables( csvs_in_folder=csvs_in_folder, merged_csv_name=merged_csv_name ) else: - print(f"\033[93mNo nextclade folder could be found for {ref}, omitting\033[0m\n") + print( + f"\033[93mNo nextclade folder could be found for {ref}, omitting\033[0m\n" + ) return def excel_generator(csv_files: List[str]): - #print("Proceeding") + # print("Proceeding") for file in csv_files: if not os.path.exists(file): print(f"\033[91mFile {file} does not exist, omitting...\033[0m") @@ -126,7 +130,9 @@ def single_csv_to_excel(csv_file: str): def main(args): if args.single_csv: # If single_csv is called, just convert target csv to excel and skip the rest - print("\033[92mSingle file convertion selected. Skipping main process...\033[0m") + print( + "\033[92mSingle file convertion selected. Skipping main process...\033[0m" + ) single_csv_to_excel(args.single_csv) exit(0) @@ -135,7 +141,9 @@ def main(args): ) with open(args.reference_file, "r") as file: references = [line.rstrip() for line in file] - print(f"\n\033[92mFound {len(references)} references: {str(references).strip('[]')}\033[0m") + print( + f"\n\033[92mFound {len(references)} references: {str(references).strip('[]')}\033[0m" + ) reference_folders = {ref: str("excel_files_" + ref) for ref in references} samples_ref_files = { @@ -160,10 +168,14 @@ def main(args): concat_tables_and_write( csvs_in_folder=variants_tables, merged_csv_name="variants_long_table.csv" ) - except FileNotFoundError as e: + except FileNotFoundError: print("\033[93mWARNING!\033[0m") - print("\033[93mAt least one variants_long_table.csv file could not be found. Therefore, merged variants_long_table.csv will be incomplete.\033[0m") - print("\033[93mPlease, check the following report in order to know which links are broken and, therefore, which tables could not be found:\033[0m\n") + print( + "\033[93mAt least one variants_long_table.csv file could not be found. Therefore, merged variants_long_table.csv will be incomplete.\033[0m" + ) + print( + "\033[93mPlease, check the following report in order to know which links are broken and, therefore, which tables could not be found:\033[0m\n" + ) # Create excel files for individual tables valid_extensions = [".csv", ".tsv", ".tab"] @@ -177,9 +189,13 @@ def main(args): valid_csvs = [file for file in rest_of_csvs if file not in broken_links] if broken_links: - print(f"\033[93mWARNING! {len(broken_links)} broken links found (for .csv, .tsv or .tab files). Please fix them.\033[0m") - for broken_link in broken_links: - print(f"\033[93mBroken link: {broken_link} (target: {os.readlink(broken_link)})\033[0m") + print( + f"\033[93mWARNING! {len(broken_links)} broken links found (for .csv, .tsv or .tab files). Please fix them.\033[0m" + ) + for broken_link in broken_links: + print( + f"\033[93mBroken link: {broken_link} (target: {os.readlink(broken_link)})\033[0m" + ) excel_generator(valid_csvs) From 1ce79569398d539e8dfaf69c8e456ff2bccfe10d Mon Sep 17 00:00:00 2001 From: victor5lm Date: Tue, 1 Oct 2024 12:05:50 +0200 Subject: [PATCH 17/19] Updated CHANGELOG.md --- CHANGELOG.md | 37 ++++++++++++++++++++++++++++++------- 1 file changed, 30 insertions(+), 7 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 8b7e3f90..b76da9b9 100755 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -10,15 +10,8 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), Code contributions to the new version: -- [Daniel Valle](https://github.com/Daniel-VM) -- [Sarai Varona](https://github.com/svarona) - ### Template fixes and updates -- Fixed path to blast database and update Emmtyper params [#339](https://github.com/BU-ISCIII/buisciii-tools/pull/339) -- Updated sarek version (v3.4.4) in ExomeEB-ExomeTrio-WGSTrio templates [#341] (https://github.com/BU-ISCIII/buisciii-tools/pull/341) -- Fixed IRMAs config for amended consensus [#325](https://github.com/BU-ISCIII/buisciii-tools/pull/325). - ### Modules #### Added enhancements @@ -51,6 +44,36 @@ Code contributions to the hotfix: ### Requirements +## [2.2.1] - 2024-10-01 : https://github.com/BU-ISCIII/buisciii-tools/releases/tag/2.2.1 + +### Credits + +Code contributions to the new version: + +- [Daniel Valle](https://github.com/Daniel-VM) +- [Sarai Varona](https://github.com/svarona) +- [Victor Lopez](https://github.com/victor5lm) +- [Sergio Olmos](https://github.com/OPSergio) + +### Template fixes and updates + +- Fixed path to blast database and update Emmtyper params [#339](https://github.com/BU-ISCIII/buisciii-tools/pull/339) +- Updated sarek version (v3.4.4) in ExomeEB-ExomeTrio-WGSTrio templates [#341] (https://github.com/BU-ISCIII/buisciii-tools/pull/341) +- Fixed IRMAs config for amended consensus [#325](https://github.com/BU-ISCIII/buisciii-tools/pull/325). +- Improved excel_generator.py and bioinfo_doc.py email creation function, and updated sftp_user.json, setup.py, main.py and some lablogs [#344](https://github.com/BU-ISCIII/buisciii-tools/pull/344). + +### Modules + +#### Added enhancements + +#### Fixes + +#### Changed + +#### Removed + +### Requirements + ## [2.2.0] - 2024-09-12 : https://github.com/BU-ISCIII/buisciii-tools/releases/tag/2.2.0 ### Credits From a104991be056528ecfad4d9828b75a2e22d15335 Mon Sep 17 00:00:00 2001 From: victor5lm Date: Tue, 1 Oct 2024 12:06:07 +0200 Subject: [PATCH 18/19] Updated setup.py --- setup.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setup.py b/setup.py index efa93a59..50fdff3d 100755 --- a/setup.py +++ b/setup.py @@ -2,7 +2,7 @@ from setuptools import setup, find_packages -version = "2.2.0" +version = "2.2.1" with open("README.md") as f: readme = f.read() From 96a7db8132b75f68e0f311fbe9a9f3139058cf26 Mon Sep 17 00:00:00 2001 From: victor5lm Date: Tue, 1 Oct 2024 12:06:22 +0200 Subject: [PATCH 19/19] Updated __main__.py --- bu_isciii/__main__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bu_isciii/__main__.py b/bu_isciii/__main__.py index 3933a027..1aebd780 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.0" + __version__ = "2.2.1" stderr.print( "[grey39] BU-ISCIII-tools version {}".format(__version__), highlight=False )