Skip to content

feat: civicpy/annotate module#11079

Draft
emmcauley wants to merge 1 commit intonf-core:masterfrom
fulcrumgenomics:em_civipy_annotate
Draft

feat: civicpy/annotate module#11079
emmcauley wants to merge 1 commit intonf-core:masterfrom
fulcrumgenomics:em_civipy_annotate

Conversation

@emmcauley
Copy link
Copy Markdown
Contributor

@emmcauley emmcauley commented Mar 27, 2026

PR checklist

Closes #11076.

⚠️ This PR is contingent on some bioconda-recipe PRs that are still under review!

This module adds CIVICpy, an analysis toolkit and SDK for extracting and analyzing knowledge from the CIViC knowledgebase. Tests are added.

⚠️ There seems to be something wrong with the pip and conda civicpy packages, they are both lacking backports:

Traceback (most recent call last):
  File "/usr/local/bin/civicpy", line 6, in <module>
    from civicpy.cli import cli
  File "/usr/local/lib/python3.12/site-packages/civicpy/cli.py", line 4, in <module>
    from civicpy import LOCAL_CACHE_PATH, civic
  File "/usr/local/lib/python3.12/site-packages/civicpy/civic.py", line 13, in <module>
    from backports.datetime_fromisoformat import MonkeyPatch
ModuleNotFoundError: No module named 'backports.datetime_fromisoformat'

Trying to add backports into the wave container build fails even if they're both from pip.

Also logged an issue on the civicpy repo here.

  • 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.
  • Broadcast software version numbers to topic: versions - See version_topics
  • 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

@emmcauley emmcauley marked this pull request as ready for review March 27, 2026 18:46
@emmcauley emmcauley force-pushed the em_civipy_annotate branch 2 times, most recently from 932b1eb to ef3d2d1 Compare March 27, 2026 19:12
@emmcauley emmcauley force-pushed the em_civipy_annotate branch from ef3d2d1 to 249aa89 Compare March 27, 2026 22:26
Comment on lines +7 to +8
? 'https://depot.galaxyproject.org/singularity/civicpy:5.2.0--pyhdfd78af_0'
: 'docker.io/griffithlab/civicpy:v5.2.0' }"
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

these are non-standard because I ran into issues building the wave container for docker + singularity

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

We have a quay.io repository for custom docker containers. It is a recommendation to upload them there so that we stay independent of third parties that might delete the images. See the docs for more info. You can request the upload via #request-core in the nf-core slack. I think its fine to store it there until they resolve the issue on their side :)

@emmcauley emmcauley marked this pull request as draft April 7, 2026 13:56
@emmcauley emmcauley added the new module Adding a new module label Apr 10, 2026
Copy link
Copy Markdown
Contributor

@famosab famosab left a comment

Choose a reason for hiding this comment

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

Nice! I am also interested in having civic added to nf-core so I already added some feedback to help with the module development :)

Comment on lines +86 to +89
{ assert snapshot(
file(process.out.vcf[0][1]).name,
process.out.versions_civicpy
).match() }
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

You can use

{ assert snapshot(sanitizeOutput(process.out)).match() }

for the stub assertion. It should not be necessary to do any other assertions in the stub test.

@@ -0,0 +1,5 @@
process {
withName: CIVICPY_ANNOTATE {
ext.args = '--include-status accepted'
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

We want the ext.args to be present in the main.nf.test file. That makes everything more readable in one go. See the module specifications for more info.

Comment on lines +7 to +8
? 'https://depot.galaxyproject.org/singularity/civicpy:5.2.0--pyhdfd78af_0'
: 'docker.io/griffithlab/civicpy:v5.2.0' }"
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

We have a quay.io repository for custom docker containers. It is a recommendation to upload them there so that we stay independent of third parties that might delete the images. See the docs for more info. You can request the upload via #request-core in the nf-core slack. I think its fine to store it there until they resolve the issue on their side :)

val annotation_genome_version

output:
tuple val(meta), path("*.vcf"), emit: vcf
Copy link
Copy Markdown
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("*.vcf"), emit: vcf
tuple val(meta), path("*.vcf"), emit: vcf

script:
def args = task.ext.args ?: ''
def prefix = task.ext.prefix ?: "${meta.id}.civic"

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Suggested change


script:
def args = task.ext.args ?: ''
def prefix = task.ext.prefix ?: "${meta.id}.civic"
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

If input and output names can overlap, use task.ext.prefix to disambiguate. For example:

if ("${vcf}" == "${prefix}.vcf.gz") error "Input and output names are the same, use \"task.ext.prefix\" to disambiguate!"

def args = task.ext.args ?: ''
def prefix = task.ext.prefix ?: "${meta.id}.civic"

"""
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

see above

# yaml-language-server: $schema=https://raw.githubusercontent.com/nf-core/modules/master/modules/meta-schema.json
name: "civicpy_annotate"

description: A python client and analysis toolkit for the Clinical Interpretations of Variants in Cancer (CIViC) knowledgebase
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Can you be more specific for annotate here?


civicpy annotate-vcf \\
--input-vcf ${vcf} \\
--output-vcf ${prefix}.vcf \\
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

We usually want the vcf files to be bgzipped if possible

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Conda probably has the same issue as the biocontainer / wave container?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

new module Adding a new module

Projects

None yet

Development

Successfully merging this pull request may close these issues.

new module: civicpy/anotate

2 participants