예제 #1
0
def alignment_to_partials(alignment, missing_data=None):
    """ Generate a partials dictionary from a treeCl.Alignment """
    partials_dict = {}
    for (name, sequence) in alignment.get_sequences():
        datatype = 'dna' if alignment.is_dna() else 'protein'
        partials_dict[name] = seq_to_partials(sequence, datatype)

    if missing_data is not None:
        l = len(alignment)
        for name in missing_data:
            if name not in partials_dict:
                partials_dict[name] = seq_to_partials('-'*l, datatype)
    return partials_dict
예제 #2
0
def biopython_to_partials(alignment, datatype):
    """ Generate a partials dictionary from a treeCl.Alignment """
    partials_dict = {}
    for seq in alignment:
        partials_dict[seq.name] = seq_to_partials(seq, datatype)
    return partials_dict