PENCE / CIHR-Group
Joint Software Centre

Funding for this software has been provided in part by the
Canadian Institutes of Health Research (CIHR Group)
and the
Protein Engineering Networks of Centres of Excellence (PENCE).


xcrvfit - Curve Fitting Tool

Version: 3.0.6 - Nov 2006

Purpose: a graphical X-windows program for binding curve studies and NMR spectroscopic analysis.

Table of Contents

  1. Latest News
  2. Overview
  3. Copyright and Acknowledgements
  4. Download and Installation
  5. How to use
  6. Input Files
  7. Output Files
  8. Available Functions
  9. FAQ
  10. Appendix: Older versions of xcrvfit

Overview of xcrvfit

The xcrvfit program tries to find the parameters of a function which best fits a given set of data. The user has a wide selection of functions which relate to binding curve studies and spectroscopic analysis.

The power of xcrvfit lies in its convenience to process multiple datasets of various formats, the ability to experiment with fitting parameter scenarios, and the ability to customize the graphics. The program runs quickly and on any platform supporting X-windows. Output from the program includes a graph of the function through the data (saved in postscript format), the rmse of the fit, a measure of the sensitivity of each fitting function parameter, and a table showing how each datapoint fits the function.

The xcrvfit program is a combination of 3 programs previously written in sunview: crvfit, jfit, and t1t2fit.

Copyright and Acknowledgements

Authors: Robert Boyko, Brian Sykes
This software was not published, you can reference it in the following fashion:
xcrvfit: a graphical X-windows program for binding curve studies and NMR
spectroscopic analysis, developed by Boyko, R. and Sykes, B.D.  (University of Alberta).
website: http://www.bionmr.ualberta.ca/bds/software/xcrvfit

We are very grateful to the many people who have suggested mathematical equations for use in xcrvfit.

Copyright (C) 1994 - No portion of this program may be incorporated into other programs or sold for profit without express written consent of the authors.

Download

Select the version of xcrvfit corresponding to your operating system.

X11 (unix,linux): xcrvfit v3.0.6 (0.50 MB)
MacOSX (aqua): xcrvfit v3.0.6 (0.30 MB)

Installation

Mac OSX

Your browser will probably already un-tar the download file. You should be able to double click on the xcrvfit icon for mac os aqua. Eventually move the xcrvfit icon to /Applications.

If this did not work, it may be because you do not have tcl/tk for your mac. Install tcl/tk at http://www.maths.mq.edu.au/~steffen/tcltk/TclTkAqua/

X11/unix

Once you have downloaded the software, you then proceed by untarring the files if your browser has not already done so. For example:

	> tar xvf xcrvfit-v3.0.6-build.tar 
	> cd xcrvfit-v3.0.6-build
Look at the README file for details on installation. The installation script is simple, it will ask where you want to install the software.
	> ./Install 
The README file also explains how to set your path environment variable to include the location of the executable. For example, here is what I did on my linux account:
	setenv XCRVFIT_HOME /home/rbo/xcrvfit-v3.0.6
	alias xcrvfit /home/rbo/xcrvfit-v3.0.6/sbin/xcrvfit

Basic Usage of xcrvfit

  1. Start the program by typing 'xcrvfit' or double clicking the icon (aqua version).

    If you do not get a graphical window, check with your system administrator to make sure the program has been installed and is accessible to you.

    The default fonts, colors, sizes of the xcrvfit gui are set in the xcrvfitDefaults file of the current directory. Click here to see an example.

  2. Enter your datafile in the entry box provided or use the "Browse" button to find it. For an explanation of the various data formats that xcrvfit recognizes see the Input Data Files section.

    The program proceeds to read in the data and display the first data set. If the data is not drawn in the plotting window make sure you may have data formatting issues.

  3. (optional) Change how the data is displayed in the graph window.

    The program starts by reading the first dataset, but the user can select another. The user has the choice of changing the offset for the x data (this is particularly useful for the chemical shift functions). Finally, the user may want to change how the graph is displayed in the plotting window by clicking the "Change Graphics" menu button under options. Here the user can change variables such as xMax, number of tic marks, titles, colors, etc.

  4. Select the fitting function.

    For a more detailed explanation of the functions see Fitting Functions .

    Once the function has been selected, the program displays the appropriate parameter fields.

  5. Input starting parameter values. When you have entered all the fields, press the "Calc-rmse" button.

    A graph of the fitting function is displayed along with a rmse (root mean square error) value. If you do not see the fitting function, it could be that your starting parameters are not very close. Try adjusting the x/y scale to display a bigger plot (see menubar options/change graphics).

  6. Press the "Best Fit" button to calculate the best fit function.

    Some functions will converge to the best fit function regardless of the starting parameters. Others are very sensitive and a close approximation is required first.

  7. Click Display Results button.

    Here you can see how every datapoint corresponds to the fitting function. Also, you can see how sensitive each fitting parameter is by looking at the stddev field.

  8. Click Next dataset.

    The program then reads in the next dataset. The previous starting parameters are not erased so that the user may be able to quickly process several datasets by alternating between "Best Fit" and "Next Dataset".

