    def plot_alignment(freq, ma = @multiple_alignment)
      # get indeces of consensus in the multiple alignment
      consensus = get_consensus(ma[0..ma.length - 2])
      consensus_idxs = consensus.split(//).each_index.select { |j| isalpha(consensus[j]) }
      consensus_ranges = array_to_ranges(consensus_idxs)

      consensus_all = get_consensus(ma)
      consensus_all_idxs = consensus_all.split(//).each_index.select { |j| isalpha(consensus_all[j]) }
      consensus_all_ranges = array_to_ranges(consensus_all_idxs)

      match_alignment = ma[0..ma.length - 2].each_with_index.map { |seq, _j| seq.split(//).each_index.select { |j| isalpha(seq[j]) } }
      match_alignment_ranges = match_alignment.map { |e| array_to_ranges(e) }

      query_alignment = ma[ma.length - 1].split(//).each_index.select { |j| isalpha(ma[ma.length - 1][j]) }
      query_alignment_ranges = array_to_ranges(query_alignment)

      len = ma[0].length

      # plot statistical model
      data = freq.each_with_index.map { |h, j| { 'y' => ma.length, 'start' => j, 'stop' => j + 1, 'color' => 'orange', 'height' => h } } +
             # hits
             match_alignment_ranges.each_with_index.map { |ranges, j| ranges.map { |range| { 'y' => ma.length - j - 1, 'start' => range.first, 'stop' => range.last, 'color' => 'red', 'height' => -1 } } }.flatten +
             ma[0..ma.length - 2].each_with_index.map { |_seq, j| consensus_ranges.map { |range| { 'y' => j + 1, 'start' => range.first, 'stop' => range.last, 'color' => 'yellow', 'height' => -1 } } }.flatten +
             # plot prediction
             [{ 'y' => 0, 'start' => 0, 'stop' => len, 'color' => 'gray', 'height' => -1 }] +
             query_alignment_ranges.map { |range| { 'y' => 0, 'start' => range.first, 'stop' => range.last, 'color' => 'red', 'height' => -1 } }.flatten +

             # plot consensus
             consensus_all_ranges.map { |range| { 'y' => 0, 'start' => range.first, 'stop' => range.last, 'color' => 'yellow', 'height' => -1 } }.flatten

      y_axis_values = 'Prediction'
      (1..ma.length - 1).each { |i| y_axis_values << ", hit #{i}" }

      y_axis_values << ', Statistical Model'

      Plot.new(data,
               :align,
               'Missing/Extra sequences Validation: Multiple Align. &' \
               'Statistical model of hits',
               'Aligned Hit Sequence, red; Conserved Region, Yellow',
               'Offset in the Alignment',
               '',
               ma.length + 1,
               y_axis_values)
    end