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

Feature/allow nextflow run usage #373

Merged
merged 6 commits into from
Oct 28, 2024
Merged
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
10 changes: 4 additions & 6 deletions .github/pull_request_template.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,18 +10,16 @@ Thank you for submitting this PR.

Before merge:

* The PR must be reviewed by one of the team members.
* A PR must be reviewed by one of the team members.

* Please check if anything in the Readme must be adjusted, or added (development-setup, production-setup, user-guide).
* Please check if anything in the documentation must be adjusted, or added (development-setup, production-setup, user-guide).

* PRs with new modules or workflow interfaces must include tests according to the developer [guidelines](https://openstack.cebitec.uni-bielefeld.de:8080/swift/v1/meta-omics-toolkit/master.html#developer_guidelines).
* PRs with new modules or workflow interfaces must include tests according to the developer [guidelines](https://metagenomics.github.io/metagenomics-tk/latest/developer_guidelines/).

* The new code is readable, well commented and should adhere to our developer [guidelines](https://openstack.cebitec.uni-bielefeld.de:8080/swift/v1/meta-omics-toolkit/master.html#developer_guidelines).
* The new code is readable, well commented and should adhere to our developer [guidelines](https://metagenomics.github.io/metagenomics-tk/latest/developer_guidelines/).

* Before merging it must be checked if a squash of commits is required.






9 changes: 5 additions & 4 deletions .github/workflows/workflow_modules.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ concurrency:
env:
WORK_DIR: "/vol/spool/${{ github.ref_name }}"
PROFILE: "slurm"
PR_NUMBER: ${{ github.event.number }}
PR_NUMBER: ${{ github.event.pull_request.number }}
EMGB_KEGG_DB: "/vol/spool/emgb/annotatedgenes2json_db_kegg-mirror-2022-12"
EMGB_DB_TITLES: "/vol/spool/emgb/uniref90.titles.tsv.gz"
jobs:
Expand Down Expand Up @@ -244,7 +244,8 @@ jobs:
runs-on: [ self-hosted, slurm]
needs: [codePolicy]
steps:
- name: Test Dereplication
- uses: actions/checkout@v4
- name: Test Quickstart
run: |
bash ./scripts/test_quickstart.sh || exit 1

Expand Down Expand Up @@ -572,15 +573,15 @@ jobs:
VERSION=$(sort VERSIONS.txt | tail -n 1)
OUTPUT=outputEasy
bash ./scripts/test_settings.sh \
" --preset --scratch /vol/scratch --input.paired.path test_data/fullPipeline/reads_split.tsv --highmemLarge=28,2000 --s3SignIn false --databases=/vol/scratch/databases/ --output=${OUTPUT} " \
" --preset --template default/fullPipeline_illumina_nanpore.yml --scratch /vol/scratch --input.paired.path test_data/fullPipeline/reads_split.tsv --highmemLarge=28,2000 --s3SignIn false --databases=/vol/scratch/databases/ --output=${OUTPUT} " \
" " "${WORK_DIR}" ${PROFILE} ${VERSION} "preset" || exit 1
bash ./scripts/check_parameter.sh ${OUTPUT} || exit 1
- name: Test whether settings in default mode can be updated
run: |
VERSION=$(sort VERSIONS.txt | tail -n 1)
OUTPUT=outputDefault
bash ./scripts/test_settings.sh \
" --scratch /vol/scratch --resources.highmemLarge.memory=2000 --s3SignIn false --databases=/vol/scratch/databases/ --output=${OUTPUT} " \
" --scratch /vol/scratch --template default/fullPipeline_illumina_nanpore.yml --resources.highmemLarge.memory=2000 --s3SignIn false --databases=/vol/scratch/databases/ --output=${OUTPUT} " \
"" "${WORK_DIR}" ${PROFILE} ${VERSION} "" || exit 1
bash ./scripts/check_parameter.sh ${OUTPUT} || exit 1

Expand Down
5 changes: 2 additions & 3 deletions docs/quickstart.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,8 @@ You will need at least 250 GB of disk space. The disk were your docker images an
## Requirements

1. docker: Install Docker by following the official Docker installation [instructions](https://docs.docker.com/engine/install/ubuntu/).
2. make: You can install make on Ubuntu via `sudo apt install make`
3. java: In order to run Nextflow you need to install Java on your machine which can be achieved via `sudo apt install default-jre`
4. Resources:
2. make: You can install make on Ubuntu via `sudo apt install make`.
3. java: In order to run Nextflow you need to install Java on your machine which can be achieved via `sudo apt install default-jre`.

## Preparation

Expand Down
4 changes: 2 additions & 2 deletions modules/assembly/shortReadAssembler.nf
Original file line number Diff line number Diff line change
Expand Up @@ -373,11 +373,11 @@ workflow _wCalculateMegahitResources {
modelType = Channel.empty()
if(params.steps.containsKey("assembly") && params.steps.assembly.containsKey("megahit") \
&& params?.steps?.assembly?.megahit?.additionalParams.contains("meta-sensitive")){
model = Channel.value(file("${baseDir}/models/assembler/megahit/sensitive.pkl"))
model = Channel.value(file("${projectDir}/models/assembler/megahit/sensitive.pkl"))
modelType = Channel.value("sensitive")
} else {
modelType = Channel.value("default")
model = Channel.value(file("${baseDir}/models/assembler/megahit/default.pkl"))
model = Channel.value(file("${projectDir}/models/assembler/megahit/default.pkl"))
}

resourceType.predict | join(nonpareil | splitCsv(header: true, sep: '\t') \
Expand Down
44 changes: 39 additions & 5 deletions nextflow.config
Original file line number Diff line number Diff line change
Expand Up @@ -46,13 +46,45 @@ if("dry-run" in params.keySet()){
System.out.println("Dry-run is enabled!")
}

def configUrlString = "https://raw.githubusercontent.com/metagenomics/metagenomics-tk/refs/tags/" + manifest.version + "/default/fullPipeline_illumina_nanpore.yml"

template = (params.containsKey("template") && params.containsKey("preset")) ? params.template : "default/fullPipeline_illumina_nanpore.yml"
/*
*
* Check if --preset is set and/or a template for a Toolkit configuration file is provided.
* Depending on the setting the corresponding configuration file is loaded.
*
*/
def loadYAML(configUrlString){
if((params.containsKey("template") && params.containsKey("preset"))){
return new Yaml().load(new File(params.template))
}
if(params.containsKey("preset")){
try {
// Step 1: Fetch the remote YAML content
def url = new URL(configUrlString)
def connection = url.openConnection()
connection.setRequestMethod('GET')

if (connection.responseCode == HttpURLConnection.HTTP_OK) {
def reader = connection.inputStream.withReader { it.text }

// Step 2: Parse the YAML content
return new Yaml().load(reader)

} else {
println "GET request not worked, response code: ${connection.responseCode}"
System.exit(1)
}
} catch (Exception e) {
e.printStackTrace()
}
}

defaultYmlFile = new File("${baseDir}/" + template)
preLoadYML = new Yaml().load(defaultYmlFile.text)
return null
}


preLoadYML = loadYAML(configUrlString)


/*
Expand All @@ -64,15 +96,17 @@ def getPresetSteps(){
disableModules = ["metabolomics", "annotation", "fragmentRecruitment"]
steps = preLoadYML["steps"]


stepsKeys = steps.keySet()

def stepsMap = [:]

System.out.println(PRETTY_SEPARATOR)
System.out.println("The following modules will be executed:\n")

for(step in stepsKeys){

if(!params.keySet().contains("no-" + step) && ! disableModules.contains(step)){
System.out.println(step)
stepsMap[step] = steps[step]
}
}
Expand Down Expand Up @@ -543,7 +577,7 @@ profiles {
docker {
fixOwnership = true
enabled = true
}
}

process {
cache = 'lenient'
Expand Down
Loading