Skip to content
Snippets Groups Projects
hicstuff.nf 1.65 KiB
def summary_params = NfcoreSchema.paramsSummaryMap(workflow, params)
// Validate input parameters
WorkflowHic.initialise(params, log)
// Check mandatory parameters
if (params.input) { ch_input = file(params.input) } else { exit 1, 'Input samplesheet not specified!' }
// Digestion parameters
if (params.digestion){
    restriction_site = params.digestion ? params.digest[ params.digestion ].restriction_site ?: false : false
    ch_restriction_site = Channel.value(restriction_site) //str seq avec ^ pour cut
    ligation_site = params.digestion ? params.digest[ params.digestion ].ligation_site ?: false : false
    ch_ligation_site = Channel.value(ligation_site) //str seq
}else if (params.dnase){
    ch_restriction_site = Channel.empty()
    ch_ligation_site = Channel.empty()
}else{
    exit 1, "Ligation motif not found. Please either use the `--digestion` parameters or specify the `--restriction_site` and `--ligation_site`. For DNase Hi-C, please use '--dnase' option"
}

Channel.fromPath( params.fasta )
    .ifEmpty { exit 1, "Genome index: Fasta file not found: ${params.fasta}" }
    .map{it->[[:],it]}
    .set { ch_fasta }


include { INPUT_CHECK } from '../subworkflows/local/input_check'
include { PREPARE_GENOME } from '../subworkflows/local/prepare_genome'
include { HICSTUFF_SUB } from '../subworkflows/local/hicstuff_sub'

workflow HICSTUFF {
    INPUT_CHECK (
        ch_input
    )
    PREPARE_GENOME(
        ch_fasta,
        ch_restriction_site
    )
    HICSTUFF_SUB(
        INPUT_CHECK.out.reads,
        PREPARE_GENOME.out.index,
        ch_ligation_site,
        params.digestion, //str enzyme
        ch_fasta,
        PREPARE_GENOME.out.chromosome_size
    )
}