def generate_pi(intervals):
	"""
	Generates pi for the BAF gaussian model, which maps from SNP location to
	interval number. In this implementation, pi maps from a chromsome number to
	ranges of positions and the interval number associated with that range. See
	the THetA2 supplement for a more in-depth explanation

	Arguments:
		intervals (2D list): 2D list of data taken from the intervals file

	Returns:
		pi (dict of lists of ints): pi map
	"""

	pi = {}
	j = 0
	for chrm, start_pos, end_pos in intervals:
		try:
			pi[chrm].append((start_pos, end_pos, j))
		except KeyError:
			pi[chrm] = [(start_pos, end_pos, j)]
		j += 1

	return pi