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 · 1 comment · Fixed by #414
Open

samtools sort overwrites #328

bounlu opened this issue Jun 21, 2023 · 1 comment · Fixed by #414
Assignees
Labels
bug Something isn't working high-priority
Milestone

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
@sateeshperi sateeshperi self-assigned this Sep 21, 2024
@sateeshperi sateeshperi added this to the 2.7.0 milestone Sep 21, 2024
@sateeshperi sateeshperi linked a pull request Sep 21, 2024 that will close this issue
@sateeshperi
Copy link
Contributor

hey @bounlu Thanks for reporting this. I just put in some fixes based on your suggestion to the linked branch

If you could give it a look and lmk if the samtools sort is as expected now 🙏

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working high-priority
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants