Skip to content

Commit 553f860

Browse files
committed
Merge branch 'rel-0.5.1'
# Conflicts: # README.md
2 parents 14b1061 + 915baae commit 553f860

File tree

9 files changed

+82
-55
lines changed

9 files changed

+82
-55
lines changed

.github/workflows/docker-image.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ jobs:
1717

1818
steps:
1919
- name: Checkout
20-
uses: actions/checkout@v6
20+
uses: actions/checkout@v6.0.1
2121
with:
2222
submodules: recursive
2323

.github/workflows/nf-test.yml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -40,15 +40,15 @@ jobs:
4040

4141
steps:
4242
- name: Check out pipeline code
43-
uses: actions/checkout@0ad4b8fadaa221de15dcec353f45205ec38ea70b # v4
43+
uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v4
4444
with:
4545
fetch-depth: 0
4646

4747
- uses: actions/setup-python@f677139bbe7f9c59b41e40162b753c062f5d49a3 # v5
4848
with:
4949
python-version: "3.11"
5050

51-
- uses: actions/setup-java@8df1039502a15bceb9433410b1a100fbe190c53b # v4
51+
- uses: actions/setup-java@f2beeb24e141e01a676f977032f5a29d81c9e27e # v4
5252
with:
5353
distribution: "temurin"
5454
java-version: "17"
@@ -78,7 +78,7 @@ jobs:
7878

7979
- name: Set up miniconda
8080
if: matrix.profile == 'conda'
81-
uses: conda-incubator/setup-miniconda@a4260408e20b96e80095f42ff7f1a15b27dd94ca # v3
81+
uses: conda-incubator/setup-miniconda@835234971496cad1653abb28a638a281cf32541f # v3
8282
with:
8383
miniconda-version: "latest"
8484
auto-update-conda: true
@@ -136,14 +136,14 @@ jobs:
136136
echo "Some test(s) failed :cold_sweat:" >> $GITHUB_STEP_SUMMARY
137137
138138
- name: Publish Test Report
139-
uses: mikepenz/action-junit-report@v4
139+
uses: mikepenz/action-junit-report@v6
140140
if: success() || failure() # always run even if the previous step fails
141141
with:
142142
report_paths: "TEST-*.xml"
143143

144144
- name: Upload test results
145145
if: always() # run even if tests fail
146-
uses: actions/upload-artifact@v4
146+
uses: actions/upload-artifact@v6
147147
with:
148148
name: nf-test-results-${{ matrix.filter }}-${{ matrix.profile }}-${{ matrix.NXF_VER }}-${{ matrix.shard }}
149149
path: |

.github/workflows/publish-pypi-release.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ jobs:
1414
id-token: write
1515

1616
steps:
17-
- uses: actions/checkout@v6
17+
- uses: actions/checkout@v6.0.1
1818
- name: Set up Python
1919
uses: actions/setup-python@v6
2020
with:

FastOMA.nf

Lines changed: 59 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -365,6 +365,41 @@ def detectInputType(input) {
365365
}
366366
}
367367

