Fix IdentifyDuplicates to resolve NoneType mismatches#788
Merged
Conversation
| record.info.get('STRANDS'), | ||
| record.info.get('CPX_TYPE'), | ||
| record.info.get('CPX_INTERVALS') | ||
| record.info.get('CHR2') or "", |
Collaborator
There was a problem hiding this comment.
Thanks for the fix. Can you give me access to the testing workspaces?
I would use the built-in .get(key, default) syntax for consistency across our scripts
Suggested change
| record.info.get('CHR2') or "", | |
| record.info.get('CHR2', ""), |
Collaborator
Author
There was a problem hiding this comment.
Just shared the workspace with you, apologies for this oversight.
And thanks for the suggestion, just modified it to use this. Given the simplicity of the change, I did a quick sanity test locally, but let me know if I should re-build the docker / re-test with the .get(key, default) syntax as well.
epiercehoffman
approved these changes
Mar 13, 2025
Collaborator
epiercehoffman
left a comment
There was a problem hiding this comment.
LGTM. Thanks for the fix and for running the extra test!
MattWellie
pushed a commit
to populationgenomics/gatk-sv
that referenced
this pull request
Apr 7, 2025
…#788) * Initial commit * Removed trailing whitespace * Used .get(x, y) to standardize with repo
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
The
IdentifyDuplicatestask looks for a match across several INFO fields in order to determine exact or insert matches. However, these INFO fields may not exist for certain records, and hence are represented asNonein the tuple that stores them. At a certain point, we sort these tuples.As highlighted in Python documentation, when sorting a list of tuples, if there is a match on the search index within each tuple, the subsequent elements in the tuples are compared to define the sort order. This means that Python starts by comparing the first element of each tuple; if they are equal, it moves to the second element, and so on, until it finds elements that differ or reaches the end of the tuples.
Hence, if we reach an element in our sort process for which the INFO field exists in one record but not another, we get the following error:
TypeError: '<' not supported between instances of 'str' and 'NoneType'. This PR is intended to avoid this by setting defaults for all INFO fields that may not exist in a record.Testing