def testBoundTaxonNamespaceDefault(self):
     d = dendropy.DataSet()
     t = dendropy.TaxonNamespace()
     d.attach_taxon_namespace(t)
     self.assertEqual(len(d.taxon_namespaces), 1)
     self.assertIs(d.taxon_namespaces[0], d.attached_taxon_namespace)
     d.read(path=pathmap.mixed_source_path(
         'reference_single_taxonset_dataset.nex'),
            schema="nexus")
     self.assertEqual(len(d.taxon_namespaces), 1)
     self.assertEqual(len(d.taxon_namespaces[0]), 33)
     d.read(path=pathmap.tree_source_path('pythonidae.mle.nex'),
            schema="nexus")
     self.assertEqual(len(d.taxon_namespaces), 1)
     self.assertEqual(len(d.taxon_namespaces[0]), 33)
     d.read(
         path=pathmap.tree_source_path('pythonidae.reference-trees.newick'),
         schema="newick")
     self.assertEqual(len(d.taxon_namespaces), 1)
     self.assertEqual(len(d.taxon_namespaces[0]), 33)
     d.read(path=pathmap.char_source_path('caenophidia_mos.chars.fasta'),
            schema="fasta",
            data_type="protein")
     self.assertEqual(len(d.taxon_namespaces), 1)
     self.assertEqual(len(d.taxon_namespaces[0]), 147)
 def testBindAndUnbind(self):
     d = dendropy.DataSet(attach_taxon_set=True)
     self.assertEqual(len(d.taxon_sets), 1)
     self.assertIs(d.taxon_sets[0], d.attached_taxon_set)
     d.read_from_path(
         pathmap.mixed_source_path('reference_single_taxonset_dataset.nex'),
         "nexus")
     _LOG.info(d.taxon_sets[0].description(2))
     self.assertEqual(len(d.taxon_sets[0]), 33)
     d.read_from_path(pathmap.tree_source_path('pythonidae.mle.nex'),
                      "nexus")
     self.assertEqual(len(d.taxon_sets), 1)
     self.assertEqual(len(d.taxon_sets[0]), 33)
     d.read_from_path(
         pathmap.tree_source_path('pythonidae.reference-trees.newick'),
         "newick")
     self.assertEqual(len(d.taxon_sets), 1)
     self.assertEqual(len(d.taxon_sets[0]), 33)
     d.detach_taxon_set()
     d.read_from_path(
         pathmap.char_source_path('caenophidia_mos.chars.fasta'),
         "proteinfasta")
     self.assertEqual(len(d.taxon_sets), 2)
     self.assertEqual(len(d.taxon_sets[0]), 33)
     self.assertEqual(len(d.taxon_sets[1]), 114)
 def testAttachTaxonNamespaceOnGet(self):
     t = dendropy.TaxonNamespace()
     d = dendropy.DataSet.get_from_path(
         pathmap.mixed_source_path('reference_single_taxonset_dataset.nex'),
         "nexus",
         taxon_namespace=t)
     self.assertEqual(len(d.taxon_namespaces), 1)
     self.assertIsNot(d.attached_taxon_namespace, None)
     self.assertIs(d.taxon_namespaces[0], d.attached_taxon_namespace)
     self.assertIs(d.attached_taxon_namespace, t)
     self.assertEqual(len(d.taxon_namespaces[0]), 33)
     d.read(path=pathmap.tree_source_path('pythonidae.mle.nex'),
            schema="nexus")
     self.assertEqual(len(d.taxon_namespaces), 1)
     self.assertEqual(len(d.taxon_namespaces[0]), 33)
     d.read(
         path=pathmap.tree_source_path('pythonidae.reference-trees.newick'),
         schema="newick")
     self.assertEqual(len(d.taxon_namespaces), 1)
     self.assertEqual(len(d.taxon_namespaces[0]), 33)
     d.detach_taxon_namespace()
     d.read_from_path(
         pathmap.char_source_path('caenophidia_mos.chars.fasta'),
         schema="fasta",
         data_type="protein")
     self.assertEqual(len(d.taxon_namespaces), 2)
     self.assertEqual(len(d.taxon_namespaces[0]), 33)
     self.assertEqual(len(d.taxon_namespaces[1]), 114)
 def test_attached_taxon_namespace(self):
     tns = dendropy.TaxonNamespace()
     ds = dendropy.DataSet.get_from_path(
         pathmap.mixed_source_path('multitaxa_mesquite.nex'),
         "nexus",
         taxon_namespace=tns)
     self.verify_attached_taxon_namespace(ds, tns)
 def test_attached_taxon_namespace(self):
     d0 = dendropy.DataSet.get_from_path(pathmap.mixed_source_path("multitaxa_mesquite.nex"), "nexus")
     for tns in d0.taxon_namespaces:
         d0.attach_taxon_namespace(tns)
         s = self.write_out_validate_equal_and_return(d0, "nexus", {})
         ds = dendropy.DataSet.get_from_string(s, "nexus")
         self.verify_attached_taxon_namespace_written(ds, tns)
 def testBindToSpecifiedTaxonSet(self):
     d = dendropy.DataSet()
     t = dendropy.TaxonSet()
     d.attach_taxon_set(t)
     self.assertEqual(len(d.taxon_sets), 1)
     self.assertIs(d.taxon_sets[0], d.attached_taxon_set)
     self.assertIs(d.attached_taxon_set, t)
     d.read_from_path(
         pathmap.mixed_source_path('reference_single_taxonset_dataset.nex'),
         "nexus")
     self.assertEqual(len(d.taxon_sets), 1)
     self.assertEqual(len(d.taxon_sets[0]), 33)
     d.read_from_path(pathmap.tree_source_path('pythonidae.mle.nex'),
                      "nexus")
     self.assertEqual(len(d.taxon_sets), 1)
     self.assertEqual(len(d.taxon_sets[0]), 33)
     d.read_from_path(
         pathmap.tree_source_path('pythonidae.reference-trees.newick'),
         "newick")
     self.assertEqual(len(d.taxon_sets), 1)
     self.assertEqual(len(d.taxon_sets[0]), 33)
     d.detach_taxon_set()
     d.read_from_path(
         pathmap.char_source_path('caenophidia_mos.chars.fasta'),
         "proteinfasta")
     self.assertEqual(len(d.taxon_sets), 2)
     self.assertEqual(len(d.taxon_sets[0]), 33)
     self.assertEqual(len(d.taxon_sets[1]), 114)
 def test_attached_taxon_namespace(self):
     tns = dendropy.TaxonNamespace()
     ds = dendropy.DataSet.get_from_path(
             pathmap.mixed_source_path('multitaxa_mesquite.nex'),
             "nexus",
             taxon_namespace=tns)
     self.verify_attached_taxon_namespace(ds, tns)
 def test_basic_get(self):
     src_filename = "standard-test-mixed.1.basic.nexus"
     src_path = pathmap.mixed_source_path(src_filename)
     ds = dendropy.DataSet.get_from_path(
             src_path,
             "nexus",
             suppress_internal_node_taxa=False, # so internal labels get translated
             )
     self.verify_dataset(ds)
