Example #1
0
#                                                                             #
###############################################################################

# Module docstring.
"""The monte_carlo user function definitions for Monte Carlo simulations."""

# relax module imports.
from graphics import WIZARD_IMAGE_PATH
from pipe_control import error_analysis
from user_functions.data import Uf_info; uf_info = Uf_info()
from user_functions.objects import Desc_container


# Generic description document, used in all user functions.
monte_carlo_desc = Desc_container("Monte Carlo Simulation Overview")
monte_carlo_desc.add_paragraph("For proper error analysis using Monte Carlo simulations, a sequence of function calls is required for running the various simulation components.  The steps necessary for implementing Monte Carlo simulations are:")
monte_carlo_desc.add_item_list_element("1", "The measured data set together with the corresponding error set should be loaded into relax.")
monte_carlo_desc.add_item_list_element("2", "Either minimisation is used to optimise the parameters of the chosen model, or a calculation is run.")
monte_carlo_desc.add_item_list_element("3", "To initialise and turn on Monte Carlo simulations, the number of simulations, n, needs to be set.")
monte_carlo_desc.add_item_list_element("4", "The simulation data needs to be created either by back calculation from the fully minimised model parameters from step 2 or by direct calculation when values are calculated rather than minimised.  The error set is used to randomise each simulation data set by assuming Gaussian errors.  This creates a synthetic data set for each Monte Carlo simulation.")
monte_carlo_desc.add_item_list_element("5", "Prior to minimisation of the parameters of each simulation, initial parameter estimates are required.  These are taken as the optimised model parameters.  An alternative is to use a grid search for each simulation to generate initial estimates, however this is extremely computationally expensive.  For the case where values are calculated rather than minimised, this step should be skipped (although the results will be unaffected if this is accidentally run).")
monte_carlo_desc.add_item_list_element("6", "Each simulation requires minimisation or calculation.  The same techniques as used in step 2, excluding the grid search when minimising, should be used for the simulations.")
monte_carlo_desc.add_item_list_element("7", "Failed simulations are removed using the techniques of model elimination.")
monte_carlo_desc.add_item_list_element("8", "The model parameter errors are calculated from the distribution of simulation parameters.")
monte_carlo_desc.add_paragraph("Monte Carlo simulations can be turned on or off using functions within this class.  Once the function for setting up simulations has been called, simulations will be turned on.  The effect of having simulations turned on is that the functions used for minimisation (grid search, minimise, etc) or calculation will only affect the simulation parameters and not the model parameters.  By subsequently turning simulations off using the appropriate function, the functions used in minimisation will affect the model parameters and not the simulation parameters.")
monte_carlo_desc.add_paragraph("An example for model-free analysis using the prompt UI mode which includes only the functions required for implementing the above steps is:")
monte_carlo_desc.add_prompt("relax> minimise.grid_search(inc=11)                              # Step 2.")
monte_carlo_desc.add_prompt("relax> minimise.execute('newton')                                # Step 2.")
monte_carlo_desc.add_prompt("relax> monte_carlo.setup(number=500)                             # Step 3.")
monte_carlo_desc.add_prompt("relax> monte_carlo.create_data(method='back_calc')               # Step 4.")
monte_carlo_desc.add_prompt("relax> monte_carlo.initial_values()                              # Step 5.")
Example #2
0
from warnings import warn

# relax module imports.
from lib.errors import RelaxError, RelaxNoDomainError, RelaxNoSequenceError
from lib.io import read_spin_data
from lib.selection import Selection, spin_id_to_data_list
from lib.warnings import RelaxNoSpinWarning
from pipe_control import pipes
from pipe_control.interatomic import interatomic_loop
from pipe_control.mol_res_spin import exists_mol_res_spin_data, generate_spin_id_unique, return_spin, spin_loop
from user_functions.data import Uf_tables; uf_tables = Uf_tables()
from user_functions.objects import Desc_container


boolean_doc = Desc_container("Boolean operators")
boolean_doc.add_paragraph("The boolean operator can be used to change how spin systems or interatomic data containers are selected.  The allowed values are: 'OR', 'NOR', 'AND', 'NAND', 'XOR', 'XNOR'.  The following table details how the selections will occur for the different boolean operators.")
table = uf_tables.add_table(label="table: bool operators", caption="Boolean operators and their effects on selections")
table.add_headings(["Spin system or interatomic data container", "1", "2", "3", "4", "5", "6", "7", "8", "9"])
table.add_row(["Original selection", "0", "1", "1", "1", "1", "0", "1", "0", "1"])
table.add_row(["New selection", "0", "1", "1", "1", "1", "1", "0", "0", "0"])
table.add_row(["OR", "0", "1", "1", "1", "1", "1", "1", "0", "1"])
table.add_row(["NOR", "1", "0", "0", "0", "0", "0", "0", "1", "0"])
table.add_row(["AND", "0", "1", "1", "1", "1", "0", "0", "0", "0"])
table.add_row(["NAND", "1", "0", "0", "0", "0", "1", "1", "1", "1"])
table.add_row(["XOR", "0", "0", "0", "0", "0", "1", "1", "0", "1"])
table.add_row(["XNOR", "1", "1", "1", "1", "1", "0", "0", "1", "0"])
boolean_doc.add_table(table.label)


