utils¶
Utility functions for lookups and browser_handlers.
-
add_consequence_to_variant
(variant: dict)[source]¶ Add information about variant consequence to a variant.
Parameters: variant (dict) – variant information
-
add_consequence_to_variants
(variant_list: list)[source]¶ Add information about variant consequence to multiple variants.
Parameters:
-
annotation_severity
(annotation: dict)[source]¶ Evaluate severity of the consequences; “bigger is more important”.
Parameters: annotation (dict) – vep_annotation from a variant Returns: severity score Return type: float
-
get_coverage
(dataset: str, datatype: str, item: str, ds_version: str = None)[source]¶ Retrieve coverage for a gene/region/transcript.
Parameters: Returns: start, stop, coverage list
Return type:
-
get_coverage_pos
(dataset: str, datatype: str, item: str, ds_version: str = None)[source]¶ Retrieve coverage range.
Parameters: Returns: start, stop, chrom
Return type:
-
get_flags_from_variant
(variant: dict)[source]¶ Get flags from variant.
Checks for: * MNP * LoF (loss of function)
Parameters: variant (dict) – a variant Returns: flags for the variant Return type: list
-
get_proper_hgvs
(annotation: dict)[source]¶ Get HGVS for change, either at transcript or protein level.
Parameters: annotation (dict) – VEP annotation with HGVS information Returns: variant effect at aa level in HGVS format (p.), None if parsing fails Return type: str
-
get_protein_hgvs
(annotation)[source]¶ Aa changes in HGVS format.
Parameters: annotation (dict) – VEP annotation with HGVS information Returns: variant effect at aa level in HGVS format (p.), None if parsing fails Return type: str
-
get_transcript_hgvs
(annotation: dict)[source]¶ Nucleotide change in HGVS format.
Parameters: annotation (dict) – VEP annotation with HGVS information Returns: variant effect at nucleotide level in HGVS format (c.), None if parsing fails Return type: str
-
get_variant_list
(dataset: str, datatype: str, item: str, ds_version: str = None)[source]¶ Retrieve variants for a datatype.
Parameters: Returns: {variants:list, headers:list}
Return type:
-
is_region_too_large
(start: int, stop: int)[source]¶ Evaluate whether the size of a region is larger than maximum query.
Parameters: Returns: True if too large
Return type:
-
order_vep_by_csq
(annotation_list: list)[source]¶ Will add “major_consequence” to each annotation and order by severity.
Parameters: annotation_list (list) – VEP annotations (as dict) Returns: annotations ordered by major consequence severity Return type: list
-
parse_dataset
(dataset: str, ds_version: str = None)[source]¶ Check/parse if the dataset name is in the beacon form (
reference:dataset:version
).Parameters: Returns: (dataset, version)
Return type:
-
parse_region
(region: str)[source]¶ Parse a region with either one or two positions
Parameters: region (str) – region, e.g. 3-100-200 or 3-100 Returns: (chrom, start, pos) Return type: tuple
-
remove_extraneous_information
(variant: dict)[source]¶ Remove information that is not used in the frontend from a variant.
Parameters: variant (dict) – variant data from database
-
remove_extraneous_vep_annotations
(annotation_list: list)[source]¶ Remove annotations with low-impact consequences (less than intron variant).
Parameters: annotation_list (list) – VEP annotations (as dict) Returns: VEP annotations with higher impact Return type: list
-
worst_csq_from_csq
(csq: str)[source]¶ Find worst consequence in a possibly &-filled consequence string.
Parameters: csq (str) – string of consequences, seperated with & (if multiple) Returns: the worst consequence Return type: str
-
worst_csq_from_list
(csq_list: list)[source]¶ Choose the worst consequence.
Parameters: csq_list (list) – list of consequences Returns: the worst consequence Return type: str