Skip to content

Commit

Permalink
Merge pull request #408 from JoseEspinosa/fixes
Browse files Browse the repository at this point in the history
Several fixes
  • Loading branch information
JoseEspinosa committed Jul 31, 2024
2 parents b161a7d + 49c405c commit d489e97
Show file tree
Hide file tree
Showing 3 changed files with 46 additions and 40 deletions.
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

0 comments on commit d489e97

Please sign in to comment.