def test_alignment_conversion(): path = os.path.join(data_dir("sequence"), "alignment.fasta") file = fasta.FastaFile.read(path) alignment = fasta.get_alignment(file) assert str(alignment) == ("ADTRCGTARDCGTR-DRTCGRAGD\n" "ADTRCGT---CGTRADRTCGRAGD\n" "ADTRCGTARDCGTRADR--GRAGD") file2 = fasta.FastaFile() fasta.set_alignment(file2, alignment, seq_names=["seq1", "seq2", "seq3"]) alignment2 = fasta.get_alignment(file2) assert str(alignment) == str(alignment2)
def show_example(ax, colors): fasta_file = fasta.FastaFile.read(EXAMPLE_FILE_NAME) alignment = fasta.get_alignment(fasta_file) alignment = alignment[:60] graphics.plot_alignment_type_based(ax, alignment, spacing=2.0, symbols_per_line=len(alignment), color_scheme=colors)