def projection(self, o):
        tline = Line(self.p1, self.p2)

        def _project(p):
            """Project a point onto the line representing self."""
            if p in tline:
                return p
            l1 = tline.perpendicular_line(p)
            return tline.intersection(l1)[0]

        projected = None
        if isinstance(o, Point):
            return _project(o)
        elif isinstance(o, LinearEntity):
            n_p1 = _project(o.p1)
            n_p2 = _project(o.p2)
            if n_p1 == n_p2:
                projected = n_p1
            else:
                projected = o.__class__(n_p1, n_p2)

        # Didn't know how to project so raise an error
        if projected is None:
            n1 = self.__class__.__name__
            n2 = o.__class__.__name__
            raise GeometryError(
                "Do not know how to project %s onto %s" % (n2, n1))

        return self.intersection(projected)[0]
gfn = genome file name
dataset/ETHPy150Open sympy/sympy/sympy/geometry/line.py/LinearEntity.projection--crossover with--dataset/ETHPy150Open adamewing/bamsurgeon/scripts/randomsites.py/Genome.__init__