Skip to content

Commit

Permalink
Merge pull request #149 from griffithlab/fusions
Browse files Browse the repository at this point in the history
Update queries and query parsing to work with new variant coordinate schema
  • Loading branch information
susannasiebert authored Oct 8, 2024
2 parents 784c172 + b39a829 commit e67f53f
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 38 deletions.
2 changes: 1 addition & 1 deletion civicpy/__version__.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
__url__ = 'http://civicpy.org'
__major__ = '3'
__minor__ = '1'
__patch__ = '0'
__patch__ = '1'
__meta_label__ = ''
__short_version__ = "{}.{}".format(__major__, __minor__)
__version__ = "{}.{}".format(__short_version__, __patch__)
Expand Down
54 changes: 20 additions & 34 deletions civicpy/civic.py
Original file line number Diff line number Diff line change
Expand Up @@ -1241,24 +1241,20 @@ def _postprocess_response_element(e, element):
if e['__typename'] != 'GeneVariant':
raise Exception("Variant type {} not supported yet".format(e['__typename']))
e['entrez_id'] = e['gene']['featureInstance']['entrezId']
build = e['referenceBuild']
build = e['coordinates']['referenceBuild']
if build == 'GRCH37':
build = 'GRCh37'
elif build == 'GRCH38':
build = 'GRCh38'
e['coordinates'] = {
'ensembl_version': e['ensemblVersion'],
'ensembl_version': e['coordinates']['ensemblVersion'],
'reference_build': build,
'reference_bases': e['referenceBases'],
'variant_bases': e['variantBases'],
'representative_transcript': None if e['primaryCoordinates'] is None else e['primaryCoordinates']['representativeTranscript'],
'chromosome': None if e['primaryCoordinates'] is None else e['primaryCoordinates']['chromosome'],
'start': None if e['primaryCoordinates'] is None else e['primaryCoordinates']['start'],
'stop': None if e['primaryCoordinates'] is None else e['primaryCoordinates']['stop'],
'representative_transcript2': None if e['secondaryCoordinates'] is None else e['secondaryCoordinates']['representativeTranscript'],
'chromosome2': None if e['secondaryCoordinates'] is None else e['secondaryCoordinates']['chromosome'],
'start2': None if e['secondaryCoordinates'] is None else e['secondaryCoordinates']['start'],
'stop2': None if e['secondaryCoordinates'] is None else e['secondaryCoordinates']['stop'],
'reference_bases': e['coordinates']['referenceBases'],
'variant_bases': e['coordinates']['variantBases'],
'representative_transcript': e['coordinates']['representativeTranscript'],
'chromosome': e['coordinates']['chromosome'],
'start': e['coordinates']['start'],
'stop': e['coordinates']['stop'],
}
elif element == 'variant_group':
e['variant_ids'] = [v['id'] for v in e['variants']['nodes']]
Expand Down Expand Up @@ -1535,22 +1531,17 @@ def _construct_get_variant_payload():
allele_registry_id: alleleRegistryId
clinvar_entries: clinvarIds
hgvs_expressions: hgvsDescriptions
variantBases
referenceBases
referenceBuild
primaryCoordinates {
chromosome
representativeTranscript
start
stop
}
secondaryCoordinates {
coordinates {
referenceBuild
ensemblVersion
chromosome
representativeTranscript
start
stop
referenceBases
variantBases
coordinateType
}
ensemblVersion
}
gene: feature {
id
Expand Down Expand Up @@ -1591,22 +1582,17 @@ def _construct_get_all_variants_payload():
allele_registry_id: alleleRegistryId
clinvar_entries: clinvarIds
hgvs_expressions: hgvsDescriptions
variantBases
referenceBases
referenceBuild
primaryCoordinates {
coordinates {
referenceBuild
ensemblVersion
chromosome
representativeTranscript
start
stop
referenceBases
variantBases
coordinateType
}
secondaryCoordinates {
chromosome
representativeTranscript
start
stop
}
ensemblVersion
}
gene: feature {
id
Expand Down
6 changes: 3 additions & 3 deletions docs/install.rst
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,11 @@ That's it!
Configuring Cache Save
----------------------

A local copy of the CIViCpy cache is kept by default at your $HOME/.civicpy/cache.pkl directory.
You may configure an environment variable CIVICPY_CACHE_FILE to adjust this destination path for
A local copy of the CIViCpy cache is kept by default at your ``$HOME/.civicpy/cache.pkl`` directory.
You may configure an environment variable ``CIVICPY_CACHE_FILE`` to adjust this destination path for
storing the cache. For example::

>> .bashrc << echo "export CIVICPY_CACHE_FILE=$HOME/.civicpy/cache.pkl"

When loading a cache, it will be updated automatically by CIViCpy if stale (default: after 7 days).
Cache stale time is configurable when calling `civic.update_cache()`.
Cache stale time is configurable when calling `civic.update_cache()` or by setting the CACHE_TIMEOUT_DAYS environment variable.

0 comments on commit e67f53f

Please sign in to comment.