def boolean_deselect(current=None, boolean=None):
    """Return the new boolean deselection result using the current selection.
Example #3
0
###############################################################################

# Module docstring.
"""The monte_carlo user function definitions for Monte Carlo simulations."""

# relax module imports.
from graphics import WIZARD_IMAGE_PATH
from pipe_control import error_analysis
from user_functions.data import Uf_info
uf_info = Uf_info()
from user_functions.objects import Desc_container

# Generic description document, used in all user functions.
monte_carlo_desc = Desc_container("Monte Carlo Simulation Overview")
monte_carlo_desc.add_paragraph(
    "For proper error analysis using Monte Carlo simulations, a sequence of function calls is required for running the various simulation components.  The steps necessary for implementing Monte Carlo simulations are:"
)
monte_carlo_desc.add_item_list_element(
    "1",
    "The measured data set together with the corresponding error set should be loaded into relax."
)
monte_carlo_desc.add_item_list_element(
    "2",
    "Either minimisation is used to optimise the parameters of the chosen model, or a calculation is run."
)
monte_carlo_desc.add_item_list_element(
    "3",
    "To initialise and turn on Monte Carlo simulations, the number of simulations, n, needs to be set."
)
monte_carlo_desc.add_item_list_element(
    "4",
Example #4
0
File: uf.py Project: tlinnet/relax
from pipe_control import pipes
from pipe_control.mol_res_spin import exists_mol_res_spin_data, spin_loop
from pipe_control.pipes import check_pipe
import specific_analyses
from specific_analyses.model_free.api import Model_free
from specific_analyses.model_free.model import model_map
from user_functions.data import Uf_tables
uf_tables = Uf_tables()
from user_functions.objects import Desc_container

# The API object.
api_model_free = Model_free()

# Classic style documentation.
classic_style_doc = Desc_container("Model-free classic style")
classic_style_doc.add_paragraph("Creator:  Edward d'Auvergne")
classic_style_doc.add_paragraph("Argument string:  \"classic\"")
classic_style_doc.add_paragraph(
    "Description:  The classic style draws the backbone of a protein in a cylindrical bond style.  Rather than colouring the amino acids to which the NH bond belongs, the three covalent bonds of the peptide bond from Ca to Ca in which the NH bond is located are coloured.  Deselected residues are shown as black lines."
)
classic_style_doc.add_paragraph("Supported data types:")
table = uf_tables.add_table(
    label="table: model-free macro classic style",
    caption=
    "The model-free classic style for mapping model spin specific data onto 3D molecular structures using either PyMOL or Molmol.",
    caption_short=
    "The model-free classic style for PyMOL and Molmol data mapping.")
table.add_headings(["Data type", "String", "Description"])
table.add_row([
    "S2.", "'s2'",
    "The standard model-free order parameter, equal to S2f.S2s for the two timescale models.  The default colour gradient starts at 'yellow' and ends at 'red'."
Example #5
0
from pipe_control.pipes import check_pipe
import specific_analyses
from specific_analyses.model_free.api import Model_free
from specific_analyses.model_free.model import model_map
from user_functions.data import Uf_tables

uf_tables = Uf_tables()
from user_functions.objects import Desc_container

# The API object.
api_model_free = Model_free()


# Classic style documentation.
classic_style_doc = Desc_container("Model-free classic style")
classic_style_doc.add_paragraph("Creator:  Edward d'Auvergne")
classic_style_doc.add_paragraph('Argument string:  "classic"')
classic_style_doc.add_paragraph(
    "Description:  The classic style draws the backbone of a protein in a cylindrical bond style.  Rather than colouring the amino acids to which the NH bond belongs, the three covalent bonds of the peptide bond from Ca to Ca in which the NH bond is located are coloured.  Deselected residues are shown as black lines."
)
classic_style_doc.add_paragraph("Supported data types:")
table = uf_tables.add_table(
    label="table: model-free macro classic style",
    caption="The model-free classic style for mapping model spin specific data onto 3D molecular structures using either PyMOL or Molmol.",
    caption_short="The model-free classic style for PyMOL and Molmol data mapping.",
)
table.add_headings(["Data type", "String", "Description"])
table.add_row(
    [
        "S2.",
        "'s2'",
Example #6
0
#                                                                             #
# This program is distributed in the hope that it will be useful,             #
# but WITHOUT ANY WARRANTY; without even the implied warranty of              #
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the               #
# GNU General Public License for more details.                                #
#                                                                             #
# You should have received a copy of the GNU General Public License           #
# along with this program.  If not, see <http://www.gnu.org/licenses/>.       #
#                                                                             #
###############################################################################

# Module docstring.
"""Module containing various shared docstrings."""


# relax module imports.
from user_functions.objects import Desc_container


# Regular expression.
regexp_doc = Desc_container("Regular expression")
regexp_doc.add_paragraph("The python function 'match', which uses regular expression, is used to determine which data type to set values to, therefore various data_type strings can be used to select the same data type.  Patterns used for matching for specific data types are listed below.")
regexp_doc.add_paragraph("This is a short description of python regular expression, for more information see the regular expression syntax section of the Python Library Reference.  Some of the regular expression syntax used in this function is:")
regexp_doc.add_item_list_element("'[]'", "A sequence or set of characters to match to a single character.  For example, '[sS]2' will match both 'S2' and 's2'.")
regexp_doc.add_item_list_element("'^'", "Match the start of the string.")
regexp_doc.add_item_list_element("'$'", "Match the end of the string.  For example, '^[Ss]2$' will match 's2' but not 'S2f' or 's2s'.")
regexp_doc.add_item_list_element("'.'", "Match any character.")
regexp_doc.add_item_list_element("'x*'", "Match the character 'x' any number of times, for example 'x' will match, as will 'xxxxx'.")
regexp_doc.add_item_list_element("'.*'", "Match any sequence of characters of any length.")
regexp_doc.add_paragraph("Importantly, do not supply a string for the data type containing regular expression.  The regular expression is implemented so that various strings can be supplied which all match the same data type.")
Example #7
0
from warnings import warn

# relax module imports.
from lib.errors import RelaxError, RelaxNoDomainError, RelaxNoSequenceError
from lib.selection import Selection, spin_id_to_data_list
from lib.sequence import read_spin_data, write_spin_data
from lib.warnings import RelaxNoSpinWarning
from pipe_control.interatomic import interatomic_loop
from pipe_control.mol_res_spin import check_mol_res_spin_data, exists_mol_res_spin_data, generate_spin_id_unique, return_spin, spin_loop
from pipe_control.pipes import check_pipe
from user_functions.data import Uf_tables; uf_tables = Uf_tables()
from user_functions.objects import Desc_container


boolean_doc = Desc_container("Boolean operators")
boolean_doc.add_paragraph("The boolean operator can be used to change how spin systems or interatomic data containers are selected.  The allowed values are: 'OR', 'NOR', 'AND', 'NAND', 'XOR', 'XNOR'.  The following table details how the selections will occur for the different boolean operators.")
table = uf_tables.add_table(label="table: bool operators", caption="Boolean operators and their effects on selections")
table.add_headings(["Spin system or interatomic data container", "1", "2", "3", "4", "5", "6", "7", "8", "9"])
table.add_row(["Original selection", "0", "1", "1", "1", "1", "0", "1", "0", "1"])
table.add_row(["New selection", "0", "1", "1", "1", "1", "1", "0", "0", "0"])
table.add_row(["OR", "0", "1", "1", "1", "1", "1", "1", "0", "1"])
table.add_row(["NOR", "1", "0", "0", "0", "0", "0", "0", "1", "0"])
table.add_row(["AND", "0", "1", "1", "1", "1", "0", "0", "0", "0"])
table.add_row(["NAND", "1", "0", "0", "0", "0", "1", "1", "1", "1"])
table.add_row(["XOR", "0", "0", "0", "0", "0", "1", "1", "0", "1"])
table.add_row(["XNOR", "1", "1", "1", "1", "1", "0", "0", "1", "0"])
boolean_doc.add_table(table.label)


def boolean_deselect(current=None, boolean=None):
    """Return the new boolean deselection result using the current selection.
