Skip to content

Commit

Permalink
Merge pull request #52 from NCI-GDC/feat/variant-support
Browse files Browse the repository at this point in the history
added a VariantSupport column type for RNA support maf column
  • Loading branch information
tzuni authored Mar 9, 2022
2 parents b85de32 + 2c45b33 commit 5e60c0e
Show file tree
Hide file tree
Showing 4 changed files with 49 additions and 2 deletions.
9 changes: 9 additions & 0 deletions maflib/column_types.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
StrandEnum,
ValidationStatusEnum,
VariantClassificationEnum,
VariantSupportEnum,
VariantTypeEnum,
VerificationStatusEnum,
YesNoOrUnknownEnum,
Expand Down Expand Up @@ -552,6 +553,14 @@ def __enum_class__(cls) -> Type[VariantTypeEnum]:
return VariantTypeEnum


class VariantSupport(EnumColumn):
"""A column that represents the RNA_Support MAF column"""

@classmethod
def __enum_class__(cls) -> Type[VariantSupportEnum]:
return VariantSupportEnum


class VerificationStatus(NullableEmptyStringIsNone, EnumColumn):
"""A column that represents the 'Verification_Status' MAF column,
where the empty string is treated as null."""
Expand Down
10 changes: 10 additions & 0 deletions maflib/column_values.py
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,16 @@ class VariantTypeEnum(MafEnum):
Consolidated: str = "Consolidated"


@unique
class VariantSupportEnum(MafEnum):
"""Enumeration for "Match", "Overlap", "No", "Unknown" column values."""

Match = "Match"
Overlap = "Overlap"
No = "No"
Unknown = "Unknown"


@unique
class VerificationStatusEnum(MafEnum):
"""Enumeration for the MAF 'Verification_Status' column value"""
Expand Down
4 changes: 2 additions & 2 deletions maflib/schemas/gdc-2.0.0-aliquot-merged.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,12 @@
"annotation-spec" : "gdc-2.0.0-aliquot-merged",
"extends" : "gdc-2.0.0-aliquot",
"columns" : [
[ "RNA_Support", "YesNoOrUnknown", "Indicates if the variant is supported (Yes) or not supported (No) by tumor RNA-Seq. If it has not been checked against RNA-Seq data, the value will be 'Unknown'." ],
[ "RNA_Support", "VariantSupport", "Indicates if the variant is found and alleles (Match), simply (Overlap), or is not supported (No) by tumor RNA-Seq. If it has not been checked against RNA-Seq data, the value will be 'Unknown'." ],
[ "RNA_depth", "NullableZeroBasedIntegerColumn", "Read depth at this locus if the variant is supported by tumor RNA-seq data." ],
[ "RNA_ref_count", "NullableZeroBasedIntegerColumn", "Read depth supporting the reference allele at this locus if the variant is supported by tumor RNA-seq data." ],
[ "RNA_alt_count", "NullableZeroBasedIntegerColumn", "Read depth supporting the variant allele at this locus if the variant is supported by tumor RNA-seq data." ],
[ "callers", "SequenceOfStrings", "A semicolon delimited list of supporting variant callers. If an asterisk is added to the caller name, this indicates the locus is a complex variant and this caller overlapped but did not support (e.g., not all callers can detect MNPs)" ]
],
"filtered" : ["ALLELE_NUM", "MINIMISED", "FILTER", "src_vcf_id", "vcf_region",
"vcf_info", "vcf_format", "vcf_tumor_gt", "vcf_normal_gt"]
"vcf_info", "vcf_format", "vcf_tumor_gt", "vcf_normal_gt"]
}
28 changes: 28 additions & 0 deletions tests/maflib/test_column_types.py
Original file line number Diff line number Diff line change
Expand Up @@ -487,6 +487,33 @@ def test_invalid(self):
column_types.YesNoOrUnknown.build("key", "Who Knows")


class TestVariantSupport(TestCase):
def test_valid(self):
self.is_column_is_valid(
column_types.VariantSupport.build("key", "Match"),
column_values.VariantSupportEnum.Match,
)
self.is_column_is_valid(
column_types.VariantSupport.build("key", "Overlap"),
column_values.VariantSupportEnum.Overlap,
)
self.is_column_is_valid(
column_types.VariantSupport.build("key", "No"),
column_values.VariantSupportEnum.No,
)
self.is_column_is_valid(
column_types.VariantSupport.build("key", "Unknown"),
column_values.VariantSupportEnum.Unknown,
)

def test_invalid(self):
# "Foo" is an invalid value so ValueError is raised but is caught and
# the fallback attempts to use "Foo" to lookup the correct Enum value
# hence generating a KeyError
with self.assertRaises(KeyError):
column_types.VariantSupport.build("key", "Foo")


class TestNullableYOrN(TestCase):
def test_valid(self):
nulls = [
Expand Down Expand Up @@ -594,6 +621,7 @@ class TestCustomEnums(TestCase):
column_types.Impact,
column_types.MC3Overlap,
column_types.GdcValidationStatus,
column_types.VariantSupport,
]

def test_valid(self):
Expand Down

0 comments on commit 5e60c0e

Please sign in to comment.