Author: bugman Date: Wed Jul 11 15:31:08 2012 New Revision: 17229 URL: http://svn.gna.org/viewcvs/relax?rev=17229&view=rev Log: Shifted some of the sample scripts into the analysis specific sub-directories. Added: trunk/sample_scripts/model_free/generate_ri.py - copied unchanged from r17228, trunk/sample_scripts/generate_ri.py trunk/sample_scripts/n_state_model/stereochem_analysis.py - copied unchanged from r17228, trunk/sample_scripts/stereochem_analysis.py Removed: trunk/sample_scripts/generate_ri.py trunk/sample_scripts/stereochem_analysis.py Removed: trunk/sample_scripts/generate_ri.py URL: http://svn.gna.org/viewcvs/relax/trunk/sample_scripts/generate_ri.py?rev=17228&view=auto ============================================================================== --- trunk/sample_scripts/generate_ri.py (original) +++ trunk/sample_scripts/generate_ri.py (removed) @@ -1,120 +1,0 @@ -############################################################################### -# # -# Copyright (C) 2004-2012 Edward d'Auvergne # -# # -# This file is part of the program relax (http://www.nmr-relax.com). # -# # -# This program is free software: you can redistribute it and/or modify # -# it under the terms of the GNU General Public License as published by # -# the Free Software Foundation, either version 3 of the License, or # -# (at your option) any later version. # -# # -# 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/>. # -# # -############################################################################### - -"""Script for back-calculating the relaxation data.""" - -# relax module imports. -from generic_fns.mol_res_spin import spin_loop - - -def back_calc(): - """Function for back calculating the relaxation data.""" - - relax_data.back_calc(ri_id='NOE_600', ri_type='NOE', frq=600e6) - relax_data.back_calc(ri_id='R1_600', ri_type='R1', frq=600e6) - relax_data.back_calc(ri_id='R2_600', ri_type='R2', frq=600e6) - relax_data.back_calc(ri_id='NOE_500', ri_type='NOE', frq=500e6) - relax_data.back_calc(ri_id='R1_500', ri_type='R1', frq=500e6) - relax_data.back_calc(ri_id='R2_500', ri_type='R2', frq=500e6) - - -def errors(): - """Function for generating relaxation data errors.""" - - # Loop over the sequence. - for spin in spin_loop(): - # Loop over the relaxation data. - for ri_id in cdp.ri_ids: - # No data. - if spin.ri_data_bc[ri_id] == None: - continue - - # Set up the error relaxation data structure if needed. - if not hasattr(spin, 'ri_data_err'): - spin.ri_data_err = {} - - # 600 MHz NOE. - if ri_id == 'NOE_600': - spin.ri_data_err[ri_id] = 0.04 - - # 500 MHz NOE. - elif ri_id == 'NOE_500': - spin.ri_data_err[ri_id] = 0.05 - - # All other data. - else: - spin.ri_data_err[ri_id] = spin.ri_data_bc[ri_id] * 0.02 - - -def write(): - """Function for writing the relaxation data to file.""" - - relax_data.write(ri_id='NOE_600', file='noe.600.out', force=True) - relax_data.write(ri_id='R1_600', file='r1.600.out', force=True) - relax_data.write(ri_id='R2_600', file='r2.600.out', force=True) - relax_data.write(ri_id='NOE_500', file='noe.500.out', force=True) - relax_data.write(ri_id='R1_500', file='r1.500.out', force=True) - relax_data.write(ri_id='R2_500', file='r2.500.out', force=True) - - -# Create the data pipe. -pipe.create('test', 'mf') - -# Load a PDB file. -structure.read_pdb('example.pdb') - -# Load the spins from the structure. -structure.load_spins(spin_id='@N') -structure.load_spins(spin_id='@H') - -# Define the magnetic dipole-dipole relaxation interaction. -dipole_pair.define(spin_id1='@N', spin_id2='@H', direct_bond=True) -dipole_pair.set_dist(spin_id1='@N', spin_id2='@H', ave_dist=1.02 * 1e-10) -dipole_pair.unit_vectors() - -# Define the CSA relaxation interaction. -value.set(val=-172e-6, param='csa') - -# Set the diffusion tensor in the PDB frame (Dxx, Dyy, Dzz, Dxy, Dxz, Dyz). -diffusion_tensor.init((1.340e7, 1.516e7, 1.691e7, 0.000e7, 0.000e7, 0.000e7), param_types=3) - -# Set the spin information. -spin.isotope('15N', spin_id='@N') -spin.isotope('1H', spin_id='@H') - -# Set the required values. -value.set(val=0.8, param='s2') -value.set(val=20e-12, param='te') - -# Select model-free model m2. -model_free.select_model(model='m2') - -# Back calculate the relaxation data (using the function defined in this script). -back_calc() - -# Generate the errors (using the function defined in this script). -errors() - -# Write the data (using the function defined in this script). -write() - -# Write the relaxation data to file. -results.write() Removed: trunk/sample_scripts/stereochem_analysis.py URL: http://svn.gna.org/viewcvs/relax/trunk/sample_scripts/stereochem_analysis.py?rev=17228&view=auto ============================================================================== --- trunk/sample_scripts/stereochem_analysis.py (original) +++ trunk/sample_scripts/stereochem_analysis.py (removed) @@ -1,141 +1,0 @@ -############################################################################### -# # -# Copyright (C) 2010-2012 Edward d'Auvergne # -# # -# This file is part of the program relax (http://www.nmr-relax.com). # -# # -# This program is free software: you can redistribute it and/or modify # -# it under the terms of the GNU General Public License as published by # -# the Free Software Foundation, either version 3 of the License, or # -# (at your option) any later version. # -# # -# 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/>. # -# # -############################################################################### - -"""Script for the determination of relative stereochemistry. - -The analysis is preformed by using multiple ensembles of structures, randomly sampled from a given -set of structures. The discrimination is performed by comparing the sets of ensembles using NOE -violations and RDC Q-factors. - -This script is split into multiple stages: - - 1. The random sampling of the snapshots to generate the N ensembles (NUM_ENS, usually 10,000 to - 100,000) of M members (NUM_MODELS, usually ~10). The original snapshot files are expected to be - named the SNAPSHOT_DIR + CONFIG + a number from SNAPSHOT_MIN to SNAPSHOT_MAX + ".pdb", e.g. - "snapshots/R647.pdb". The ensembles will be placed into the "ensembles" directory. - - 2. The NOE violation analysis. - - 3. The superimposition of ensembles. For each ensemble, Molmol is used for superimposition - using the fit to first algorithm. The superimposed ensembles will be placed into the - "ensembles_superimposed" directory. This stage is not necessary for the NOE analysis. - - 4. The RDC Q-factor analysis. - - 5. Generation of Grace graphs. - - 6. Final ordering of ensembles using the combined RDC and NOE Q-factors, whereby the NOE - Q-factor is defined as:: - - Q^2 = U / sum(NOE_i^2), - - where U is the quadratic flat bottom well potential - the NOE violation in Angstrom^2. The - denominator is the sum of all squared NOEs - this must be given as the value of NOE_NORM. The - combined Q is given by:: - - Q_total^2 = Q_NOE^2 + Q_RDC^2. -""" - -# relax module imports. -from auto_analyses.stereochem_analysis import Stereochem_analysis - - -# Stage of analysis (see the docstring above for the options). -STAGE = 1 - -# Number of ensembles. -NUM_ENS = 100000 - -# Ensemble size. -NUM_MODELS = 10 - -# Configurations. -CONFIGS = ["R", "S"] - -# Snapshot directories (corresponding to CONFIGS). -SNAPSHOT_DIR = ["snapshots", "snapshots"] - -# Min and max number of the snapshots (corresponding to CONFIGS). -SNAPSHOT_MIN = [0, 0] -SNAPSHOT_MAX = [76, 71] - -# Pseudo-atoms. -PSEUDO = [ -["Q7", ["@H16", "@H17", "@H18"]], -["Q9", ["@H20", "@H21", "@H22"]], -["Q10", ["@H23", "@H24", "@H25"]] -] - -# NOE info. -NOE_FILE = "noes" -NOE_NORM = 50 * 4**2 # The NOE normalisation factor (sum of all NOEs squared). - -# RDC file info. -RDC_NAME = "PAN" -RDC_FILE = "pan_rdcs" -RDC_SPIN_ID1_COL = 1 -RDC_SPIN_ID2_COL = 2 -RDC_DATA_COL = 2 -RDC_ERROR_COL = None - -# Bond length. -BOND_LENGTH = 1.117 * 1e-10 - -# Log file output (only for certain stages). -LOG = True - -# Number of buckets for the distribution plots. -BUCKET_NUM = 200 - -# Distribution plot limits. -LOWER_LIM_NOE = 0.0 -UPPER_LIM_NOE = 600.0 -LOWER_LIM_RDC = 0.0 -UPPER_LIM_RDC = 1.0 - - -# Set up and code execution. -analysis = Stereochem_analysis( - stage=STAGE, - num_ens=NUM_ENS, - num_models=NUM_MODELS, - configs=CONFIGS, - snapshot_dir=SNAPSHOT_DIR, - snapshot_min=SNAPSHOT_MIN, - snapshot_max=SNAPSHOT_MAX, - pseudo=PSEUDO, - noe_file=NOE_FILE, - noe_norm=NOE_NORM, - rdc_name=RDC_NAME, - rdc_file=RDC_FILE, - rdc_spin_id1_col=RDC_SPIN_ID1_COL, - rdc_spin_id2_col=RDC_SPIN_ID2_COL, - rdc_data_col=RDC_DATA_COL, - rdc_error_col=RDC_ERROR_COL, - bond_length=BOND_LENGTH, - log=LOG, - bucket_num=BUCKET_NUM, - lower_lim_noe=LOWER_LIM_NOE, - upper_lim_noe=UPPER_LIM_NOE, - lower_lim_rdc=LOWER_LIM_RDC, - upper_lim_rdc=UPPER_LIM_RDC -) -analysis.run()