Example #8
0
#                                                                             #
# This program is distributed in the hope that it will be useful,             #
# but WITHOUT ANY WARRANTY; without even the implied warranty of              #
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the               #
# GNU General Public License for more details.                                #
#                                                                             #
# You should have received a copy of the GNU General Public License           #
# along with this program.  If not, see <http://www.gnu.org/licenses/>.       #
#                                                                             #
###############################################################################

# Module docstring.
"""Module containing various shared docstrings."""


# relax module imports.
from user_functions.objects import Desc_container


# Regular expression.
regexp_doc = Desc_container("Regular expression")
regexp_doc.add_paragraph("The python function 'match', which uses regular expression, is used to determine which data type to set values to, therefore various data_type strings can be used to select the same data type.  Patterns used for matching for specific data types are listed below.")
regexp_doc.add_paragraph("This is a short description of python regular expression, for more information see the regular expression syntax section of the Python Library Reference.  Some of the regular expression syntax used in this function is:")
regexp_doc.add_item_list_element("'[]'", "A sequence or set of characters to match to a single character.  For example, '[sS]2' will match both 'S2' and 's2'.")
regexp_doc.add_item_list_element("'^'", "Match the start of the string.")
regexp_doc.add_item_list_element("'$'", "Match the end of the string.  For example, '^[Ss]2$' will match 's2' but not 'S2f' or 's2s'.")
regexp_doc.add_item_list_element("'.'", "Match any character.")
regexp_doc.add_item_list_element("'x*'", "Match the character 'x' any number of times, for example 'x' will match, as will 'xxxxx'.")
regexp_doc.add_item_list_element("'.*'", "Match any sequence of characters of any length.")
regexp_doc.add_paragraph("Importantly, do not supply a string for the data type containing regular expression.  The regular expression is implemented so that various strings can be supplied which all match the same data type.")