FAQ | This is a LIVE service | Changelog

Skip to content
Snippets Groups Projects
Commit 3979d174 authored by M.D. Driver's avatar M.D. Driver
Browse files

initial attempt at map merging to form FGIPs.

parent 5d27e4cd
No related branches found
No related tags found
No related merge requests found
......@@ -8,5 +8,6 @@ setup(name='solventmapcreator',
author_email='mdd31@cam.ac.uk',
license='TBD',
packages=setuptools.find_packages(),
package_data={'test/resources':['test/resources']},
package_data={'test/resources':['test/resources'],
'solvationcalculation/resources':['solvationcalculation/resources']},
zip_safe=False)
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Script for merging the molecules to the solvent map to create the functional
group interaction profile.
@author: mark
"""
import logging
import os
import svgutils.transform as svgt
logging.basicConfig()
LOGGER = logging.getLogger(__name__)
LOGGER.setLevel(logging.WARN)
FGIP_MOLECULES_FILENAME = os.path.join(os.path.dirname(__file__),
"resources/FGIPmolecules.svg")
def create_fgip_from_map(map_filename):
"""This creates a FGIP from the given solvent map.
"""
svg_figure = create_svgfigure()
map_plot = get_svg_plot(map_filename)
map_plot.moveto(0.0,150.0, scale=1.1)
molecules_plot = get_molecules()
append_svg_plots(svg_figure, map_plot)
append_svg_plots(svg_figure, molecules_plot)
output_filename = create_output_filename(map_filename)
save_svg_figure(svg_figure, output_filename)
def save_svg_figure(svg_figure, filename):
"""This saves the figue to file.
"""
svg_figure.save(filename)
def create_output_filename(filename, suffix="_solv_map.svg"):
"""This returns the output filename to be used.
"""
return filename.replace(suffix, "_FGIP.svg")
def append_svg_plots(svg_figure, svg_plot):
"""This appends the plot to the figure.
"""
svg_figure.append(svg_plot)
def get_molecules():
"""This gets the molecules.
"""
return get_svg_plot(FGIP_MOLECULES_FILENAME)
def get_svg_plot(svg_filename):
"""This gets the plot elements.
"""
figure = svgt.fromfile(svg_filename)
return figure.getroot()
def create_svgfigure():
"""This creates SVG figure with default size.
"""
return svgt.SVGFigure(width="725.05334pt", height="676.02484pt")
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment