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

Add CRAM and BAM support to last/mafconvert #7391

Merged
merged 9 commits into from
Feb 1, 2025

Conversation

charles-plessy
Copy link
Contributor

@charles-plessy charles-plessy commented Jan 29, 2025

  • I want CRAM support for the https://github.com/nf-core/pairgenomealign pipeline, which is the main consumer of the last/* modules
  • The upstream version of maf-convert supports SAM but not CRAM.
  • In case of large (multi-GB) files, it is inconvenient to go from MAF to CRAM via a SAM intermediate. In pipelines that parallelise over a lot of genomes it could amount to hundreds of GB of extra disk space used
  • By adding samtools to the container of this module, I allow the module to pipe the SAM output in samtools and convert it to CRAM.
  • I added BAM support by the way because it was easy.

PR checklist

Closes #XXX

  • This comment contains a description of changes (with reason).
  • If you've fixed a bug or added code that should be tested, add tests!
  • If you've added a new tool - have you followed the module conventions in the contribution docs
  • If necessary, include test data in your PR.
  • Remove all TODO statements.
  • Emit the versions.yml file.
  • Follow the naming conventions.
  • Follow the parameters requirements.
  • Follow the input/output options guidelines.
  • Add a resource label
  • Use BioConda and BioContainers if possible to fulfil software requirements.
  • Ensure that the test works with either Docker / Singularity. Conda CI tests can be quite flaky:
    • For modules:
      • nf-core modules test <MODULE> --profile docker
      • nf-core modules test <MODULE> --profile singularity
      • nf-core modules test <MODULE> --profile conda
    • For subworkflows:
      • nf-core subworkflows test <SUBWORKFLOW> --profile docker
      • nf-core subworkflows test <SUBWORKFLOW> --profile singularity
      • nf-core subworkflows test <SUBWORKFLOW> --profile conda

The target genome file is needed to create the CRAM file, therefore I
added one input channel to the module.

I also re-output the genome file in the `cram` output channel, because
it is the only way I found to access it during tests.

By the way, the module will fail if the genome file is encrypted with
formats that are not BGZF.
Comment on lines 21 to 22
tuple val(meta), path("*.cram"), path(fasta), optional:true, emit: cram
path("*.fai"), optional:true, emit: fai
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
tuple val(meta), path("*.cram"), path(fasta), optional:true, emit: cram
path("*.fai"), optional:true, emit: fai
tuple val(meta), path("*.cram"), optional:true, emit: cram

fasta is an input file so shouldn't be in the output section,
fai should also be an input file :)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

At the moment I need path(fasta) in the cram output channel because I did not find another way to access that file during the tests. Can you help me to solve that problem?

Copy link
Contributor

@nvnieuwk nvnieuwk left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I posted some comments, can you update those? Looking very good though!

@charles-plessy
Copy link
Contributor Author

@nvnieuwk ping :)

Copy link
Contributor

@nvnieuwk nvnieuwk left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One more suggestion 😉

modules/nf-core/last/mafconvert/main.nf Outdated Show resolved Hide resolved
Copy link
Contributor

@nvnieuwk nvnieuwk left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM when tests pass

@charles-plessy charles-plessy added this pull request to the merge queue Feb 1, 2025
Merged via the queue into master with commit 406ace5 Feb 1, 2025
30 checks passed
@charles-plessy charles-plessy deleted the maf-convert-cram-bam branch February 1, 2025 01:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants