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

Several fixes #408

Merged
merged 7 commits into from
Jul 31, 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
57 changes: 45 additions & 12 deletions main.nf
Original file line number Diff line number Diff line change
Expand Up @@ -11,18 +11,6 @@

nextflow.enable.dsl = 2

/*
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
IMPORT FUNCTIONS / MODULES / SUBWORKFLOWS / WORKFLOWS
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
*/
include { CHIPSEQ } from './workflows/chipseq'
include { PREPARE_GENOME } from './subworkflows/local/prepare_genome'
include { PIPELINE_INITIALISATION } from './subworkflows/local/utils_nfcore_chipseq_pipeline'
include { PIPELINE_COMPLETION } from './subworkflows/local/utils_nfcore_chipseq_pipeline'
include { getGenomeAttribute } from './subworkflows/local/utils_nfcore_chipseq_pipeline'
include { getMacsGsize } from './subworkflows/local/utils_nfcore_chipseq_pipeline'

/*
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
GENOME PARAMETER VALUES
Expand All @@ -40,6 +28,18 @@ params.gene_bed = getGenomeAttribute('gene_bed')
params.blacklist = getGenomeAttribute('blacklist')
params.macs_gsize = getMacsGsize(params)

/*
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
IMPORT FUNCTIONS / MODULES / SUBWORKFLOWS / WORKFLOWS
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
*/
include { CHIPSEQ } from './workflows/chipseq'
include { PREPARE_GENOME } from './subworkflows/local/prepare_genome'
include { PIPELINE_INITIALISATION } from './subworkflows/local/utils_nfcore_chipseq_pipeline'
include { PIPELINE_COMPLETION } from './subworkflows/local/utils_nfcore_chipseq_pipeline'
// include { getGenomeAttribute } from './subworkflows/local/utils_nfcore_chipseq_pipeline'
// include { getMacsGsize } from './subworkflows/local/utils_nfcore_chipseq_pipeline'

/*
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
NAMED WORKFLOWS FOR PIPELINE
Expand Down Expand Up @@ -137,6 +137,39 @@ workflow {
)
}

/*
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
FUNCTIONS
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
*/

//
// Get attribute from genome config file e.g. fasta
//
def getGenomeAttribute(attribute) {
if (params.genomes && params.genome && params.genomes.containsKey(params.genome)) {
if (params.genomes[ params.genome ].containsKey(attribute)) {
return params.genomes[ params.genome ][ attribute ]
}
}
return null
}

//
// Get macs genome size (macs_gsize)
//
def getMacsGsize(params) {
def val = null
if (params.genomes && params.genome && params.genomes.containsKey(params.genome)) {
if (params.genomes[ params.genome ].containsKey('macs_gsize')) {
if (params.genomes[ params.genome ][ 'macs_gsize' ].containsKey(params.read_length.toString())) {
val = params.genomes[ params.genome ][ 'macs_gsize' ][ params.read_length.toString() ]
}
}
}
return val
}

/*
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
THE END
Expand Down
2 changes: 1 addition & 1 deletion subworkflows/local/prepare_genome.nf
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ workflow PREPARE_GENOME {
ch_bwa_index = UNTAR_BWA_INDEX ( [ [:], bwa_index ] ).untar
ch_versions = ch_versions.mix(UNTAR_BWA_INDEX.out.versions)
} else {
ch_bwa_index = file(bwa_index)
ch_bwa_index = [ [:], file(bwa_index) ]
}
} else {
ch_bwa_index = BWA_INDEX ( ch_fasta.map { [ [:], it ] } ).index
Expand Down
27 changes: 0 additions & 27 deletions subworkflows/local/utils_nfcore_chipseq_pipeline/main.nf
Original file line number Diff line number Diff line change
Expand Up @@ -149,18 +149,6 @@ def validateInputParameters() {
}
}

//
// Get attribute from genome config file e.g. fasta
//
def getGenomeAttribute(attribute) {
if (params.genomes && params.genome && params.genomes.containsKey(params.genome)) {
if (params.genomes[ params.genome ].containsKey(attribute)) {
return params.genomes[ params.genome ][ attribute ]
}
}
return null
}

//
// Exit pipeline if incorrect --genome key provided
//
Expand All @@ -175,21 +163,6 @@ def genomeExistsError() {
}
}

//
// Get macs genome size (macs_gsize)
//
def getMacsGsize(params) {
def val = null
if (params.genomes && params.genome && params.genomes.containsKey(params.genome)) {
if (params.genomes[ params.genome ].containsKey('macs_gsize')) {
if (params.genomes[ params.genome ][ 'macs_gsize' ].containsKey(params.read_length.toString())) {
val = params.genomes[ params.genome ][ 'macs_gsize' ][ params.read_length.toString() ]
}
}
}
return val
}

//
// Generate methods description for MultiQC
//
Expand Down
Loading