Skip to content

Commit

Permalink
remove lib
Browse files Browse the repository at this point in the history
  • Loading branch information
ramprasadn committed Jan 15, 2025
1 parent 7a81697 commit 4e71e74
Show file tree
Hide file tree
Showing 4 changed files with 60 additions and 53 deletions.
43 changes: 0 additions & 43 deletions lib/CustomFunctions.groovy

This file was deleted.

10 changes: 8 additions & 2 deletions main.nf
Original file line number Diff line number Diff line change
Expand Up @@ -34,14 +34,18 @@ workflow NFCORE_RAREDISEASE {

take:
samplesheet // channel: samplesheet read in from --input
samples
case_info

main:

//
// WORKFLOW: Run pipeline
//
RAREDISEASE (
samplesheet
samplesheet,
samples,
case_info
)
emit:
multiqc_report = RAREDISEASE.out.multiqc_report // channel: /path/to/multiqc_report.html
Expand Down Expand Up @@ -71,7 +75,9 @@ workflow {
// WORKFLOW: Run main workflow
//
NFCORE_RAREDISEASE (
PIPELINE_INITIALISATION.out.samplesheet
PIPELINE_INITIALISATION.out.samplesheet,
PIPELINE_INITIALISATION.out.samples,
PIPELINE_INITIALISATION.out.case_info
)
//
// SUBWORKFLOW: Run completion tasks
Expand Down
49 changes: 49 additions & 0 deletions subworkflows/local/utils_nfcore_raredisease_pipeline/main.nf
Original file line number Diff line number Diff line change
Expand Up @@ -102,8 +102,19 @@ workflow PIPELINE_INITIALISATION {
}
.set { ch_samplesheet }

ch_samples = ch_samplesheet.map { meta, fastqs ->
new_id = meta.sample
new_meta = meta - meta.subMap('lane', 'read_group') + [id:new_id]
return new_meta
}.unique()

ch_case_info = ch_samples.toList().map { createCaseChannel(it) }


emit:
samplesheet = ch_samplesheet
samples = ch_samples
case_info = ch_case_info
versions = ch_versions
}

Expand Down Expand Up @@ -160,6 +171,44 @@ workflow PIPELINE_COMPLETION {
FUNCTIONS
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
*/

def boolean isNonZeroNonEmpty(value) {
return (value instanceof String && value != "" && value != "0") ||
(value instanceof Number && value != 0)
}

// Function to get a list of metadata (e.g. case id) for the case [ meta ]
def createCaseChannel(List rows) {
def case_info = [:]
def probands = [] as Set
def upd_children = [] as Set
def father = ""
def mother = ""

rows.each { item ->
if (item?.phenotype == 2) {
probands << item.sample
}
if (isNonZeroNonEmpty(item?.paternal) && isNonZeroNonEmpty(item?.maternal)) {
upd_children << item.sample
}
if (isNonZeroNonEmpty(item?.paternal)) {
father = item.paternal
}
if (isNonZeroNonEmpty(item?.maternal)) {
mother = item.maternal
}
}

case_info.father = father
case_info.mother = mother
case_info.probands = probands.toList()
case_info.upd_children = upd_children.toList()
case_info.id = rows[0].case_id

return case_info
}

//
// Check and validate pipeline parameters
//
Expand Down
11 changes: 3 additions & 8 deletions workflows/raredisease.nf
Original file line number Diff line number Diff line change
Expand Up @@ -175,19 +175,14 @@ workflow RAREDISEASE {

take:
ch_samplesheet // channel: samplesheet read in from --input
ch_samples
ch_case_info

main:

ch_versions = Channel.empty()
ch_multiqc_files = Channel.empty()

ch_samples = ch_samplesheet.map { meta, fastqs ->
new_id = meta.sample
new_meta = meta - meta.subMap('lane', 'read_group') + [id:new_id]
return new_meta
}.unique()

ch_case_info = ch_samples.toList().map { CustomFunctions.createCaseChannel(it) }

//
// Initialize file channels for PREPARE_REFERENCES subworkflow
//
Expand Down

0 comments on commit 4e71e74

Please sign in to comment.