Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

susannasiebert
Copy link
Collaborator

@susannasiebert susannasiebert commented Jan 9, 2020

This PR adds variant search by:

  • name
  • allele registry CAID
  • non-build37 coordinates (right now only GRCh37 and GRCh38 are supported)

TODO:

  • Add tests
  • Add support for additional reference build versions

Copy link
Member

@ahwagner ahwagner left a comment

Choose a reason for hiding this comment

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

Overall, this looks good. Would be awesome to have real GRCh38 support (like query coordinate liftover), but I think this PR satisfies the 80/20 rule.

The suggestion to refactor the code is not required for merging this (though it would be nice), but you should autodoc the search_variants_by_allele_registry_id and search_variants_by_name methods under a new docs subsection (maybe By Other Attribute?) under Getting records before we merge it in.

civicpy/civic.py Outdated
Comment on lines 999 to 1019
def search_variants_by_allele_registry_id(caid):
"""
Search the cache for variants matching the queried Allele Registry ID (CAID)
:param String caid: Allele Registry ID to query
:return: Returns a list of variant hashes matching the Allele Registry ID
"""
variants = get_all_variants()
return [v for v in variants if v.allele_registry_id == caid]

def search_variants_by_name(name):
"""
Search the cache for variants matching the queried name
:param String name: Variant name to query
:return: Returns a list of variant hashes matching the name
"""
variants = get_all_variants()
return [v for v in variants if v.name == name]
Copy link
Member

Choose a reason for hiding this comment

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

I think we should use this opportunity to create a generalized search_variants_by_attribute (or, even better, search_class_by_attribute) that mirrors this pattern, with appropriate params passed for the explicit routines. Will be less maintenance down the road.

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 has been implemented

@susannasiebert
Copy link
Collaborator Author

@ahwagner I added the documentation for the two new search functions. I also added a catch guard to the bulk coordinate search since it doesn't currently support search by non-GRCh37 builds.

@susannasiebert susannasiebert requested a review from ahwagner May 18, 2020 14:50
Copy link
Member

@ahwagner ahwagner left a comment

Choose a reason for hiding this comment

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

Looks great. Merge at your leisure.

@susannasiebert susannasiebert merged commit a6a6e14 into master May 18, 2020
@susannasiebert susannasiebert deleted the variant_search branch May 19, 2020 17:50
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