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

updated tests running average coverage calculations in cloud executors #102

Merged
merged 6 commits into from
Aug 29, 2024

Conversation

mattheww95
Copy link
Collaborator

@mattheww95 mattheww95 commented Aug 23, 2024

updating tests of mirkokondo to determine why average coverage values are not appearing in cloud executors.

Copy link

github-actions bot commented Aug 23, 2024

nf-core lint overall result: Passed ✅ ⚠️

Posted for pipeline commit 167fc40

+| ✅ 223 tests passed       |+
#| ❔  31 tests were ignored |#
!| ❗   3 tests had warnings |!

❗ Test warnings:

  • nextflow_config - Config manifest.version should end in dev: 0.3.0
  • readme - README contains the placeholder zenodo.XXXXXXX. This should be replaced with the zenodo doi (after the first release).
  • schema_lint - Schema $id should be https://raw.githubusercontent.com/phac-nml/mikrokondo/master/nextflow_schema.json
    Found https://raw.githubusercontent.com/phac-nml/mikrokondo/main/nextflow_schema.json

❔ Tests ignored:

  • files_exist - File is ignored: CODE_OF_CONDUCT.md
  • files_exist - File is ignored: assets/nf-core-mikrokondo_logo_light.png
  • files_exist - File is ignored: docs/images/nf-core-mikrokondo_logo_light.png
  • files_exist - File is ignored: docs/images/nf-core-mikrokondo_logo_dark.png
  • files_exist - File is ignored: .github/ISSUE_TEMPLATE/config.yml
  • files_exist - File is ignored: .github/workflows/awstest.yml
  • files_exist - File is ignored: .github/workflows/awsfulltest.yml
  • files_exist - File is ignored: docs/output.md
  • files_exist - File is ignored: docs/README.md
  • files_exist - File is ignored: docs/usage.md
  • nextflow_config - Config variable ignored: manifest.name
  • nextflow_config - Config variable ignored: manifest.homePage
  • files_unchanged - File does not exist: CODE_OF_CONDUCT.md
  • files_unchanged - File ignored due to lint config: LICENSE or LICENSE.md or LICENCE or LICENCE.md
  • files_unchanged - File ignored due to lint config: .github/CONTRIBUTING.md
  • files_unchanged - File ignored due to lint config: .github/ISSUE_TEMPLATE/bug_report.yml
  • files_unchanged - File does not exist: .github/ISSUE_TEMPLATE/config.yml
  • files_unchanged - File ignored due to lint config: .github/ISSUE_TEMPLATE/feature_request.yml
  • files_unchanged - File ignored due to lint config: .github/PULL_REQUEST_TEMPLATE.md
  • files_unchanged - File ignored due to lint config: .github/workflows/branch.yml
  • files_unchanged - File ignored due to lint config: .github/workflows/linting.yml
  • files_unchanged - File ignored due to lint config: assets/email_template.html
  • files_unchanged - File ignored due to lint config: assets/email_template.txt
  • files_unchanged - File ignored due to lint config: assets/sendmail_template.txt
  • files_unchanged - File does not exist: assets/nf-core-mikrokondo_logo_light.png
  • files_unchanged - File does not exist: docs/images/nf-core-mikrokondo_logo_light.png
  • files_unchanged - File does not exist: docs/images/nf-core-mikrokondo_logo_dark.png
  • files_unchanged - File does not exist: docs/README.md
  • files_unchanged - File ignored due to lint config: .gitignore or .prettierignore
  • actions_awstest - 'awstest.yml' workflow not found: /home/runner/work/mikrokondo/mikrokondo/.github/workflows/awstest.yml
  • multiqc_config - multiqc_config

✅ Tests passed:

Run details

  • nf-core/tools version 2.14.1
  • Run at 2024-08-28 20:47:53

@mattheww95
Copy link
Collaborator Author

While I am not full sure what caused the issue between nextflow version 23.04.0 and version 24.04.4, I was able to identify the code block that caused the issue, along with the potentially relevant PRs.

Within the QCReportFields there were some closures in arrays defined like so:

  coverage_calc_fields {
      fixed_cov = "String"
  }
   average_coverage {
            path = ["${params.coverage_calc_fields.fixed_cov}"]
            coerce_type = 'Float'
            compare_fields = ['min_average_coverage']
            comp_type = 'ge'
            on = true
            low_msg = "Depth of coverage from assembly is lower than than expected. A top-up run is likely needed."
        }

The issue seemed to arise from the GString, appearing in a closure which is technically with in another closure so the value of at the first index of path is actually of type: org.codehaus.groovy.runtime.GStringImpl

There is a snippet of code later on the checks if a value is contained within a map, but due to whatever comparison is implemented the value with the type org.codehaus.groovy.runtime.GStringImpl must not compare the string pointed to by the value and some other comparison instead.

If we change the config code in the snippet above to:

  coverage_calc_fields {
      fixed_cov = "String"
  }
   average_coverage {
            path = [params.coverage_calc_fields.fixed_cov] // removed closure
            coerce_type = 'Float'
            compare_fields = ['min_average_coverage']
            comp_type = 'ge'
            on = true
            low_msg = "Depth of coverage from assembly is lower than than expected. A top-up run is likely needed."
        }

The code now works.

The potentially relelvant issue and PR affecting this I beleive are here:

Copy link
Member

@apetkau apetkau left a comment

Choose a reason for hiding this comment

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

This looks great Matthew. Thanks so much for all your work on fixing this issue 😄

I have a few comments for you.

modules/local/report.nf Outdated Show resolved Hide resolved
modules/local/report.nf Show resolved Hide resolved
modules/local/report.nf Show resolved Hide resolved
modules/local/report.nf Show resolved Hide resolved
tests/main.nf.test Show resolved Hide resolved
Copy link

@kylacochrane kylacochrane left a comment

Choose a reason for hiding this comment

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

This looks great Matthew! Just one question to make sure I understand the def generate_coverage_data function correctly 😄
Also, thank you for the references on GStrings in closures (squared!) - I've made a note to keep that knowledge handy for the future!

@@ -130,14 +130,13 @@ def generate_coverage_data(sample_data, bp_field, species){
&& species[species_data_pos].fixed_genome_size != null){

def length = species[species_data_pos].fixed_genome_size.toLong()
def cov = base_pairs / q_length
def cov = base_pairs / length

Choose a reason for hiding this comment

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

Just checking to make sure I understand the difference between q_length and length:

  • is q_length a dynamic value specific to each sample entry in sample_data?
  • is length a fixed value of the species genome size, as in a standard reference for each species.?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

This is correct! however, I think I have something mixed up. Just reading through the code again to make sure I am reporting the correct thing.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

q_length or query length here is the genome length generated by quast in this case or whatever path is pointed to in the QCReportFields of the nextflow.config while the length field is the length specified in the QCReport section for a specific organism.

Choose a reason for hiding this comment

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

Fantastic! Thanks for looking into this!

Copy link
Member

@apetkau apetkau left a comment

Choose a reason for hiding this comment

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

Thanks so much for solving this issue Matthew. This looks really great 😄

@mattheww95 mattheww95 merged commit 3a3b982 into dev Aug 29, 2024
5 checks passed
@mattheww95 mattheww95 deleted the update/tests branch August 29, 2024 15:09
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.

3 participants