def testReadingAndWritingCharMatrix(self): dna1 = datagen.reference_dna_matrix() output_path = pathmap.named_output_path( filename="roundtrip_test.fasta", suffix_timestamp=True) dna1.write_to_path(output_path, 'fasta') dna2 = dendropy.DnaCharacterMatrix.get_from_path(output_path, 'fasta') self.assertDistinctButEqual(dna1, dna2)
def testWriteTreeListSameTaxa(self): output_path = pathmap.named_output_path(filename="reference.trees.out.newick", suffix_timestamp=True) self.ref_tree_list.write_to_path(output_path, schema="newick") t_tree_list = dendropy.TreeList.get_from_path(output_path, "newick", taxon_set=self.ref_tree_list.taxon_set) self.assertDistinctButEqualTreeList( self.ref_tree_list, t_tree_list, distinct_taxa=False, equal_oids=None)
def testWriteTreeListDistinctTaxa(self): ref_tree_list = datagen.reference_tree_list() output_path = pathmap.named_output_path(filename="reference.trees.out.nexus", suffix_timestamp=True) ref_tree_list.write_to_path(output_path, "nexus") t_tree_list = dendropy.TreeList.get_from_path(output_path, "nexus") self.assertDistinctButEqualTreeList( ref_tree_list, t_tree_list, distinct_taxa=True, equal_oids=None)
def testWriteTreeListSameTaxa(self): output_path = pathmap.named_output_path( filename="reference.trees.out.newick", suffix_timestamp=True) self.ref_tree_list.write_to_path(output_path, schema="newick") t_tree_list = dendropy.TreeList.get_from_path( output_path, "newick", taxon_set=self.ref_tree_list.taxon_set) self.assertDistinctButEqualTreeList(self.ref_tree_list, t_tree_list, distinct_taxa=False, equal_oids=None)
def testWriteTreeListDistinctTaxa(self): ref_tree_list = datagen.reference_tree_list() output_path = pathmap.named_output_path( filename="reference.trees.out.nexus", suffix_timestamp=True) ref_tree_list.write_to_path(output_path, "nexus") t_tree_list = dendropy.TreeList.get_from_path(output_path, "nexus") self.assertDistinctButEqualTreeList(ref_tree_list, t_tree_list, distinct_taxa=True, equal_oids=None)
def testDnaRountTripDistinctTaxa(self): c1 = datagen.reference_dna_matrix() path = pathmap.named_output_path("char_rw_dna.nex") c1.write_to_path(path, "nexus") c2 = dendropy.DnaCharacterMatrix.get_from_path(path, "nexus") self.assertDistinctButEqual(c1, c2, char_type=dendropy.DnaCharacterMatrix, distinct_state_alphabets=False, distinct_taxa=True)
def testStandardRountTripSameTaxa(self): c1 = datagen.reference_standard_matrix() path = pathmap.named_output_path("char_rw_dna.nex") c1.write_to_path(path, "nexus") c2 = dendropy.StandardCharacterMatrix.get_from_path( path, "nexus", taxon_set=c1.taxon_set) self.assertDistinctButEqual(c1, c2, char_type=dendropy.StandardCharacterMatrix, distinct_state_alphabets=None, distinct_taxa=False)
def testStandardRountTripSameTaxa(self): c1 = datagen.reference_standard_matrix() path = pathmap.named_output_path("char_rw_dna.nex") c1.write_to_path(path, "nexus") c2 = dendropy.StandardCharacterMatrix.get_from_path(path, "nexus", taxon_set=c1.taxon_set) self.assertDistinctButEqual( c1, c2, char_type=dendropy.StandardCharacterMatrix, distinct_state_alphabets=None, distinct_taxa=False)
def testDnaRountTripDistinctTaxa(self): c1 = datagen.reference_dna_matrix() path = pathmap.named_output_path("char_rw_dna.nex") c1.write_to_path(path, "nexus") c2 = dendropy.DnaCharacterMatrix.get_from_path(path, "nexus") self.assertDistinctButEqual( c1, c2, char_type=dendropy.DnaCharacterMatrix, distinct_state_alphabets=False, distinct_taxa=True)
def testStandardRountTripDistinctTaxa(self): c1 = datagen.reference_standard_matrix() path = pathmap.named_output_path("char_rw_dna.nex") c1.write_to_path(path, "nexus") c2 = dendropy.StandardCharacterMatrix.get_from_stream( open(path, "rU"), "nexus") self.assertDistinctButEqual(c1, c2, char_type=dendropy.StandardCharacterMatrix, distinct_state_alphabets=None, distinct_taxa=True, ignore_chartypes=True)
def testStandardRountTripDistinctTaxa(self): c1 = datagen.reference_standard_matrix() path = pathmap.named_output_path("char_rw_dna.nex") c1.write_to_path(path, "nexus") c2 = dendropy.StandardCharacterMatrix.get_from_stream(open(path, "rU"), "nexus") self.assertDistinctButEqual( c1, c2, char_type=dendropy.StandardCharacterMatrix, distinct_state_alphabets=None, distinct_taxa=True, ignore_chartypes=True)
def setUp(self): self.reference_dataset = datagen.reference_single_taxonset_dataset() self.data_path = pathmap.named_output_path("char_read.nex") self.reference_dataset.write_to_path(self.data_path, "nexus")
def testReadingAndWritingCharMatrix(self): dna1 = datagen.reference_dna_matrix() output_path = pathmap.named_output_path(filename="roundtrip_test.fasta", suffix_timestamp=True) dna1.write_to_path(output_path, 'fasta') dna2 = dendropy.DnaCharacterMatrix.get_from_path(output_path, 'fasta') self.assertDistinctButEqual(dna1, dna2)