Skip to content

Commit c7301a3

Browse files
authored
Merge pull request #561 from BU-ISCIII/develop
Develop merge for 2.2.11 release
2 parents 9cde34e + b92cb71 commit c7301a3

File tree

16 files changed

+182
-77
lines changed

16 files changed

+182
-77
lines changed

CHANGELOG.md

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,45 @@ All notable changes to this project will be documented in this file.
44

55
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
66

7+
## [2.2.11] - 2025-07-11 : https://github.com/BU-ISCIII/buisciii-tools/releases/tag/2.2.11
8+
9+
### Credits
10+
11+
- [Juan Ledesma](https://github.com/juanledesma78)
12+
- [Victor Lopez](https://github.com/victor5lm)
13+
- [Jaime Ozáez](https://github.com/jaimeozaez)
14+
15+
### Template fixes and updates
16+
17+
- Added micromamba environment PikaVirus_dev_2.6 to file hpc_slurm_pikavirus.config [#535](https://github.com/BU-ISCIII/buisciii-tools/pull/535).
18+
- Changed analysis_date in create_summary_report.sh to take properly dates from RSV services when using viralrecon [#540](https://github.com/BU-ISCIII/buisciii-tools/pull/540).
19+
- Fixed date formats for IRMA's template and excel_generator.py [#549](https://github.com/BU-ISCIII/buisciii-tools/pull/549).
20+
- Fixed the way whether samples are paired or single-end is detected [#550](https://github.com/BU-ISCIII/buisciii-tools/pull/550).
21+
- Removed pseudo_aligner parameter from RNASeq's lablog and added all missing symlinks in its RESULTS's lablog [#552](https://github.com/BU-ISCIII/buisciii-tools/pull/552).
22+
- Updated scratch.py and __main__.py to properly handle custom paths and temporary directories [#555](https://github.com/BU-ISCIII/buisciii-tools/pull/555).
23+
- Updated create_summary_report.sh to transform negative values into 0 [#556](https://github.com/BU-ISCIII/buisciii-tools/pull/556).
24+
- Updated the assembly stats script to handle files in RAW properly and when quast results are not available for any sample [#557](https://github.com/BU-ISCIII/buisciii-tools/pull/557).
25+
26+
### Modules
27+
28+
- Fixed clean module to handle subpaths stated in services.json [#543](https://github.com/BU-ISCIII/buisciii-tools/pull/543).
29+
- Fixed bioinfo_doc module to be able to indicate type (service_info or delivery) via CLI [#558](https://github.com/BU-ISCIII/buisciii-tools/pull/558).
30+
- Fixed the bioinfo_doc module to properly ask for email text notes and the scratch module to use proper scratch_tmp_path [#559](https://github.com/BU-ISCIII/buisciii-tools/pull/559).
31+
32+
#### Added enhancements
33+
34+
- Added new script to download multiple SRA entries in fastq format when necessary [#551](https://github.com/BU-ISCIII/buisciii-tools/pull/551).
35+
36+
#### Fixes
37+
38+
#### Changed
39+
40+
- Modified bu-isciii > buisciii for all commands in README text [#548](https://github.com/BU-ISCIII/buisciii-tools/pull/548).
41+
42+
#### Removed
43+
44+
### Requirements
45+
746
## [2.2.10] - 2025-05-21 : https://github.com/BU-ISCIII/buisciii-tools/releases/tag/2.2.10
847

948
### Credits

README.md

Lines changed: 22 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -69,13 +69,13 @@ pip install .
6969
Run bu-isciii tools:
7070

7171
```bash
72-
bu-isciii --help
72+
buisciii --help
7373
```
7474

7575
Outputs the following:
7676

7777
```bash
78-
Usage: bu-isciii [OPTIONS] COMMAND [ARGS]...
78+
Usage: buisciii [OPTIONS] COMMAND [ARGS]...
7979

8080
Options:
8181
--version Show the version and exit.
@@ -110,7 +110,7 @@ bu-isciii list
110110
Help:
111111

112112
```bash
113-
Usage: bu-isciii list [OPTIONS] <service>
113+
Usage: buisciii list [OPTIONS] <service>
114114

115115
List available bu-isciii services.
116116

@@ -163,13 +163,13 @@ Output:
163163
Example of usage:
164164

165165
```bash
166-
bu-isciii new-service <resolution_id>
166+
buisciii new-service <resolution_id>
167167
```
168168

169169
Help:
170170

171171
```bash
172-
Usage: bu-isciii new-service [OPTIONS] <resolution id>
172+
Usage: buisciii new-service [OPTIONS] <resolution id>
173173

174174
Create new service, it will create folder and copy template depending on
175175
selected service.
@@ -186,13 +186,13 @@ Options:
186186
Example of usage:
187187

188188
```bash
189-
bu-isciii scratch --direction service_to_scratch <resolution_id>
189+
buisciii scratch --direction service_to_scratch <resolution_id>
190190
```
191191

192192
Help:
193193

194194
```bash
195-
Usage: bu-isciii scratch [OPTIONS] <resolution id>
195+
Usage: buisciii scratch [OPTIONS] <resolution id>
196196

197197
Copy service folder to scratch directory for execution.
198198

@@ -217,13 +217,13 @@ Options:
217217
Example of usage:
218218

219219
```bash
220-
bu-isciii finish <resolution_id>
220+
buisciii finish <resolution_id>
221221
```
222222

223223
Help:
224224

225225
```bash
226-
Usage: bu-isciii finish [OPTIONS] <resolution id>
226+
Usage: buisciii finish [OPTIONS] <resolution id>
227227

228228
Service cleaning, remove big files, rename folders before copy and copy
229229
resolution FOLDER to sftp.
@@ -246,13 +246,13 @@ Finish module performs de following modules at onin this order, at once:
246246
Example of usage:
247247

248248
```bash
249-
bu-isciii clean <resolution_id>
249+
buisciii clean <resolution_id>
250250
```
251251

252252
Help:
253253

254254
```bash
255-
Usage: bu-isciii clean [OPTIONS] <resolution id>
255+
Usage: buisciii clean [OPTIONS] <resolution id>
256256

257257
Service cleaning. It will either remove big files, rename folders before
258258
copy, revert this renaming, show removable files or show folders for no
@@ -278,21 +278,21 @@ Options:
278278
##### scratch back
279279

280280
```bash
281-
bu-isciii scratch --direction scratch_to_service <resolution_id>
281+
buisciii scratch --direction scratch_to_service <resolution_id>
282282
```
283283

284284
##### copy_sftp
285285

286286
Example of usage:
287287

288288
```bash
289-
bu-isciii copy-sftp <resolution_id>
289+
buisciii copy-sftp <resolution_id>
290290
```
291291

292292
Help:
293293

294294
```bash
295-
Usage: bu-isciii copy-sftp [OPTIONS] <resolution id>
295+
Usage: buisciii copy-sftp [OPTIONS] <resolution id>
296296

297297
Copy resolution FOLDER to sftp, change status of resolution in iskylims and
298298
generate md, pdf, html.
@@ -311,13 +311,13 @@ Options:
311311
Example of usage:
312312

313313
```bash
314-
bu-isciii bioinfo-doc <resolution_id>
314+
buisciii bioinfo-doc <resolution_id>
315315
```
316316

317317
Help:
318318

319319
```bash
320-
Usage: bu-isciii bioinfo-doc [OPTIONS] <resolution id>
320+
Usage: buisciii bioinfo-doc [OPTIONS] <resolution id>
321321

322322
Create the folder documentation structure in bioinfo_doc server
323323

@@ -342,13 +342,13 @@ Options:
342342
Example of usage:
343343

344344
```bash
345-
bu-isciii archive --date_from 2022-01-01 --date_until 2023-01-01
345+
buisciii archive --date_from 2022-01-01 --date_until 2023-01-01
346346
```
347347

348348
Help:
349349

350350
```bash
351-
Usage: bu-isciii archive [OPTIONS]
351+
Usage: buisciii archive [OPTIONS]
352352

353353
Archive services or retrieve services from archive
354354

@@ -375,13 +375,13 @@ Options:
375375
Example of usage:
376376

377377
```bash
378-
bu-isciii autoclean-sftp
378+
buisciii autoclean-sftp
379379
```
380380

381381
Help:
382382

383383
```bash
384-
Usage: bu-isciii autoclean-sftp [OPTIONS]
384+
Usage: buisciii autoclean-sftp [OPTIONS]
385385

386386
Clean old sftp services
387387

@@ -397,13 +397,13 @@ Options:
397397
Example of usage:
398398

399399
```bash
400-
bu-isciii fix-permissions -d /data/bi
400+
buisciii fix-permissions -d /data/bi
401401
```
402402

403403
Help:
404404

405405
```bash
406-
Usage: bu-isciii fix-permissions [OPTIONS]
406+
Usage: buisciii fix-permissions [OPTIONS]
407407

408408
Fix permissions
409409

buisciii/__main__.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ def run_buisciii():
5757
)
5858

5959
# stderr.print("[green] `._,._,'\n", highlight=False)
60-
__version__ = "2.2.10"
60+
__version__ = "2.2.11"
6161
stderr.print(
6262
"[grey39] BU-ISCIII-tools version {}".format(__version__), highlight=False
6363
)
@@ -252,7 +252,7 @@ def new_service(ctx, resolution, path, no_create_folder, ask_path):
252252
"-t",
253253
"--tmp_dir",
254254
type=click.Path(),
255-
default="/data/ucct/bi/scratch_tmp/bi/",
255+
default="/scratch/bi/",
256256
help="Directory to which the files will be transfered for execution. Default: /data/ucct/bi/scratch_tmp/bi/",
257257
)
258258
@click.option(
@@ -411,7 +411,7 @@ def copy_sftp(ctx, resolution, path, ask_path, sftp_folder):
411411
"-t",
412412
"--tmp_dir",
413413
type=click.Path(),
414-
default="/data/ucct/bi/scratch_tmp/bi/",
414+
default="/scratch/bi/",
415415
help="Absolute path to the scratch directory containing the service.",
416416
)
417417
@click.pass_context
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
# This script is supposed to be run when having to download .fastq files from multiple SRA entries.
2+
# To run this script, please copy it to the corresponding RAW folder from the service.
3+
4+
#module load SRA-Toolkit/3.0.5-gompi-2021a
5+
mkdir logs
6+
7+
while IFS= read -r in || [ -n "$in" ]; do
8+
echo "srun --partition short_idx --mem 4G --cpus-per-task 2 --time 02:00:00 --job-name ${in}_SRA_DOWNLOAD --output logs/SRA_DOWNLOAD.${in}.%j.log fastq-dump --split-files --gzip ${in} &" >> _01_SRA_fastq_download.sh
9+
done < ../ANALYSIS/samples_id.txt
10+
11+
echo 'for f in *_1.fastq.gz *_2.fastq.gz; do [ -e "$f" ] || continue; mv "$f" "$(echo "$f" | sed -E '\''s/_([12])\.fastq\.gz$/_R\1.fastq.gz/'\'')"; done' > _02_fix_filenames.sh

buisciii/bioinfo_doc.py

Lines changed: 41 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -51,11 +51,19 @@ def __init__(
5151
conf=None,
5252
email_psswd=None,
5353
):
54+
# Type validation
55+
valid_types = ["service_info", "delivery"]
5456
if type is None:
5557
self.type = buisciii.utils.prompt_selection(
5658
msg="Select the documentation type you want to create",
57-
choices=["service_info", "delivery"],
59+
choices=valid_types,
5860
)
61+
else:
62+
if type not in valid_types:
63+
raise ValueError(
64+
f"Invalid type: '{type}'. It must be one of the following: {', '.join(valid_types)}."
65+
)
66+
self.type = type
5967
self.conf = conf.get_configuration("bioinfo_doc")
6068
if path is None:
6169
if ask_path:
@@ -647,9 +655,38 @@ def email_creation(self):
647655
"\n", "<br />"
648656
)
649657
else:
650-
email_data["email_notes"] = buisciii.utils.ask_for_some_text(
651-
msg="Write email notes"
652-
).replace("\n", "<br />")
658+
if buisciii.utils.prompt_yn_question(
659+
msg="Do you wish to provide a text file for email notes?",
660+
dflt=False,
661+
):
662+
for i in range(3, -1, -1):
663+
email_data["email_notes"] = buisciii.utils.prompt_path(
664+
msg="Write the path to the file with RAW text as email notes"
665+
)
666+
if not os.path.isfile(
667+
os.path.expanduser(email_data["email_notes"])
668+
):
669+
stderr.print(
670+
f"Provided file doesn't exist. Attempts left: {i}"
671+
)
672+
else:
673+
stderr.print(
674+
f"File selected: {email_data['email_notes']}"
675+
)
676+
break
677+
else:
678+
stderr.print(
679+
"No more attempts. Email notes will be given by prompt"
680+
)
681+
email_data["email_notes"] = (
682+
buisciii.utils.ask_for_some_text(
683+
msg="Write email notes"
684+
).replace("\n", "<br />")
685+
)
686+
else:
687+
email_data["email_notes"] = buisciii.utils.ask_for_some_text(
688+
msg="Write email notes"
689+
).replace("\n", "<br />")
653690
else:
654691
if buisciii.utils.prompt_yn_question(
655692
msg="Do you wish to provide a text file for email notes?",

buisciii/clean.py

Lines changed: 24 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -214,32 +214,37 @@ def scan_dirs(self, to_find):
214214
"""
215215
self.check_path_exists()
216216
pathlist = []
217-
# key: root, values: [[files inside], [dirs inside]]
218217
found = []
219-
# TODO: This has to be revisite if it takes to long.
220-
# I've tried to continue if found, but I guess there could be several work folders in the project.. Let's see how it goes
221-
for root, dirs, files in os.walk(self.full_path):
222-
for item_to_be_found in to_find:
223-
if os.path.basename(root) == item_to_be_found:
224-
pathlist.append(root)
225-
found.append(item_to_be_found)
226-
for file in files:
227-
path = os.path.join(root, file)
228-
if file == item_to_be_found:
229-
pathlist.append(path)
230-
found.append(item_to_be_found)
218+
219+
for item_to_find in to_find:
220+
# If there are subpaths in to_find, split them into different components (e.g., ["virus_coverage", "plots"], from virus_coverage/plots)
221+
path_parts = item_to_find.split(os.sep)
222+
target_name = path_parts[-1]
223+
parent_dirs = path_parts[:-1]
224+
225+
for root, dirs, files in os.walk(self.full_path):
226+
if root.endswith(os.sep.join(parent_dirs)):
227+
# Check for matching directories, if any
228+
if target_name in dirs:
229+
full_path = os.path.join(root, target_name)
230+
pathlist.append(full_path)
231+
found.append(item_to_find)
232+
# Check for matching files, if any
233+
if target_name in files:
234+
full_path = os.path.join(root, target_name)
235+
pathlist.append(full_path)
236+
found.append(item_to_find)
231237

232238
# Check found list without duplicates
233-
if not list(dict.fromkeys(found)).sort() == to_find.sort():
239+
if not sorted(list(dict.fromkeys(found))) == sorted(to_find):
234240
stderr.print(
235-
"[orange]WARNING:Some files/dir to delete/rename have not been found"
241+
"[orange]WARNING: Some files/dirs to delete/rename were not found"
236242
)
237243
for item in to_find:
238244
if item not in found:
239-
stderr.print("[orange] %s" % item)
240-
return pathlist
241-
else:
242-
return pathlist
245+
stderr.print(f"[orange] {item}")
246+
247+
return pathlist
243248

244249
def find_work(self):
245250
"""

buisciii/conf/configuration.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,6 @@
5656
"'service_info.txt'",
5757
"'work'"
5858
],
59-
"scratch_path": "/scratch/bi/",
6059
"srun_settings": {
6160
"--partition": "middle_idx",
6261
"--time": "24:00:00",

0 commit comments

Comments
 (0)