Esempio n. 9
0
 def test_default(self):
     d0 = dendropy.DataSet.get_from_path(
         pathmap.mixed_source_path('multitaxa_mesquite.nex'), "nexus")
     s = self.write_out_validate_equal_and_return(d0, "nexus", {})
     ds = dendropy.DataSet.get_from_string(
         s,
         "nexus",
     )
     self.verify_unrestricted(ds)
 def test_basic_get(self):
     src_filename = "standard-test-mixed.1.basic.nexus"
     src_path = pathmap.mixed_source_path(src_filename)
     ds = dendropy.DataSet.get_from_path(
         src_path,
         "nexus",
         suppress_internal_node_taxa=
         False,  # so internal labels get translated
     )
     self.verify_dataset(ds)
 def test_basic_read(self):
     src_filename = "standard-test-mixed.1.basic.nexus"
     src_path = pathmap.mixed_source_path(src_filename)
     ds = dendropy.DataSet()
     result = ds.read(
             path=src_path,
             schema="nexus",
             suppress_internal_node_taxa=False, # so internal labels get translated
             )
     self.assertEqual(result, (1, 7, 4))
     self.verify_dataset(ds)
Esempio n. 12
0
 def test_attached_taxon_namespace(self):
     d0 = dendropy.DataSet.get_from_path(
         pathmap.mixed_source_path('multitaxa_mesquite.nex'), "nexus")
     for tns in d0.taxon_namespaces:
         d0.attach_taxon_namespace(tns)
         s = self.write_out_validate_equal_and_return(d0, "nexus", {})
         ds = dendropy.DataSet.get_from_string(
             s,
             "nexus",
         )
         self.verify_attached_taxon_namespace_written(ds, tns)
 def test_basic_read(self):
     src_filename = "standard-test-mixed.1.basic.nexus"
     src_path = pathmap.mixed_source_path(src_filename)
     ds = dendropy.DataSet()
     result = ds.read(
         path=src_path,
         schema="nexus",
         suppress_internal_node_taxa=
         False,  # so internal labels get translated
     )
     self.assertEqual(result, (1, 7, 4))
     self.verify_dataset(ds)
 def testMultiTaxonNamespace(self):
     d = dendropy.DataSet()
     d.read(path=pathmap.mixed_source_path('reference_single_taxonset_dataset.nex'), schema="nexus")
     self.assertEqual(len(d.taxon_namespaces), 1)
     self.assertEqual(len(d.taxon_namespaces[0]), 33)
     d.read(path=pathmap.tree_source_path('pythonidae.mle.nex'), schema="nexus")
     self.assertEqual(len(d.taxon_namespaces), 2)
     self.assertEqual(len(d.taxon_namespaces[1]), 33)
     d.read(path=pathmap.tree_source_path('pythonidae.reference-trees.newick'), schema="newick")
     self.assertEqual(len(d.taxon_namespaces), 3)
     self.assertEqual(len(d.taxon_namespaces[2]), 33)
     d.read(path=pathmap.char_source_path('caenophidia_mos.chars.fasta'), schema="fasta", data_type="protein")
     self.assertEqual(len(d.taxon_namespaces), 4)
     self.assertEqual(len(d.taxon_namespaces[3]), 114)
 def testMultiTaxonSet(self):
     d = dendropy.DataSet()
     d.read_from_path(pathmap.mixed_source_path('reference_single_taxonset_dataset.nex'), "nexus")
     self.assertEqual(len(d.taxon_sets), 1)
     self.assertEqual(len(d.taxon_sets[0]), 33)
     d.read_from_path(pathmap.tree_source_path('pythonidae.mle.nex'), "nexus")
     self.assertEqual(len(d.taxon_sets), 2)
     self.assertEqual(len(d.taxon_sets[1]), 33)
     d.read_from_path(pathmap.tree_source_path('pythonidae.reference-trees.newick'), "newick")
     self.assertEqual(len(d.taxon_sets), 3)
     self.assertEqual(len(d.taxon_sets[2]), 33)
     d.read_from_path(pathmap.char_source_path('caenophidia_mos.chars.fasta'), "proteinfasta")
     self.assertEqual(len(d.taxon_sets), 4)
     self.assertEqual(len(d.taxon_sets[3]), 114)
 def testBoundTaxonSetDefault(self):
     d = dendropy.DataSet(attach_taxon_set=True)
     self.assertEqual(len(d.taxon_sets), 1)
     self.assertIs(d.taxon_sets[0], d.attached_taxon_set)
     d.read_from_path(pathmap.mixed_source_path('reference_single_taxonset_dataset.nex'), "nexus")
     self.assertEqual(len(d.taxon_sets), 1)
     self.assertEqual(len(d.taxon_sets[0]), 33)
     d.read_from_path(pathmap.tree_source_path('pythonidae.mle.nex'), "nexus")
     self.assertEqual(len(d.taxon_sets), 1)
     self.assertEqual(len(d.taxon_sets[0]), 33)
     d.read_from_path(pathmap.tree_source_path('pythonidae.reference-trees.newick'), "newick")
     self.assertEqual(len(d.taxon_sets), 1)
     self.assertEqual(len(d.taxon_sets[0]), 33)
     d.read_from_path(pathmap.char_source_path('caenophidia_mos.chars.fasta'), "proteinfasta")
     self.assertEqual(len(d.taxon_sets), 1)
     self.assertEqual(len(d.taxon_sets[0]), 147)
 def testBoundTaxonNamespaceDefault(self):
     d = dendropy.DataSet()
     t = dendropy.TaxonNamespace()
     d.attach_taxon_namespace(t)
     self.assertEqual(len(d.taxon_namespaces), 1)
     self.assertIs(d.taxon_namespaces[0], d.attached_taxon_namespace)
     d.read(path=pathmap.mixed_source_path('reference_single_taxonset_dataset.nex'), schema="nexus")
     self.assertEqual(len(d.taxon_namespaces), 1)
     self.assertEqual(len(d.taxon_namespaces[0]), 33)
     d.read(path=pathmap.tree_source_path('pythonidae.mle.nex'), schema="nexus")
     self.assertEqual(len(d.taxon_namespaces), 1)
     self.assertEqual(len(d.taxon_namespaces[0]), 33)
     d.read(path=pathmap.tree_source_path('pythonidae.reference-trees.newick'), schema="newick")
     self.assertEqual(len(d.taxon_namespaces), 1)
     self.assertEqual(len(d.taxon_namespaces[0]), 33)
     d.read(path=pathmap.char_source_path('caenophidia_mos.chars.fasta'), schema="fasta", data_type="protein")
     self.assertEqual(len(d.taxon_namespaces), 1)
     self.assertEqual(len(d.taxon_namespaces[0]), 147)
 def testBindAndUnbind(self):
     d = dendropy.DataSet(attach_taxon_set=True)
     self.assertEqual(len(d.taxon_sets), 1)
     self.assertIs(d.taxon_sets[0], d.attached_taxon_set)
     d.read_from_path(pathmap.mixed_source_path('reference_single_taxonset_dataset.nex'), "nexus")
     _LOG.info(d.taxon_sets[0].description(2))
     self.assertEqual(len(d.taxon_sets[0]), 33)
     d.read_from_path(pathmap.tree_source_path('pythonidae.mle.nex'), "nexus")
     self.assertEqual(len(d.taxon_sets), 1)
     self.assertEqual(len(d.taxon_sets[0]), 33)
     d.read_from_path(pathmap.tree_source_path('pythonidae.reference-trees.newick'), "newick")
     self.assertEqual(len(d.taxon_sets), 1)
     self.assertEqual(len(d.taxon_sets[0]), 33)
     d.detach_taxon_set()
     d.read_from_path(pathmap.char_source_path('caenophidia_mos.chars.fasta'), "proteinfasta")
     self.assertEqual(len(d.taxon_sets), 2)
     self.assertEqual(len(d.taxon_sets[0]), 33)
     self.assertEqual(len(d.taxon_sets[1]), 114)
 def testBindToSpecifiedTaxonSet(self):
     d = dendropy.DataSet()
     t = dendropy.TaxonSet()
     d.attach_taxon_set(t)
     self.assertEqual(len(d.taxon_sets), 1)
     self.assertIs(d.taxon_sets[0], d.attached_taxon_set)
     self.assertIs(d.attached_taxon_set, t)
     d.read_from_path(pathmap.mixed_source_path('reference_single_taxonset_dataset.nex'), "nexus")
     self.assertEqual(len(d.taxon_sets), 1)
     self.assertEqual(len(d.taxon_sets[0]), 33)
     d.read_from_path(pathmap.tree_source_path('pythonidae.mle.nex'), "nexus")
     self.assertEqual(len(d.taxon_sets), 1)
     self.assertEqual(len(d.taxon_sets[0]), 33)
     d.read_from_path(pathmap.tree_source_path('pythonidae.reference-trees.newick'), "newick")
     self.assertEqual(len(d.taxon_sets), 1)
     self.assertEqual(len(d.taxon_sets[0]), 33)
     d.detach_taxon_set()
     d.read_from_path(pathmap.char_source_path('caenophidia_mos.chars.fasta'), "proteinfasta")
     self.assertEqual(len(d.taxon_sets), 2)
     self.assertEqual(len(d.taxon_sets[0]), 33)
     self.assertEqual(len(d.taxon_sets[1]), 114)
 def testMultiTaxonNamespace(self):
     d = dendropy.DataSet()
     d.read(path=pathmap.mixed_source_path(
         'reference_single_taxonset_dataset.nex'),
            schema="nexus")
     self.assertEqual(len(d.taxon_namespaces), 1)
     self.assertEqual(len(d.taxon_namespaces[0]), 33)
     d.read(path=pathmap.tree_source_path('pythonidae.mle.nex'),
            schema="nexus")
     self.assertEqual(len(d.taxon_namespaces), 2)
     self.assertEqual(len(d.taxon_namespaces[1]), 33)
     d.read(
         path=pathmap.tree_source_path('pythonidae.reference-trees.newick'),
         schema="newick")
     self.assertEqual(len(d.taxon_namespaces), 3)
     self.assertEqual(len(d.taxon_namespaces[2]), 33)
     d.read(path=pathmap.char_source_path('caenophidia_mos.chars.fasta'),
            schema="fasta",
            data_type="protein")
     self.assertEqual(len(d.taxon_namespaces), 4)
     self.assertEqual(len(d.taxon_namespaces[3]), 114)
 def testAttachTaxonNamespaceOnGet(self):
     t = dendropy.TaxonNamespace()
     d = dendropy.DataSet.get_from_path(pathmap.mixed_source_path('reference_single_taxonset_dataset.nex'),
             "nexus",
             taxon_namespace=t)
     self.assertEqual(len(d.taxon_namespaces), 1)
     self.assertIsNot(d.attached_taxon_namespace, None)
     self.assertIs(d.taxon_namespaces[0], d.attached_taxon_namespace)
     self.assertIs(d.attached_taxon_namespace, t)
     self.assertEqual(len(d.taxon_namespaces[0]), 33)
     d.read(path=pathmap.tree_source_path('pythonidae.mle.nex'), schema="nexus")
     self.assertEqual(len(d.taxon_namespaces), 1)
     self.assertEqual(len(d.taxon_namespaces[0]), 33)
     d.read(path=pathmap.tree_source_path('pythonidae.reference-trees.newick'), schema="newick")
     self.assertEqual(len(d.taxon_namespaces), 1)
     self.assertEqual(len(d.taxon_namespaces[0]), 33)
     d.detach_taxon_namespace()
     d.read_from_path(pathmap.char_source_path('caenophidia_mos.chars.fasta'), schema="fasta", data_type="protein")
     self.assertEqual(len(d.taxon_namespaces), 2)
     self.assertEqual(len(d.taxon_namespaces[0]), 33)
     self.assertEqual(len(d.taxon_namespaces[1]), 114)
 def testMultiTaxonSet(self):
     d = dendropy.DataSet()
     d.read_from_path(
         pathmap.mixed_source_path('reference_single_taxonset_dataset.nex'),
         "nexus")
     self.assertEqual(len(d.taxon_sets), 1)
     self.assertEqual(len(d.taxon_sets[0]), 33)
     d.read_from_path(pathmap.tree_source_path('pythonidae.mle.nex'),
                      "nexus")
     self.assertEqual(len(d.taxon_sets), 2)
     self.assertEqual(len(d.taxon_sets[1]), 33)
     d.read_from_path(
         pathmap.tree_source_path('pythonidae.reference-trees.newick'),
         "newick")
     self.assertEqual(len(d.taxon_sets), 3)
     self.assertEqual(len(d.taxon_sets[2]), 33)
     d.read_from_path(
         pathmap.char_source_path('caenophidia_mos.chars.fasta'),
         "proteinfasta")
     self.assertEqual(len(d.taxon_sets), 4)
     self.assertEqual(len(d.taxon_sets[3]), 114)
 def testBoundTaxonSetDefault(self):
     d = dendropy.DataSet(attach_taxon_set=True)
     self.assertEqual(len(d.taxon_sets), 1)
     self.assertIs(d.taxon_sets[0], d.attached_taxon_set)
     d.read_from_path(
         pathmap.mixed_source_path('reference_single_taxonset_dataset.nex'),
         "nexus")
     self.assertEqual(len(d.taxon_sets), 1)
     self.assertEqual(len(d.taxon_sets[0]), 33)
     d.read_from_path(pathmap.tree_source_path('pythonidae.mle.nex'),
                      "nexus")
     self.assertEqual(len(d.taxon_sets), 1)
     self.assertEqual(len(d.taxon_sets[0]), 33)
     d.read_from_path(
         pathmap.tree_source_path('pythonidae.reference-trees.newick'),
         "newick")
     self.assertEqual(len(d.taxon_sets), 1)
     self.assertEqual(len(d.taxon_sets[0]), 33)
     d.read_from_path(
         pathmap.char_source_path('caenophidia_mos.chars.fasta'),
         "proteinfasta")
     self.assertEqual(len(d.taxon_sets), 1)
     self.assertEqual(len(d.taxon_sets[0]), 147)
 def test_default(self):
     d0 = dendropy.DataSet.get_from_path(pathmap.mixed_source_path("multitaxa_mesquite.nex"), "nexus")
     s = self.write_out_validate_equal_and_return(d0, "nexus", {})
     ds = dendropy.DataSet.get_from_string(s, "nexus")
     self.verify_unrestricted(ds)
