Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

nf-test POC #201

Merged
merged 32 commits into from
Oct 8, 2023
Merged
Show file tree
Hide file tree
Changes from 30 commits
Commits
Show all changes
32 commits
Select commit Hold shift + click to select a range
131788e
restore nf-test tests for sra workflow
maxulysse Sep 21, 2023
23b75bc
restore module tests
maxulysse Sep 21, 2023
c95793e
restore CI
maxulysse Sep 21, 2023
7e935bb
forgot some files
maxulysse Sep 21, 2023
e43e5f1
fix NXF_VER
maxulysse Sep 22, 2023
185e930
fix linting
maxulysse Sep 22, 2023
ab282b9
Merge branch 'refactor' into nf-test
maxulysse Sep 22, 2023
b11c1d8
restore file
maxulysse Sep 22, 2023
b0dd0a3
do some tests
maxulysse Sep 22, 2023
aad776b
2 *
maxulysse Sep 22, 2023
4c56977
Merge pull request #200 from maxulysse/nf-test
maxulysse Sep 22, 2023
89d39e9
forgot this file
maxulysse Sep 22, 2023
7c70ad9
Merge pull request #202 from maxulysse/test_data
maxulysse Sep 22, 2023
d456c20
fix path to file to include and update snapshots
maxulysse Sep 22, 2023
944cef3
Merge pull request #203 from maxulysse/nf-test
maxulysse Sep 22, 2023
cdaf06f
use initialise subworkflows
maxulysse Sep 22, 2023
b8b1590
move scripts
maxulysse Sep 22, 2023
b6c71a1
no need to test on push on dev, pr are enough
maxulysse Sep 22, 2023
d6f8971
more code polish
maxulysse Sep 22, 2023
a968fcb
code polish
maxulysse Sep 25, 2023
58f92b0
more code polish
maxulysse Sep 25, 2023
c989176
params
maxulysse Sep 25, 2023
131fd1b
more code polish
maxulysse Sep 25, 2023
08d30eb
typo
maxulysse Sep 25, 2023
034a520
use rc2
maxulysse Sep 25, 2023
45c9020
regenerate tests and snapshots
maxulysse Sep 25, 2023
191a8e7
Apply suggestions from code review
maxulysse Sep 25, 2023
4edab23
Merge branch 'refactor' into nf-test
maxulysse Sep 25, 2023
904c15e
Merge branch 'refactor' into nf-test
maxulysse Sep 25, 2023
6cf3085
update snapshots
maxulysse Sep 25, 2023
bf27df9
Merge branch 'refactor' into nf-test
maxulysse Oct 6, 2023
56e5143
update snapshots
maxulysse Oct 6, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
*.config linguist-language=nextflow
*.nf.test linguist-language=nextflow
tests/**/*nf.test.snap linguist-generated
modules/nf-core/** linguist-generated
subworkflows/nf-core/** linguist-generated
71 changes: 71 additions & 0 deletions .github/tags.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
# local modules
multiqc_mappings_config:
- modules/local/multiqc_mappings_config/**
sra_fastq_ftp:
- modules/local/sra_fastq_ftp/**
sra_ids_to_runinfo:
- modules/local/sra_ids_to_runinfo/**
sra_merge_samplesheet:
- modules/local/sra_merge_samplesheet/**
sra_runinfo_to_ftp:
- modules/local/sra_runinfo_to_ftp/**
sra_to_samplesheet:
- modules/local/sra_to_samplesheet/**

# workflow: sra
sra_custom_ena_metadata_fields:
- modules/local/sra_ids_to_runinfo/**
- modules/local/sra_runinfo_to_ftp/**
- modules/local/sra_fastq_ftp/**
- modules/local/sra_to_samplesheet/**
- modules/local/sra_merge_samplesheet/**
- workflows/sra/**
sra_default_parameters:
- modules/local/sra_ids_to_runinfo/**
- modules/local/sra_runinfo_to_ftp/**
- modules/local/sra_fastq_ftp/**
- modules/local/sra_to_samplesheet/**
- modules/local/sra_merge_samplesheet/**
- workflows/sra/**
sra_force_sratools_download:
- modules/local/sra_ids_to_runinfo/**
- modules/local/sra_runinfo_to_ftp/**
- modules/local/sra_fastq_ftp/**
- modules/local/sra_to_samplesheet/**
- modules/local/sra_merge_samplesheet/**
- workflows/sra/**
sra_nf_core_pipeline_atacseq:
- modules/local/sra_ids_to_runinfo/**
- modules/local/sra_runinfo_to_ftp/**
- modules/local/sra_fastq_ftp/**
- modules/local/sra_to_samplesheet/**
- modules/local/sra_merge_samplesheet/**
- workflows/sra/**
sra_nf_core_pipeline_rnaseq:
- modules/local/sra_ids_to_runinfo/**
- modules/local/sra_runinfo_to_ftp/**
- modules/local/sra_fastq_ftp/**
- modules/local/sra_to_samplesheet/**
- modules/local/sra_merge_samplesheet/**
- workflows/sra/**
sra_nf_core_pipeline_taxprofiler:
- modules/local/sra_ids_to_runinfo/**
- modules/local/sra_runinfo_to_ftp/**
- modules/local/sra_fastq_ftp/**
- modules/local/sra_to_samplesheet/**
- modules/local/sra_merge_samplesheet/**
- workflows/sra/**
sra_nf_core_pipeline_viralrecon:
- modules/local/sra_ids_to_runinfo/**
- modules/local/sra_runinfo_to_ftp/**
- modules/local/sra_fastq_ftp/**
- modules/local/sra_to_samplesheet/**
- modules/local/sra_merge_samplesheet/**
- workflows/sra/**
sra_skip_fastq_download:
- modules/local/sra_ids_to_runinfo/**
- modules/local/sra_runinfo_to_ftp/**
- modules/local/sra_fastq_ftp/**
- modules/local/sra_to_samplesheet/**
- modules/local/sra_merge_samplesheet/**
- workflows/sra/**
91 changes: 62 additions & 29 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -1,28 +1,67 @@
name: nf-core CI
# This workflow runs the pipeline with the minimal test dataset to check that it completes without any syntax errors
name: nf-core CI
on:
pull_request:
release:
types: [published]
merge_group:
types:
- checks_requested
branches:
- master
- dev
- refactor
- nf-test

env:
NXF_ANSI_LOG: false
NFTEST_VER: "0.8.0-rc2"

concurrency:
group: "${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}"
cancel-in-progress: true

jobs:
changes:
name: Check for changes
runs-on: ubuntu-latest
outputs:
# Expose matched filters as job 'tags' output variable
tags: ${{ steps.filter.outputs.changes }}
steps:
- uses: actions/checkout@v3
- uses: dorny/paths-filter@v2
id: filter
with:
filters: ".github/tags.yml"

define_nxf_versions:
name: Choose nextflow versions to test against depending on target branch
runs-on: ubuntu-latest
outputs:
matrix: ${{ steps.nxf_versions.outputs.matrix }}
steps:
- id: nxf_versions
run: |
if [[ "${{ github.event_name }}" == "pull_request" && "${{ github.base_ref }}" == "dev" && "${{ matrix.NXF_VER }}" != "latest-everything" ]]; then
echo matrix='["latest-everything"]' | tee -a $GITHUB_OUTPUT
else
echo matrix='["latest-everything", "23.04.0"]' | tee -a $GITHUB_OUTPUT
fi

test:
name: Run pipeline with test data
# 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 == 'nf-core/fetchngs') }}"
name: ${{ matrix.tags }} ${{ matrix.profile }} NF ${{ matrix.NXF_VER }}
needs: [changes, define_nxf_versions]
if: needs.changes.outputs.tags != '[]'
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
NXF_VER:
- "23.04.0"
- "latest-everything"
NXF_VER: ${{ fromJson(needs.define_nxf_versions.outputs.matrix) }}
tags: ["${{ fromJson(needs.changes.outputs.tags) }}"]
profile:
- "docker"

steps:
- name: Check out pipeline code
uses: actions/checkout@v3
Expand All @@ -32,29 +71,23 @@ jobs:
with:
version: "${{ matrix.NXF_VER }}"

- name: Run pipeline with test data
- name: Install nf-test
run: |
nextflow run ${GITHUB_WORKSPACE} -profile test,docker --outdir ./results
wget -qO- https://code.askimed.com/install/nf-test | bash -s $NFTEST_VER
sudo mv nf-test /usr/local/bin/

parameters:
name: Test workflow parameters
if: ${{ github.event_name != 'push' || (github.event_name == 'push' && github.repository == 'nf-core/fetchngs') }}
runs-on: ubuntu-latest
strategy:
matrix:
parameters:
- "--nf_core_pipeline rnaseq"
- "--ena_metadata_fields run_accession,experiment_accession,library_layout,fastq_ftp,fastq_md5 --sample_mapping_fields run_accession,library_layout"
- "--skip_fastq_download"
- "--force_sratools_download"
steps:
- name: Check out pipeline code
uses: actions/checkout@v2

- name: Install Nextflow
- name: Run nf-test
run: |
wget -qO- get.nextflow.io | bash
sudo mv nextflow /usr/local/bin/
- name: Run pipeline with various parameters
nf-test test --tag ${{ matrix.tags }} --profile "test,${{ matrix.profile }}" --junitxml=test.xml

- name: Output log on failure
if: failure()
run: |
nextflow run ${GITHUB_WORKSPACE} -profile test,docker --outdir ./results ${{ matrix.parameters }}
sudo apt install bat > /dev/null
batcat --decorations=always --color=always ${{ github.workspace }}/.nf-test/tests/*/meta/nextflow.log

