Skip to content

fix: ensure that selected AF and AN fields are written to the output vcf in find-sites - #173

Closed
johanneskoester wants to merge 4 commits into
brentp:masterfrom
johanneskoester:patch-2
Closed

johanneskoester wants to merge 4 commits into
brentp:masterfrom
johanneskoester:patch-2

Conversation

@johanneskoester

Copy link
Copy Markdown
Contributor

@brentp in addition, find-sites should however normalize their names to AF and AN, because downstream somalier commands require that.

@johanneskoester

Copy link
Copy Markdown
Contributor Author

@brentp I did the latter in the second commit. I am not familiar with nim though and used Github Copilot to help with the change.

Copilot AI left a comment

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.

🟡 Changes recommended

When a record lacks the population-specific field selected by --AN-field, the output retains the original AN, silently reporting an unrelated allele count as the selected population’s value.

1 open issue
What changed in this PR

This PR updates find-sites to write the selected allele-count and allele-frequency fields under the canonical AN and AF names required by downstream somalier commands.

Changes:

  • Add canonical INFO header definitions when custom field names are selected.
  • Copy selected values into AN and AF before writing records.
  • Preserve AN and AF while removing other INFO fields.
File Description
src/​somalierpkg/​findsites.nim Normalize selected INFO fields and update output field filtering.

Review effort: Balanced

Comment on lines +330 to +331
if info.get(field_AN, ans) == Status.OK:
doAssert info.set("AN", ans) == Status.OK

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

@johanneskoester I think this is a small issue, but probably resolved with else info.delete("AN") likewise for AF

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.

Done!

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

probably need :

@johanneskoester

Copy link
Copy Markdown
Contributor Author

@brentp can you help me with the failing tests?

@brentp

brentp commented Nov 4, 2026

Copy link
Copy Markdown
Owner

yes, I'll take it from here. thanks!

@brentp

brentp commented Nov 4, 2026

Copy link
Copy Markdown
Owner

I merged this in #137 and tagged v0.3.7

thanks again!

@brentp brentp closed this Nov 4, 2026
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