Skip to content

Commit

Permalink
Made the hic param pattern more flexible
Browse files Browse the repository at this point in the history
  • Loading branch information
GallVp committed Sep 18, 2024
1 parent d1c2f0a commit 9bd0117
Show file tree
Hide file tree
Showing 17 changed files with 211 additions and 12 deletions.
31 changes: 30 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,11 @@ jobs:
- invalid
- stub
- noltr
- hicparam
include:
- OPTION_STUB: ""
- OPTION_STUB: "-stub"
TEST_PARAMS: stub
TEST_PARAMS: [stub, hicparam]
steps:
- name: Check out pipeline code
uses: actions/checkout@0ad4b8fadaa221de15dcec353f45205ec38ea70b # v4
Expand All @@ -55,3 +56,31 @@ jobs:
-params-file \
./tests/${{ matrix.TEST_PARAMS }}/params.json \
${{ matrix.OPTION_STUB }}
nf-test:
name: Run nf-tests
# Only run on push if this is the nf-core dev branch (merged PRs)
if: "${{ github.event_name != 'push' || (github.event_name == 'push' && github.repository == 'plant-food-research-open/assemblyqc') }}"
runs-on: ubuntu-latest
strategy:
matrix:
NXF_VER:
- "23.04.0"
steps:
- name: Check out pipeline code
uses: actions/checkout@0ad4b8fadaa221de15dcec353f45205ec38ea70b # v4

- name: Install Nextflow
uses: nf-core/setup-nextflow@v2
with:
version: ${{ matrix.NXF_VER }}

- name: Install nf-test
uses: nf-core/[email protected]

- name: Run nf-tests
run: |
nf-test \
test \
--verbose \
tests
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,7 @@ testing*
# PFR files
*.stdout
*.stderr

# nf-test files
.nf-test/
.nf-test.log
15 changes: 15 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,21 @@
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).

## v2.1.1+dev - [19-Sep-2024]

### `Added`

1. Configured nf-test for function testing

### `Fixed`

1. Made the `hic` param pattern more flexible as `^SR\w+$|^\S+\{1,2\}[\w\.]*\.f(ast)?q\.gz$`

### `Dependencies`

1. Nextflow!>=23.04.0
2. [email protected]

## v2.1.0 - [31-July-2024]

### `Added`
Expand Down
2 changes: 1 addition & 1 deletion CITATION.cff
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ authors:
- family-names: "Deng"
given-names: "Cecilia"
title: "AssemblyQC: A Nextflow pipeline for reproducible reporting of assembly quality"
version: 2.1.0
version: 2.1.1+dev
date-released: 2024-07-30
url: "https://github.com/Plant-Food-Research-Open/assemblyqc"
doi: 10.1093/bioinformatics/btae477
4 changes: 4 additions & 0 deletions cleanNXF.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,7 @@ do
rm -rf "work/$i"
done
echo "Cleaned work..."

rm -f .nf-test.log
rm -rf .nf-test
echo "Cleaned nf-test..."
12 changes: 6 additions & 6 deletions docs/parameters.md
Original file line number Diff line number Diff line change
Expand Up @@ -66,12 +66,12 @@ A Nextflow pipeline which evaluates assembly quality with multiple QC tools and

## HiC options

| Parameter | Description | Type | Default | Required | Hidden |
| -------------------- | -------------------------------------------------------------------------------------- | --------- | ------------------------------------------------- | -------- | ------ |
| `hic` | HiC reads path provided as a SRA ID or as paired reads with pattern '\*{1,2}.fastq.gz' | `string` | | | |
| `hic_skip_fastp` | Skip HiC read trimming | `boolean` | | | |
| `hic_skip_fastqc` | Skip HiC read QC | `boolean` | | | |
| `hic_fastp_ext_args` | Additional parameters for fastp trimming | `string` | --qualified_quality_phred 20 --length_required 50 | | |
| Parameter | Description | Type | Default | Required | Hidden |
| -------------------- | ---------------------------------------------------------------------------------------- | --------- | ------------------------------------------------- | -------- | ------ |
| `hic` | HiC reads path provided as a SRA ID or as paired reads such as 'hic_reads{1,2}.fastq.gz' | `string` | | | |
| `hic_skip_fastp` | Skip HiC read trimming | `boolean` | | | |
| `hic_skip_fastqc` | Skip HiC read QC | `boolean` | | | |
| `hic_fastp_ext_args` | Additional parameters for fastp trimming | `string` | --qualified_quality_phred 20 --length_required 50 | | |

## Synteny options

Expand Down
2 changes: 1 addition & 1 deletion docs/usage.md
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ This section provides additional information for parameters. It does not list al

### HiC

- `hic`: Path to reads provided as a SRA ID or as a path to paired reads with pattern '\*{1,2}.(fastq|fq).gz'. These reads are applied to each assembly listed by `input`.
- `hic`: Path to reads provided as a SRA ID or as a path to paired reads such as 'hic_reads{1,2}.fastq.gz'. These reads are applied to each assembly listed by `input`.

### Synteny analysis

