Skip to content

Commit

Permalink
Always Treat Accession Based Variants as Fully Qualified
Browse files Browse the repository at this point in the history
  • Loading branch information
bencap committed Sep 18, 2024
1 parent d87b726 commit b6d08fe
Showing 1 changed file with 13 additions and 7 deletions.
20 changes: 13 additions & 7 deletions src/mavedb/lib/validation/dataframe.py
Original file line number Diff line number Diff line change
Expand Up @@ -346,9 +346,6 @@ def validate_hgvs_transgenic_column(column: pd.Series, is_index: bool, targets:
This function also validates all individual variants in the column and checks for agreement against the target
sequence (for non-splice variants).
Implementation NOTE: We assume variants will only be presented as fully qualified (accession:variant)
if this column is being validated against multiple targets.
Parameters
----------
column : pd.Series
Expand Down Expand Up @@ -419,14 +416,23 @@ def validate_hgvs_transgenic_column(column: pd.Series, is_index: bool, targets:

# variants can exist on the same line separated by a space
for variant in s.split(" "):
# When there are multiple targets, treat provided variants as fully qualified.
if len(targets) > 1:
# Treat all variants as fully qualified
try:
name, variant = str(variant).split(":")
else:
name = list(targets.keys())[0]
# Raised when there are too few arguments to unpack.
except ValueError:
invalid_variants.append(
f"invalid variant string '{variant}' at row {i}. Variant was not presented as fully qualified with respect to its target accession."
)
continue

if variant is not None:
try:
Variant(variant, targetseq=target_seqs[name])
except KeyError:
invalid_variants.append(
f"invalid variant string '{variant}' at row {i}. Accession {name} does not match any of the supplied targets: {target_seqs.keys()}."
)
except MaveHgvsParseError:
try:
Variant(variant) # note this will get called a second time for splice variants
Expand Down

0 comments on commit b6d08fe

Please sign in to comment.