Skip to content

Commit

Permalink
add phase
Browse files Browse the repository at this point in the history
  • Loading branch information
RuthEberhardt committed Apr 29, 2024
1 parent 32c5a8e commit b413a8e
Show file tree
Hide file tree
Showing 5 changed files with 170 additions and 2 deletions.
22 changes: 22 additions & 0 deletions bsub_nextflow.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
#!/bin/bash

# to run: bsub < $PWD/bsub_nextflow.sh

#BSUB -o /path/to/a/log/dir/%J.o
#BSUB -e /path/to/a/log/dir/%J.e
#BSUB -M 8000
#BSUB -q oversubscribed
#BSUB -n 2

export HTTP_PROXY='http://wwwcache.sanger.ac.uk:3128'
export HTTPS_PROXY='http://wwwcache.sanger.ac.uk:3128'
export NXF_ANSI_LOG=false
export NXF_OPTS="-Xms8G -Xmx8G -Dnxf.pool.maxThreads=2000"
export NXF_VER=22.04.0-5697


nextflow run \
${pwd}/main.nf \
-profile sanger \
-with-trace \
-resume
50 changes: 50 additions & 0 deletions conf/base.config
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
process {

// TODO nf-core: Check the defaults for all processes
cpus = { check_max( 1 * task.attempt, 'cpus' ) }
memory = { check_max( 2.GB * task.attempt, 'memory' ) }
time = { check_max( 1.h * task.attempt, 'time' ) }

errorStrategy = { task.exitStatus in [143,137,104,134,139] ? 'retry' : 'finish' }
maxRetries = 1
maxErrors = '-1'

// Process-specific resource requirements
// NOTE - Please try and re-use the labels below as much as possible.
// These labels are used and recognised by default in DSL2 files hosted on nf-core/modules.
// If possible, it would be nice to keep the same label naming convention when
// adding in your local modules too.
// TODO nf-core: Customise requirements for specific processes.
// See https://www.nextflow.io/docs/latest/config.html#config-process-selectors

withLabel:process_low {
cpus = { check_max( 2 * task.attempt, 'cpus' ) }
memory = { check_max( 1.GB * task.attempt, 'memory' ) }
time = { check_max( 1.h * task.attempt, 'time' ) }
}
withLabel:process_medium {
cpus = { check_max( 4 * task.attempt, 'cpus' ) }
memory = { check_max( 4.GB * task.attempt, 'memory' ) }
time = { check_max( 2.h * task.attempt, 'time' ) }
}
withLabel:process_high {
cpus = { check_max( 8 * task.attempt, 'cpus' ) }
memory = { check_max( 10.GB * task.attempt, 'memory' ) }
time = { check_max( 12.h * task.attempt, 'time' ) }
}
withLabel:process_long {
time = { check_max( 20.h * task.attempt, 'time' ) }
}
withLabel:process_high_memory {
memory = { check_max( 200.GB * task.attempt, 'memory' ) }
}

withLabel:error_ignore {
errorStrategy = 'ignore'
}
withLabel:error_retry {
errorStrategy = 'retry'
maxRetries = 2
}

}
2 changes: 1 addition & 1 deletion modules/local/split_vcfs/main.nf
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ process SPLIT_VCFS {
tuple path(vcf), path(sample_list)

output:
path('vcf_sample_subset.vcf.gz')
tuple path('vcf_sample_subset.vcf.gz'), path('vcf_sample_subset.vcf.gz.csi'), emit: split_vcfs

script:
"""
Expand Down
85 changes: 84 additions & 1 deletion nextflow.config
Original file line number Diff line number Diff line change
@@ -1,8 +1,91 @@
includeConfig 'conf/base.config'

params {

// number of samples to be processed in each batch. Recommended 100-200
batch_size = 10
vcf_in = "/lustre/scratch126/humgen/teams/hgi/users/re3/blended_genomes_exomes/glimpse_pipe_test/test_vcfs/test_for_glimpse.vcf.gz"
// refdir = "/lustre/scratch125/humgen/resources/GLIMPSE/1000g_chunked_for_GLIMPSE/defaults_snp_biallelic/split/"
refdir = "/lustre/scratch126/humgen/teams/hgi/users/re3/blended_genomes_exomes/glimpse_pipe_test/ref_mini/"
workdir = "/lustre/scratch126/humgen/teams/hgi/users/re3/blended_genomes_exomes/glimpse_pipe_test/work"

custom_config_version = 'master'
custom_config_base = "https://raw.githubusercontent.com/nf-core/configs/${params.custom_config_version}"

}
}

// Load nf-core custom profiles from different Institutions
try {
includeConfig "https://raw.githubusercontent.com/nf-core/configs/master/nfcore_custom.config"
} catch (Exception e) {
System.err.println("WARNING: Could not load nf-core/config profiles: https://raw.githubusercontent.com/nf-core/configs/master/nfcore_custom.config")
}


def check_max(obj, type) {
if (type == 'memory') {
try {
if (obj.compareTo(params.max_memory as nextflow.util.MemoryUnit) == 1)
return params.max_memory as nextflow.util.MemoryUnit
else
return obj
} catch (all) {
println " ### ERROR ### Max memory '${params.max_memory}' is not valid! Using default value: $obj"
return obj
}
} else if (type == 'time') {
try {
if (obj.compareTo(params.max_time as nextflow.util.Duration) == 1)
return params.max_time as nextflow.util.Duration
else
return obj
} catch (all) {
println " ### ERROR ### Max time '${params.max_time}' is not valid! Using default value: $obj"
return obj
}
} else if (type == 'cpus') {
try {
return Math.min( obj, params.max_cpus as int )
} catch (all) {
println " ### ERROR ### Max cpus '${params.max_cpus}' is not valid! Using default value: $obj"
return obj
}
}
}


//process{
// executor = 'lsf'
// queue = { task.time < 20.m ? 'small' : task.time < 12.h ? 'normal' : task.time < 48.h ? 'long' : task.time < 168.h ? 'week' : 'basement' }
// queue = 'basement'

// withLabel:process_small{
// cpus = 6
// queue = 'small'
// time = {0.1h * task.attempt}
// errorStrategy = 'retry'
// memory = 50.MB
// }

// withLabel:process_medium{
// cpus = 6
// queue = 'normal'
// time = {2h * task.attempt}
// errorStrategy = 'retry'
// memory = 200.MB
// }
//}

//executor{
// name = 'lsf'
// perJobMemLimit = true
// poolSize = 4
// submitRateLimit = '5 sec'
// killBatchSize = 50
//}

//singularity {
// enabled = true
// cacheDir = '/nfs/hgi/singularityContainers/'
// runOptions = '--bind /lustre'
//}
13 changes: 13 additions & 0 deletions workflows/run_glimpse.nf
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
include { SPLIT_SAMPLES } from '../modules/local/split_samples/main'
include { SPLIT_VCFS } from '../modules/local/split_vcfs/main'
include { GLIMPSE2_PHASE } from '../modules/nf-core/glimpse2/phase/main'

workflow RUN_GLIMPSE {

Expand All @@ -10,4 +11,16 @@ workflow RUN_GLIMPSE {

SPLIT_VCFS(vcf_samples)

ref = channel.fromPath("${params.refdir}*.bin")

phase_input = SPLIT_VCFS.out.split_vcfs.combine(ref).map{
vcf, index , ref_bin ->
[[], vcf, index, [], [], [], ref_bin, [], []]
}
phase_input2 = channel.empty()

GLIMPSE2_PHASE(phase_input, phase_input2)

GLIMPSE2_PHASE.out.versions.view()

}

0 comments on commit b413a8e

Please sign in to comment.