Each plotted residue SVG file is edited and the contents of the file transfered into
        an SVG group (g). This allows a plot to be included in the final image and the group
        transform function allows to move the plot to the correct 2D coordinates in respect
        to the 2D drug molecule. The groups are added to self.draw_plots variable which is
        included in the final figure.

def manage_the_plots(self):
        """
        Each plotted residue SVG file is edited and the contents of the file transfered into
        an SVG group (g). This allows a plot to be included in the final image and the group
        transform function allows to move the plot to the correct 2D coordinates in respect
        to the 2D drug molecule. The groups are added to self.draw_plots variable which is
        included in the final figure.
        """
        diagram = ""
        for residue in sorted(self.molecule.nearest_points_coords.keys()):
            for i, line in enumerate(fileinput.input(residue[1]+residue[2]+".svg", inplace=1)):
                    if i <= 8:
                        continue
                    else:
                        sys.stdout.write(line.replace ("</svg>","</g>"))
            input1 = "</defs>"
            x = str(int(self.molecule.nearest_points_coords[residue][0]+(self.molecule.x_dim-self.molecule.molsize1)/2)-90)
            y = str(int(self.molecule.nearest_points_coords[residue][1]+(self.molecule.y_dim-self.molecule.molsize2)/2)-90)
            output1 = "<g  id='"+residue[0]+residue[1]+"_"+residue[2]+"' class='residue' transform='translate("+x+","+y+" )' x='"+x+"' y='"+y+"'>"
            self.change_lines_in_svg(residue[1]+residue[2]+'.svg', input1, output1)
            input2 = "font-style:normal;"
            output2 = "font-style:normal;font-weight:bold;"
            self.change_lines_in_svg(residue[1]+residue[2]+'.svg', input2, output2)
            with open(residue[1]+residue[2]+".svg", "r") as f:
                lines = f.readlines()
                diagram = diagram +"".join(map(str,lines))
                f.close()
        self.draw_plots = diagram