Skip to content

Commit

Permalink
make RNA VAF as default instead of DNA VAF
Browse files Browse the repository at this point in the history
  • Loading branch information
priesgo committed Dec 16, 2022
1 parent 1f2ef34 commit 1a0df50
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 8 deletions.
4 changes: 2 additions & 2 deletions neofox/published_features/expression.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,9 +46,9 @@ def _get_expression_annotation(

def get_annotations(self, neoantigen: Neoantigen) -> List[Annotation]:

vaf = neoantigen.dna_variant_allele_frequency
vaf = neoantigen.rna_variant_allele_frequency
if vaf is None or vaf == -1:
vaf = neoantigen.rna_variant_allele_frequency
vaf = neoantigen.dna_variant_allele_frequency

return [
AnnotationFactory.build_annotation(
Expand Down
20 changes: 14 additions & 6 deletions neofox/tests/unit_tests/test_expression.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@

from unittest import TestCase

from neofox.model.factories import NOT_AVAILABLE_VALUE
from neofox.model.factories import NOT_AVAILABLE_VALUE, NeoantigenFactory
from neofox.model.neoantigen import Neoantigen
from neofox.published_features.expression import Expression

Expand All @@ -30,20 +30,28 @@ def setUp(self) -> None:
self.expression = Expression()

def test_calculate_expression_mutation(self):
neoantigen = Neoantigen(rna_expression=12.0, dna_variant_allele_frequency=0.2)
neoantigen = NeoantigenFactory.build_neoantigen(
rna_expression=12.0, dna_variant_allele_frequency=0.2, patient_identifier="patient1",
mutated_xmer="DDDDD")
result = self.expression.get_annotations(neoantigen=neoantigen)[0]
self.assertGreater(result.value, "0.0")
self.assertGreater(float(result.value), 0.0)

# no reads for mut
neoantigen = Neoantigen(rna_expression=12.0, dna_variant_allele_frequency=0.0)
neoantigen = NeoantigenFactory.build_neoantigen(
rna_expression=12.0, dna_variant_allele_frequency=0.0, patient_identifier="patient1",
mutated_xmer="DDDDD")
result = self.expression.get_annotations(neoantigen=neoantigen)[0]
self.assertEqual(result.value, "0")

# no reads for mut/wt
neoantigen = Neoantigen(rna_expression=12.0, dna_variant_allele_frequency=-1, rna_variant_allele_frequency=-1)
neoantigen = NeoantigenFactory.build_neoantigen(
rna_expression=12.0, dna_variant_allele_frequency=-1, rna_variant_allele_frequency=-1, patient_identifier="patient1",
mutated_xmer="DDDDD")
result = self.expression.get_annotations(neoantigen=neoantigen)[0]
self.assertEqual(result.value, NOT_AVAILABLE_VALUE)

neoantigen = Neoantigen(rna_expression=None, dna_variant_allele_frequency=-1, rna_variant_allele_frequency=-1)
neoantigen = NeoantigenFactory.build_neoantigen(
rna_expression=None, dna_variant_allele_frequency=-1, rna_variant_allele_frequency=-1,
patient_identifier="patient1", mutated_xmer="DDDDD")
result = self.expression.get_annotations(neoantigen=neoantigen)[0]
self.assertEqual(result.value, NOT_AVAILABLE_VALUE)

0 comments on commit 1a0df50

Please sign in to comment.