Expand Down
2 changes: 1 addition & 1 deletion nextflow.config
Original file line number Diff line number Diff line change
Expand Up @@ -283,7 +283,7 @@ manifest {
description = """A Nextflow pipeline which evaluates assembly quality with multiple QC tools and presents the results in a unified html report."""
mainScript = 'main.nf'
nextflowVersion = '!>=23.04.0'
version = '2.1.0'
version = '2.1.1+dev'
doi = 'https://doi.org/10.1093/bioinformatics/btae477'
}

Expand Down
4 changes: 2 additions & 2 deletions nextflow_schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -213,8 +213,8 @@
"properties": {
"hic": {
"type": "string",
"description": "HiC reads path provided as a SRA ID or as paired reads with pattern '*{1,2}.fastq.gz'",
"pattern": "^SR\\w+$|^\\S+\\{1,2\\}\\.f(ast)?q\\.gz$"
"description": "HiC reads path provided as a SRA ID or as paired reads such as 'hic_reads{1,2}.fastq.gz'",
"pattern": "^SR\\w+$|^\\S+\\{1,2\\}[\\w\\.]*\\.f(ast)?q\\.gz$"
},
"hic_skip_fastp": {
"type": "boolean",
Expand Down
8 changes: 8 additions & 0 deletions nf-test.config
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
config {

testsDir "tests"
workDir ".nf-test"
configFile "nextflow.config"
profile ""

}
2 changes: 2 additions & 0 deletions tests/hicparam/assemblysheet.csv
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
tag,fasta
test,tests/hicparam/test_genome.fa.gz
Binary file added tests/hicparam/hic/Dummy_hic_1.merged.fq.gz
Binary file not shown.
Binary file added tests/hicparam/hic/Dummy_hic_2.merged.fq.gz
Binary file not shown.
10 changes: 10 additions & 0 deletions tests/hicparam/hicparam.nf
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
import groovy.json.JsonSlurper

def checkHiCParam(paramValue, schema) {
def jsonSlurper = new JsonSlurper()
def jsonContent = jsonSlurper.parse ( file ( schema, checkIfExists: true ) )
def pattern = jsonContent.definitions.hic_options.properties.hic.pattern
def match = paramValue ==~ pattern

return match
}
118 changes: 118 additions & 0 deletions tests/hicparam/hicparam.nf.test
Original file line number Diff line number Diff line change
@@ -0,0 +1,118 @@
nextflow_function {

name "checkHiCParam"
script "./hicparam.nf"
function "checkHiCParam"

test("Dummy_hic.R{1,2}.fq.gz") {
when {
function {
"""
input[0] = "Dummy_hic.R{1,2}.fq.gz"
input[1] = "$baseDir/nextflow_schema.json"
"""
}
}

then {
assert function.success
assert function.result
}
}

test("Dummy_hic.{1,2}.fq.gz") {
when {
function {
"""
input[0] = "Dummy_hic.{1,2}.fq.gz"
input[1] = "$baseDir/nextflow_schema.json"
"""
}
}

then {
assert function.success
assert function.result
}
}

test("Dummy_hic{1,2}.fastq.gz") {
when {
function {
"""
input[0] = "Dummy_hic{1,2}.fastq.gz"
input[1] = "$baseDir/nextflow_schema.json"
"""
}
}

then {
assert function.success
assert function.result
}
}

test("Dummy_hic.R{1,2}.merged.fq.gz") {
when {
function {
"""
input[0] = "Dummy_hic.R{1,2}.merged.fq.gz"
input[1] = "$baseDir/nextflow_schema.json"
"""
}
}

then {
assert function.success
assert function.result
}
}

test("Dummy_hic{1,2}_merged.samtools._check.fq.gz") {
when {
function {
"""
input[0] = "Dummy_hic{1,2}_merged.samtools._check.fq.gz"
input[1] = "$baseDir/nextflow_schema.json"
"""
}
}

then {
assert function.success
assert function.result
}
}

test("CK13_02_hic_R{1,2}.merged.fastq.gz") {
when {
function {
"""
input[0] = "CK13_02_hic_R{1,2}.merged.fastq.gz"
input[1] = "$baseDir/nextflow_schema.json"
"""
}
}

then {
assert function.success
assert function.result
}
}

test("CK13_02_hic_1.merged.fastq.gz -- fail") {
when {
function {
"""
input[0] = "CK13_02_hic_1.merged.fastq.gz"
input[1] = "$baseDir/nextflow_schema.json"
"""
}
}

then {
assert function.success
assert ! function.result
}
}
}
9 changes: 9 additions & 0 deletions tests/hicparam/params.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"config_profile_name": "Test to verify hic param validation",
"config_profile_description": "Test to verify hic param validation",
"input": "tests/hicparam/assemblysheet.csv",
"hic": "tests/hicparam/hic/Dummy_hic_{1,2}.merged.fq.gz",
"max_cpus": 2,
"max_memory": "6.GB",
"max_time": "6.h"
}
Binary file added tests/hicparam/test_genome.fa.gz
Binary file not shown.

0 comments on commit 9bd0117

Please sign in to comment.