modules icon indicating copy to clipboard operation
modules copied to clipboard

new subworkflow: FASTA_BGZIP_INDEX_DICT_SAMTOOLS

Open charles-plessy opened this issue 7 months ago • 1 comments

Is there an existing subworkflow for this?

  • [x] I have searched for the existing subworkflow

Is there an open PR for this?

  • [x] I have searched for existing PRs

Is there an open issue for this?

  • [x] I have searched for existing issues

Are you going to work on this?

  • [x] If I'm planning to work on this subworkflow, I added myself to the Assignees to facilitate tracking who is working on the subworkflow

charles-plessy avatar May 22 '25 06:05 charles-plessy

I have created a local subworkflow in nf-core/pairgenomealign, that takes a genome as input, and returns the genome compressed with bgzip, with its fai and gzi indices, plus as sequence dictionary, to facilitate samtools operations later in the pipeline.

If there is interest I will be pleased to make a PR.

https://github.com/nf-core/pairgenomealign/tree/milestone_2.2.0/subworkflows/local/fasta_bgzip_index_dict_samtools

include { SAMTOOLS_BGZIP     } from '../../../modules/nf-core/samtools/bgzip/main'
include { SAMTOOLS_DICT      } from '../../../modules/nf-core/samtools/dict/main'
include { SAMTOOLS_FAIDX     } from '../../../modules/nf-core/samtools/faidx/main'

workflow FASTA_BGZIP_INDEX_DICT_SAMTOOLS {

    take:
    ch_fasta // channel: [ val(meta), fasta ]

    main:

    ch_versions = Channel.empty()

    // Guarantee BGZIP compression
    SAMTOOLS_BGZIP ( ch_fasta )
    ch_versions = ch_versions.mix(SAMTOOLS_BGZIP.out.versions)

    SAMTOOLS_FAIDX ( SAMTOOLS_BGZIP.out.fasta, [[],[]], [[],[]] )
    ch_versions = ch_versions.mix(SAMTOOLS_FAIDX.out.versions)

    SAMTOOLS_DICT  ( SAMTOOLS_BGZIP.out.fasta )
    ch_versions = ch_versions.mix(SAMTOOLS_DICT .out.versions)

    emit:
    fasta_gz = SAMTOOLS_BGZIP.out.fasta        // channel: [ val(meta),  fasta.gz ]
    fai      = SAMTOOLS_FAIDX.out.fai          // channel: [ val(meta),  fai ]
    gzi      = SAMTOOLS_FAIDX.out.gzi          // channel: [ val(meta),  gzi ]
    dict     = SAMTOOLS_DICT .out.dict         // channel: [ val(meta),  dict ]

    versions = ch_versions                     // channel: [ versions.yml ]
}

charles-plessy avatar May 22 '25 06:05 charles-plessy