예제 #1
0
 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
예제 #2
0
 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')
예제 #3
0
 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')
예제 #4
0
 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
예제 #5
0
 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
예제 #6
0
 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
예제 #7
0
 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
예제 #8
0
 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
예제 #9
0
 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
예제 #10
0
 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
예제 #11
0
 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
예제 #12
0
 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