Input Data Files for xcrvfit

The xcrvfit program can read data files which are in one of the following formats:
  1. crvfit
  2. kay
  3. jfit
  4. fp
Data which is in the kay, jfit or fp formats is converted to crvfit format automatically by the software. Here is a description of each format type with examples. crvfit - Each line in the text file contains one point where the point is specified as either "x f(x)" or "x f(x) x2". Comments are prefixed by "!".
	! This is a crvfit data file
	!
	! x     f(x)
	!
	1.0    5.1
	2.2    12.0
	3.6    19.3
Multiple datasets can be placed in one file however an ID number must be found on the line preceding each data set. An example of this format is found in the file
data-line of the installed lib/examples directory. Here is another example of where f(x) is dependent on x and x2.

kay - In this format the x-values are placed on the first line and each subsequent line contains an identifier (likely the amino acid number) and the corresponding y-values. Any entry preceded with a "#" is treated as a missing value in the table. An example of this format is found in the file data-t2.kay of the installed lib/examples directory.

jfit - jfit format refers to Varian's vnmr 'fitspec.data' file format. An example of this format follows below:

	100  (number of points)
	-20  (start of plot)
	30   (width of plot)
	1.00 (first y-value)
	1.05 (second y-value)
	...
An example of this format is found in the file data.jfit of the installed lib/examples directory.

fp - fp format refers to Varian's vnmr 'fp.out' file format. An example of this format is found in the file data.fp of the installed lib/examples directory.

Understanding the Output

The log file "xcrvfit.log" contains a record of each convergence achieved through pressing the iterate button. This is particularly useful for stepping through a number of T2 fits.

Here is an example results file.

Data Input.: data.cubic
Num of data: 10

Function...: Cubic Polynomial
Description: Notes: A0*x*x*x + A1*x*x + A2*x + A3
Parameters.: 4

Parameter   Hold Constant          Value         StdDev
A0.......:       no             -0.00506        0.00211
A1.......:       no              1.30573        0.13435
A2.......:       no             -5.14197        2.32052
A3.......:       no              8.09954       10.43368

Stddev.....: 9.5043        
Iterations.: 116
Max It.....: 200

Point by Point Analysis
          X[i]           Y[i]         Y-Calc       Residual
       0.00000        2.00000        8.09954        6.09954
       4.30000       13.00000        9.72971       -3.27029
       9.60000       93.00000       74.59546      -18.40454
      14.70000      190.00000      198.59236        8.59236
      18.70000      319.00000      335.45210       16.45210
      23.30000      537.00000      533.14359       -3.85641
      27.50000      750.00000      748.90418       -1.09582
      32.40000     1044.00000     1040.07185       -3.92815
      36.80000     1340.00000     1334.93300       -5.06700
      41.80000     1700.00000     1704.96881        4.96881

Fitting Functions in xcrvfit