368+
// Helper to prefer user-specified value if set, else derive from input_root
369+
def resolveFolderParam(input_root_ch, param_value, default_subdir, required=true) {
370+
if (param_value) {
371+
return Channel.fromPath(param_value, type: 'dir', checkIfExists: true)
372+
} else {
373+
return resolveSubPath(input_root_ch, default_subdir, 'dir', required)
374+
}
375+
}
376+
377+
378+
//Resolve a subpath inside an input directory and return a path channel
379+
def resolveSubPath(base_ch, subpath, type='dir', required=true) {
380+
base_ch.map { base ->
381+
def fullPath = "${base}/${subpath}"
382+
def targetFile = file(fullPath)
383+
384+
if (required) {
385+
if (type == 'dir' && (!targetFile.exists() || !targetFile.isDirectory())){
386+
log.error "Required directory not found: ${fullPath}"
387+
exit 1
388+
} else if (type == 'file' && (!targetFile.exists() || !targetFile.isFile())) {
389+
log.error "Required file not found: ${fullPath}"
390+
exit 1
391+
}
392+
}
393+
return targetFile
394+
}
395+
}
396+
397+
// Resolve a single file (emit once)
398+
def resolveFile(base_ch, filename, required=true) {
399+
resolveSubPath(base_ch, filename, 'file', required).first()
400+
}
401+
402+
368403
// handle deprecated parameters
369404
def handleDeprecatedParameters() {
370405
if (params.input_folder && !params.input) {
@@ -405,41 +440,37 @@ workflow {
405440

406441
// Detect input type
407442
def inputType = detectInputType(params.input)
408-
if (inputType == "directory") {
409-
// Local/custom dataset - allow parameter overrides
410-
proteome_folder = Channel.value(params.proteome_folder)
411-
proteomes = Channel.fromPath("${params.proteome_folder}/*.{fa,fasta}", checkIfExists: true)
412-
species_tree = Channel.value(params.species_tree)
413-
splice_folder = Channel.value(params.splice_folder)
414-
hogmap_in = Channel.value(params.hogmap_in)
415-
} else {
416-
// Input is either a URL or an archive file - fetch and extract
417-
// Fetch test dataset from remote URL
418-
if (inputType == "url") {
419-
input_path = fetchRemoteData(Channel.value(params.input))
420-
} else if (inputType == "archive") {
421-
input_path = extractLocalArchive(Channel.fromPath(params.input))
422-
}
423-
424-
// Set up all channels based on the downloaded folder structure
425-
proteome_folder = input_path.map { "${it}/proteome" }
426-
proteomes = input_path.flatMap { dir ->
427-
file("${dir}/proteome").listFiles().findAll {
428-
it.name.endsWith('.fa') || it.name.endsWith('.fasta') || it.name.endsWith('.faa')
429-
}
430-
}
431-
species_tree = input_path.map { "${it}/species_tree.nwk" }
432-
splice_folder = input_path.map { "${it}/splice" }
433-
hogmap_in = input_path.map { "${it}/hogmap_in" }
434-
}
443+
if (inputType == 'directory') {
444+
input_root = Channel.fromPath(params.input, type: 'dir', checkIfExists: true)
445+
446+
} else if (inputType == 'url') {
447+
input_root = fetchRemoteData(Channel.value(params.input)).testDataDir
448+
449+
} else if (inputType == 'archive') {
450+
input_root = extractLocalArchive(Channel.fromPath(params.input)).extractedDir
451+
}
452+
// Now resolve each folder
453+
proteome_folder = resolveFolderParam(input_root, params.proteome_folder, 'proteome')
454+
splice_folder = resolveFolderParam(input_root, params.splice_folder, 'splice', false)
455+
hogmap_in = resolveFolderParam(input_root, params.hogmap_in, 'hogmap_in', false)
456+
species_tree = params.species_tree ?
457+
Channel.fromPath(params.species_tree, type: 'file', checkIfExists: true).first() :
458+
resolveFile(input_root, 'species_tree.nwk')
459+
proteomes = proteome_folder.flatMap { dir ->
460+
// Use file() to list files, don't create new channels
461+
def proteomeDir = file(dir.toString())
462+
return proteomeDir.listFiles().findAll {
463+
it.name.endsWith('.fa') || it.name.endsWith('.fasta')
464+
}
465+
}
435466

436467
// Static channels
437468
omamerdb = Channel.fromPath(params.omamer_db)
438469
notebook = Channel.fromPath("$workflow.projectDir/FastOMA/fastoma_notebook_stat.ipynb", type: "file", checkIfExists: true).first()
439470

440471
// Run the pipeline
441472
(species_tree_checked, ready_input_check) = check_input(proteome_folder, hogmap_in, species_tree, omamerdb, splice_folder)
442-
omamer_input_channel = proteomes
473+
omamer_input_channel = proteomes
443474
.combine(omamerdb)
444475
.combine(hogmap_in)
445476
.combine(ready_input_check)

FastOMA/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11

22
__packagename__ = "FastOMA"
3-
__version__ = "0.5.0"
3+
__version__ = "0.5.1"
44

55
import logging
66
logger = logging.getLogger("FastOMA")

README.md

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ installed.
6060
```bash
6161
nextflow run dessimozlab/FastOMA -profile docker --input /path/to/in_folder --output_folder /path/to/out_folder
6262
```
63-
You could also add specific version to be used by adding `-r v0.5.0` to the command line. Without any `-r` argument,
63+
You could also add specific version to be used by adding `-r v0.5.1` to the command line. Without any `-r` argument,
6464
always the latest available release will be used. With `-r dev` the latest development release can be used.
6565

6666
> [!WARNING]
@@ -99,10 +99,10 @@ There are four ways to run/install FastOMA detailed below:
9999
The FastOMA workflow can be run directly without any installation using nextflow's ability to fetch a workflow from github. A specific version can be selected by specifying the `-r` option to nextflow to select a specific version of FastOMA:
100100

101101
```bash
102-
nextflow run dessimozlab/FastOMA -r v0.5.0 -profile conda
102+
nextflow run dessimozlab/FastOMA -r v0.5.1 -profile conda
103103
```
104104

105-
This will fetch version v0.5.0 from github and run the FastOMA workflow using the conda profile. See section [How to run fastOMA](#how-to-run-fastoma).
105+
This will fetch version v0.5.1 from github and run the FastOMA workflow using the conda profile. See section [How to run fastOMA](#how-to-run-fastoma).
106106

107107
### 2. Cloning the FastOMA repo and running from there
108108

@@ -195,7 +195,7 @@ nextflow run FastOMA.nf -profile docker \
195195
--output_folder myresult/
196196
```
197197
This will use the container that is tagged with the current commit id. Similarly, one could also use
198-
`--container_version "0.5.0"` to use the container with version `dessimozlab/fastoma:0.5.0` from dockerhub. Check the latest version on the [DockerHub](https://hub.docker.com/r/dessimozlab/fastoma/tags).
198+
`--container_version "0.5.1"` to use the container with version `dessimozlab/fastoma:0.5.1` from dockerhub. Check the latest version on the [DockerHub](https://hub.docker.com/r/dessimozlab/fastoma/tags).
199199

200200
### Singularity
201201
Since Docker needs administrator privileges (root access), [Singluarity](https://apptainer.org/index.html) (a.k.a Apptainer) is a good alternative. This can be installed using [Conda](https://anaconda.org/conda-forge/singularity) with `conda install conda-forge::singularity`. However, in most of the academic HPC cluster, singluarity is already installed and can be called with `module load`.
@@ -467,7 +467,9 @@ Citation: Majidian, Sina, Yannis Nevers, Ali Yazdizadeh Kharrazi, Alex Warwick
467467

468468

469469
## Change log
470-
=======
470+
- Update v0.5.1:
471+
- Bug with input handling fixed.
472+
- upgraded github actions for CI/CD.
471473
- Update v0.5.0:
472474
- renamed input_folder parameter to input. input accepts now also (remote) archive tarball files.
473475
- better configuration setup (close to nf-core)

conf/test.config

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,4 @@ params {
1111
omamer_db = "${projectDir}/testdata/test.h5"
1212
input = "${projectDir}/testdata/in_folder"
1313
report = true
14-
15-
// derived parameters
16-
proteome_folder = "${params.input}/proteome"
17-
hogmap_in = "${params.input}/hogmap_in"
18-
splice_folder = "${params.input}/splice"
19-
species_tree = "${params.input}/species_tree.nwk"
2014
}

nextflow.config

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ manifest {
88
nextflowVersion = ">=22.10.4"
99
defaultBranch = "main"
1010
doi = "10.1101/2024.01.29.577392"
11-
version = "0.5.0"
11+
version = "0.5.1"
1212
contributors = [
1313
[
1414
name: 'Sina Majidian',
@@ -32,10 +32,10 @@ params {
3232
// these can be overridden by the user on the command line
3333
input = null
3434
// input sub-folders, can also be somewhere else
35-
proteome_folder = "${params.input}/proteome"
36-
hogmap_in = "${params.input}/hogmap_in"
37-
splice_folder = "${params.input}/splice"
38-
species_tree = "${params.input}/species_tree.nwk"
35+
proteome_folder = null
36+
hogmap_in = null
37+
splice_folder = null
38+
species_tree = null
3939
// cache path for (remote) archive input files
4040
test_data_cache = null
4141
// Keep deprecated parameter for backward compatibility
@@ -51,7 +51,7 @@ params {
5151

5252
// container settings
5353
container_name = "dessimozlab/fastoma"
54-
container_version = "0.5.0"
54+
container_version = "0.5.1"
5555

5656
// OMAmer database for mapping to precomputed HOGs
5757
omamer_db = "https://omabrowser.org/All/LUCA.h5"

nextflow_schema.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
"title": "Input options",
1010
"type": "object",
1111
"description": "Define where the pipeline should find input data ",
12-
"required": ["input", "species_tree"],
12+
"required": ["input"],
1313
"properties": {
1414
"input": {
1515
"type": "string",
@@ -230,7 +230,7 @@
230230
},
231231
"container_version": {
232232
"type": "string",
233-
"default": "0.5.0"
233+
"default": "0.5.1"
234234
}
235235
}
236236
}

0 commit comments

Comments
 (0)