def test_equals(self): """Tests the motif.equals fn""" foo = Motif() bar = Motif() foo.id = 'M00134' bar.id = 'M00134' self.assertTrue(foo.equals(bar)) self.assertTrue(foo.equals(foo))
def test_from_xml_optional_attr(self): """Test that a motif with none of the optional attributes is read in correctly""" 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 = "5" dom = parse('fixtures/goodMotifOpt.xml') #print dom.documentElement.tagName bar = Motif.from_xml(dom.documentElement) #print bar self.assertTrue(foo.equals(bar))
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))
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))
def test_not_equals(self): """Tests the motif.equals fn""" foo = Motif() bar = Motif() foo.id = 'M00134' self.assertFalse(foo.equals(bar))