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

Add Boltz #230

Draft
wants to merge 8 commits into
base: dev
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
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 CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- [[PR ##205](https://github.com/nf-core/proteinfold/pull/205)] - Change input schema from `sequence,fasta` to `id,fasta`.
- [[PR #210](https://github.com/nf-core/proteinfold/pull/210)]- Moving post-processing logic to a subworkflow, change wave images pointing to oras to point to https and refactor module to match nf-core folder structure.
- [[#214](https://github.com/nf-core/proteinfold/issues/214)]- Fix colabfold image to run in cpus after [#188](https://github.com/nf-core/proteinfold/issues/188) fix.
- [[#229](https://github.com/nf-core/proteinfold/issues/229)]- Add Boltz pipeline [PR #230](https://github.com/nf-core/proteinfold/pull/230).

## [[1.1.1](https://github.com/nf-core/proteinfold/releases/tag/1.1.1)] - 2025-07-30

Expand Down
2 changes: 2 additions & 0 deletions conf/dbs.config
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@ params {
pdb_seqres_link = 'https://files.wwpdb.org/pub/pdb/derived_data/pdb_seqres.txt'
uniprot_sprot_link = 'https://ftp.ebi.ac.uk/pub/databases/uniprot/current_release/knowledgebase/complete/uniprot_sprot.fasta.gz'
uniprot_trembl_link = 'https://ftp.ebi.ac.uk/pub/databases/uniprot/current_release/knowledgebase/complete/uniprot_trembl.fasta.gz'
boltz_ccd_link = 'https://huggingface.co/boltz-community/boltz-1/resolve/main/ccd.pkl'
boltz_model_link = 'https://huggingface.co/boltz-community/boltz-1/resolve/main/boltz1.ckpt'

// Alphafold paths
bfd_path = "${params.alphafold2_db}/bfd/*"
Expand Down
35 changes: 35 additions & 0 deletions main.nf
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,10 @@ if (params.mode.toLowerCase().split(",").contains("esmfold")) {
include { PREPARE_ESMFOLD_DBS } from './subworkflows/local/prepare_esmfold_dbs'
include { ESMFOLD } from './workflows/esmfold'
}
if (params.mode.toLowerCase().split(",").contains("boltz")) {
include { PREPARE_BOLTZ_DBS } from './subworkflows/local/prepare_boltz_dbs'
include { BOLTZ } from './workflows/boltz'
}

include { PIPELINE_INITIALISATION } from './subworkflows/local/utils_nfcore_proteinfold_pipeline'
include { PIPELINE_COMPLETION } from './subworkflows/local/utils_nfcore_proteinfold_pipeline'
Expand Down Expand Up @@ -205,6 +209,37 @@ workflow NFCORE_PROTEINFOLD {
ch_report_input = ch_report_input.mix(ESMFOLD.out.pdb_msa)
}

//
// WORKFLOW: Run Boltz
//
if (params.mode.toLowerCase().split(",").contains("boltz")) {
PREPARE_BOLTZ_DBS(
params.boltz_ccd_path,
params.boltz_model_path,
params.boltz_ccd_link,
params.boltz_model_link
)
ch_versions = ch_versions.mix(PREPARE_BOLTZ_DBS.out.versions)

BOLTZ(
ch_samplesheet,
ch_versions,
PREPARE_BOLTZ_DBS.out.boltz_ccd,
PREPARE_BOLTZ_DBS.out.boltz_model
)
ch_versions = ch_versions.mix(BOLTZ.out.versions)
ch_report_input = ch_report_input.mix(
BOLTZ
.out
.msa
.join(BOLTZ.out.structures)
.join(BOLTZ.out.confidence)
.join(BOLTZ.out.plddt)
.map { it[0]["model"] = "boltz"; it }
)

}

//
// POST PROCESSING: generate visualisation reports
//
Expand Down
29 changes: 29 additions & 0 deletions modules/local/create_samplesheet/main.nf
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
process CREATE_SAMPLESHEET_YAML {
tag "$meta.id"
label 'process_single'

container 'docker://nbtmsh/samplesheet-utils'

input:
tuple val(meta), path(samplesheet)

output:
tuple val(meta), path("*.yaml"), emit: samplesheet

when:
task.ext.when == null || task.ext.when

script:
"""
create-samplesheet \\
--directory ./ \\
--yaml \
--output-file \$(sample-name --sanitise --index 0 ./*.fasta).yaml
"""

stub:
"""
echo "" > samplesheet.yaml
"""
}

25 changes: 25 additions & 0 deletions modules/local/run_boltz/main.nf
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
/*
* Run Alphafold2
*/
process RUN_BOLTZ {
tag "$meta.id"
label 'process_medium'

container "docker.io/nbtmsh/boltz:0.1.2"

input:
tuple val(meta), path(fasta)
path ('boltz1_conf.ckpt')
path ('ccd.pkl')

output:
path ("boltz_results_${fasta.baseName}/processed/msa/*.npz"), emit: msa
path ("boltz_results_${fasta.baseName}/processed/structures/*.npz"), emit: structures
path ("boltz_results_${fasta.baseName}/predictions/${fasta.baseName}/confidence*.json"), emit: confidence
path ("boltz_results_${fasta.baseName}/predictions/${fasta.baseName}/plddt_*.npz"), emit: plddt

script:
"""
/opt/miniforge/envs/boltz/bin/boltz predict --use_msa_server --accelerator gpu "./${fasta.name}" --cache ./
"""
}
8 changes: 8 additions & 0 deletions nextflow.config
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,14 @@ params {
uniref90_path = null
pdb_seqres_path = null
uniprot_path = null

// Boltz links
boltz_ccd_link = null
boltz_model_link = null

// Boltz parameters
boltz_ccd_path = null
boltz_model_path = null

// Colabfold parameters
colabfold_server = "webserver"
Expand Down
29 changes: 29 additions & 0 deletions nextflow_schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -296,6 +296,35 @@
}
}
},
"boltz_options": {
"title": "Boltz DBs and model paths options",
"type": "object",
"fa_icon": "fas fa-database",
"description": "Paths used to provide model paths and weight paths to Boltz",

"properties": {
"boltz_ccd_link": {
"type": "string",
"description": "Link to download CCD file",
"icon": "fas fa-link"
},
"boltz_model_link": {
"type": "string",
"description": "Link to download model file",
"icon": "fas fa-link"
},
"boltz_ccd_path": {
"type": "string",
"description": "Path to CCD path",
"icon": "fas folder-open"
},
"boltz_model_path": {
"type": "string",
"description": "Path to Model path",
"icon": "fas folder-open"
}
}
},
"alphafold2_dbs_and_parameters_link_options": {
"title": "Alphafold2 DBs and parameters links options",
"type": "object",
Expand Down
49 changes: 49 additions & 0 deletions subworkflows/local/prepare_boltz_dbs.nf
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
//
// Download the files required for Boltz
//

include {
ARIA2 as ARIA2_BOLTZ_CCD
ARIA2 as ARIA2_BOLTZ_MODEL } from '../../modules/nf-core/aria2/main'

workflow PREPARE_BOLTZ_DBS {
// TODO: Implement
take:
boltz_ccd
boltz_model
boltz_ccd_link
boltz_model_link

main:
ch_versions = Channel.empty()

if (boltz_ccd) {
ch_boltz_ccd = Channel.value(file(boltz_ccd))
ch_boltz_model = Channel.value(file(boltz_model))
} else {
ARIA2_BOLTZ_CCD(
[
[:],
boltz_ccd_link
]
)
ch_boltz_ccd = ARIA2_BOLTZ_CCD.out.downloaded_file.map{ it[1] }
ch_versions = ch_versions.mix(ARIA2_BOLTZ_CCD.out.versions)

ARIA2_BOLTZ_MODEL(
[
[:],
boltz_model_link
]
)
ch_boltz_model = ARIA2_BOLTZ_MODEL.out.downloaded_file.map{ it[1] }
ch_versions = ch_versions.mix(ARIA2_BOLTZ_MODEL.out.versions)
}

emit:
boltz_ccd = ch_boltz_ccd
boltz_model = ch_boltz_model
versions = ch_versions
}


75 changes: 75 additions & 0 deletions workflows/boltz.nf
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
/*
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
IMPORT LOCAL MODULES/SUBWORKFLOWS
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
*/

//
// MODULE: Loaded from modules/local/
//

/*
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
IMPORT NF-CORE MODULES/SUBWORKFLOWS
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
*/

//
// MODULE: Installed directly from nf-core/modules
//
include { MULTIQC } from '../modules/nf-core/multiqc/main'
include { CREATE_SAMPLESHEET_YAML } from '../modules/local/create_samplesheet'

//
// SUBWORKFLOW: Consisting entirely of nf-core/modules
//
include { paramsSummaryMap } from 'plugin/nf-schema'
include { paramsSummaryMultiqc } from '../subworkflows/nf-core/utils_nfcore_pipeline'
include { softwareVersionsToYAML } from '../subworkflows/nf-core/utils_nfcore_pipeline'
include { methodsDescriptionText } from '../subworkflows/local/utils_nfcore_proteinfold_pipeline'

//
// MODULE: Boltz
//
include { RUN_BOLTZ } from '../modules/local/run_boltz'

/*
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
RUN MAIN WORKFLOW
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
*/

workflow BOLTZ {

take:
ch_samplesheet // channel: samplesheet read from --input
ch_versions // channel: [ path(versions.yml) ]
ch_boltz_ccd // channel: [ path(boltz_ccd) ]
ch_boltz_model // channel: [ path(model) ]

main:
ch_multiqc_files = Channel.empty()
// CREATE_SAMPLESHEET_YAML
CREATE_SAMPLESHEET_YAML(
ch_samplesheet
)

// RUN_BOLTZ
RUN_BOLTZ(
CREATE_SAMPLESHEET_YAML.out.samplesheet,
ch_boltz_model,
ch_boltz_ccd
)

emit:
versions = ch_versions
msa = RUN_BOLTZ.out.msa
structures = RUN_BOLTZ.out.structures
confidence = RUN_BOLTZ.out.confidence
plddt = RUN_BOLTZ.out.plddt
}
/*
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
THE END
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
*/
Loading