code: public int convertToSeq1Position(int seq2Position) {
          int seq1p, seq2p = 0, prevSeq1p = 0, prevSeq2p = 0;
          boolean onInsertion;
  
          for (int mut : mutations) {
              seq1p = getPosition(mut);
              onInsertion = false;
  
              switch (mut & MUTATION_TYPE_MASK) {
                  case RAW_MUTATION_TYPE_DELETION:
                      --seq2p;
                      break;
                  case RAW_MUTATION_TYPE_INSERTION:
                      onInsertion = true;
                      --seq1p;
                      ++seq2p;
                      break;
              }
  
              seq2p += seq1p - prevSeq1p;
  
              if (seq2p == seq2Position && onInsertion)
                  return -1 - (seq2Position - prevSeq2p + prevSeq1p);
  
              if (seq2p >= seq2Position) {
                  return seq2Position - prevSeq2p + prevSeq1p;
              }
  
              prevSeq1p = seq1p;
              prevSeq2p = seq2p;
          }
  
          return seq2Position - prevSeq2p + prevSeq1p;
      }
docs: Converts position from coordinates in seq2 (after mutation) to coordinates in seq1 (before mutation) using this
  alignment (mutations).
  
  If letter in provided position is marked as insertion in this mutations, this method will return {@code
  (- 1 - imagePosition)}, where {@code imagePosition} is a position of letter right after that place where target
  nucleotide was added according to this alignment.
  
  @param seq2Position position in seq2
  @return position in seq1