Example #1
0
    def test_canonicalize_variant_dsl(self):
        """Use the __str__ functions in the DSL to create BEL instead of external pybel.canonicalize."""
        self.assertEqual('var("p.Val600Glu")', str(hgvs('p.Val600Glu')))
        self.assertEqual('var("p.Val600Glu")',
                         str(protein_substitution('Val', 600, 'Glu')))

        self.assertEqual('pmod(Ph)', str(pmod('Ph')))
        self.assertEqual('pmod(TEST:Ph)', str(pmod('Ph', namespace='TEST')))
        self.assertEqual('pmod(TEST:Ph, Ser)',
                         str(pmod('Ph', namespace='TEST', code='Ser')))
        self.assertEqual(
            'pmod(TEST:Ph, Ser, 5)',
            str(pmod('Ph', namespace='TEST', code='Ser', position=5)))
        self.assertEqual(
            'pmod(GO:"protein phosphorylation", Thr, 308)',
            str(
                pmod(name='protein phosphorylation',
                     namespace='GO',
                     code='Thr',
                     position=308)))

        self.assertEqual('frag("?")', str(fragment()))
        self.assertEqual('frag("672_713")', str(fragment(start=672, stop=713)))
        self.assertEqual('frag("?", "descr")',
                         str(fragment(description='descr')))
        self.assertEqual(
            'frag("672_713", "descr")',
            str(fragment(start=672, stop=713, description='descr')))

        self.assertEqual('gmod(Me)', str(gmod('Me')))
        self.assertEqual('gmod(TEST:Me)', str(gmod('Me', namespace='TEST')))
        self.assertEqual('gmod(GO:"DNA Methylation")',
                         str(gmod('DNA Methylation', namespace='GO')))
Example #2
0
SET Subgraph = "Epigenetic modification subgraph"
g(HGNC:MTHFR,sub(C,677,T)) =| p(HGNC:MTHFR)
g(HGNC:MTHFR,sub(A,1298,C)) =| p(HGNC:MTHFR)
g(HGNC:MTHFR,sub(C,677,T)) neg a(CHEBI:"folic acid")
g(HGNC:MTHFR,sub(C,677,T)) pos path(MESH:"Alzheimer Disease")
"""

c2 = '21119889'
e2 = "Two common MTHFR polymorphisms, namely 677C>T (Ala222Val) and 1298A>C (Glu429Ala), are known to reduce MTHFR activity. \
It has been shown that the MTHFR 677T allele is associated with increased total plasma Hcy levels (tHcy) and decreased serum folate levels, mainly in 677TT homozygous subjects.\
the MTHFR 677C>T polymorphism as a candidate AD risk factor"
e2 = str(hash(e2))

mthfr = protein('HGNC', 'MTHFR')
mthfr_c677t = protein('HGNC', 'MTHFR', variants=[protein_substitution('Ala', 222, 'Val')])
mthfr_a1298c = protein('HGNC', 'MTHFR', variants=[protein_substitution('Glu', 429, 'Ala')])
folic_acid = abundance('CHEBI', 'folic acid')
alzheimer_disease = pathology('MESH', 'Alzheimer Disease')

example_graph.add_decreases(mthfr_c677t, mthfr, citation=c2, evidence=e2, object_modifier=activity())
example_graph.add_decreases(mthfr_a1298c, mthfr, citation=c2, evidence=e2, object_modifier=activity())
example_graph.add_negative_correlation(mthfr_c677t, folic_acid, citation=c2, evidence=e2)
example_graph.add_positive_correlation(mthfr_c677t, alzheimer_disease, citation=c2, evidence=e2)

c3 = '17948130'
e3 = 'A polymorphism in the NDUFB6 promoter region that creates a possible DNA methylation site (rs629566, A/G) was ' \
     'associated with a decline in muscle NDUFB6 expression with age. Although young subjects with the rs629566 G/G ' \
     'genotype exhibited higher muscle NDUFB6 expression, this genotype was associated with reduced expression in' \
     ' elderly subjects. This was subsequently explained by the finding of increased DNA methylation in the promoter ' \
     'of elderly, but not young, subjects carrying the rs629566 G/G genotype. Furthermore, the degree of DNA' \
Example #3
0
g(HGNC:MTHFR,sub(A,1298,C)) =| p(HGNC:MTHFR)
g(HGNC:MTHFR,sub(C,677,T)) neg a(CHEBI:"folic acid")
g(HGNC:MTHFR,sub(C,677,T)) pos path(MESH:"Alzheimer Disease")
"""

c2 = '21119889'
e2 = "Two common MTHFR polymorphisms, namely 677C>T (Ala222Val) and 1298A>C (Glu429Ala), are known to reduce MTHFR activity. \
It has been shown that the MTHFR 677T allele is associated with increased total plasma Hcy levels (tHcy) and decreased serum folate levels, mainly in 677TT homozygous subjects.\
the MTHFR 677C>T polymorphism as a candidate AD risk factor"

e2 = str(hash(e2))

mthfr = Protein(namespace='hgnc', name='MTHFR')
mthfr_c677t = Protein(namespace='hgnc',
                      name='MTHFR',
                      variants=[protein_substitution('Ala', 222, 'Val')])
mthfr_a1298c = Protein(namespace='hgnc',
                       name='MTHFR',
                       variants=[protein_substitution('Glu', 429, 'Ala')])
folic_acid = abundance('CHEBI', 'folic acid')
alzheimer_disease = pathology('MESH', 'Alzheimer Disease')

example_graph.add_decreases(mthfr_c677t,
                            mthfr,
                            citation=c2,
                            evidence=e2,
                            object_modifier=activity())
example_graph.add_decreases(mthfr_a1298c,
                            mthfr,
                            citation=c2,
                            evidence=e2,
Example #4
0
 def get_protein_substitution(self):
     return protein_substitution(self.from_aa, self.position, self.to_aa)