Esempio n. 25
0
 def get_source_dataset(self, **kwargs):
     src_ds = dendropy.DataSet.get_from_path(
         pathmap.mixed_source_path("standard-test-mixed.1.basic.nexus"),
         "nexus", **kwargs)
     return src_ds
 def testFromPathFactory(self):
     ds2 = dendropy.DataSet.get_from_path(
         pathmap.mixed_source_path('reference_single_taxonset_dataset.nex'),
         "nexus")
     self.assertDistinctButEqual(self.dataset, ds2, ignore_chartypes=True)
 def test_default(self):
     ds = dendropy.DataSet.get_from_path(
             pathmap.mixed_source_path('multitaxa_mesquite.nex'),
             "nexus")
     self.verify_unrestricted(ds)
 def testFromPathFactory(self):
     ds2 = dendropy.DataSet.get_from_path(pathmap.mixed_source_path('reference_single_taxonset_dataset.nex'), "nexus")
     self.assertDistinctButEqual(self.dataset, ds2,
             ignore_chartypes=True)
 def test_default(self):
     ds = dendropy.DataSet.get_from_path(
         pathmap.mixed_source_path('multitaxa_mesquite.nex'), "nexus")
     self.verify_unrestricted(ds)
 def get_source_dataset(self, **kwargs):
     src_ds = dendropy.DataSet.get_from_path(
         pathmap.mixed_source_path("standard-test-mixed.1.basic.nexus"), "nexus", **kwargs
     )
     return src_ds