Skip to content

Commit

Permalink
trying to add bed from reference file
Browse files Browse the repository at this point in the history
  • Loading branch information
jbv2 committed Jan 26, 2024
1 parent 4d1f765 commit b36bc45
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 39 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -20,21 +20,33 @@ workflow RUN_SEXDETERMINE {
// Generate sex_determine input
// Break here the input not in the workflow

ch_samtoolsdepth_input = sexdeterrmine_bam
.combine(sexdeterrmine_bed)
.multiMap{
meta, bam, meta2, bed ->
bam : [ meta, bam ]
intervals : [ meta2, bed ]
}
ch_bed = sexdeterrmine_bed
.map {
// Prepend a new meta that contains the meta.id value as the new_meta.reference attribute
WorkflowEager.addNewMetaFromAttributes( it, "id" , "reference" , false )
}

ch_input_sexdetermine = sexdeterrmine_bam
.map {
// Prepend a new meta that contains the meta.reference value as the new_meta.reference attribute
WorkflowEager.addNewMetaFromAttributes( it, "reference" , "reference" , false )
}
.combine( ch_bed, by: 0 ) // [ [combine_meta], [meta], bam, bai, [ref_meta], bed ]

ch_samtoolsdepth_input = ch_input_sexdetermine
.multiMap {
ignore_me, meta, bam, bai, ref_meta, bed ->
bam: [ meta, bam ]
bed: [ ref_meta, bed ]
}

SAMTOOLS_DEPTH_SEXDETERMINE(ch_samtoolsdepth_input)
ch_sex_determine_input = SAMTOOLS_DEPTH_SEXDETERMINE.out.tsv
ch_versions = ch_versions.mix( SAMTOOLS_DEPTH_SEXDETERMINE.out.versions )

// Run sex determination with samtools depth input
// Does it need a sample list file to run?
SEXDETERRMINE(ch_sex_determine_input, sexdeterrmine_list)
// Does it need a sample list file to run? yep
SEXDETERRMINE(ch_sex_determine_input)
ch_coverages = SEXDETERRMINE.out.tsv
ch_multiqc_files = ch_multiqc_files.mix( SEXDETERRMINE.out.json )
ch_versions = ch_versions.mix( SEXDETERRMINE.out.versions )
Expand Down
41 changes: 11 additions & 30 deletions workflows/eager.nf
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ include { MANIPULATE_DAMAGE } from '../subworkflows/local/manipulate
include { METAGENOMICS_COMPLEXITYFILTER } from '../subworkflows/local/metagenomics_complexityfilter'
include { ESTIMATE_CONTAMINATION } from '../subworkflows/local/estimate_contamination'
include { CALCULATE_DAMAGE } from '../subworkflows/local/calculate_damage'
include { RUN_SEXDETERMINE } from '../subworkflows/local/sex_determination'
include { RUN_SEXDETERMINE } from '../subworkflows/local/run_sex_determination'

/*
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Expand Down Expand Up @@ -134,25 +134,12 @@ workflow EAGER {
}


// Sex determine
// SUBWORKFLOW: Run Sex determination
if ( params.sexdeterrmine_bedfile ) {
ch_sexdeterrmine_bed = Channel.fromPath( params.sexdeterrmine_bedfile, checkIfExists: true )
.collect()
.map {
file ->
meta = file.simpleName
[meta,file]
}

} else {
ch_sexdeterrmine_bed = []
}

if ( params.sexdeterrmine_samplelist) {
ch_sexdeterrmine_samplelist = Channel.fromPath( params.sexdeterrmine_samplelist, checkIfExists: true )

} else {
ch_sexdeterrmine_samplelist = []
ch_sexdeterrmine_bed = REFERENCE_INDEXING.out.sexdeterrmine_bed
.map{
WorkflowEager.addNewMetaFromAttributes( it, "id" , "reference" , false )
}
}

//
Expand Down Expand Up @@ -534,21 +521,15 @@ workflow EAGER {
}

//
// SUBWORKFLOW: Sex Determine
// SUBWORKFLOW: Run Sex Determination
//

if ( params.run_sexdeterrmine ) {
ch_sexdeterrmine_input = ch_dedupped_bams

ch_sexdeterrmine_input = ch_dedupped_bams
.map {
meta, bam, bai ->
[ meta, bam ]
}

RUN_SEXDETERMINE(ch_sexdeterrmine_input, ch_sexdeterrmine_bed, ch_sexdeterrmine_samplelist)
ch_versions = ch_versions.mix( RUN_SEXDETERMINE.out.versions )
ch_multiqc_files = ch_multiqc_files.mix( RUN_SEXDETERMINE.out.mqc.collect{it[1]}.ifEmpty([]) )

RUN_SEXDETERMINE(ch_sexdeterrmine_input, REFERENCE_INDEXING.out.sexdeterrmine_bed )
ch_versions = ch_versions.mix( ESTIMATE_CONTAMINATION.out.versions )
ch_multiqc_files = ch_multiqc_files.mix( ESTIMATE_CONTAMINATION.out.mqc.collect{it[1]}.ifEmpty([]) )
}

//
Expand Down

0 comments on commit b36bc45

Please sign in to comment.