Commit 2f944afd authored by Chris Cheshire's avatar Chris Cheshire
Browse files

Merge branch 'peakcallers' into dev

parents 0e2da5b3 2452b477
Loading
Loading
Loading
Loading
+16 −1
Original line number Diff line number Diff line
@@ -145,7 +145,22 @@ jobs:
      fail-fast: false
      matrix:
        nxf_version: ['21.10.3', '']
        tags: ["samplesheet", "verify_output_input", "verify_output_align_short", "verify_output_align_long", "verify_output_peak_calling", "verify_output_reporting", "verify_output_save", "verify_output_skip"]
        tags:
          - samplesheet
          - verify_output_input
          - verify_output_peak_calling
          - verify_output_reporting
          - verify_output_save
          - verify_output_skip
          - verify_output_align_only_q_filter
          - verify_output_align_duplicates_mark
          - verify_output_align_duplicates_remove
          - verify_output_align_duplicates_remove_target
          - verify_output_align_intermed
          - verify_output_align_only_align
          - verify_output_align_save_spikein_align
          - verify_output_align_save_unaligned
          - test_peak_callers
    steps:
      - uses: actions/checkout@v2

+7 −1
Original line number Diff line number Diff line
@@ -161,7 +161,13 @@ params {

        "seacr" {
            args          = "non stringent"
            suffix        = ".peaks.bed"
            suffix        = ".seacr.peaks.bed"
            publish_dir   = "03_peak_calling/04_called_peaks"
        }

        "macs2" {
            args          = ""
            suffix        = ".macs2.peaks.bed"
            publish_dir   = "03_peak_calling/04_called_peaks"
        }

+3 −0
Original line number Diff line number Diff line
@@ -42,6 +42,9 @@
            "gunzip": {
                "git_sha": "e560fbbc3ed68e62bc810a50f552394056f81762"
            },
            "macs2/callpeak": {
                "git_sha": "20d8250d9f39ddb05dfb437603aaf99b5c0b2b41"
            },
            "picard/markduplicates": {
                "git_sha": "3aacd46da2b221ed47aaa05c413a828538d2c2ae"
            },
+1 −1
Original line number Diff line number Diff line
@@ -35,7 +35,7 @@ process GENERATE_REPORTS {
        --meta_ctrl $meta_data_ctrl \\
        --raw_frag "*.frag_len.txt" \\
        --bin_frag "*bin500.awk.bed" \\
        --seacr_bed "*bed.*.bed" \\
        --seacr_bed "*bed*.bed" \\
        --output . \\
        --log log.txt

+78 −0
Original line number Diff line number Diff line
//
//  Utility functions used in nf-core DSL2 module files
//

//
// Extract name of software tool from process name using $task.process
//
def getSoftwareName(task_process) {
    return task_process.tokenize(':')[-1].tokenize('_')[0].toLowerCase()
}

//
// Extract name of module from process name using $task.process
//
def getProcessName(task_process) {
    return task_process.tokenize(':')[-1]
}

//
// Function to initialise default values and to generate a Groovy Map of available options for nf-core modules
//
def initOptions(Map args) {
    def Map options = [:]
    options.args            = args.args ?: ''
    options.args2           = args.args2 ?: ''
    options.args3           = args.args3 ?: ''
    options.publish_by_meta = args.publish_by_meta ?: []
    options.publish_dir     = args.publish_dir ?: ''
    options.publish_files   = args.publish_files
    options.suffix          = args.suffix ?: ''
    return options
}

//
// Tidy up and join elements of a list to return a path string
//
def getPathFromList(path_list) {
    def paths = path_list.findAll { item -> !item?.trim().isEmpty() }      // Remove empty entries
    paths     = paths.collect { it.trim().replaceAll("^[/]+|[/]+\$", "") } // Trim whitespace and trailing slashes
    return paths.join('/')
}

//
// Function to save/publish module results
//
def saveFiles(Map args) {
    def ioptions  = initOptions(args.options)
    def path_list = [ ioptions.publish_dir ?: args.publish_dir ]

    // Do not publish versions.yml unless running from pytest workflow
    if (args.filename.equals('versions.yml') && !System.getenv("NF_CORE_MODULES_TEST")) {
        return null
    }
    if (ioptions.publish_by_meta) {
        def key_list = ioptions.publish_by_meta instanceof List ? ioptions.publish_by_meta : args.publish_by_meta
        for (key in key_list) {
            if (args.meta && key instanceof String) {
                def path = key
                if (args.meta.containsKey(key)) {
                    path = args.meta[key] instanceof Boolean ? "${key}_${args.meta[key]}".toString() : args.meta[key]
                }
                path = path instanceof String ? path : ''
                path_list.add(path)
            }
        }
    }
    if (ioptions.publish_files instanceof Map) {
        for (ext in ioptions.publish_files) {
            if (args.filename.endsWith(ext.key)) {
                def ext_list = path_list.collect()
                ext_list.add(ext.value)
                return "${getPathFromList(ext_list)}/$args.filename"
            }
        }
    } else if (ioptions.publish_files == null) {
        return "${getPathFromList(path_list)}/$args.filename"
    }
}
 No newline at end of file
Loading