Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

samtools sort overwrites #328

Open
bounlu opened this issue Jun 21, 2023 · 0 comments
Open

samtools sort overwrites #328

bounlu opened this issue Jun 21, 2023 · 0 comments
Labels
bug Something isn't working

Comments

@bounlu
Copy link

bounlu commented Jun 21, 2023

I want to extract deduplicated and sorted bam file from the pipeline by using the Bismark aligner.

When I use --save_align_intermeds flag, SAMTOOLS_SORT module writes the sorted bam file to the output directory as per this config:

    withName: SAMTOOLS_SORT {
        ext.prefix = { "${meta.id}.sorted" }
        publishDir = [
            [
                path: { "${params.outdir}/${params.aligner}/deduplicated/" },
                mode: params.publish_dir_mode,
                pattern: "*markdup*.bam",
                enabled: params.save_align_intermeds
            ],
            [
                path: { "${params.outdir}/${params.aligner}/alignments/" },
                mode: params.publish_dir_mode,
                pattern: "*.bam",
                enabled: params.save_align_intermeds
            ]
        ]
    }

However, SAMTOOLS_SORT is used twice with alias in the BISMARK workflow, one is before and one is after deduplication. The sorted file before deduplication is saved, then the sorted file after deduplication is overwritten. This is because both files use identical filename after sorting due to the same prefix. This redundancy should be avoided by adding .deduplicated.sorted. for the latter.

Moreover, the overwritten file is written to the wrong folder /alignments/ instead of /deduplicated/.

@bounlu bounlu added the bug Something isn't working label Jun 21, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant