def testSubTreesConvViaPS(self): o = pathmap.nexson_obj('10/pg_10.json') ps = PhyloSchema('newick', content='subtree', content_id=('tree3', 'node508'), version='1.2.1') x = ps.serialize(o) self.assertTrue(x.startswith('(')) # pylint: disable=E1103 o = pathmap.nexson_obj('10/pg_10.json') ps = PhyloSchema('newick', content='subtree', content_id=('tree3', 'ingroup'), version='1.2.1') x = ps.serialize(o) self.assertTrue(x.startswith('(')) # pylint: disable=E1103
def testTreesCulledNonmatcingConvViaPS(self): o = pathmap.nexson_obj('9/v1.2.json') self.assertEqual(len(extract_tree_nexson(o, tree_id=None)), 2) ps = PhyloSchema('nexson', content='tree', content_id='tree2', version='1.2.1', cull_nonmatching='true') x = ps.serialize(o) etn = extract_tree_nexson(o, tree_id=None) self.assertEqual(len(etn), 1) self.assertEqual(etn[0][0], 'tree2') self.assertTrue(x.startswith('{')) # pylint: disable=E1103 rx = json.loads(x) etn = extract_tree_nexson(rx, tree_id=None) self.assertEqual(len(etn), 1) self.assertEqual(etn[0][0], 'tree2')
def testTreesCulledNonmatcingConvViaPSV0(self): """Verify that the culling does not break the conversion to other forms of NexSON""" o = pathmap.nexson_obj('9/v1.2.json') self.assertEqual(len(extract_tree_nexson(o, tree_id=None)), 2) ps = PhyloSchema('nexson', content='tree', content_id='tree2', version='0.0.0', cull_nonmatching='true') x = ps.serialize(o) etn = extract_tree_nexson(o, tree_id=None) self.assertEqual(len(etn), 1) self.assertEqual(etn[0][0], 'tree2') self.assertTrue(x.startswith('{')) # pylint: disable=E1103 rx = json.loads(x) self.assertEqual(detect_nexson_version(rx), '0.0.0') etn = extract_tree_nexson(rx, tree_id=None) self.assertEqual(len(etn), 1) self.assertEqual(etn[0][0], 'tree2')
def testNexmlConvByExtViaPS(self): o = pathmap.nexson_obj('10/pg_10.json') ps = PhyloSchema(type_ext='.nexml', otu_label='otttaxonname') nex = ps.serialize(o, src_schema=PhyloSchema('nexson', version='1.2.1')) self.assertTrue(nex.startswith('<')) # pylint: disable=E1103
def testNewickConvViaPS(self): o = pathmap.nexson_obj('10/pg_10.json') ps = PhyloSchema('newick', content='tree', content_id='tree3') nex = ps.serialize(o) self.assertTrue(nex.startswith('(')) # pylint: disable=E1103
def testNexusConvByExtViaPS(self): o = pathmap.nexson_obj('10/pg_10.json') ps = PhyloSchema(None, type_ext='.nex', content='tree', content_id='tree3') nex = ps.serialize(o) self.assertTrue(nex.startswith('#')) # pylint: disable=E1103
def testNexmlConvViaPS(self): o = pathmap.nexson_obj('10/pg_10.json') ps = PhyloSchema('nexml') nex = ps.serialize(o) self.assertTrue(nex.startswith('<')) # pylint: disable=E1103
def testOtuMapConvViaPS(self): o = pathmap.nexson_obj('10/pg_10.json') ps = PhyloSchema('nexson', content='otumap', version='1.2.1') x = ps.serialize(o) self.assertTrue(x.startswith('{')) # pylint: disable=E1103
def testOtuMapConvViaPS(self): o = pathmap.nexson_obj('10/pg_10.json') ps = PhyloSchema('nexson', content='otumap', version='1.2.1') x = ps.serialize(o) self.assertTrue(x.startswith('{')) #pylint: disable=E1103
def testNewickConvViaPS(self): o = pathmap.nexson_obj('10/pg_10.json') ps = PhyloSchema('newick', content='tree', content_id='tree3') nex = ps.serialize(o) self.assertTrue(nex.startswith('(')) #pylint: disable=E1103
def testNexmlConvViaPS(self): o = pathmap.nexson_obj('10/pg_10.json') ps = PhyloSchema('nexml') nex = ps.serialize(o) self.assertTrue(nex.startswith('<')) #pylint: disable=E1103
def testNexmlConvByExtViaPS(self): o = pathmap.nexson_obj('10/pg_10.json') ps = PhyloSchema(type_ext='.nexml', otu_label='otttaxonname') nex = ps.serialize(o, src_schema=PhyloSchema('nexson', version='1.2.1')) self.assertTrue(nex.startswith('<')) #pylint: disable=E1103