@@ -515,6 +515,7 @@ process {
515515 ]
516516 }
517517
518+ // TODO: add readgroup split for using unmerged libs for genotyping
518519 withName: 'BWA_SAMSE|BWA_SAMPE' {
519520 tag = { "${meta.id_index}|${meta.sample_id}_${meta.library_id}_L${meta.lane}" }
520521 ext.args = {
@@ -537,6 +538,7 @@ process {
537538 ]
538539 }
539540
541+ // TODO: add readgroup split for using unmerged libs for genotyping
540542 withName: BWA_MEM {
541543 tag = { "${meta.reference}|${meta.sample_id}_${meta.library_id}_L${meta.lane}" }
542544 ext.args = {
@@ -552,6 +554,7 @@ process {
552554 ]
553555 }
554556
557+ // TODO: add readgroup split for using unmerged libs for genotyping
555558 withName: BOWTIE2_ALIGN {
556559 tag = { "${meta.reference}|${meta.sample_id}_${meta.library_id}_L${meta.lane}" }
557560 ext.args = {
@@ -1260,7 +1263,6 @@ process {
12601263 }
12611264
12621265 withName: ".*MERGE_LIBRARIES_DAMAGE_MANIPULATION:SAMTOOLS_MERGE_LIBRARIES" {
1263- // TODO: add parameter from run_trim_bam/run_pmd_filtering/run_mapdamage_rescaling --> replace genotpying source for final bams
12641266 tag = { "${meta.reference}|${meta.sample_id}|${meta.damage_manipulation}" }
12651267 ext.prefix = { "${meta.sample_id}_${meta.reference}_${meta.damage_manipulation}_unsorted" }
12661268 publishDir = [
@@ -1639,22 +1641,22 @@ process {
16391641 }
16401642
16411643 withName: GATK_REALIGNERTARGETCREATOR {
1642- tag = { "${meta.reference}|${meta.sample_id}" }
1644+ tag = { params.genotyping_use_unmerged_libraries ? "${meta.reference}|${meta.sample_id}|${meta.library_id}" : "${meta.reference}|${meta.sample_id}" }
16431645 ext.args = [
16441646 params.genotyping_gatk_ug_defaultbasequalities > 0 ? "--defaultBaseQualities ${params.genotyping_gatk_ug_defaultbasequalities}" : "", // Empty string since GATK complains if its default of -1 is provided.
16451647 ].join(' ').trim()
1646- ext.prefix = { "${meta.sample_id}_${meta.reference}_realigntarget" }
1648+ ext.prefix = { params.genotyping_use_unmerged_libraries ? "${sample_id}_${ meta.library_id}_${meta.reference}_realigntarget" : "${ sample_id}_${meta.reference}_realigntarget" }
16471649 publishDir = [
16481650 enabled: false
16491651 ]
16501652 }
16511653
16521654 withName: GATK_INDELREALIGNER {
1653- tag = { "${meta.reference}|${meta.sample_id}" }
1655+ tag = { params.genotyping_use_unmerged_libraries ? "${meta.reference}|${meta.sample_id}|${meta.library_id}" : "${meta.reference}|${meta.sample_id}" }
16541656 ext.args = [
16551657 params.genotyping_gatk_ug_defaultbasequalities > 0 ? "--defaultBaseQualities ${params.genotyping_gatk_ug_defaultbasequalities}" : "", // Empty string since GATK complains if its default of -1 is provided.
16561658 ].join(' ').trim()
1657- ext.prefix = { "${meta.sample_id}_${meta.reference}_realigned" }
1659+ ext.prefix = { params.genotyping_use_unmerged_libraries ? "${sample_id}_${ meta.library_id}_${meta.reference}_realigned" : "${ sample_id}_${meta.reference}_realigned" }
16581660 publishDir = [
16591661 [
16601662 // data
@@ -1667,16 +1669,17 @@ process {
16671669 }
16681670
16691671 withName: GATK_UNIFIEDGENOTYPER {
1670- tag = { "${meta.reference}|${meta.sample_id}" }
1672+ tag = { params.genotyping_use_unmerged_libraries ? "${meta.reference}|${meta.sample_id}|${meta.library_id}" : "${meta.reference}|${meta.sample_id}" }
16711673 ext.args = {[
1672- "--sample_ploidy ${meta2.ploidy}",
1674+ // ploidy set at 2 for non-specified ploidy in input fasta sheet for consistency with gatk default
1675+ meta2.ploidy ? "--sample_ploidy ${meta2.ploidy}" : "--sample_ploidy 2",
16731676 "-stand_call_conf ${params.genotyping_gatk_call_conf}",
16741677 "-dcov ${params.genotyping_gatk_ug_downsample}",
16751678 "--output_mode ${params.genotyping_gatk_ug_out_mode}",
16761679 "--genotype_likelihoods_model ${params.genotyping_gatk_ug_genotype_mode}",
16771680 params.genotyping_gatk_ug_defaultbasequalities > 0 ? "--defaultBaseQualities ${params.genotyping_gatk_ug_defaultbasequalities}" : "", // Empty string since GATK complains if its default of -1 is provided.
16781681 ].join(' ').trim() }
1679- ext.prefix = { "${meta.sample_id}_${meta.reference}" }
1682+ ext.prefix = { params.genotyping_use_unmerged_libraries ? "${sample_id}_${ meta.library_id}_${meta.reference}" : "${ sample_id}_${meta.reference}" }
16801683 publishDir = [
16811684 [
16821685 // data
@@ -1688,9 +1691,9 @@ process {
16881691 }
16891692
16901693 withName: BCFTOOLS_INDEX_UG {
1691- tag = { "${meta.reference}|${meta.sample_id}" }
1694+ tag = { params.genotyping_use_unmerged_libraries ? "${meta.reference}|${meta.sample_id}|${meta.library_id}" : "${meta.reference}|${meta.sample_id}" }
16921695 ext.args = "--tbi" //tbi indices for consistency with GATK HC
1693- ext.prefix = { "${meta.sample_id}_${meta.reference}" }
1696+ ext.prefix = { params.genotyping_use_unmerged_libraries ? "${sample_id}_${ meta.library_id}_${meta.reference}" : "${ sample_id}_${meta.reference}" }
16941697 publishDir = [
16951698 [
16961699 // data
@@ -1702,15 +1705,15 @@ process {
17021705 }
17031706
17041707 withName: GATK4_HAPLOTYPECALLER {
1705- tag = { "${meta.reference}|${meta.sample_id}" }
1708+ tag = { params.genotyping_use_unmerged_libraries ? "${meta.reference}|${meta.sample_id}|${meta.library_id}" : "${meta.reference}|${meta.sample_id}" }
17061709 ext.args = {[
17071710 // Option names have changed from underscore_separated to hyphen-separated in GATK4
1708- "--sample-ploidy ${meta2.ploidy}",
1711+ meta2.ploidy ? "--sample-ploidy ${meta2.ploidy}" : "--sample-ploidy 2 ",
17091712 "-stand-call-conf ${params.genotyping_gatk_call_conf}",
17101713 "--output-mode ${params.genotyping_gatk_hc_out_mode}",
17111714 "--emit-ref-confidence ${params.genotyping_gatk_hc_emitrefconf}",
17121715 ].join(' ').trim() }
1713- ext.prefix = { "${meta.sample_id}_${meta.reference}" }
1716+ ext.prefix = { params.genotyping_use_unmerged_libraries ? "${sample_id}_${ meta.library_id}_${meta.reference}" : "${ sample_id}_${meta.reference}" }
17141717 publishDir = [
17151718 [
17161719 // data
@@ -1722,13 +1725,13 @@ process {
17221725 }
17231726
17241727 withName: FREEBAYES {
1725- tag = { "${meta.reference}|${meta.sample_id}" }
1728+ tag = { params.genotyping_use_unmerged_libraries ? "${meta.reference}|${meta.sample_id}|${meta.library_id}" : "${meta.reference}|${meta.sample_id}" }
17261729 ext.args = {[
1727- "-p ${ref_meta.ploidy}",
1730+ ref_meta.ploidy ? "--ploidy ${ref_meta.ploidy}" : "--ploidy 2 ",
17281731 "-C ${params.genotyping_freebayes_min_alternate_count}",
17291732 params.genotyping_freebayes_skip_coverage != 0 ? "-g ${params.genotyping_freebayes_skip_coverage}" : "",
17301733 ].join(' ').trim() }
1731- ext.prefix = { "${meta.sample_id}_${meta.reference}" }
1734+ ext.prefix = { params.genotyping_use_unmerged_libraries ? "${sample_id}_${ meta.library_id}_${meta.reference}" : "${ sample_id}_${meta.reference}" }
17321735 publishDir = [
17331736 [
17341737 // data
@@ -1740,9 +1743,9 @@ process {
17401743 }
17411744
17421745 withName: BCFTOOLS_INDEX_FREEBAYES {
1743- tag = { "${meta.reference}|${meta.sample_id}" }
1746+ tag = { params.genotyping_use_unmerged_libraries ? "${meta.reference}|${meta.sample_id}|${meta.library_id}" : "${meta.reference}|${meta.sample_id}" }
17441747 ext.args = "--tbi" //tbi indices for consistency with GATK HC
1745- ext.prefix = { "${meta.sample_id}_${meta.reference}" }
1748+ ext.prefix = { params.genotyping_use_unmerged_libraries ? "${sample_id}_${ meta.library_id}_${meta.reference}" : "${ sample_id}_${meta.reference}" }
17461749 publishDir = [
17471750 [
17481751 // data
@@ -1754,8 +1757,8 @@ process {
17541757 }
17551758
17561759 withName: BCFTOOLS_STATS_GENOTYPING {
1757- tag = { "${meta.reference}|${meta.sample_id}" }
1758- ext.prefix = { "${meta.sample_id}_${meta.reference}" }
1760+ tag = { params.genotyping_use_unmerged_libraries ? "${meta.reference}|${meta.sample_id}|${meta.library_id}" : "${meta.reference}|${meta.sample_id}" }
1761+ ext.prefix = { params.genotyping_use_unmerged_libraries ? "${sample_id}_${ meta.library_id}_${meta.reference}" : "${ sample_id}_${meta.reference}" }
17591762 publishDir = [
17601763 [
17611764 // stats
0 commit comments