def get_seq_position_info(alignment): 
    """
    Get information for each position of the alignment.
    Output is in list format, with each index corresponding to the 0-based position
    of the alignment. 
    Each index contains dictionary with following information: 
    pos - position number
    accessions - the accessions represented at that position
    bases - base calls in corresponding order of accessions
    seqs_rep - number of accessions represented at that position
    p_seq_rep - percentage of accessions represented at that position
    """
    def get_sequence_regions(alignment): 
        """
        Identify the regions that each accession spans on the alignment.
        Algorithm: 
        1) From beginning of sequence, keep going until position is not '-',
           then record the position as the start of the region
        2) From the end of the sequence, go in reverse until position is not '-',
           then record the position as the end of the region
        3) Return tuple --> (accession, start, end)
        """
        def get_sequence_region(accession): 
            #Variables
            f_start = False
            f_end = False
            start = 0
            end = 0
            #Data from SeqRecord object 
            sequence = accession.seq
            acc = (accession.id).split('.')[0]
            #From beginning of the sequence, keep going until position is not '-'
            i = 0
            while (f_start is False): 
                if sequence[i] != '-': 
                    start = i
                    f_start = True
                i = i + 1
            #From ending of the sequence, keep going until position is not '-'
            i = -1
            while (f_end is False): 
                if sequence[i] != '-':
                    end = i%len(sequence) #Translate negative index to positive index
                    f_end = True
                i = i - 1
            return ((acc, start, end))
        sequence_regions = []
        for accession in alignment: 
            sequence_regions.append(get_sequence_region(accession))
        return sequence_regions
    def get_contributing_seqs(position, list_seq_region):
        """
        Given a position and the list of sequence regions for each accession,
        identify which accessions are represented
        """
        list_accession = []
        list_indices = []
        for sequence in list_seq_region:
            if (position >= sequence[1]) and (position <= sequence[2]): 
                list_accession.append(sequence[0])
                list_indices.append(list_seq_region.index(sequence))
        return list_accession, list_indices
    list_seq_position_info = []
    #Get sequence regions
    list_seq_regions = get_sequence_regions(alignment)
    num_accessions = len(alignment)
    for position in range(alignment.get_alignment_length()):
        list_accessions, list_indices = get_contributing_seqs(position, list_seq_regions)
        list_bases = []
        #Append the basecalls of every contributing sequence at specified position
        for index in list_indices: 
            list_bases.append(alignment[index].seq[position])
        position_info = {
            'pos':position,
            'accessions':tuple(list_accessions),
            'bases':tuple(list_bases),
            'seqs_rep':len(list_accessions),
            'p_seq_rep':len(list_accessions)/num_accessions,
        }
        list_seq_position_info.append(position_info)
    return list_seq_position_info