Pierre Lavigne has suggested a number of functions in xcrvfit. These notes are available
here.
  1. Line

  2. Quadratic

  3. Cubic

  4. Exponential

  5. T1 Relaxation

  6. T2 Relaxation

  7. R2 Dimer Olga's notes in ms word document

  8. Sum of Two Exponentials Note that in this particular function one or more variables should be held constant.

  9. Sum of Two Exponentials 2 Note that in this particular function one or more variables should be held constant.

  10. pH Titration

  11. Sinusoidal 1

  12. Sinusoidal 2 (request from Brian Sykes)

  13. Single Crystal fit (request from Gump Zhao)

  14. Sigmoidal

  15. UC-Dimer

  16. Melting Curve 3

  17. Melting Curve 4

  18. Chemical Shift XY1

  19. Chemical Shift XY2 Note this function does not converge very well if the KD2 parameter is not held constant.

  20. Sum of Two Lorentzian Curves

  21. jFit Gaussian
    	b = (x - a[0]) / a[1];
    	lz1 = (1.0 / (2.0 * PI * a[1])) * exp(-0.5 * b * b);
    	b = (x - a[2]) / a[3];
    	lz2 = (1.0 / (2.0 * PI * a[3])) * exp(-0.5 * b * b);
    	f(x) = a[4] * (lz1 + a[5]*lz2);
    	

  22. jFit Dispersion
    	b = 4.0 * PI * PI;
    	c = 2.0 * PI * a[1] * a[1] * (x-a[0]);
    	lz1 = c / (1 + b * (x-a[0])*(x-a[0]) * (a[1]*a[1]));
    	c = 2.0 * PI * a[3] * a[3] * (x-a[2]);
    	lz2 = c / (1 + b * (x-a[2])*(x-a[2]) * (a[3]*a[3]));
    	f(x) = (a[4] * (lz1 - a[5]*lz2));
    	

  23. Chemical Denaturation of Trimer (request from Pierre Lavigne)
    	set b [expr exp((0.0 - $Parms(4) + $Parms(5) * $x) / $Parms(7))]
    	set c [expr abs($b / (3.0 * $Parms(6) * $Parms(6)))]
    	set d [expr 0.5 * $c]
    	set e [expr sqrt($c * $c * (0.25 + 0.03704 * $c))]
    	set g [expr $d + $e]
    	set h [expr $d - $e]
    	set w [expr pow($g, 0.3333333) - pow(abs($h), 0.3333333)]
    	return [expr (1.0 - $w) * ($Parms(0) - $Parms(1) * $x) + $w * ($Parms(2) - $Parms(3) * $x)]
    	

  24. Chemical Denaturation of Monomer/Trimer (request from Pierre Lavigne)
    	set b [expr exp((0.0 - $Parms(4) + $Parms(5) * $x) / $Parms(7))]
    	set c [expr abs($b / (3.0 * $Parms(6) * $Parms(6)))]
    	set d [expr 0.5 * $c]
    	set e [expr sqrt($c * $c * (0.25 + 0.03704 * $c))]
    	set g [expr $d + $e]
    	set h [expr $d - $e]
    	set w [expr pow($g, 0.3333333) - pow(abs($h), 0.3333333)]
    	set f [expr exp((0.0 - $Parms(0) + $Parms(1) * $x) / $Parms(7))]
    	return [expr (1.0 - $w) * $Parms(2) + (1.0 - $f / (1.0 + $f)) * $Parms(3)]
    

  25. Cp(temp) for unfolding of monomer (request from Pierre Lavigne)
    	set c [expr $x * 0.008314]
    	set d [expr $x * $x * $Parms(7) + $x * $Parms(0) + $Parms(1)]
    	set e [expr $x * $x * $Parms(2) + $x * $Parms(3) + $Parms(4)]
    	set f [expr (($Parms(4) - $Parms(1))*($x - $Parms(6))) + ((0.50 *
    		($Parms(3) - $Parms(0))) * (( $x * $x ) - ($Parms(6) * $Parms(6)))) +
    		((0.3333 * ($Parms(2) - $Parms(8))) * (pow($x,3.0) - pow($Parms(6),3.0)))]
    	set s [expr (($Parms(4) - $Parms(1))*(log($x) - log($Parms(6)))) +
    		(($Parms(3) - $Parms(0)) * ($x - $Parms(6))) + ((0.50 * ($Parms(2) -
    		$Parms(7))) * (($x * $x) - ($Parms(6) * $Parms(6))))]
    	set g [expr $f + $Parms(5)]
    	set h [expr exp(($b * (($Parms(5) / $Parms(6)) + $s) - $g) / $c)]
    	set v [expr $h / (1.0 + $h)]
    	set w [expr $v * (1.0 - $v) * ($g * $g / ($c * $x))]
    	return [expr $d + $w + ($v * $f)]
    

  26. Cp(temp) for unfolding of dimer (request from Pierre Lavigne)
    	set c [expr $x * 0.008314]
    	set d [expr $x * $x * $Parms(8) + $x * $Parms(0) + $Parms(1)]
    	set e [expr $x * $x * $Parms(2) + $x * $Parms(3) + $Parms(4)]
    	set f [expr (($Parms(4) - $Parms(1))*($x - $Parms(6))) + ((0.50 *
    		($Parms(3) - $Parms(0))) * (( $x * $x ) - ($Parms(6) * $Parms(6)))) +
    		((0.3333 * ($Parms(2) - $Parms(8))) * (pow($x,3.0) - pow($Parms(6),3.0)))]
    	set s [expr (($Parms(4) - $Parms(1))*(log($x) - log($Parms(6)))) +
    		(($Parms(3) - $Parms(0)) * ($x - $Parms(6))) + ((0.50 * ($Parms(2) -
    		$Parms(8))) * (($x * $x) - ($Parms(6) * $Parms(6))))]
    	set g [expr 2.0 * ($f + $Parms(5))]
    	set h [expr exp(($x * 2.0 * (($Parms(5) / $Parms(6)) + $s +
    		0.008314 * log(1.66 * $Parms(7))) - $g) / $c)]
    	set v [expr (( -1.0 * $h + sqrt($h * $h + 8.0 * $Parms(7) * $h)) / (4.0 * $Parms(7)))]
    	set w [expr ($v * (1.0 - $v) / (2.0 - $v)) * (2.0 * $g * $g / ($c * $x))]
    	return [expr $d + $w + ($v * ($e - $d))]
    

  27. Cp(temp) for unfolding of trimer (request from Pierre Lavigne)
    	set c [expr $x * 0.008314]
    	set d [expr $x * $x * $Parms(8) + $x * $Parms(0) + $Parms(1)]
    	set e [expr $x * $x * $Parms(2) + $x * $Parms(3) + $Parms(4)]
    	set f [expr (($Parms(4) - $Parms(1))*($x - $Parms(6))) + ((0.50 * ($Parms(3) - $Parms(0))) * (( $x * $x ) - ($Parms(6) * $Parms(6)))) + ((0.3333 * ($Parms(2) - $Parms(8))) * (pow($x,3.0) - pow($Parms(6),3.0)))]
    	set s [expr (($Parms(4) - $Parms(1))*(log($x) - log($Parms(6)))) + (($Parms(3) - $Parms(0)) * ($x - $Parms(6))) + ((0.50 * ($Parms(2) - $Parms(8))) * (($x * $x) - ($Parms(6) * $Parms(6))))]
    	set g [expr $f + $Parms(5)]
    	set h [expr exp($x * (($Parms(5) / $Parms(6)) + $s + 0.008314 * log(2.09 * $Parms(7)*$Parms(7)) - $g) / $c)]
    	set i [expr sqrt(1.0 + ($h / (20.25 * $Parms(7)*$Parms(7))))]
    	set j [expr ($h / (6.0 * $Parms(7)*$Parms(7))) * (1.0 + $i)]
    	set k [expr ($h / (6.0 * $Parms(7)*$Parms(7))) * (1.0 - $i)]
    	set v [expr pow($j, 0.3333333) + pow($k, 0.3333333)]
    	set w [expr ($v * (1.0 - $v) / (3.0 - 2 * $v)) * (3.0 * $g * $g / ($c * $x))]
    	return [expr $d + $w + ($v * ($e - $d))]
    

  28. deltaG unfolding for dimers (request from Gary Shaw)
    	set j [expr 8.314 * $Parms(7)]
    	set k [expr exp((0.0 - ($Parms(4) + $Parms(5)*$x)) / $j)]
    	set m [expr $Parms(2) + $Parms(3) * $x]
    	set n [expr ($Parms(0) + $Parms(1) * $x) - $m]
    	set p [expr sqrt($k * $k + 8.0 * $Parms(6) * $k)]
    	return [expr ($n * ($p - $k)) / (4.0 * $Parms(6)) + $m]
    

