Ejemplo n.º 1
0
    def test_to_xml(self):
        """test the xml serialization method"""
        pssm = [[0.1, 0.3, 0.4, 0.2], [0.5, 0.1, 0.1, 0.3],
                [0.2, 0.4, 0.3, 0.1]]
        foo = Motif()
        for attr in AcceptanceTests._ATTRIBUTES:
            setattr(foo, attr, '5')
        foo.symbols = ["Runx3", "Ahr"]
        foo.entrezs = ["25690", "11622", "196"]
        foo.refseqs = ["NM_013464", "NM_001621"]
        foo.antisense = True
        foo.setpssm(pssm)

        xml_str = foo.to_xml(print_non_schema=True)
        dom = parseString(xml_str)
        #verify the output
        #PUNT--i'm not up for it right now
        self.assertTrue(True)
Ejemplo n.º 2
0
    def test_from_xml(self):
        """test the xml motif parser; goodMotif.xml should equal foo"""
        pssm = [[0.1, 0.3, 0.4, 0.2], [0.5, 0.1, 0.1, 0.3],
                [0.2, 0.4, 0.3, 0.1]]
        foo = Motif()
        for attr in AcceptanceTests._ATTRIBUTES:
            setattr(foo, attr, '5')
        foo.id = "5"
        foo.symbols = ["Runx3", "Ahr"]
        foo.entrezs = ["25690", "11622", "196"]
        foo.refseqs = ["NM_013464", "NM_001621"]
        foo.antisense = True
        foo.setpssm(pssm)
        #print foo

        dom = parse('fixtures/goodMotif.xml')
        #print dom.documentElement.tagName
        bar = Motif.from_xml(dom.documentElement)
        #print bar
        self.assertTrue(foo.equals(bar))
Ejemplo n.º 3
0
    def test_from_xml2(self):
        """test the xml motif parser w/o reading from file--use to_xml"""
        pssm = [[0.1, 0.3, 0.4, 0.2], [0.5, 0.1, 0.1, 0.3],
                [0.2, 0.4, 0.3, 0.1]]
        foo = Motif()
        foo.id = "19"
        foo.symbols = ["Runx3", "Ahr"]
        foo.entrezs = ["25690", "11622", "196"]
        foo.refseqs = ["NM_013464", "NM_001621"]
        foo.antisense = True
        foo.setpssm(pssm)
        #print foo

        fuz = foo.to_xml()
        #print fuz
        dom = parseString(fuz)
        bar = Motif.from_xml(dom.documentElement)
        #print bar
        #print "%s, %s" % (foo.id, bar.id)
        #print foo.id == bar.id
        self.assertTrue(foo.equals(bar))