- name: Publish Test Report
uses: mikepenz/action-junit-report@v3
if: always() # always run even if the previous step fails
with:
report_paths: test.xml
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,6 @@ results/
testing/
testing*
*.pyc
.nf-test/
nf-test
.nf-test.log
1 change: 1 addition & 0 deletions .nf-core.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,4 @@ lint:
files_unchanged:
- assets/sendmail_template.txt
- lib/NfcoreTemplate.groovy
- .gitattributes
36 changes: 36 additions & 0 deletions conf/test_data.config
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
params {
// Base directory for test data
test_data_base = "https://raw.githubusercontent.com/nf-core/test-datasets/fetchngs"

merge_samplesheet_ids = [ "DRX024467_DRR026872", "SRX11047067_SRR14709033", "SRX9504942_SRR13055517", "DRX026011_DRR028935", "SRX17709227_SRR21711856", "SRX9504942_SRR13055518", "ERX1188904_ERR1109373", "SRX17709228_SRR21711855", "SRX9504942_SRR13055519", "ERX1234253_ERR1160846", "SRX6725035_SRR9984183", "SRX9504942_SRR13055520", "SRX10940790_SRR14593545", "SRX9315476_SRR12848126", "SRX9626017_SRR13191702" ]

def merge_samplesheet_url = "${params.test_data_base}/modules/local/sra_merge_samplesheet/samplesheets/"
def merge_mappings_url = "${params.test_data_base}/modules/local/sra_merge_samplesheet/mappings/"
def merge_samplesheet_urls = []
def merge_mappings_urls = []

merge_samplesheet_ids.each { id ->
merge_samplesheet_urls += "${merge_samplesheet_url}${id}.samplesheet.csv"
merge_mappings_urls += "${merge_mappings_url}/${id}.mappings.csv"
}

fastq_ftp_ids = ["SRR13191702"]
def fastq_ftp_url = "ftp.sra.ebi.ac.uk/vol1/fastq/SRR131/002/SRR13191702/"
def fastq_ftp_urls = []

fastq_ftp_ids.each { id ->
fastq_ftp_urls += "${fastq_ftp_url}${id}_1.fastq.gz"
fastq_ftp_urls += "${fastq_ftp_url}${id}_2.fastq.gz"
}

test_data {
'modules_local' {
multiqc_mappings_config = "${params.test_data_base}/modules/local/multiqc_mappings_config/SRX9626017_SRR13191702.mappings.csv"
sra_merge_samplesheet_samplesheets = merge_samplesheet_urls
sra_merge_samplesheet_mappings = merge_mappings_urls
sra_to_samplesheet = "${params.test_data_base}/modules/local/sra_to_samplesheet/SRX9626017_SRR13191702.mappings.csv"
sra_fastq_ftp = fastq_ftp_urls
sra_runinfo_to_ftp = "${params.test_data_base}/modules/local/sra_runinfo_to_ftp/SRR13191702.runinfo.tsv"
}
}
}
31 changes: 31 additions & 0 deletions modules/local/multiqc_mappings_config/tests/main.nf.test
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
nextflow_process {

name "Test process: MULTIQC_MAPPINGS_CONFIG"
script "modules/local/multiqc_mappings_config/main.nf"
process "MULTIQC_MAPPINGS_CONFIG"
tag "modules"
tag "modules_local"
tag "multiqc_mappings_config"

test("Should run without failures") {

when {
params {
outdir = "$outputDir"
}

process {
"""
input[0] = file(params.test_data['modules_local']['multiqc_mappings_config'], checkIfExists: true)
"""
}
}

then {
assertAll(
{ assert process.success },
{ assert snapshot(process.out).match() }
)
}
}
}
27 changes: 27 additions & 0 deletions modules/local/multiqc_mappings_config/tests/main.nf.test.snap
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
{
"Should run without failures": {
"content": [
{
"0": [
[
"multiqc_config.yml:md5,7f3cb10fff83ba9eb3e8fa6862d1290a",
"versions.yml:md5,dd4c66f0551d15510b36bb2e2b2fdd73"
]
],
"1": [
"versions.yml:md5,dd4c66f0551d15510b36bb2e2b2fdd73"
],
"versions": [
"versions.yml:md5,dd4c66f0551d15510b36bb2e2b2fdd73"
],
"yml": [
[
"multiqc_config.yml:md5,7f3cb10fff83ba9eb3e8fa6862d1290a",
"versions.yml:md5,dd4c66f0551d15510b36bb2e2b2fdd73"
]
]
}
],
"timestamp": "2023-09-22T10:58:18.132284"
}
}
34 changes: 34 additions & 0 deletions modules/local/sra_fastq_ftp/tests/main.nf.test
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
nextflow_process {

name "Test process: SRA_FASTQ_FTP"
script "modules/local/sra_fastq_ftp/main.nf"
process "SRA_FASTQ_FTP"
tag "modules"
tag "modules_local"
tag "sra_fastq_ftp"

test("Should run without failures") {

when {
params {
outdir = "$outputDir"
}

process {
"""
input[0] = [
[ id:'SRX9626017_SRR13191702', single_end:false, md5_1: '89c5be920021a035084d8aeb74f32df7', md5_2: '56271be38a80db78ef3bdfc5d9909b98' ], // meta map
params.test_data['modules_local']['sra_fastq_ftp']
]
"""
}
}

then {
assertAll(
{ assert process.success },
{ assert snapshot(process.out).match() }
)
}
}
}
Loading