Frequently Asked Questions about xcrvfit

  1. How do i change the colors and fonts to something nicer?

    Just take a look at your $HOME/.xcrvfitDefaults file and change it to something better. When you change an item, make sure you don't introduce additional blanks at the end.

  2. After entering the starting parameters, I don't see a fitting curve.

    Make sure to press return after entering each parameter. If you still don't see a fitting curve then double check the starting parameters, perhaps we are using different units or a different scale for the parameters.

  3. I press the iterate button and something bad happens.

    Some functions are very sensitive to the iterative approach. Try holding some of the parameters "constant" before iterating.

    Also, some functions require a reasonably close fit to the data before the iterate function can work.

  4. I want to enter my own function

    I am willing to look at adding new functions, send me an email.

Appendix: Older Versions of xcrvfit

Crvfit

Crvfit was developed at the University of Alberta in the Brian Sykes lab in 1989. It is a graphical curve fitting program which is easy to use, easy to add your own functions, and has fast convergence.

Crvfit is frequently used in the lab for binding curve studies where some functions are of the form f(x, x2). We have also used crvfit to calculate T1 and T2 relaxation curves and J coupling constants.

When convergence is not easily obtainable (some functions are very sensitive to pertubations), the user can still obtain useful fits by holding parameters constant.

The main disadvantage of crvfit is that it runs on sunview which the lab still supports (but just barely). crvfit was eventually ported to X-windows and is now called xcrvfit.

Fast Crvfit

Fast crvfit is a derivative of crvfit which fits multiple input files to the same function. So if you have lots of data files that you wish to fit with the same function, this program could save alot of time. However it is a risky program in that there is no graphical output. You will not be able to "see" the fit, the output is a statistical report only.

CrvfitS

This program does curve fitting for binding studies for the following cases:

Crvfit_nmrdata

This is a small utility which reformats our vnmr data files to crvfit or jfit data files.

Dimerfit

This program finds chi-square values from fitting data to curves by varying the values for kd1, kd2 and kdimer. There is also an option which allows the user to have the output formatted into a table which is acceptable for input into the macintosh "wingz" program.

Jfit

Graphical curve fitting package for estimating J-coupling constants via absorption/dispersion Lorentzians or Gaussian functions.


Back to Software Centre

This file last updated:

Questions to: bionmr@biochem.ualberta.ca