tag:blogger.com,1999:blog-30190544891270592712024-03-14T03:06:50.029+01:00YANUB: yet another (nearly) useless blogA blog from a scientist and former Debian developer (and occasional book writer)... Tricks for data handling, programming, debian administration and development, command-line and many other joyful things in the same spirit.
Oh, and sometimes completely unrelated things !Vincent Fourmondhttp://www.blogger.com/profile/04388598885608111329noreply@blogger.comBlogger142125tag:blogger.com,1999:blog-3019054489127059271.post-87232968192358809292023-03-27T18:06:00.002+02:002023-03-27T18:06:39.076+02:00QSoas version 3.2 is out<div class="separator" style="clear: both;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiheNKIDuRyhT7yb4Tv8h-rnF2irNp72sqjJbaUf4dr9cM6d4JlrzaS5qwxuUnhyphenhyphenGFW3otAyv1u_c6Wja6VN_DUoFs3RCzf7ki7HPhz-0N70vGUL_FK-XVHitADCK-kx_2Jqd4B4_CH9Ck/s512/QSoas-logo.png" style="display: block; padding: 1em 0; text-align: center; clear: right; float: right;"><img alt="" border="0" width="200" data-original-height="512" data-original-width="512" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiheNKIDuRyhT7yb4Tv8h-rnF2irNp72sqjJbaUf4dr9cM6d4JlrzaS5qwxuUnhyphenhyphenGFW3otAyv1u_c6Wja6VN_DUoFs3RCzf7ki7HPhz-0N70vGUL_FK-XVHitADCK-kx_2Jqd4B4_CH9Ck/s200/QSoas-logo.png"/></a></div>Version 3.2 of QSoas is out ! It is mostly a bug-fix release, fixing the computation mistake found in the <code>eecr-relay</code> wave shape fit, see the <a href="https://pubs.acs.org/doi/10.1021/jacs.3c01652">correction to our initial article in JACS</a>. We strongly encourage all the users of the <code>eecr-relay</code> wave shape fit to upgrade, and, unfortunately, refit previously fitted data as the results might change. The other wave shape fits are not affected by the issue.
<p/>
<h4>New features</h4>
In addition to this important bug fix, new possibilities have been added, including a way to make fits with <q>partially global</q> parameters using the new <a href="https://bip.cnrs.fr/groups/bip06/software/reference/#cmd-define-indexed-fit"><code>define-indexed-fit</code></a> command, to pick the best parameters dataset-by-dataset within fit trajectories, but also a parameter space explorer trying all possible permutations of one or more sets of parameters, and the possibility to save the results of a command to a global ruby variable.
<p/>
There are a lot of other new features, improvements and so on, look for the full list <a href="https://bip.cnrs.fr/groups/bip06/software/changes/#v3p2">there</a>.
<h4>About QSoas</h4><br/>
<a href="http://qsoas.org">QSoas</a> is a powerful open source data analysis program that focuses on flexibility and powerful fitting capacities. It is released under the <a href="https://www.gnu.org/licenses/old-licenses/gpl-2.0.en.html">GNU General Public License</a>. It is described in <a href="http://pubs.acs.org/doi/abs/10.1021/acs.analchem.6b00224">Fourmond, Anal. Chem., 2016, 88 (10), pp 5050–5052</a>. Current version is <strong>3.2</strong>. You can download <strong>for free </strong> its source code or precompiled versions for MacOS and Windows <a href="http://qsoas.org/downloads/">there</a>. Alternatively, you can clone from the <a href="https://github.com/fourmond/QSoas">GitHub repository</a>.
Vincent Fourmondhttp://www.blogger.com/profile/04388598885608111329noreply@blogger.com0tag:blogger.com,1999:blog-3019054489127059271.post-2439201684638240132022-10-16T14:54:00.000+02:002022-10-16T14:54:28.476+02:00Tutorial: analysis of multiwavelength fast kinetics dataThe purpose of this post is to demonstrate a first approach to the analysis of multiwavelength kinetic data, like those obtained using stopped-flow data. To practice, we will use data that were acquired during the stopped flow practicals of the <a href="http://frenchbic.cnrs.fr/2021/01/25/3rd-frenchbic-summer-school-on-methods-for-studying-metals-in-biology/">MetBio summer school</a> from the <a href="http://frenchbic.cnrs.fr/">FrenchBIC</a>. During the practicals, the student monitored the reaction of myoglobin (in its Fe(III) state) with azide, which yields a fast and strong change in the absorbance spectrum of the protein, which was monitored using a diode array. The data is publicly available on <a href="https://zenodo.org/record/7190333">zenodo</a>.
<p/>
<h4>Aims of this tutorial</h4>
The purpose of this tutorial is to teach you to use the free software<a href="https://bip.cnrs.fr/groups/bip06/software/">QSoas</a> to run a simple, multiwavelength exponential fit on the data, and to look at the results. This is not a kinetics lecture, so that it will not go in depth about the use of the exponential fit and its meaning.
<p/>
<h4>Getting started: loading the file</h4>
First, make sure you have a working version of QSoas, you can download them (for free) <a href="http://qsoas.org/downloads/">there</a>. Then download the data files from <a href="https://zenodo.org/record/7190333">zenodo</a>. We will work only on the data file <a href="https://zenodo.org/record/7190333/files/Azide-1.25mm_001.txt?download=1"><code>Azide-1.25mm_001.dat</code></a>, but of course, the purpose of this tutorial is to enable you to work on all of them. The data files contain the time evolution of the absorbance for all wavelengths, in a <q>matrix</q> format, in which each row correpond to a time point and each column to a wavelength.
<p/>
Start <a href="https://bip.cnrs.fr/groups/bip06/software/">QSoas</a>, and launch the command:
<pre>
QSoas> load /comments='"'
</pre>
Then, choose the <code>Azide-1.25mm_001.dat</code> data file. This should bring up a horizontal red line at the bottom of the data display, with X values between about 0 and 2.5. If you zoom on the red line with the mouse wheel, you'll realize it is data. The <code>/comments='"'</code> part is very important since it allows the extraction of the wavelength from the data. We will look at what it means another day. At this stage, you can look at the loaded data using the command:
<pre>
QSoas> edit
</pre>
You should have a window looking like this:
<div class="separator" style="clear: both;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhjs7iODDDYyNosikw_668mDMdrj0ViPpEPnBZncKOcr0B93XI2BQ-Rc3DwCh26MPbPbxGYdbULfgs4t1LQcJGyLOpbrFu62YaxsnTuX_lPbtuADMHyBjCTlr1zcFThYdOUayxlmn541au2EPg8uTKBlsRRcHELcufF-SBVedV4A-sRnR6d6hOm_sL4/s2082/Data-edit.png" style="display: block; padding: 1em 0; text-align: center; "><img alt="" border="0" width="400" data-original-height="1359" data-original-width="2082" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhjs7iODDDYyNosikw_668mDMdrj0ViPpEPnBZncKOcr0B93XI2BQ-Rc3DwCh26MPbPbxGYdbULfgs4t1LQcJGyLOpbrFu62YaxsnTuX_lPbtuADMHyBjCTlr1zcFThYdOUayxlmn541au2EPg8uTKBlsRRcHELcufF-SBVedV4A-sRnR6d6hOm_sL4/s400/Data-edit.png"/></a></div>
The rows each correspond to a data point displayed on the window below. The first column correspond to the X values, the second the Y values, and all the other ones to extra Y columns (they are not displayed by default). What is especially interesting is the first row, which contains a <code>nan</code> as the X value and what is obviously the wavelength for all the Y values. To tell that QSoas should take this line as the wavelength (which will be the <q>perpendicular coordinate</q>, the coordinate of the other direction of the matrix), first close the edit window and run:
<pre>
QSoas> set-perp /from-row=0
</pre>
<p/>
<h4>Splitting and fitting</h4>
Now, we have a single dataset containing a lot of Y columns. We want to fit all of them simultaneously with a (mono) exponential fit. For that, we first need to split the big matrix into a series of X,Y datasets (because fitting only works on the first Y). This is possible by running:
<pre>
QSoas> expand /style=red-to-blue /flags=kinetics
</pre>
Your screen should now look like this:
<div class="separator" style="clear: both;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj6tROpZQW_o5OTfaJu_0oeCNhikbdnYZHy018_IWikPACsUJ4oxDWrNu9Z1IFj4Vlpt2y1krYXEnUTQ_pjb_w0fXftOZt6qTWNja3MFFHK-YlOTGF7ohFC3n25ebgEeSs1BLEPpZ6I1c2F4NJK2NdmOhq-KMJNQu5kzm2sufotSwltrPjcd8iyYl3V/s2076/All-kinetics.png" style="display: block; padding: 1em 0; text-align: center; "><img alt="" border="0" width="400" data-original-height="1355" data-original-width="2076" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj6tROpZQW_o5OTfaJu_0oeCNhikbdnYZHy018_IWikPACsUJ4oxDWrNu9Z1IFj4Vlpt2y1krYXEnUTQ_pjb_w0fXftOZt6qTWNja3MFFHK-YlOTGF7ohFC3n25ebgEeSs1BLEPpZ6I1c2F4NJK2NdmOhq-KMJNQu5kzm2sufotSwltrPjcd8iyYl3V/s400/All-kinetics.png"/></a></div>
You're looking at the kinetics at all wavelengths at the same time (this may take some time to display on your computer, it is after all a rather large number of data points). The <code>/style=red-to-blue</code> is not strictly necessary, but it gives the red to blue color gradient which makes things easier to look at (and cooler !). The <code>/flags=kinetics</code> is there to attach a label (a <q>flag</q>) to the newly created datasets so we can easily manipulate all of them at the same time. Then it's time to fit, with the following command:
<pre>
QSoas> mfit-exponential-decay flagged:kinetics
</pre>
This should bring up a new window. After resizing it, you should have something that looks like this:
<div class="separator" style="clear: both;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi8_FpIPEETLPelE2aNTyHXNxkXoqxb7YTUvECWF6xGLc9WGhp_1hpksioaqPaXk7aRkdWrNDbFQlArrkvdOpSGwPkbDaJPRpU_EvUuFWS_Z4yjqus6wuUCmXZySqZEtK2EmcGDiB4RUZjYJ6FLgzJ2nmAUKTQS_ZExRSri1IJzylMW5u6cF90XajL-/s2084/FittingInterface.png" style="display: block; padding: 1em 0; text-align: center; "><img alt="" border="0" width="400" data-original-height="1362" data-original-width="2084" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi8_FpIPEETLPelE2aNTyHXNxkXoqxb7YTUvECWF6xGLc9WGhp_1hpksioaqPaXk7aRkdWrNDbFQlArrkvdOpSGwPkbDaJPRpU_EvUuFWS_Z4yjqus6wuUCmXZySqZEtK2EmcGDiB4RUZjYJ6FLgzJ2nmAUKTQS_ZExRSri1IJzylMW5u6cF90XajL-/s400/FittingInterface.png"/></a></div>
The bottom of the fit window is taken by the parameters, each with two checkboxes on the right to set them fixed (i.e. not determined by the fitting mechanism) and/or global (i.e. with a single value for all the datasets, here all the wavelengths). The top shows the current dataset along with the corresponding fit (in green), and, below, the residuals. You can change the dataset by clicking on the horizontal arrows or using Ctrl+PgUp or Ctrl+PgDown (keep holding it to scan fast). See the <code>Z = 728.15</code> showing that QSoas has recognized that the currently displayed dataset corresponds to the wavelength 728.15. The equation fitted to the data is: $$y(x) = A_\infty + A_1 \times \exp -(x - x_0)/\tau_1$$
In this case, while the \(A_1\) and \(A_\infty\) parameters clearly depend on the wavelength, the time constant of evolution should be independent of wavelength (the process happens at a certain rate regardless of the wavelength we're analyzing), so that the \(\tau_1\) parameter should be common for all the datasets/wavelengths. Just click on the <q>global</q> checkbox at the right of the <code>tau_1</code> parameter, make sure it is checked, and hit the <q>Fit</q> button...
<p />
The fit should not take long (less than a minute), and then you end up with the results of the fits: all the parameters. The best way to look at the non global parameters like \(A_1\) and \(A_\infty\) is to use the <q>Show Parameters</q> item from the <q>Parameters</q> menu. Using it and clicking on <code>A_inf</code> too should give you a display like this one:
<div class="separator" style="clear: both;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi9xwHx3j1EStdE7zBDhRdVGfwKKF7Xvo4Dd7CX48DrCKKQkJ7COxFV3flVUwRvzyNgiocqrMWhJnUqsqky0O_d1pbekuhLH3wQfWN2Tmk9y7BrOP0_WpS5pD0_7M6B6_X1h5kLFGAyW5ey250aBUzt627lKU3Ok1E_V9syQXBYg9XgP21V6hLfNyTK/s2073/FitParameters.png" style="display: block; padding: 1em 0; text-align: center; "><img alt="" border="0" width="400" data-original-height="1347" data-original-width="2073" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi9xwHx3j1EStdE7zBDhRdVGfwKKF7Xvo4Dd7CX48DrCKKQkJ7COxFV3flVUwRvzyNgiocqrMWhJnUqsqky0O_d1pbekuhLH3wQfWN2Tmk9y7BrOP0_WpS5pD0_7M6B6_X1h5kLFGAyW5ey250aBUzt627lKU3Ok1E_V9syQXBYg9XgP21V6hLfNyTK/s400/FitParameters.png"/></a></div>
The <code>A_inf</code> parameter corresponds to the spectum at infinite time (of azide-bound heme), while the <code>A_1</code> parameter corresponds to the difference spectrum between the initial (azide-free) and final (azide-bound) states.
<p/>
Now, the fit is finished, you can save the parameters if you want to reload them in a later fit by using the <q>Parameters</q>/<q>Save</q> menu item or export them in a form more suitable for plotting using <q>Parameters</q>/<q>Export</q> (although QSoas can also display and the parameters saved using <q>Save</q>). This concludes this first approach to fitting the data. What you can do is
<ul>
<li>look at the depence of the <code>tau_1</code> parameter as a function of the azide concentration;</li>
<li>try fitting more than one exponential, using for instance:
<pre>
QSoas> mfit-exponential-decay /exponentials=2 flagged:kinetics
</pre>
</li>
</ul>
<p/>
<h4>How to read the code above</h4>
All the lines starting by <code>QSoas></code> in the code areas above are meant to be typed into the QSoas command line (at the bottom of the window), and started by pressing <em>enter</em> at the end. You must remove the <code>QSoas></code> bit. The other lines (when applicable) show you the response of QSoas, in the terminal just above the command-line. You may want to play with the <a href="https://bip.cnrs.fr/groups/bip06/software/tutorial/">QSoas tutorial</a> to learn more about how to interact with QSoas.
<p/>
<h4>About QSoas</h4>
<a href="http://qsoas.org">QSoas</a> is a powerful open source data analysis program that focuses on flexibility and powerful fitting capacities. It is released under the <a href="https://www.gnu.org/licenses/old-licenses/gpl-2.0.en.html">GNU General Public License</a>. It is described in <a href="http://pubs.acs.org/doi/abs/10.1021/acs.analchem.6b00224">Fourmond, Anal. Chem., 2016, 88 (10), pp 5050–5052</a>. Current version is <strong>3.1</strong>. You can freely (and at no cost) download its source code or precompiled versions for MacOS and Windows <a href="http://qsoas.org/downloads/">there</a>. Alternatively, you can clone from the <a href="https://github.com/fourmond/QSoas">GitHub repository</a>.
<br/>
<b>Contact:</b> find my email address <a href="https://bip.cnrs.fr/contact/vincent-fourmond/">there</a>, or contact me on <a href="https://www.linkedin.com/in/vincent-fourmond-13998324a/">LinkedIn</a>.Vincent Fourmondhttp://www.blogger.com/profile/04388598885608111329noreply@blogger.com3tag:blogger.com,1999:blog-3019054489127059271.post-16000672846459223322022-09-28T15:29:00.000+02:002022-09-28T15:29:04.160+02:00Version 3.1 of QSoas is outThe new version of QSoas has just been released ! It brings in a host of new features, as the releases before, but maybe the most important change is the following...<p>
<h4>Binary images now freely available !</h4>
Starting from now, all the binary images for the new versions of QSoas will freely available from the <a href="https://bip.cnrs.fr/groups/bip06/software/downloads/">download page</a>. You can download the precompiled versions of QSoas for MacOS or windows. So now, you have no reason anymore not to try !<br/>
My aim with making the binaries freely available is also to simplify the release process for me and therefore increase the rate at which new versions are released.<p/>
<h4>Improvements to the fit interface</h4>
Some work went into improving the fit interface, in particular for the handling of fit trajectories when doing parameter space exploration, for difficult fits with many parameters and many local minima. The fit window now features real menus, along with tab a way to display the terminal (see the menus and the tabs selection on the image).
<br/>
<div class="separator" style="clear: both;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgITJ9qzhep6YDRx0VULBtGYZEutJkYJzbbZymrrcoIH1DXPkXuPgxuB2Ldv7k_ChpL7AtdqiKXbTRRbDun2mdovep2F0OY8dHYnbvg06_dPftLLMcp9zjwCxI4I64P9sviWXpw8wyZPpfoOS7VdjOFpg-9s1xqETUvcvlgMccylIsM73KIzZgf66nd/s4096/QSoas-fits-macos.png" style="display: block; padding: 1em 0; text-align: center; "><img alt="" border="0" width="400" data-original-height="2304" data-original-width="4096" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgITJ9qzhep6YDRx0VULBtGYZEutJkYJzbbZymrrcoIH1DXPkXuPgxuB2Ldv7k_ChpL7AtdqiKXbTRRbDun2mdovep2F0OY8dHYnbvg06_dPftLLMcp9zjwCxI4I64P9sviWXpw8wyZPpfoOS7VdjOFpg-9s1xqETUvcvlgMccylIsM73KIzZgf66nd/s320/QSoas-fits-macos.png"/></a></div>
Individual fits have also been improved, with, among others, the possibility to easily simulate voltammograms with the <code>kinetic-system</code> fits, and the handling of Marcus-Hush-Chidsey (or Marcus "distribution of states") kinetics for electron transfers.<p/>
<h4>Column and row names</h4>
This release greatly improves the handling of column and row names, including commands to easily modify them, the possibility to use Ruby formulas to change them, and a much better way read and write them to data files. Mastering the use of column names (and to a lesser extent, row names) can greatly simplify data handling, especially when dealing with files with a large number of columns.<p/>
<h4>Complex numbers</h4>
Version 3.1 brings in support for formulas handling complex numbers. Although it is not possible to store complex numbers directly into datasets, it is easy to separate them in real and imaginary parts to your liking.<p/>
<h4>Scripting improvement</h4>
Two important improvements for scripting are included in version 3.1. The first is the possibility to define <em>virtual files</em> inside a script file, which makes it easy to define <q>subfunctions</q> to run using commands like <a href="https://bip.cnrs.fr/groups/bip06/software/reference/#cmd-run-for-each">run-for-each</a>. The second is the possibility to define <q>variables</q> to be reused later (like the script arguments) using the new command <a href="https://bip.cnrs.fr/groups/bip06/software/reference/#cmd-let">let</a>.
<p/>
There are a lot of other new features, improvements and so on, look for the full list <a href="https://bip.cnrs.fr/groups/bip06/software/changes/#v3p1">there</a>.
<h4>About QSoas</h4><br/>
<a href="http://qsoas.org">QSoas</a> is a powerful open source data analysis program that focuses on flexibility and powerful fitting capacities. It is released under the <a href="https://www.gnu.org/licenses/old-licenses/gpl-2.0.en.html">GNU General Public License</a>. It is described in <a href="http://pubs.acs.org/doi/abs/10.1021/acs.analchem.6b00224">Fourmond, Anal. Chem., 2016, 88 (10), pp 5050–5052</a>. Current version is <strong>3.1</strong>. You can download its source code or precompiled versions for MacOS and Windows <a href="http://qsoas.org/downloads/">there</a>. Alternatively, you can clone from the <a href="https://github.com/fourmond/QSoas">GitHub repository</a>.
Vincent Fourmondhttp://www.blogger.com/profile/04388598885608111329noreply@blogger.com0tag:blogger.com,1999:blog-3019054489127059271.post-39339816377173374442021-07-07T19:38:00.000+02:002021-07-07T19:38:26.445+02:00Upcoming features of QSoas and github repository<div class="separator" style="clear: both;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiheNKIDuRyhT7yb4Tv8h-rnF2irNp72sqjJbaUf4dr9cM6d4JlrzaS5qwxuUnhyphenhyphenGFW3otAyv1u_c6Wja6VN_DUoFs3RCzf7ki7HPhz-0N70vGUL_FK-XVHitADCK-kx_2Jqd4B4_CH9Ck/s512/QSoas-logo.png" style="display: block; padding: 1em 0; text-align: center; clear: right; float: right;"><img alt="" border="0" width="200" data-original-height="512" data-original-width="512" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiheNKIDuRyhT7yb4Tv8h-rnF2irNp72sqjJbaUf4dr9cM6d4JlrzaS5qwxuUnhyphenhyphenGFW3otAyv1u_c6Wja6VN_DUoFs3RCzf7ki7HPhz-0N70vGUL_FK-XVHitADCK-kx_2Jqd4B4_CH9Ck/s200/QSoas-logo.png"/></a></div>For the past years, most of the development has happened behind the scene in a private repository, and the code has appeared in the public repository only a couple of months before the release, in the <code>release</code> branch. I have now decided to publish the <q>current</q> code of QSoas in the github repository (in the <a href="https://github.com/fourmond/QSoas/tree/public"><code>public</code></a> branch). This way, you can follow and use all the good things that were developed since the last release, and also verify whether any bug you have is still present in the currently developed version !<br /><br />
<h4>Upcoming features</h4><br />
This is the occasion to write a bit about the some of the features that have been added since the <a href="/2020/12/version-30-of-qsoas-is-out.html">publication of the 3.0 release</a>. Not all of them are polished nor documented yet, but here are a few teasers. The current version in github has:
<ul>
<li>a comprehensive handling of column/row names, which makes it much easier to work with files with named columns (like the output files QSoas produces !);</li>
<li>better handling of lists of meta-data, when there is one value of the meta for each segment or each Y column;</li>
<li>handling of complex numbers in <a href='https://bip.cnrs.fr/groups/bip06/software/reference/#cmd-apply-formula'>apply-formula</a>;</li>
<li>defining fits using external python code;</li>
<li>a command for linear least squares (which has the huge advantage of being exact and not needing any initial parameters);</li>
<li>commands to pause in a script or sort datasets in the stack;</li>
<li>improvements over previous commands, in particular with <code>eval</code>;</li>
<li>... and more...</li>
</ul>
Check out the <a href="https://github.com/fourmond/QSoas/tree/public">github repository</a> if you want to know more about the new features !
<br /><br />
As of now, no official date is planned for the 3.1 release, but this could happen during fall.
<br/><br/>
<h4>About QSoas</h4><br/>
<a href="http://qsoas.org">QSoas</a> is a powerful open source data analysis program that focuses on flexibility and powerful fitting capacities. It is released under the <a href="https://www.gnu.org/licenses/old-licenses/gpl-2.0.en.html">GNU General Public License</a>. It is described in <a href="http://pubs.acs.org/doi/abs/10.1021/acs.analchem.6b00224">Fourmond, Anal. Chem., 2016, 88 (10), pp 5050–5052</a>. Current version is <strong>3.0</strong>. You can download its source code <a href="http://qsoas.org/downloads/">there</a> (or clone from the <a href="https://github.com/fourmond/QSoas">GitHub repository</a>) and compile it yourself, or buy precompiled versions for MacOS and Windows <a href="https://evalorix.com/en/shop/science-and-engineering-products-and-tools/software-and-apps/qsoas-software/">there</a>.
Vincent Fourmondhttp://www.blogger.com/profile/04388598885608111329noreply@blogger.com0tag:blogger.com,1999:blog-3019054489127059271.post-15731791279020416922021-06-13T23:14:00.001+02:002021-06-13T23:14:38.290+02:00Solution for QSoas quiz #2: averaging several Y values for the same X value This post describes two similar solutions to the <a href='https://vince-debian.blogspot.com/2021/05/qsoas-quiz-2-averaging-several-y-values.html'>Quiz #2</a>, using the data files found <a href='https://github.com/fourmond/QSoasExampleFiles/tree/data/Quiz-02'>there</a>. The two solutions described here rely on <a href='https://bip.cnrs.fr/groups/bip06/software/reference/#cmd-split-on-values'><code>split-on-values</code></a>. The first solution is the one that came naturally to me, and is by far the most general and extensible, but the second one is shorter, and doesn't require external script files.
<br />
<div class="separator" style="clear: both;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhjQOvdYqysZmVqLZTsbvpPiiVCGIdQ3YqKMTHGU-ywEzPOKjK4JdxEyNWwpeNVWHu0PS5SEY0-2P2PSSl7-grBJ-f-2Y3lI6sJKFC3U287CxuGGnDG1mB4dga3u6c3s_HqSYc4PQ3eSrU/s1981/Quiz-02.png" style="display: block; padding: 1em 0; text-align: center; "><img alt="" border="0" width="400" data-original-height="1200" data-original-width="1981" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhjQOvdYqysZmVqLZTsbvpPiiVCGIdQ3YqKMTHGU-ywEzPOKjK4JdxEyNWwpeNVWHu0PS5SEY0-2P2PSSl7-grBJ-f-2Y3lI6sJKFC3U287CxuGGnDG1mB4dga3u6c3s_HqSYc4PQ3eSrU/s320/Quiz-02.png"/></a></div>
<h4>Solution #1</h4>
The key to both solution is to separate the original data into a series of datasets that only contain data at a fixed value of x (which corresponds here to a fixed pH), and then process each dataset one by one to extract the average and standard deviation. This first step is done thus:
<pre>QSoas> load kcat-vs-ph.dat
QSoas> split-on-values pH x /flags=data
</pre>
After these commands, the stacks contains a series of datasets bearing the <code>data</code> flag, that each contain a single column of data, as can be seen from the beginnings of a show-stack command:
<pre>QSoas> k
Normal stack:
F C Rows Segs Name
#0 (*) 1 43 1 'kcat-vs-ph_subset_22.dat'
#1 (*) 1 44 1 'kcat-vs-ph_subset_21.dat'
#2 (*) 1 43 1 'kcat-vs-ph_subset_20.dat'
...
</pre>
Each of these datasets have a meta-data named <code>pH</code> whose value is the original x value from <code>kcat-vs-ph.dat</code>. Now, the idea is to run a <a href='https://bip.cnrs.fr/groups/bip06/software/reference/#cmd-stats'><code>stats</code></a> command on the resulting datasets, extracting the average value of x and its standard deviation, together with the value of the meta <code>pH</code>. The most natural and general way to do this is to use <a href='https://bip.cnrs.fr/groups/bip06/software/reference/#cmd-run-for-datasets'><code>run-for-datasets</code></a>, using the following script file (named <code>process-one.cmds</code>):
<pre>stats /meta=pH /output=true /stats=x_average,x_stddev
</pre>
So the command looks like:
<pre>QSoas> run-for-datasets process-one.cmds flagged:data
</pre>
This command produces an output file containing, for each flagged dataset, a line containing <code>x_average</code>, <code>x_stddev</code>, and <code>pH</code>. Then, it is just a matter of loading the output file and shuffling the columns in the right order to get the data in the form asked. Overall, this looks like <a href="https://github.com/fourmond/QSoasExampleFiles/blob/data/Quiz-02/solution-1.cmds">this</a>:
<pre>
l kcat-vs-ph.dat
split-on-values pH x /flags=data
output result.dat /overwrite=true
run-for-datasets process-one.cmds flagged:data
l result.dat
apply-formula tmp=y2;y2=y;y=x;x=tmp
dataset-options /yerrors=y2
</pre>
The slight improvement over what is described above is the use of the <a href='https://bip.cnrs.fr/groups/bip06/software/reference/#cmd-output'><code>output</code></a> command to write the output to a dedicated file (here <code>result.dat</code>), instead of <code>out.dat</code> and ensuring it is overwritten, so that no data remains from previous runs.
<br />
<br />
<h4>Solution #2</h4>
The second solution is almost the same as the first one, with two improvements:
<ul>
<li>the <a href='https://bip.cnrs.fr/groups/bip06/software/reference/#cmd-stats'><code>stats</code></a> command can work with datasets other than the current one, by supplying them to the <code>/buffers=</code> option, so that it is not necessary to use <a href='https://bip.cnrs.fr/groups/bip06/software/reference/#cmd-run-for-datasets'><code>run-for-datasets</code></a>;</li>
<li>the use of the output file can by replaced by the use of the <a href='https://bip.cnrs.fr/groups/bip06/software/reference/#data-output'>accumulator</a>.</li>
</ul>
This yields the following, smaller, <a href="https://github.com/fourmond/QSoasExampleFiles/blob/data/Quiz-02/solution-2.cmds">solution</a>:
<pre>
l kcat-vs-ph.dat
split-on-values pH x /flags=data
stats /meta=pH /accumulate=* /stats=x_average,x_stddev /buffers=flagged:data
pop
apply-formula tmp=y2;y2=y;y=x;x=tmp
dataset-options /yerrors=y2
</pre>
<br />
<br />
<h4>About QSoas</h4>
<a href="http://qsoas.org">QSoas</a> is a powerful open source data analysis program that focuses on flexibility and powerful fitting capacities. It is released under the <a href="https://www.gnu.org/licenses/old-licenses/gpl-2.0.en.html">GNU General Public License</a>. It is described in <a href="http://pubs.acs.org/doi/abs/10.1021/acs.analchem.6b00224">Fourmond, Anal. Chem., 2016, 88 (10), pp 5050–5052</a>. Current version is <strong>3.0</strong>. You can download its source code <a href="http://qsoas.org/downloads/">there</a> (or clone from the <a href="https://github.com/fourmond/QSoas">GitHub repository</a>) and compile it yourself, or buy precompiled versions for MacOS and Windows <a href="https://evalorix.com/en/shop/science-and-engineering-products-and-tools/software-and-apps/qsoas-software/">there</a>.
Vincent Fourmondhttp://www.blogger.com/profile/04388598885608111329noreply@blogger.com0tag:blogger.com,1999:blog-3019054489127059271.post-21809929774827118152021-05-30T22:36:00.001+02:002021-05-30T22:36:04.572+02:00QSoas quiz #2: averaging several Y values for the same X valueThis second quiz may sound like the <a href="https://vince-debian.blogspot.com/2020/10/qsoas-quiz-1-averaging-spectra.html">first one</a>, but in fact, the approach used is completely different. The point is to gather some elementary statistics from a series of experiments performed under different conditions, but with several repeats at the same conditions.
<br />
<h4>Quiz</h4>
You are given a file (which you can download <a href='https://github.com/fourmond/QSoasExampleFiles/raw/data/Quiz-02/kcat-vs-ph.dat'>there</a>) that contains a series of <code>pH value</code> data: the X column is the pH, the Y column the result of the experiment at the given pH (let's say the measure of the catalytic rate of an enzyme). Your task is to take this data and produce a single dataset which contains, for each pH value, the pH, the average of the results at that pH and the standard deviation. The result should be identical to the <a href='https://github.com/fourmond/QSoasExampleFiles/raw/data/Quiz-02/processed.dat'>following file</a>, and should look like that:
<div class="separator" style="clear: both;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhjQOvdYqysZmVqLZTsbvpPiiVCGIdQ3YqKMTHGU-ywEzPOKjK4JdxEyNWwpeNVWHu0PS5SEY0-2P2PSSl7-grBJ-f-2Y3lI6sJKFC3U287CxuGGnDG1mB4dga3u6c3s_HqSYc4PQ3eSrU/s1981/Quiz-02.png" style="display: block; padding: 1em 0; text-align: center; "><img alt="" border="0" width="400" data-original-height="1200" data-original-width="1981" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhjQOvdYqysZmVqLZTsbvpPiiVCGIdQ3YqKMTHGU-ywEzPOKjK4JdxEyNWwpeNVWHu0PS5SEY0-2P2PSSl7-grBJ-f-2Y3lI6sJKFC3U287CxuGGnDG1mB4dga3u6c3s_HqSYc4PQ3eSrU/s320/Quiz-02.png"/></a></div>
There are several ways to do this, but all ways must rely on <a href="https://bip.cnrs.fr/groups/bip06/software/reference/#cmd-stats"><code>stats</code></a>, and the more natural way in QSoas is to take advantage of <a href="https://bip.cnrs.fr/groups/bip06/software/reference/#cmd-split-on-values"><code>split-on-values</code></a>, which is a very powerful command but somehow hard to master, which is the point of this Quiz.
<br />
By the way, the data file is purely synthetic, if you look in the <a href='https://github.com/fourmond/QSoasExampleFiles'>GitHub repository</a>, you'll see how it was generated.
<br />
<br />
<h4>About QSoas</h4>
<a href="http://qsoas.org">QSoas</a> is a powerful open source data analysis program that focuses on flexibility and powerful fitting capacities. It is released under the <a href="https://www.gnu.org/licenses/old-licenses/gpl-2.0.en.html">GNU General Public License</a>. It is described in <a href="http://pubs.acs.org/doi/abs/10.1021/acs.analchem.6b00224">Fourmond, Anal. Chem., 2016, 88 (10), pp 5050–5052</a>. Current version is <strong>3.0</strong>. You can download its source code <a href="http://qsoas.org/downloads/">there</a> (or clone from the <a href="https://github.com/fourmond/QSoas">GitHub repository</a>) and compile it yourself, or buy precompiled versions for MacOS and Windows <a href="https://evalorix.com/en/shop/science-and-engineering-products-and-tools/software-and-apps/qsoas-software/">there</a>.
Vincent Fourmondhttp://www.blogger.com/profile/04388598885608111329noreply@blogger.com0tag:blogger.com,1999:blog-3019054489127059271.post-1503329538749436822021-05-16T22:01:00.001+02:002021-05-16T22:01:48.945+02:00Tutorial: analyze redox inactivations/reactivationsRedox-dependent inactivations are actually rather common in the field of metalloenzymes, and electrochemistry can be an extremely powerful tool to study them, providing one can analyze the data quantitatively. The point of this point is to teach the reader how to do so using <a href='https://qsoas.org'>QSoas</a>. For more general information about redox inactivations and how to study them using electrochemical techniques, the reader is invited to read the review <a href="http://dx.doi.org/10.1002/celc.201901028">del Barrio and Fourmond, ChemElectroChem 2019</a>.
<p />
This post is a tutorial to learn the analysis of data coming from the study of the redox-dependent substrate inhibition of periplasmic nitrate reductase NapAB, which has the advantage of being relatively simple. The whole processed is discussed in <a href='http://dx.doi.org/10.1016/j.bbabio.2014.05.357'>Jacques et al, BBA, 2014</a>. What you need to know in order to follow this tutorial is the following:
<ul>
<li>the whole inactivation/reactivation process can be modelled by a simple reversible reaction:
$$ \mathrm{A} \rightleftharpoons \mathrm{I} $$
A is the active form, I the inactive form;
</li>
<li>the forward rate constant is \(k_i(E)\) (dependent on potential) and the backward rate constant is \(k_a(E)\), also dependent on potential;</li>
<li>the experiment is done in a series of 5 steps at 3 different potentials: \(E_0\) then \(E_1\) then \(E_2\) then \(E_1\) then, finally, \(E_0\);</li>
<li>the enzyme is assumed to be fully active at the beginning of the first step;</li>
<li>a single experiment is used to obtain the values of \(k_i\) and \(k_a\) for the three potentials (although not reliably for the value at \(E_0\)</li>
<li>the current given by the active species depends on potential (and it is negative because the enzyme catalyzes a reduction), and the inactive species gives no current;</li>
<li>in addition to the reversible reaction above, there is an irreversible, potential-dependent loss.</li>
</ul>
You can download the data files from the <a href="https://github.com/fourmond/QSoasExampleFiles/tree/data/Jacques-2014">GitHub repository</a>. Before fitting the data to determine the values of the rate constants at the potentials of the experiment, we will first subtract the background current, assuming that the respective contributions of faradaic and non-faradaic currents is <i>additive</i>. Start QSoas, go to the directory where you saved the files, and load both the data file and the blank file thus:
<pre>QSoas> cd
QSoas> load 27.oxw
QSoas> load 27-blanc.oxw
QSoas> S 1 0
</pre>
(after the first command, you have to manually select the directory in which you downloaded the data files). The <code>S 1 0</code> command just subtracts the dataset 1 (the first loaded) from the dataset 0 (the last loaded), see more <a href="https://bip.cnrs.fr/groups/bip06/software/reference#cmd-subtract">there</a>. <q>blanc</q> is the French for <q>blank</q>...
<p />
Then, we remove a bit of the beginning and the end of the data, corresponding to one half of the steps at \(E_0\), which we don't exploit much here (they are essentially only used to make sure that the irreversible loss is taken care of properly). This is done using <a href="https://bip.cnrs.fr/groups/bip06/software/reference#cmd-strip-if">strip-if</a>:
<pre>QSoas> strip-if x<30||x>300
</pre>
Then, we can fit ! The fit used is called <a href="https://bip.cnrs.fr/groups/bip06/software/reference#cmd-fit-linear-kinetic-system">fit-linear-kinetic-system</a>, which is used to fit kinetic models with only linear reactions (like here) and steps which change the values of the <em>rate constants</em> but do not instantly change the <em>concentrations</em>. The specific command to fit the data is:
<pre>QSoas> fit-linear-kinetic-system /species=2 /steps=0,1,2,1,0
</pre>
The <code>/species=2</code> indicates that there are two species (A and I). The <code>/steps=0,1,2,1,0</code> indicates that there are 5 steps, with three different conditions (0 to 2) in order 0,1,2,1,0. This fits needs a bit of setup before getting started. The species are numbered, 1 and 2, and the conditions (potentials) are indicated by <code>#0</code>, <code>#1</code> and <code>#2</code> suffixes.
<ul>
<li>The <code>I_1</code> and <code>I_2</code> are the currents for the species 1 and 2, so something for 1 (active form) and 0 for 2 (inactive form).
Moreover, the parameters <code>I_2_#0</code> (and <code>_#1</code>, <code>_#2</code>) should be fixed and not free (since we don't need to adjust a current for the inactive form).</li>
<li>The <code>k_11</code> and <code>k_22</code> correspond to species-specific irreversible loss. It is generally best to leave them fixed to 0.</li>
<li><code>k_12</code> is the formation of 2 (I) from 1 (A), and <code>k_21</code> is the formation of A from I. Their values will be determined for the three conditions. The default values should work here.</li>
<li>The <code>k_loss</code> parameters are the rates of irreversible loss that apply indiscriminately on all species (unlike <code>k_11</code> and <code>k_22</code>). They are adjusted and ther default values should work too.</li>
<li><code>alpha_1_0</code> and <code>alpha_2_0</code> are the initial concentrations of species 1 and 2, so they should be fixed to 1 and 0.</li>
<li>Last, the <code>xstart_a</code> and (<code>_b</code>, <code>_c</code>, <code>_d</code> and <code>_e</code>) correspond to the starting times for the steps, here, 0, 60, 120, 210 and 270.</li>
</ul>
For the sake of simplicity, you can also simply load the <code>starting-parameters.params</code> parameters to have all setup the correct way. Then, just hit <q>Fit</q>, enjoy this moment when QSoas works and you don't have to... The screen should now look like this:
<div class="separator" style="clear: both;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjrHFmwKs6XswLObLH10RQ387z5q3V0kowZBydLVRaxmeXgK18wHI70zglaU0jyRszM4y15M3yYpv4EIENREqKFvqMbj95l0c-zLMAzKs89GD2hqM3X4IfXtfqNBOyjBFmGargLFHC1SWE/s1809/Fit-Jacques.png" style="display: block; padding: 1em 0; text-align: center; "><img alt="" border="0" width="400" data-original-height="1200" data-original-width="1809" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjrHFmwKs6XswLObLH10RQ387z5q3V0kowZBydLVRaxmeXgK18wHI70zglaU0jyRszM4y15M3yYpv4EIENREqKFvqMbj95l0c-zLMAzKs89GD2hqM3X4IfXtfqNBOyjBFmGargLFHC1SWE/s400/Fit-Jacques.png"/></a></div>
Now, it's done ! The fit is actually pretty good, and you can read the values of the inactivation and reactivation rate constants from the fit parameters.
<p />
You can train also on the <code>21.oxw</code> and <code>21-blanc.oxw</code> files. Usually, re-loading the best fit parameters from other potentials as starting parameters work really well. Gathering the results of several fits into a real curve of rate constants as a function of potentials is left as an exercise for the reader (or maybe a later post), although you may find these <a href="/search/label/meta-data">series of posts</a> useful in this context !
<br />
<h4>About QSoas</h4>
<a href="http://qsoas.org">QSoas</a> is a powerful open source data analysis program that focuses on flexibility and powerful fitting capacities. It is released under the <a href="https://www.gnu.org/licenses/old-licenses/gpl-2.0.en.html">GNU General Public License</a>. It is described in <a href="http://pubs.acs.org/doi/abs/10.1021/acs.analchem.6b00224">Fourmond, Anal. Chem., 2016, 88 (10), pp 5050–5052</a>. Current version is <strong>3.0</strong>. You can download its source code <a href="http://qsoas.org/downloads/">there</a> (or clone from the <a href="https://github.com/fourmond/QSoas">GitHub repository</a>) and compile it yourself, or buy precompiled versions for MacOS and Windows <a href="https://evalorix.com/en/shop/science-and-engineering-products-and-tools/software-and-apps/qsoas-software/">there</a>.Vincent Fourmondhttp://www.blogger.com/profile/04388598885608111329noreply@blogger.com0tag:blogger.com,1999:blog-3019054489127059271.post-8217731027126040632021-03-11T09:31:00.000+01:002021-03-11T09:31:13.873+01:00All tips and tricks about QSoas<div class="separator" style="clear: both;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiheNKIDuRyhT7yb4Tv8h-rnF2irNp72sqjJbaUf4dr9cM6d4JlrzaS5qwxuUnhyphenhyphenGFW3otAyv1u_c6Wja6VN_DUoFs3RCzf7ki7HPhz-0N70vGUL_FK-XVHitADCK-kx_2Jqd4B4_CH9Ck/s512/QSoas-logo.png" style="display: block; padding: 1em 0; text-align: center; clear: right; float: right;"><img alt="" border="0" width="200" data-original-height="512" data-original-width="512" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiheNKIDuRyhT7yb4Tv8h-rnF2irNp72sqjJbaUf4dr9cM6d4JlrzaS5qwxuUnhyphenhyphenGFW3otAyv1u_c6Wja6VN_DUoFs3RCzf7ki7HPhz-0N70vGUL_FK-XVHitADCK-kx_2Jqd4B4_CH9Ck/s200/QSoas-logo.png"/></a></div>I've decided to post regular summaries of all the articles written here about QSoas; this is the first post of this kind. All the articles related to QSoas can be found <a href="https://vince-debian.blogspot.com/search/label/qsoas">here</a> also.
<p />
The articles written here can be separated into several categories.
<h4>Tutorials to analyze real data</h4>
These are posts about how to reproduce the data analysis of published articles, including links to the original data so you can fully reproduce our results.
<ul>
<li><a href="https://vince-debian.blogspot.com/2020/09/tutorial-analyze-km-data-of-codhs.html">how to determine the \(K_m\)</a> of enzymes working with gaseous substrates with electrochemistry, as in <a href="https://dx.doi.org/10.1002/anie.201709261">Domnik et al, <i>Angewandte Chemie</i> 2017</a>.</li>
</ul>
These posts all have the label <a href="https://vince-debian.blogspot.com/search/label/tutorial">tutorial</a>.<p />
<h4>All about fits</h4>
QSoas has a particularly powerful interface for non-linear least square minimisations (<q>fits</q>):
<ul>
<li>See <a href="https://vince-debian.blogspot.com/2016/01/qsoas-tips-and-tricks-using-fit.html">here</a> to learn how you can take advantage of the fit interface to explore easily how a parameter influences the shape of a function.</li>
<li>See <a href="https://vince-debian.blogspot.com/2020/10/qsoas-tips-and-tricks-generating-smooth.html">here</a> how you can produce smooth curves for a fit on <q>jaggy</q> data.
</ul>
<h4>Meta-data</h4>
Meta data describe the conditions in which experiments were performed.
<ul>
<li>You can see <a href="https://vince-debian.blogspot.com/2020/11/qsoas-tips-and-tricks-using-meta-data.html">here</a> how to use them in data analysis, to plot for instance peak position as a function of meta-data;</li>
<li>You can see <a href="https://vince-debian.blogspot.com/2021/02/qsoas-tips-and-tricks-permanently.html">here</a> how to permanently store meta-data for files.</li>
</ul>
<h4>Quiz and their solutions</h4>
Quiz are small problems that take some skill to solve; they can teach you a lot about how to work with QSoas.
<ul>
<li><a href="https://vince-debian.blogspot.com/2020/10/qsoas-quiz-1-averaging-spectra.html">Quiz #1</a>: computing the standard deviation of spectra, along with the <a href="https://vince-debian.blogspot.com/2020/11/solution-for-qsoas-quiz-1-averaging.html">solution</a>. This quiz can teach you a lot about combining data from different datasets and manipulating data row-by-row.</li>
</ul>
<h4>Other tips and tricks</h4>
<ul>
<li>See <a href="https://vince-debian.blogspot.com/2016/11/finding-zeros-of-data-using-qsoas.html">here</a> how to find the 0s of experimental data.</li>
<li>See <a href="https://vince-debian.blogspot.com/2016/02/qsoas-tips-and-tricks-better-baselines.html">here</a> how one can save just the selected points in a baseline, and reuse them.</li>
<li>See <a href="https://vince-debian.blogspot.com/2017/02/extended-dataset-generation.html">here</a> to learn how to generate many datasets in one go from a mathematical formula.</li>
<li>See <a href="https://vince-debian.blogspot.com/2017/10/define-function-with-inline-ruby-code.html">here</a> how to define a custom mathematical function using Ruby.</li>
<li>See <a href="https://vince-debian.blogspot.com/2021/01/taking-advantage-of-ruby-in-qsoas.html">here</a> how one can take advantage of Ruby, the underlying programming language to sum columns, extend the values of columns with lots of missing values and rename datasets using a pattern.</li>
<li>See <a href="https://vince-debian.blogspot.com/2017/05/run-qsoas-complely-non-interactively.html">here</a> how you can use QSoas without starting the graphical interface !</li>
</ul>
<h4>Release annoucements</h4>
These have generally lot of general information about the possibilities in QSoas:
<ul>
<li><a href="https://vince-debian.blogspot.com/2015/12/announcing-qsoas-powerful-yfx-data.html">initial release</a>;</li>
<li>version <a href="https://vince-debian.blogspot.com/2016/07/qsoas-version-20-is-out-qsoas-paper.html">2.0</a>;</li>
<li>version <a href="https://vince-debian.blogspot.com/2017/01/version-21-of-qsoas-is-out.html">2.1</a>;</li>
<li>version <a href="https://vince-debian.blogspot.com/2018/03/release-22-of-qsoas.html">2.2</a>;</li>
<li>and, finally, version <a href="https://vince-debian.blogspot.com/2020/12/version-30-of-qsoas-is-out.html">3.0</a>.</li>
</ul>
<br/>
<h4>About QSoas</h4>
<a href="http://qsoas.org">QSoas</a> is a powerful open source data analysis program that focuses on flexibility and powerful fitting capacities. It is released under the <a href="https://www.gnu.org/licenses/old-licenses/gpl-2.0.en.html">GNU General Public License</a>. It is described in <a href="http://pubs.acs.org/doi/abs/10.1021/acs.analchem.6b00224">Fourmond, Anal. Chem., 2016, 88 (10), pp 5050–5052</a>. Current version is <strong>3.0</strong>. You can download its source code <a href="http://qsoas.org/downloads/">there</a> (or clone from the <a href="https://github.com/fourmond/QSoas">GitHub repository</a>) and compile it yourself, or buy precompiled versions for MacOS and Windows <a href="https://evalorix.com/en/shop/science-and-engineering-products-and-tools/software-and-apps/qsoas-software/">there</a>.Vincent Fourmondhttp://www.blogger.com/profile/04388598885608111329noreply@blogger.com0tag:blogger.com,1999:blog-3019054489127059271.post-28495228675139991012021-02-16T11:51:00.000+01:002021-02-16T11:51:26.170+01:00QSoas tips and tricks: permanently storing meta-data<div class="separator" style="clear: both;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiheNKIDuRyhT7yb4Tv8h-rnF2irNp72sqjJbaUf4dr9cM6d4JlrzaS5qwxuUnhyphenhyphenGFW3otAyv1u_c6Wja6VN_DUoFs3RCzf7ki7HPhz-0N70vGUL_FK-XVHitADCK-kx_2Jqd4B4_CH9Ck/s512/QSoas-logo.png" style="display: block; padding: 1em 0; text-align: center; clear: right; float: right;"><img alt="" border="0" width="200" data-original-height="512" data-original-width="512" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiheNKIDuRyhT7yb4Tv8h-rnF2irNp72sqjJbaUf4dr9cM6d4JlrzaS5qwxuUnhyphenhyphenGFW3otAyv1u_c6Wja6VN_DUoFs3RCzf7ki7HPhz-0N70vGUL_FK-XVHitADCK-kx_2Jqd4B4_CH9Ck/s200/QSoas-logo.png"/></a></div>It is one thing to acquire and process data, but the data themselves are most often useless without the <i>context</i>, the conditions in which the experiments were made. These additional informations can be called <q>meta-data</q>. In a <a href="/2020/11/qsoas-tips-and-tricks-using-meta-data.html">previous post</a>, we have already described how one can set meta-data to data that are already loaded, and how one can make use of them.
<p />
QSoas is already able to figure out some meta-data in the case of electrochemical data, most notably in the case of files acquired by GPES, ECLab or CHI potentiostats. However, only a small number of constructors are supported as of now<sup><a href="#meta-fn-1">[1]</a></sup>, and there are a number of experimental details that the software is never going to be able to figure out for you, such as the pH, the sample, what you were doing...
<p/>
The new version of QSoas provides a means to permanently store meta-data for experimental data files:
<pre>QSoas> record-meta pH 7 file.dat</pre>
This command uses <a href="https://bip.cnrs.fr/groups/bip06/software/reference/#cmd-record-meta">record-meta</a> to permanently store the information <q>pH = 7</q> for the file <code>file.dat</code>. Any time QSoas loads the file again, either today or in one year, the meta-data will contain the value 7 for the field pH. Behind the scenes, QSoas creates a single small file, <code>file.dat.qsm</code>, in which the meta-data are stored (in the form of a JSON dictionnary).
<p/>
You can set the same meta-data to many files in one go, using wildcards (see <a href="https://bip.cnrs.fr/groups/bip06/software/reference/#cmd-load">load</a> for more information). For instance, to set the pH=7 meta-data to all the <code>.dat</code> files in the current directory, you can use:
<pre>QSoas> record-meta pH 7 *.dat</pre>
You can only set one meta-data for each call to <a href="https://bip.cnrs.fr/groups/bip06/software/reference/#cmd-record-meta">record-meta</a>, but you can use it as many times as you like.
<p/>
Finally, you can use the <code>/for-which</code> option to <a href="https://bip.cnrs.fr/groups/bip06/software/reference/#cmd-load">load</a> or <a href="https://bip.cnrs.fr/groups/bip06/software/reference/#cmd-browse">browse</a> to select only the files which have the meta you need:
<pre>QSoas> browse /for-which=$meta.pH<=7</pre>
This command browses the files in the current directory, showing only the ones that have a pH meta-data which is 7 or below.
<p id='meta-fn-1'>[1] I'm always ready to implement the parsing of other file formats that could be useful for you. If you need parsing of special files, please contact me, sending the given files and the meta-data you'd expect to find in those.</p>
<p/><p/>
<h4>About QSoas</h4>
<a href="http://qsoas.org">QSoas</a> is a powerful open source data analysis program that focuses on flexibility and powerful fitting capacities. It is released under the <a href="https://www.gnu.org/licenses/old-licenses/gpl-2.0.en.html">GNU General Public License</a>. It is described in <a href="http://pubs.acs.org/doi/abs/10.1021/acs.analchem.6b00224">Fourmond, Anal. Chem., 2016, 88 (10), pp 5050–5052</a>. Current version is <strong>3.0</strong>. You can download its source code <a href="http://qsoas.org/downloads/">there</a> (or clone from the <a href="https://github.com/fourmond/QSoas">GitHub repository</a>) and compile it yourself, or buy precompiled versions for MacOS and Windows <a href="https://evalorix.com/en/shop/science-and-engineering-products-and-tools/software-and-apps/qsoas-software/">there</a>.
Vincent Fourmondhttp://www.blogger.com/profile/04388598885608111329noreply@blogger.com2tag:blogger.com,1999:blog-3019054489127059271.post-80944961443696451312021-01-13T15:45:00.001+01:002021-01-13T15:45:34.827+01:00Taking advantage of Ruby in QSoasFirst of all, let me all wish you a happy new year, with all my wishes of health and succes. I sincerely hope this year will be simpler for most people as last year !
<p/>
For the first post of the year, I wanted to show you how to take advantage of <a href="https://www.ruby-lang.org/">Ruby</a>, the programming language embedded in <a href="https://bip.cnrs.fr/groups/bip06/software/">QSoas</a>, to make various things, like:
<ul>
<li>creating a column with the sum of Y values;</li>
<li>extending values that are present only in a few lines;</li>
<li>renaming datasets using a pattern.</li>
</ul>
<h4 id="summing-values">Summing the values in a column</h4>
When using commands that take formulas (Ruby code), like <a href="https://bip.cnrs.fr/groups/bip06/software/reference/#cmd-apply-formula">apply-formula</a>, the code is run for every single point, for which all the values are updated. In particulier, the state of the previous point is not known. However, it is possible to store values in what is called <a href="https://ruby-doc.org/docs/ruby-doc-bundle/UsersGuide/rg/globalvars.html">global variables</a>, whose name start with an <code>$</code> sign. Using this, we can keep track of the previous values. For instance, to create a new column with the sum of the <code>y</code> values, one can use the following approach:
<pre>
QSoas> eval $sum=0
QSoas> apply-formula /extra-columns=1 $sum+=y;y2=$sum
</pre>
The first line initializes the variable to 0, before we start summing, and the code in the second line is run for each dataset row, in order. For the first row, for instance, <code>$sum</code> is initially 0 (from the <code>eval</code> line); after the execution of the code, it is now the first value of <code>y</code>. After the second row, the second value of <code>y</code> is added, and so on. The image below shows the resulting <code>y2</code> when used on:
<pre>
QSoas> generate-dataset -1 1 x
</pre>
<div class="separator" style="clear: both;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjcwGSaeN3gasSDhHcX99Cu0o319EWMc3m31T8-rzQpaLkeC_Y19db0QhMO5Nsq8SHwTi8oEOy6nO7Enik5SzN8oE0p_SwLvieQdimasCcdEjq_rVZWyMCYZO4oJbhDVGCveCdq03T2_1M/s1388/QSoas-sum.png" style="display: block; padding: 1em 0; text-align: center; "><img alt="" border="0" width="400" data-original-height="947" data-original-width="1388" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjcwGSaeN3gasSDhHcX99Cu0o319EWMc3m31T8-rzQpaLkeC_Y19db0QhMO5Nsq8SHwTi8oEOy6nO7Enik5SzN8oE0p_SwLvieQdimasCcdEjq_rVZWyMCYZO4oJbhDVGCveCdq03T2_1M/s400/QSoas-sum.png"/></a></div>
<br>
<br>
<h4 id="extending-values">Extending values in a column</h4>
Another use of the global variables is to add "missing" data. For instance, let's imagine that a files given the variation of current over time as the potential is changed, but the potential is only changed stepwise and only indicated when it changes:
<pre>
## time current potential
0 0.1 0.5
1 0.2
2 0.3
3 0.2
4 1.2 0.6
5 1.3
...
</pre>
If you need to have the values everywhere, for instance if you need to <a href="https://bip.cnrs.fr/groups/bip06/software/reference/#cmd-split-on-values">split on their values</a>, you could also use a global variable, taking advantage of the fact that missing values are represented by QSoas using "Not A Number" values, which can be detected using the Ruby function <a href="https://ruby-doc.org/core-2.5.0/Float.html#method-i-nan-3F"><code>nan?</code></a>:
<pre>
QSoas> apply-formula "if y2.nan?; then y2=$value; else $value=y2;end"
</pre>
Note the need of quotes because there are spaces in the ruby code. If the value of <code>y2</code> is NaN, that is it is missing, then it is taken from the global variable <code>$value</code> else <code>$value</code> is set the current value of <code>y2</code>. Hence, the values are propagated down:
<pre>
## time current potential
0 0.1 0.5
1 0.2 0.5
2 0.3 0.5
3 0.2 0.5
4 1.2 0.6
5 1.3 0.6
...
</pre>
Of course, this doesn't work if the first value of <code>y2</code> is missing.
<br><br>
<h4>Renaming using a pattern</h4>
The command <a href="https://bip.cnrs.fr/groups/bip06/software/reference/#cmd-save-datasets">save-datasets</a> can be used to save a whole series of datasets to the disk. It can also rename them on the fly, and, using the <code>/mode=rename</code> option, does only the renaming part, without saving. You can make full use of <a href="https://bip.cnrs.fr/groups/bip06/software/reference/#meta-data">meta-data</a> (see also a first post <a href="https://vince-debian.blogspot.com/2020/11/qsoas-tips-and-tricks-using-meta-data.html">here</a>)for renaming. The full power is unlocked using the <code>/expression=</code> option. For instance, for renaming the last 5 datasets (so numbers 0 to 4) using a scheme based on the value of their <code>pH</code> meta-data, you can use the following code:
<pre>
QSoas> save-datasets /mode=rename /expression='"dataset-#{$meta.pH}"' 0..4
</pre>
The double quotes are cumbersome but necessary, since the outer quotes (<code>'</code>) prevent the inner ones (<code>"</code>) to be removed and the inner quotes are here to indicate to Ruby that we are dealing with text. The bit inside <code>#{...}</code> is interpreted by Ruby as Ruby code; here it is <code>$meta.pH</code>, the value of the "pH" meta-data. Finally the <code>0..4</code> specifies the datasets to work with. So theses datasets will change name to become <code>dataset-7</code> for pH 7, etc...<br><br>
<h4>About QSoas</h4>
<a href="http://qsoas.org">QSoas</a> is a powerful open source data analysis program that focuses on flexibility and powerful fitting capacities. It is released under the <a href="https://www.gnu.org/licenses/old-licenses/gpl-2.0.en.html">GNU General Public License</a>. It is described in <a href="http://pubs.acs.org/doi/abs/10.1021/acs.analchem.6b00224">Fourmond, Anal. Chem., 2016, 88 (10), pp 5050–5052</a>. Current version is <strong>3.0</strong>. You can download its source code <a href="http://qsoas.org/downloads/">there</a> (or clone from the <a href="https://github.com/fourmond/QSoas">GitHub repository</a>) and compile it yourself, or buy precompiled versions for MacOS and Windows <a href="https://evalorix.com/en/shop/science-and-engineering-products-and-tools/software-and-apps/qsoas-software/">there</a>.
Vincent Fourmondhttp://www.blogger.com/profile/04388598885608111329noreply@blogger.com0tag:blogger.com,1999:blog-3019054489127059271.post-74387505686849644692020-12-14T16:48:00.001+01:002020-12-14T17:38:45.891+01:00Version 3.0 of QSoas is outAfter almost two years of development, version 3.0 of QSoas is finally out ! It brings in a number of new features.
<p/><p/>
<h4>An <q>expert</q> mode for fitting</h4>
Undoubtedly the most important feature in the new version is a complete upgrade of the fit system, which now features an <q>expert</q> mode, turned on by using the <code>/expert=true</code> option with the fit commands. The expert mode features a command prompt that looks like the normal command prompt, in which it is possible:
<ul>
<li>to fix/unfix, set, reset and load ans save parameters;</li>
<li>export parameters or computed datasets;</li>
<li>launch the fit;</li>
<li>select fit engines and configure them;</li>
<li>list of all the fits that were run in the session with their starting and finishing parameters (see picture), and reuse them;</li>
<li>run scripts;</li>
<li>fit data completely non-interactively;</li>
<li>and, last but not least, perform <q>parameter space exploration</q>, which consists in running (automatically) a number of fits with different (random) starting parameters to maximize the chances of finding out the best parameters for the fit, avoiding local minima.</li>
</ul>
The latter feature is very important when running fits with many parameters. In that case, there are a number of local minima, and it is necessary to try a number of different starting parameters to really find the best parameters. The new parameter space exploration feature makes it much easier than before, with an interface that allows easily finding the best parameters tried so far and reuse them.
<div class="separator" style="clear: both;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj-U78tOdznI9foML8nNubuPvjgAFqzNy0hPaeIBpYpKjjy8ZWNbIrjGZmsKoN0q6LmbtNJSG3NFkgh3E9LF4KI-wzv1VKvxPO3bEili_pfNlS5xu_TT8o872TOksO6mJ_ZExj3j_cXbWA/s2048/QSoas-3.0-exploration.png" style="display: block; padding: 1em 0; text-align: center; "><img alt="" border="0" width="400" data-original-height="1344" data-original-width="2048" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj-U78tOdznI9foML8nNubuPvjgAFqzNy0hPaeIBpYpKjjy8ZWNbIrjGZmsKoN0q6LmbtNJSG3NFkgh3E9LF4KI-wzv1VKvxPO3bEili_pfNlS5xu_TT8o872TOksO6mJ_ZExj3j_cXbWA/s400/QSoas-3.0-exploration.png"/></a></div>
<p/><p/>
<h4>A new documentation system</h4>
Another very important update is the inclusion of a new, offline, documentation system. The documentation features browsing via table of contents, a command index and text search. It also features the possibility to copy commands from the help to the command prompt, or even run them directly. To top it all, it comes with a series of startup tips that might teach you a thing or two about QSoas (try hitting <q>Show random</q> to learn new tricks !).
<div class="separator" style="clear: both;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgxaBxg69QzBux-ejzN-XfeyEbzRGiynDUzQZvqeMfML37ChjSaAGcfLrYZr_hhuvn9HwN19OinouJT66ylN2udqeJT30iPkV2Xw2VHS-HNVC2nxRaazl130rjNhT9PJ0Xno329n7AekZg/s1849/QSoas-3.0-help.png" style="display: block; padding: 1em 0; text-align: center; "><img alt="" border="0" width="400" data-original-height="1439" data-original-width="1849" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgxaBxg69QzBux-ejzN-XfeyEbzRGiynDUzQZvqeMfML37ChjSaAGcfLrYZr_hhuvn9HwN19OinouJT66ylN2udqeJT30iPkV2Xw2VHS-HNVC2nxRaazl130rjNhT9PJ0Xno329n7AekZg/s400/QSoas-3.0-help.png"/></a></div>
<p/><p/>
<h4>Many other features</h4>
For the full list of changes, please see the <a href="https://bip.cnrs.fr/groups/bip06/software/changes/#v3p0">changelog</a>. Apart from the changes described above, these are my favorites:
<div class="separator" style="clear: both;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhaG9P0cEDqFyOVZFt1BgX4CmX3R-kRtCAIBHwegTYivH3DNNatwcICvEEbXkMoZRlZ5I3I70k648i65hl8wnWHU3i6Z4k7aNEW3QNOGGnsWSk99ILXIYXDfiFiQUgPxzZbUGCFxE1vu3Q/s512/QSoas-logo.png" style="display: block; padding: 1em 0; text-align: center; clear: right; float: right;"><img alt="" border="0" width="160" data-original-height="512" data-original-width="512" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhaG9P0cEDqFyOVZFt1BgX4CmX3R-kRtCAIBHwegTYivH3DNNatwcICvEEbXkMoZRlZ5I3I70k648i65hl8wnWHU3i6Z4k7aNEW3QNOGGnsWSk99ILXIYXDfiFiQUgPxzZbUGCFxE1vu3Q/s320/QSoas-logo.png"/></a></div><ul>
<li>running the command from the menu now gives a dialog box for selecting all the arguments and options, which is very useful to discover the possibilities of the various commands;</li>
<li>features that make the statistics and meta-data much easier to use with commands like <a href="https://bip.cnrs.fr/groups/bip06/software/reference/#cmd-apply-formula"><code>apply-formula</code></a>, like automatic code completion;</li>
<li>a new system for permanently storing meta-data using <a href="https://bip.cnrs.fr/groups/bip06/software/reference/#cmd-record-meta"><code>record-meta</code></a>;</li>
<li>a new fit for <a href="https://bip.cnrs.fr/groups/bip06/software/reference/#cmd-fit-implicit">fitting implicit equations</a>, in which one cannot express \(y = f(x)\), but only \(f(x,y)=0\);</li>
<li>and, of course, a brand shiny new logo by Marta Meneghello !</li>
</ul>
<p />
To get the new version, you can just download the source code from the <a href="https://bip.cnrs.fr/groups/bip06/software/downloads/">downloads page</a>, where you can also purchase precompiled versions for Windows and MacOS. You can also clone the source from the <a href="https://github.com/fourmond/QSoas">GitHub repository</a>.
<p/><p/>
<h4>About QSoas</h4><a href="http://qsoas.org">QSoas</a> is a powerful open source data analysis program that focuses on flexibility and powerful fitting capacities. It is released under the <a href="https://www.gnu.org/licenses/old-licenses/gpl-2.0.en.html">GNU General Public License</a>. It is described in <a href="http://pubs.acs.org/doi/abs/10.1021/acs.analchem.6b00224">Fourmond, Anal. Chem., 2016, 88 (10), pp 5050–5052</a>. Current version is <strong>3.0</strong>. You can download its source code <a href="http://qsoas.org/downloads/">there</a> (or clone from the <a href="https://github.com/fourmond/QSoas">GitHub repository</a>) and compile it yourself, or buy precompiled versions for MacOS and Windows <a href="https://evalorix.com/en/shop/science-and-engineering-products-and-tools/software-and-apps/qsoas-software/">there</a>.
Vincent Fourmondhttp://www.blogger.com/profile/04388598885608111329noreply@blogger.com0tag:blogger.com,1999:blog-3019054489127059271.post-28539928240620015002020-11-23T19:30:00.003+01:002020-11-23T19:55:43.040+01:00QSoas tips and tricks: using meta-data, first levelBy essence, <a href="http://qsoas.org">QSoas</a> works with \(y = f(x)\) datasets. However, in practice, when working with experimental data (or data generated from simulations), one has often more than one experimental parameter (\(x\)). For instance, one could record series of spectra (\(A = f(\lambda)\)) for different pH values, so that the absorbance is in fact a function of both the pH and \(\lambda\). QSoas has different ways to deal with such situations, and we'll describe one today, using <a href="https://bip.cnrs.fr/groups/bip06/software/reference/#meta-data">meta-data</a>.
<p/>
<h4>Setting meta-data</h4>
Meta-data are simply series of name/values attached to a dataset. It can be numbers, dates or just text. Some of these are automatically detected from certain type of data files (but that is the topic for another day). The simplest way to set meta-data is to use the <a href="https://bip.cnrs.fr/groups/bip06/software/reference/#cmd-set-meta"><code>set-meta</code></a> command:
<pre>QSoas> set-meta pH 7.5</pre>
This command sets the meta-data <code>pH</code> to the value <code>7.5</code>. Keep in mind that QSoas does not know anything about the meaning of the meta-data<sup><a href="#note-1">[1]</a></sup>. It can keep track of the meta-data you give, and manipulate them, but it will not interpret them for you. You can set several meta-data by repeating calls to <code>set-meta</code>, and you can display the meta-data attached to a dataset using the command <a href="https://bip.cnrs.fr/groups/bip06/software/reference/#cmd-show"><code>show</code></a>. Here is an example:
<pre>QSoas> generate-buffer 0 10
QSoas> set-meta pH 7.5
QSoas> set-meta sample "My sample"
QSoas> show 0
Dataset generated.dat: 2 cols, 1000 rows, 1 segments, #0
Flags:
Meta-data: pH = 7.5 sample = My sample</pre>
Note here the use of quotes around <code>My sample</code> since there is a space inside the value.
<p>
<h4>Using meta-data</h4>
There are many ways to use meta-data in QSoas. In this post, we will discuss just one: using meta-data in the <a href="https://bip.cnrs.fr/groups/bip06/software/reference/#output-file">output file</a>. The output file can collect data from several commands, like peak data, statistics and so on. For instance, each time the command <a href="https://bip.cnrs.fr/groups/bip06/software/reference/#cmd-1"><code>1</code></a> is run, a line with the information about the largest peak of the current dataset is written to the output file. It is possible to automatically add meta-data to those lines by using the <code>/meta=</code> option of the <a href="https://bip.cnrs.fr/groups/bip06/software/reference/#cmd-output"><code>output</code></a> command. Just listing the names of the meta-data will add them to each line of the output file.
<p/>
As a full example, we'll see how one can take advantage of meta-data to determine the position of the peak of the function \(x^2 \exp (-a\,x)\) depends on \(a\). For that, we first create a script that generates the function for a certain value of \(a\), sets the meta-data <code>a</code> to the corresponding value, and find the peak. Let's call this file <code>do-one.cmds</code> (all the script files can be found in the <a href="https://github.com/fourmond/QSoasExampleFiles/tree/data/Tips-and-Tricks-02">GitHub repository</a>):
<pre>generate-buffer 0 20 x**2*exp(-x*${1})
set-meta a ${1}
1 </pre>
This script takes a single argument, the value of \(a\), generates the appropriate dataset, sets the meta-data <code>a</code> and writes the data about the largest (and only in this case) peak to the output file. Let's now run this script with <code>1</code> as an argument:
<pre>QSoas> @ do-one.cmds 1</pre>
This command generates a file <code>out.dat</code> containing the following data:
<pre>## buffer what x y index width left_width right_width area
generated.dat max 2.002002002 0.541340590883 100 3.4034034034 1.24124124124 2.162162162161.99999908761</pre>
This gives various information about the peak found: the name of the dataset it was found in, whether it's a maximum or minimum, the x and y positions of the peak, the index in the file, the widths of the peak and its area. We are interested here mainly in the <code>x</code> position.
<p/>
Then, we just run this script for several values of \(a\) using <a href="https://bip.cnrs.fr/groups/bip06/software/reference/#cmd-run-for-each"><code>run-for-each</code></a>, and in particular the option <code>/range-type=lin</code> that makes it interpret values like <code>0.5..5:80</code> as <q>80 values evenly spread between 0.5 and 5</q>. The script is called <code>run-all.cmds</code>:
<pre>output peaks.dat /overwrite=true /meta=a
run-for-each do-one.cmds /range-type=lin 0.5..5:80
V all /style=red-to-blue</pre>
The first line sets up the output to the output file <code>peaks.dat</code>. The option <code>/meta=a</code> makes sure the meta <code>a</code> is added to each line of the output file, and <code>/overwrite=true</code> make sure the file is overwritten just before the first data is written to it, in order to avoid accumulating the results of different runs of the script. The last line just displays all the curves with a color gradient. It looks like this:
<div class="separator" style="clear: both;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiI4MEwmXDogWLH8vMR4yYhruhFmU1VDrzbDvbcT02KoXhpy-vFNKljA4yeLpFZ3euWhcUeVhfgnTdhZnrM6YLfjuuyFF7Gd6ay-lgVVmFOC7ICHFzrOASCbg8AO9HP5yAkoZSgolQ0eyk/s1667/Peaks-1.png" style="display: block; padding: 1em 0; text-align: center; "><img alt="" border="0" width="400" data-original-height="1246" data-original-width="1667" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiI4MEwmXDogWLH8vMR4yYhruhFmU1VDrzbDvbcT02KoXhpy-vFNKljA4yeLpFZ3euWhcUeVhfgnTdhZnrM6YLfjuuyFF7Gd6ay-lgVVmFOC7ICHFzrOASCbg8AO9HP5yAkoZSgolQ0eyk/s400/Peaks-1.png"/></a></div>
Running this script (with <code>@ run-all.cmds</code>) creates a new file <code>peaks.dat</code>, whose first line looks like this:
<pre>## buffer what x y index width left_width right_width area a</pre>
The column <code>x</code> (the 3rd) contains the position of the peaks, and the column <code>a</code> (the 10th) contains the meta <code>a</code> (this column wasn't present in the output we described above, because we had not used yet the <code>output /meta=a</code> command). Therefore, to load the peak position as a function of <code>a</code>, one has just to run:
<pre>QSoas> load peaks.dat /columns=10,3</pre>
This looks like this:
<div class="separator" style="clear: both;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjOwHEi8IaGYNvjod4WxGzTqU9aIUjnbnqgUg-NGSmPno6S-wilP_1EEHSTdPSK05b9CM5d5Mo4yeJF3qlNOEADKHb5wuhLzD2drkm0piLoNkUasNUAsEmSZaugFMnte-nXr_5EKuTW-cE/s1667/Peaks-2.png" style="display: block; padding: 1em 0; text-align: center; "><img alt="" border="0" width="400" data-original-height="1246" data-original-width="1667" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjOwHEi8IaGYNvjod4WxGzTqU9aIUjnbnqgUg-NGSmPno6S-wilP_1EEHSTdPSK05b9CM5d5Mo4yeJF3qlNOEADKHb5wuhLzD2drkm0piLoNkUasNUAsEmSZaugFMnte-nXr_5EKuTW-cE/s400/Peaks-2.png"/></a></div>
Et voilà !
<p/>
To train further, you can:
<ul>
<li>improve the resolution in x;</li>
<li>improve the resolution in y;</li>
<li>plot the <em>magnitude</em> of the peak;</li>
<li>extend the range;</li>
<li>derive the analytical formula for the position of the peak and verify it !</li>
</ul>
<p/>
<p id='note-1'><small>[1] this is not exactly true. For instance, some commands like <a href="https://bip.cnrs.fr/groups/bip06/software/reference/#cmd-unwrap"><code>unwrap</code></a> interpret the <code>sr</code> meta-data as a voltammetric scan rate if it is present. But this is the exception.</small>
</p>
<p />
<p />
<h4>About QSoas</h4><a href="http://qsoas.org">QSoas</a> is a powerful open source data analysis program that focuses on flexibility and powerful fitting capacities. It is released under the <a href="https://www.gnu.org/licenses/old-licenses/gpl-2.0.en.html">GNU General Public License</a>. It is described in <a href="http://pubs.acs.org/doi/abs/10.1021/acs.analchem.6b00224">Fourmond, Anal. Chem., 2016, 88 (10), pp 5050–5052</a>. Current version is <strong>2.2</strong>. You can download its source code <a href="https://bip.cnrs.fr/groups/bip06/software/downloads/">there</a> (or clone from the <a href="https://github.com/fourmond/QSoas">GitHub repository</a>) and compile it yourself, or buy precompiled versions for MacOS and Windows <a href="http://qsoas.org/downloads/">there</a>.Vincent Fourmondhttp://www.blogger.com/profile/04388598885608111329noreply@blogger.com0tag:blogger.com,1999:blog-3019054489127059271.post-68820035681138176302020-11-11T20:53:00.000+01:002020-11-11T20:53:34.813+01:00Solution for QSoas quiz #1: averaging spectraThis post describes the solution to the <a href="https://vince-debian.blogspot.com/2020/10/qsoas-quiz-1-averaging-spectra.html">Quiz #1</a>, based on the files found <a href="https://github.com/fourmond/QSoasExampleFiles/tree/data/Quiz-01">there</a>. The point is to produce both the average and the standard deviation of a series of spectra. Below is how the final averaged spectra shoud look like:
<div class="separator" style="clear: both;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEig1bvc1bKG0gEHYIWR_ga2RPHjsSDS9c2U_kHhiNAQjJW8HRJRTPzUYDm0WgtOJZJW09Y39MwyE3UBvNgVmTpdwyKgWo0BcOi5nR5Oxw_U26X5GxFYRjQVcyqIO-ZnQM6K9QvZr2X7suQ/s1761/StandardDeviation.png" style="display: block; padding: 1em 0; text-align: center; "><img alt="" border="0" data-original-height="1060" data-original-width="1761" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEig1bvc1bKG0gEHYIWR_ga2RPHjsSDS9c2U_kHhiNAQjJW8HRJRTPzUYDm0WgtOJZJW09Y39MwyE3UBvNgVmTpdwyKgWo0BcOi5nR5Oxw_U26X5GxFYRjQVcyqIO-ZnQM6K9QvZr2X7suQ/s400/StandardDeviation.png" width="400"/></a></div>
I will present here two different solutions.
<h4>Solution 1: using the definition of standard deviation</h4>
There is a simple solution using the definition of the standard deviation:
$$\sigma_y = \sqrt{<y^2> - {<y>}^2}$$
in which \(<y^2>\) is the average of \(y^2\) (and so on). So the simplest solution is to construct datasets with an additional column that would contain \(y^2\), average these columns, and replace the average with the above formula. For that, we need first a companion script that loads a single data file and adds a column with \(y^2\). Let's call this script <code>load-one.cmds</code>:
<pre>
load ${1}
apply-formula y2=y**2 /extra-columns=1
flag /flags=processed
</pre>
When this script is run with the name of a spectrum file as argument, it loads it (replaces <code>${1}</code> by the first argument, the file name), adds a column <code>y2</code> containing the square of the <code>y</code> column, and flag it with the <code>processed</code> flag. This is not absolutely necessary, but it makes it much easier to refer to all the spectra when they are processed. Then to process all the spectra, one just has to run the following commands:
<pre>
run-for-each load-one.cmds Spectrum-1.dat Spectrum-2.dat Spectrum-3.dat
average flagged:processed
apply-formula y2=(y2-y**2)**0.5
dataset-options /yerrors=y2
</pre>
The <a href="https://bip.cnrs.fr/groups/bip06/software/reference/#cmd-run-for-each"><code>run-for-each</code></a> command runs the <code>load-one.cmds</code> script for all the spectra (one could also have used <code>Spectra-*.dat</code> to not have to give all the file names). Then, the <a href="https://bip.cnrs.fr/groups/bip06/software/reference/#cmd-average"><code>average</code></a> averages the values of the columns over all the datasets. To be clear, it finds all the values that have the same X (or very close X values) and average them, column by column. The result of this command is therefore a dataset with the average of the original \(y\) data as <code>y</code> column and the average of the original \(y^2\) data as <code>y2</code> column. So now, the only thing left to do is to use the above equation, which is done by the <a href="https://bip.cnrs.fr/groups/bip06/software/reference/#cmd-apply-formula"><code>apply-formula</code></a> code. The last command, <a href="https://bip.cnrs.fr/groups/bip06/software/reference/#cmd-dataset-options"><code>dataset-options</code></a>, is not absolutely necessary but it signals to QSoas that the standard error of the <code>y</code> column should be found in the <code>y2</code> column. This is now available as script <code>method-one.cmds</code> in the <a href="https://github.com/fourmond/QSoasExampleFiles/tree/data/Quiz-01">git repository</a>.
<br/>
<br/>
<h4>Solution 2: use QSoas's knowledge of standard deviation</h4>
The other method is a little more involved but it demonstrates a good approach to problem solving with QSoas. The starting point is that, in <code>apply-formula</code>, the value <code>$stats.y_stddev</code> corresponds to the standard deviation of the whole <code>y</code> <b>column</b>... Loading the spectra yields just a series of <code>x,y</code> datasets. We can <code>contract</code> them into a single dataset with one <code>x</code> column and several <code>y</code> columns:
<pre>
load Spectrum-*.dat /flags=spectra
contract flagged:spectra
</pre>
After these commands, the current dataset contains data in the form of:
<pre>
lambda1 a1_1 a1_2 a1_3
lambda2 a2_1 a2_2 a2_3
...
</pre>
in which the <code>a<em>i</em>_1</code> come from the first file, <code>a<em>i</em>_2</code> the second and so on. We need to use <a href="https://bip.cnrs.fr/groups/bip06/software/reference/#cmd-transpose"><code>transpose</code></a> to transform that dataset into:
<pre>
0 a1_1 a2_1 ...
1 a1_2 a2_2 ...
2 a1_3 a2_3 ...
</pre>
In this dataset, values of the absorbance for the same wavelength for each dataset is now stored in columns. The next step is just to use <a href="https://bip.cnrs.fr/groups/bip06/software/reference/#cmd-expand"><code>expand</code></a> to obtain a series of datasets with the same x column and a single y column (each corresponding to a different wavelength in the original data). The game is now to replace these datasets with something that looks like:
<pre>
0 a_average
1 a_stddev
</pre>
For that, one takes advantage of the <code>$stats.y_average</code> and <code>$stats.y_stddev</code> values in <a href="https://bip.cnrs.fr/groups/bip06/software/reference/#cmd-apply-formula"><code>apply-formula</code></a>, together with the <code>i</code> special variable that represents the index of the point:
<pre>
apply-formula "if i == 0; then y=$stats.y_average; end; if i == 1; then y=$stats.y_stddev; end"
strip-if i>1
</pre>
Then, all that is left is to apply this to all the datasets created by <code>expand</code>, which can be just made using <a href="https://bip.cnrs.fr/groups/bip06/software/reference/#cmd-run-for-datasets"><code>run-for-datasets</code></a>, and then, we reverse the splitting by using <code>contract</code> and <code>transpose</code> ! In summary, this looks like this. We need two files. The first, <code>process-one.cmds</code> contains the following code:
<pre>
apply-formula "if i == 0; then y=$stats.y_average; end; if i == 1; then y=$stats.y_stddev; end"
strip-if i>1
flag /flags=processed
</pre>
The main file, <code>method-two.cmds</code> looks like this:
<pre>
load Spectrum-*.dat /flags=spectra
contract flagged:spectra
transpose
expand /flags=tmp
run-for-datasets process-one.cmds flagged:tmp
contract flagged:processed
transpose
dataset-options /yerrors=y2
</pre>
<b>Note</b> some of the code above can be greatly simplified using new features present in the upcoming 3.0 version, but that is the topic for another post.
<p/>
<h4>About QSoas</h4><a href="http://qsoas.org">QSoas</a> is a powerful open source data analysis program that focuses on flexibility and powerful fitting capacities. It is released under the <a href="https://www.gnu.org/licenses/old-licenses/gpl-2.0.en.html">GNU General Public License</a>. It is described in <a href="http://pubs.acs.org/doi/abs/10.1021/acs.analchem.6b00224">Fourmond, Anal. Chem., 2016, 88 (10), pp 5050–5052</a>. Current version is <strong>2.2</strong>. You can download its source code and compile it yourself or buy precompiled versions for MacOS and Windows <a href="http://qsoas.org/downloads/">there</a>.
Vincent Fourmondhttp://www.blogger.com/profile/04388598885608111329noreply@blogger.com0tag:blogger.com,1999:blog-3019054489127059271.post-90075162935030082772020-10-22T13:57:00.000+02:002020-10-22T13:57:13.215+02:00QSoas tips and tricks: generating smooth curves from a fitOften, one would want to generate smooth data from a fit over a small number of data points. For an example, take the data in the <a href="https://raw.githubusercontent.com/fourmond/QSoasExampleFiles/data/Tips-and-Tricks-01/michaelis.dat">following file</a>. It contains (fake) experimental data points that obey to Michaelis-Menten kinetics:
$$v = \frac{v_m}{1 + K_m/s}$$
in which \(v\) is the measured rate (the y values of the data), \(s\) the concentration of substrate (the x values of the data), \(v_m\) the maximal rate and \(K_m\) the Michaelis constant. To fit this equation to the data, just use the <a href="https://bip.cnrs.fr/groups/bip06/software/reference/#cmd-fit-arb"><code>fit-arb</code></a> fit:
<pre>QSoas> l michaelis.dat
QSoas> fit-arb vm/(1+km/x)</pre>
After running the fit, the window should look like this:
<div class="separator" style="clear: both;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjjwNIGTdoxXU1jQYJFKYs336mK5EGTTDVHUHg9CvPANlrg6WnVjB12lP-KLBj4NGfAS2OUxo1qs7YBtNyfjrpnXzd0Q7iH2ml35PM2rGwul4h-fM-VWvEFxXnhpljygRdrn0UPljbzSBc/s2253/Michaelis-fit.jpeg" style="display: block; padding: 1em 0; text-align: center; "><img alt="" border="0" width="400" data-original-height="1048" data-original-width="2253" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjjwNIGTdoxXU1jQYJFKYs336mK5EGTTDVHUHg9CvPANlrg6WnVjB12lP-KLBj4NGfAS2OUxo1qs7YBtNyfjrpnXzd0Q7iH2ml35PM2rGwul4h-fM-VWvEFxXnhpljygRdrn0UPljbzSBc/s400/Michaelis-fit.jpeg"/></a></div>
Now, with the fit, we have reasonable values for \(v_m\) (<code>vm</code>) and \(K_m\) (<code>km</code>). But, for publication, one would want to generate "smooth" curve going through the lines... Saving the curve from "Data.../Save all" doesn't help, since the data has as many points as the original data and looks very "jaggy" (like on the screenshot above)... So one needs a curve with more data points.
<p/>
Maybe the most natural solution is simply to use <a href="https://bip.cnrs.fr/groups/bip06/software/reference/#cmd-generate-buffer"><code>generate-buffer</code></a> together with <a href="https://bip.cnrs.fr/groups/bip06/software/reference/#cmd-apply-formula"><code>apply-formula</code></a> using the formula and the values of <code>km</code> and <code>vm</code> obtained from the fit, like:
<pre>QSoas> generate-buffer 0 20
QSoas> apply-formula y=3.51742/(1+3.69767/x)</pre>
By default, <code>generate-buffer</code> generate 1000 evenly spaced x values, but you can change their number using the <code>/samples</code> option. The two above commands can be combined to just one call to <code>generate-buffer</code>:
<pre>QSoas> generate-buffer 0 20 3.51742/(1+3.69767/x)</pre>
This works, but it is quite cumbersome and it is not going to work well for complex formulas or the results of differential equations or kinetic systems...
<p/>
This is why to each <code>fit-</code> command corresponds a <code>sim-</code> command that computes the result of the fit using a "saved parameters" file (here, <a href="https://raw.githubusercontent.com/fourmond/QSoasExampleFiles/data/Tips-and-Tricks-01/michaelis.params"><code>michaelis.params</code></a>, but you can also save it yourself) and buffers as "models" for X values:
<pre>QSoas> generate-buffer 0 20
QSoas> sim-arb vm/(1+km/x) michaelis.params 0</pre>
This strategy works with every single fit ! As an added benefit, you even get the fit parameters as meta-data, which are displayed by the <a href="https://bip.cnrs.fr/groups/bip06/software/reference/#cmd-show"><code>show</code></a> command:
<pre>QSoas> show 0
Dataset generated_fit_arb.dat: 2 cols, 1000 rows, 1 segments, #0
Flags:
Meta-data: commands = sim-arb vm/(1+km/x) michaelis.params 0 fit = arb (formula: vm/(1+km/x)) km = 3.69767
vm = 3.5174</pre>
They also get saved as comments if you save the data.
<p/>
<b>Important note:</b> the <code>sim-arb</code> command will be available only in the 3.0 release, although you can already enjoy it if you use the <a href="https://github.com/fourmond/QSoas">github version</a>.
<p/>
<h4>About QSoas</h4><a href="http://qsoas.org">QSoas</a> is a powerful open source data analysis program that focuses on flexibility and powerful fitting capacities. It is released under the <a href="https://www.gnu.org/licenses/old-licenses/gpl-2.0.en.html">GNU General Public License</a>. It is described in <a href="http://pubs.acs.org/doi/abs/10.1021/acs.analchem.6b00224">Fourmond, Anal. Chem., 2016, 88 (10), pp 5050–5052</a>. Current version is <strong>2.2</strong>. You can download its source code and compile it yourself or buy precompiled versions for MacOS and Windows <a href="http://qsoas.org/downloads/">there</a>.
Vincent Fourmondhttp://www.blogger.com/profile/04388598885608111329noreply@blogger.com0tag:blogger.com,1999:blog-3019054489127059271.post-59243560708833419052020-10-07T14:25:00.000+02:002020-10-07T14:25:11.051+02:00QSoas quiz #1 : averaging spectraHere is the first QSoas quiz ! I recently measured several identical spectra in a row to evaluate the noise of the setup, and so I wanted to average all the spectra and also determine the standard deviation in the absorbances. Averaging the spectra can simply be done taking advantage of the <a href="https://bip.cnrs.fr/groups/bip06/software/reference/#cmd-average"><code>average</code></a> command:
<pre>
QSoas> load Spectrum*.dat /flags=spectra
QSoas> average flagged:spectra
</pre>
However, <a href="https://bip.cnrs.fr/groups/bip06/software/reference/#cmd-average"><code>average</code></a> does not provide means to make standard deviations, it just takes the average of all but the X column. I wanted to add this feature, but I realized there are already at least two distinct ways to do that...<br />
<br />
<h4>Quiz</h4>
Your task is to determine the average and standard deviations of the three spectra located <a href="https://github.com/fourmond/QSoasExampleFiles/tree/data/Quiz-01">there</a>, (<a href="https://raw.githubusercontent.com/fourmond/QSoasExampleFiles/data/Quiz-01/Spectrum-1.dat"><code>Spectrum-1.dat</code></a>, <a href="https://raw.githubusercontent.com/fourmond/QSoasExampleFiles/data/Quiz-01/Spectrum-2.dat"><code>Spectrum-2.dat</code></a> and <a href="https://raw.githubusercontent.com/fourmond/QSoasExampleFiles/data/Quiz-01/Spectrum-3.dat"><code>Spectrum-3.dat</code></a>). There are at least two ways:
<ul>
<li>One that relies simply on <a href="https://bip.cnrs.fr/groups/bip06/software/reference/#cmd-average"><code>average</code></a> and on <a href="https://bip.cnrs.fr/groups/bip06/software/reference/#cmd-apply-formula"><code>apply-formula</code></a>, and which requires that you remember how to compute standard deviations.</li>
<li>One that is a little more involved, that requires more data manipulation (take a look at <a href="https://bip.cnrs.fr/groups/bip06/software/reference/#cmd-contract"><code>contract</code></a> for instance) and relies on the fact that you can use statistics in <a href="https://bip.cnrs.fr/groups/bip06/software/reference/#cmd-apply-formula"><code>apply-formula</code></a> (and in particular you can use <code>y_stddev</code> to refer to the standard deviation of \(y\)), but which does not require you to know exactly how to compute standard deviations.</li>
</ul>
To help you, I've added the result in <a href="https://raw.githubusercontent.com/fourmond/QSoasExampleFiles/data/Quiz-01/Average.dat"><code>Average.dat</code></a>. The figure below shows a zoom on the data superimposed to the average (bonus points to find how to display this light red area that corresponds to the standard deviation !).
<div class="separator" style="clear: both;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEig1bvc1bKG0gEHYIWR_ga2RPHjsSDS9c2U_kHhiNAQjJW8HRJRTPzUYDm0WgtOJZJW09Y39MwyE3UBvNgVmTpdwyKgWo0BcOi5nR5Oxw_U26X5GxFYRjQVcyqIO-ZnQM6K9QvZr2X7suQ/s1761/StandardDeviation.png" style="display: block; padding: 1em 0; text-align: center; "><img alt="" border="0" width="400" data-original-height="1060" data-original-width="1761" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEig1bvc1bKG0gEHYIWR_ga2RPHjsSDS9c2U_kHhiNAQjJW8HRJRTPzUYDm0WgtOJZJW09Y39MwyE3UBvNgVmTpdwyKgWo0BcOi5nR5Oxw_U26X5GxFYRjQVcyqIO-ZnQM6K9QvZr2X7suQ/s400/StandardDeviation.png"/></a></div>
I will post the answer later. In the meantime, feel free to post your own solutions or attempts, hacks, and so on !
<br />
<br />
<h4>About QSoas</h4><a href="http://qsoas.org">QSoas</a> is a powerful open source data analysis program that focuses on flexibility and powerful fitting capacities. It is released under the <a href="https://www.gnu.org/licenses/old-licenses/gpl-2.0.en.html">GNU General Public License</a>. It is described in <a href="http://pubs.acs.org/doi/abs/10.1021/acs.analchem.6b00224">Fourmond, Anal. Chem., 2016, 88 (10), pp 5050–5052</a>. Current version is <strong>2.2</strong>. You can download its source code or buy precompiled versions for MacOS and Windows <a href="http://qsoas.org/downloads/">there</a>.
Vincent Fourmondhttp://www.blogger.com/profile/04388598885608111329noreply@blogger.com0tag:blogger.com,1999:blog-3019054489127059271.post-42947554035813618082020-09-23T16:41:00.000+02:002020-09-23T16:41:02.302+02:00Tutorial: analyze Km data of CODHsThis is the first post of a series in which we will provide the readers with simple tutorial approaches to reproduce the data analysis of some of our published papers. All our data analysis is performed using <a href="https://qsoas.org">QSoas</a>. Today, we will show you how to analyze the <script type="math/tex">K_m</script> experiments we used to characterize the behaviour of an enzyme, the Nickel-Iron CO dehydrogenase IV from <em>Carboxytothermus hydrogenoformans</em>. The experiments we analyze here are described in much more details in the original publication, <a href="https://doi.org/10.1002/anie.201709261">Domnik <i>et al</i>, <i>Angewandte Chemie</i>, <b>2017</b></a>. The only things you need to know for now are the following:
<ul>
<li> the data is the evolution of the current over time given by the absorbed enzyme;</li>
<li> at a given point, a certain amount of CO (50 µM) is injected, and its concentration decreases exponentially over time;</li>
<li> the enzyme has a Michaelis-Menten behaviour with respect to CO.</li>
</ul>
This means that we expect a response of the type: $$i(t) = \frac{i_m}{1 + \frac{K_m}{[\mathrm{CO}](t)}}$$ in which $$[\mathrm{CO}](t) = \begin{cases}
0, & \text{for } t < t_0 \\
C_0 \exp \frac{t_0 - t}{\tau}, & \text{for }t\geq t_0 %>
\end{cases}$$
<p>
To begin this tutorial, first download the files from the <a href="https://github.com/fourmond/QSoasExampleFiles/tree/data/Domnik-2017">github repository</a> (direct links: <a href='https://raw.githubusercontent.com/fourmond/QSoasExampleFiles/data/Domnik-2017/Km-CODH-IV.dat'>data</a>, <a href='https://raw.githubusercontent.com/fourmond/QSoasExampleFiles/data/Domnik-2017/Km-CODH-IV.params'>parameter file</a> and <a href='https://raw.githubusercontent.com/fourmond/QSoasExampleFiles/data/Domnik-2017/transport.rb'>ruby script</a>). Start QSoas, go to the directory where you saved the files, load the data file, and remove spikes in the data using the following commands:
<pre>QSoas> cd
QSoas> l Km-CODH-IV.dat
QSoas> R
</pre>
<h5>First fit</h5>Then, to fit the above equation to the data, the simplest is to take advantage of the <a href="https://bip.cnrs.fr/groups/bip06/software/reference/#time-dependent-parameters">time-dependent parameters</a> features of <a href="https://qsoas.org">QSoas</a>. Run simply:
<pre>QSoas> fit-arb im/(1+km/s) /with=s:1,exp</pre>
This simply launches the fit interface to fit the exact equations above. The <code>im/(1+km/s)</code> is simply the translation of the Michaelis-Menten equation above, and the <code>/with=s:1,exp</code> specifies that <code>s</code> is the result of the sum of 1 exponential like for the definition of <script type="math/tex">[\mathrm{CO}](t)</script> above. Then, load the <code>Km-CODH-IV.params</code> parameter files (using the "Parameters.../Load from file" action at the bottom, or the <code>Ctrl+L</code> keyboard shortcut). Your window should now look like this:
<div class="separator" style="clear: both;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg9EOsscZSnGrFCsJlwjnWAzb3hhVzyz6CECGdmmdO5ZKhnH7xMWGaMIzIsyo7QP5NZx_XDh3Oe5N3jRjyyllyKYkTVHwmy1olQ_NF3zhyphenhyphenSi6DcR9-EHxz2D4yfNu9Rf_-SCR7Z1vb8_Rk/s1563/CODH-IV-fit-1.png" style="display: block; padding: 1em 0; text-align: center; "><img alt="" border="0" width="400" data-original-height="1048" data-original-width="1563" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg9EOsscZSnGrFCsJlwjnWAzb3hhVzyz6CECGdmmdO5ZKhnH7xMWGaMIzIsyo7QP5NZx_XDh3Oe5N3jRjyyllyKYkTVHwmy1olQ_NF3zhyphenhyphenSi6DcR9-EHxz2D4yfNu9Rf_-SCR7Z1vb8_Rk/s400/CODH-IV-fit-1.png"/></a></div>
To fit the data, just hit the "Fit" button ! (or <code>Ctrl+F</code>).
<h5>Including an offset</h5>
The fit is not bad, but not perfect. In particular, it is easy to see why: the current predicted by the fit goes to 0 at large times, but the actual current is below 0. We need therefore to include an offset to take this into consideration. Close the fit window, and re-run a fit, but now with this command:
<pre>QSoas> fit-arb im/(1+km/s)+io /with=s:1,exp</pre>
Notice the <code>+io</code> bit that corresponds to the addition of an offset current. Load again the base parameters, run the fit again... Your fit window show now look like:
<div class="separator" style="clear: both;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgTHI45oH98tMDUJdCWg7xInBOCf2erVYl6qGv1u94_UO8gmmsHlAtFUZPkU3SuF8La7WWfjnercwy-k_llNYVo-vOqHm6OtnKAssgQBsd0a_WSoyg1sRqJyL4D0mEl2f-en_rgupeaFik/s1563/CODH-IV-fit-2.png" style="display: block; padding: 1em 0; text-align: center; "><img alt="" border="0" width="400" data-original-height="1048" data-original-width="1563" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgTHI45oH98tMDUJdCWg7xInBOCf2erVYl6qGv1u94_UO8gmmsHlAtFUZPkU3SuF8La7WWfjnercwy-k_llNYVo-vOqHm6OtnKAssgQBsd0a_WSoyg1sRqJyL4D0mEl2f-en_rgupeaFik/s400/CODH-IV-fit-2.png"/></a></div>
See how the offset current is now much better taken into account. Let's talk a bit more about the parameters:
<ul>
<li><code>im</code> is \(i_m\), the maximal current, around 120 nA (which matches the magnitude of the original current).</li>
<li><code>io</code> is the offset current, around -3nA.</li>
<li><code>km</code> is the \(K_m\), expressed in the same units as <code>s_1</code>, the first "injected" value of <code>s</code> (we used 50 because the injection is 50 µM CO). That means the value of \(K_m\) determined by this fit is around 9 nM ! (but see below).</li>
<li><code>s_t_1</code> is the time of the injection of CO (it was in the parameter files you loaded).</li>
<li>Finally, <code>s_tau_1</code> is the time constant of departure of CO, noted \(\tau\) in the equations above.
</ul>
<h5>Taking into account mass-transport limitations</h5>
However, the fit is still unsatisfactory: the predicted curve fails to reproduce the curvature at the beginning and at the end of the decrease. This is due to issues linked to mass-transport limitations, which are discussed in details in <a href="https://doi.org/10.1016/j.electacta.2017.03.114">Merrouch <i>et al</i>, <i>Electrochimica Acta</i>, <b>2017</b></a>. In short, what you need to do is to close the fit window again, load the <code>transport.rb</code> Ruby file that contains the definition of the <code>itrpt</code> function, and re-launch the fit window using:
<pre>QSoas> ruby-run transport.rb
QSoas> fit-arb itrprt(s,km,nFAm,nFAmu)+io /with=s:1,exp</pre>
Load again the parameter file... but this time you'll have to play a bit more with the starting parameters for QSoas to find the right values when you fit. Here are some tips:
<ul>
<li>the curve predicted with the current parameters (use "Update" to update the display) should "look like" the data;</li>
<li>apart from <code>io</code>, no parameter should be negative;</li>
<li>there <em>may be</em> hints about the correct values in the papers...</li>
</ul>
A successful fit should look like this:
<div class="separator" style="clear: both;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiwqmI-5hPN4t0mEp_HKJnfU5KBVykzDpvWFhU_cvNnArMSrGUXvO99Zxx0KhhRbHsx4gkMmNNQwebBlZacxCOqw0yV5bBOjmtkiCnAoto9EYGRXF_vIT8fDMT1e3yg0lJOvdAW4Fn5Oao/s1563/CODH-IV-fit-3.png" style="display: block; padding: 1em 0; text-align: center; "><img alt="" border="0" width="400" data-original-height="1048" data-original-width="1563" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiwqmI-5hPN4t0mEp_HKJnfU5KBVykzDpvWFhU_cvNnArMSrGUXvO99Zxx0KhhRbHsx4gkMmNNQwebBlZacxCOqw0yV5bBOjmtkiCnAoto9EYGRXF_vIT8fDMT1e3yg0lJOvdAW4Fn5Oao/s400/CODH-IV-fit-3.png"/></a></div>
Here you are ! I hope you enjoyed analyzing our data, and that it will help you analyze <b>yours</b> ! Feel free to comment and ask for clarifications.<br />
<br />
<h4>About QSoas</h4><a href="http://qsoas.org">QSoas</a> is a powerful open source data analysis program that focuses on flexibility and powerful fitting capacities. It is released under the <a href="https://www.gnu.org/licenses/old-licenses/gpl-2.0.en.html">GNU General Public License</a>. It is described in <a href="http://pubs.acs.org/doi/abs/10.1021/acs.analchem.6b00224">Fourmond, Anal. Chem., 2016, 88 (10), pp 5050–5052</a>. Current version is <strong>2.2</strong>. You can download its source code or buy precompiled versions for MacOS and Windows <a href="http://qsoas.org/downloads/">there</a>.
Vincent Fourmondhttp://www.blogger.com/profile/04388598885608111329noreply@blogger.com2tag:blogger.com,1999:blog-3019054489127059271.post-34552576660414750252018-03-21T21:04:00.002+01:002020-09-23T14:36:25.862+02:00Release 2.2 of QSoasThe new release of <a href="http://qsoas.org">QSoas</a> is finally ready ! It brings in a lot of new features and improvements, notably greatly improved memory use for massive multifits, a fit for linear (in)activation processes (the one we used in <a href='http://dx.doi.org/10.1038/nchem.1892'>Fourmond <em>et al</em>, Nature Chemistry 2014</a>), a new way to transform "numbers" like peak position or stats into new datasets and even SVG output ! Following popular demand, it also finally brings back the peak area output in the <a href='http://qsoas.org/manual.html#cmd-find-peaks'>find-peaks</a> command (and the other, related commands) ! You can browse the full list of changes <a href="http://qsoas.org/changes.html">there</a>.<br />
<br />
The new release can be downloaded from the <a href='http://qsoas.org/downloads.html'>downloads page</a>.<br />
<h4>Freely available binary images for QSoas 1.0</h4>In addition to the new release, we are now releasing the binary images for MacOS and Windows for the release <code>1.0</code>. They are also freely available for download from the <a href='http://qsoas.org/downloads.html'>downloads page</a>.<br />
<br />
<h4>About QSoas</h4><a href="http://qsoas.org">QSoas</a> is a powerful open source data analysis program that focuses on flexibility and powerful fitting capacities. It is released under the <a href="https://www.gnu.org/licenses/old-licenses/gpl-2.0.en.html">GNU General Public License</a>. It is described in <a href="http://pubs.acs.org/doi/abs/10.1021/acs.analchem.6b00224">Fourmond, Anal. Chem., 2016, 88 (10), pp 5050–5052</a>. Current version is <strong>2.2</strong>. You can download its source code or buy precompiled versions for MacOS and Windows <a href="http://qsoas.org/downloads/">there</a>.Vincent Fourmondhttp://www.blogger.com/profile/04388598885608111329noreply@blogger.com0tag:blogger.com,1999:blog-3019054489127059271.post-2410255599981964152017-10-10T00:31:00.001+02:002020-09-23T14:36:32.942+02:00Define a function with inline Ruby code in QSoas<a href="http://qsoas.org">QSoas</a> can read and execute Ruby code directly, while reading command files, or even at the command prompt. For that, just write plain Ruby code inside a <code>ruby</code>...<code>ruby end</code> block. Probably the most useful possibility is to define elaborated functions directly from within <code>QSoas</code>, or, preferable, from within a script; this is an alternative to defining a function in a completely separated Ruby-only file using <a href="http://qsoas.org/manual.html#cmd-ruby-run">ruby-run</a>. For instance, you can define a function for plain <a href="https://en.wikipedia.org/wiki/Michaelis%E2%80%93Menten_kinetics">Michaelis-Menten kinetics</a> with a file containing:<br />
<br />
<pre>ruby
def my_func(x, vm, km)
return vm/(1 + km/x)
end
ruby end
</pre><br />
This defines the function <code>my_func</code> with three parameters, <script type="math/tex">x</script>, <script type="math/tex">v_m</script> (<code>vm</code>) and <script type="math/tex">K_m</script>(<code>km</code>), with the formula: <script type="math/tex">\frac{v_m}{1 + K_m/x}</script><br />
<br />
You can then test that the function has been correctly defined running for instance:<br />
<br />
<pre>QSoas> eval my_func(1.0,1.0,1.0)
=> 0.5
QSoas> eval my_func(1e4,1.0,1.0)
=> 0.999900009999
</pre><br />
This yields the correct answer: the first command evaluates the function with <code>x = 1.0</code>, <code>vm = 1.0</code> and <code>km = 1.0</code>. For <script type="math/tex">x = K_m</script>, the result is <script type="math/tex">v_m/2</script> (here <code>0.5</code>). For <script type="math/tex">x \gg K_m</script>, the result is almost <script type="math/tex">v_m</script>. You can use the newly defined <code>my_func</code> in any place you would use any ruby code, such as in the <a href="http://vince-debian.blogspot.fr/2017/02/extended-dataset-generation.html">optional argument to generate-buffer</a>, or for <a href="http://qsoas.org/manual.html#arbitrary-fits">arbitrary fits</a>:<br />
<br />
<pre>QSoas> generate-buffer 0 10 my_func(x,3.0,0.6)
QSoas> fit-arb my_func(x,vm,km)
</pre><br />
To redefine <code>my_func</code>, just run the ruby code again with a new definition, such as:<br />
<pre>ruby
def my_func(x, vm, km)
return vm/(1 + km/x**2)
end
ruby end
</pre>The previous version is just erased, and all new uses of <code>my_func</code> will refer to your new definition.<br />
<br />
<br />
<h4>See for yourself</h4>The code for this example can be found <a href="https://github.com/fourmond/qsoas-goodies/blob/master/define-ruby-function.cmds">there</a>. Browse the <code>qsoas-goodies</code> <a href="https://github.com/fourmond/qsoas-goodies/">github repository</a> for more goodies !<br />
<br />
<h4>About QSoas</h4><a href="http://qsoas.org">QSoas</a> is a powerful open source data analysis program that focuses on flexibility and powerful fitting capacities. It is released under the <a href="https://www.gnu.org/licenses/old-licenses/gpl-2.0.en.html">GNU General Public License</a>. It is described in <a href="http://pubs.acs.org/doi/abs/10.1021/acs.analchem.6b00224">Fourmond, Anal. Chem., 2016, 88 (10), pp 5050–5052</a>. Current version is <strong>2.1</strong>. You can download its source code or buy precompiled versions for MacOS and Windows <a href="http://qsoas.org/downloads/">there</a>.<br />
<br />
Vincent Fourmondhttp://www.blogger.com/profile/04388598885608111329noreply@blogger.com0tag:blogger.com,1999:blog-3019054489127059271.post-59064386074736671262017-09-08T23:42:00.001+02:002017-09-08T23:42:29.124+02:00Extract many attachement from many mails in one go using ripmimeI was recently looking for a way to extract many attachments from a series of emails. I first had a look at the <a href="https://addons.mozilla.org/en-US/thunderbird/addon/attachmentextractor/">AttachmentExtractor</a> <a href="https://www.mozilla.org/en-US/thunderbird/">thunderbird</a> plugin, but it seems very old and not maintained anymore. So I've come up with another very simple solution that also works with any other mail client.</p><p>Just copy all the mails you want to extract attachments from to a single (temporary) mail folder, find out which file holds the mail folder and use <a href="http://www.pldaniels.com/ripmime/">ripmime</a> on that file (ripmime is packaged for <a href="http://debian.org">Debian</a>). For my case, it looked like:<br />
</p><pre>~ ripmime -i .icedove/XXXXXXX.default/Mail/pop.xxxx/tmp -d target-directory
</pre><p>Simple solution, but it saved me quite some time. Hope it helps !Vincent Fourmondhttp://www.blogger.com/profile/04388598885608111329noreply@blogger.com1tag:blogger.com,1999:blog-3019054489127059271.post-40261583230324619672017-07-13T10:03:00.002+02:002017-07-23T15:21:09.587+02:00Screen that hurts my eyes, take 2Six month ago, I wrote a <a href="http://vince-debian.blogspot.fr/2017/01/rfh-screen-that-hurts-my-eyes.html">lengthy post</a> about my new computer hurting my eyes. I haven't made any progress with that, but I've accidentally upgraded my work computer from Kernel 4.4 to 4.8 and the nvidia drivers from 340.96-4 to 375.66-2. Well, my work computer now hurts, I've switched back to the previous kernel and drivers, I hope it'll be back to normal.</p><p>Any ideas of something specific that changed, either between 4.4 and 4.8 (kernel startup code, default framebuffer modes, etc ?), or between the 340.96 and the 375.66 drivers ? In any case, I'll try that specific combination of kernels/drivers home to see if I can get it to a useable state.</p><h2>Update, July 23rd</h2><p>I reverted to the earlier drivers/kernel, to no avail. But it seems in fact the problem with my work computer is linked to an allergy of some kind, since antihistamine drugs have an effect (there are construction works in my lab, perhaps they are the cause ?). No idea still for my <a href="http://vince-debian.blogspot.fr/2017/01/rfh-screen-that-hurts-my-eyes.html">home computer</a>, for which the problem is definitely not solved.Vincent Fourmondhttp://www.blogger.com/profile/04388598885608111329noreply@blogger.com8tag:blogger.com,1999:blog-3019054489127059271.post-24798452623421027502017-05-14T00:45:00.000+02:002017-12-21T14:51:52.045+01:00Run QSoas complely non-interactively<a href="http://qsoas.org">QSoas</a> can run scripts, and, since version 2.0, it can be run completely without user interaction from the command-line (though an interface may be briefly displayed). This possibility relies on the following <a href="http://bip.cnrs-mrs.fr/bip06/qsoas/manual.html#command-line-options">command-line options</a>:</p><ul><li><code>--run</code>, which runs the command given on the command-line;</li>
<li><code>--exit-after-running</code>, which closes automatically QSoas after all the commands specified by <code>--run</code> were run;</li>
<li><code>--stdout</code> (since version 2.1), which redirects QSoas's terminal directly to the shell output.</li>
</ul>If you create a <code>script.cmds</code> file containing the following commands:<br />
<pre>generate-buffer -10 10 sin(x)
save sin.dat
</pre>and run the following command from your favorite command-line interpreter:<br />
<pre>~ QSoas --stdout --run '@ script.cmds' --exit-after-running
</pre>This will create a <code>sin.dat</code> file containing a sinusoid. However, if you run it twice, a <q>Overwrite file 'sin.dat' ?</q> dialog box will pop up. You can prevent that by adding the <code>/overwrite=true</code> option to <code>save</code>. As a general rule, you should avoid all commands that may ask questions in the scripts; a <code>/overwrite=true</code> option is also available for <code>save-buffers</code> for instance.</p><p>I use this possibility massively because I don't like to store <q>processed</q> files, I prefer to store the original data files and run a script to generate the <q>processed</q> data when I want to plot or to further process them. It can also be used to generate fitted data from saved parameters files. I use this to run automatic tests on Linux, Windows and Mac for every single build, in order to quickly spot platform-specific regressions.</p><p>To help you make use of this possibility, here is a shell function (Linux/Mac users only, add to your <code>$HOME/.bashrc</code> file or equivalent, and restart a terminal) to run directly on QSoas command files:<br />
<pre>qs-run () {
QSoas --stdout --run "@ $1" --exit-after-running
}
</pre>To run the <code>script.cmds</code> script above, just run<br />
<pre>~ qs-run script.cmds
</pre><br />
<h4>About QSoas</h4><a href="http://qsoas.org">QSoas</a> is a powerful open source data analysis program that focuses on flexibility and powerful fitting capacities. It is described in <a href="http://pubs.acs.org/doi/abs/10.1021/acs.analchem.6b00224">Fourmond, Anal. Chem., 2016, 88 (10), pp 5050–5052</a>. Current version is <strong>2.1</strong>Vincent Fourmondhttp://www.blogger.com/profile/04388598885608111329noreply@blogger.com0tag:blogger.com,1999:blog-3019054489127059271.post-28699889885998839122017-04-18T23:34:00.000+02:002017-04-18T23:34:56.051+02:00make-theme-image: a script to make yourself an idea of a icon theme<div class="separator" style="clear: both; text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi9motOYQhf0B27-Rddq42efZ6TtMW5FrAcJkn6Clz4C9MOz1iG_gcL8hmRcK9YPZjmoF9UVaDSC59Tvp9fFCkGtFCikpYVfjP8VjLoGAKCCuZzipjXV6gHoBlFDQVAp5mV1mt9U3O8S8k/s1600/gnome-icon-theme.png" imageanchor="1" style="clear: right; float: right; margin-bottom: 1em; margin-left: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi9motOYQhf0B27-Rddq42efZ6TtMW5FrAcJkn6Clz4C9MOz1iG_gcL8hmRcK9YPZjmoF9UVaDSC59Tvp9fFCkGtFCikpYVfjP8VjLoGAKCCuZzipjXV6gHoBlFDQVAp5mV1mt9U3O8S8k/s200/gnome-icon-theme.png" width="200" height="200" /></a></div>I created some time ago a <a href="https://github.com/fourmond/utils">utils</a> repository on github to publish miscellaneous scripts, but it's only recently that I have started to really populate it. One of my recent work is <code>make-theme-image</code> script, that downloads an icon them package, grabs relevant, user-specifiable, icons, and arrange them in a neat montage. The images displayed are the results of running<br />
<br />
<pre>~ make-theme-image gnome-icon-theme moblin-icon-theme
</pre><br />
<div class="separator" style="clear: both; text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgd3vqQtw94LsRalnA5YWcaqGdcLtHNJ09nghwjhV2PETnThidtWAB-3xL2yWY8IJt4ZcfOxTgvJnF1JGT0-FkIo3T3jZsvahKbFglE9OBpTxmhlQNuQs_fwqoUlHyiMpGZ2J9YZ9TGeA8/s1600/moblin-icon-theme.png" imageanchor="1" style="clear: right; float: right; margin-bottom: 1em; margin-left: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgd3vqQtw94LsRalnA5YWcaqGdcLtHNJ09nghwjhV2PETnThidtWAB-3xL2yWY8IJt4ZcfOxTgvJnF1JGT0-FkIo3T3jZsvahKbFglE9OBpTxmhlQNuQs_fwqoUlHyiMpGZ2J9YZ9TGeA8/s200/moblin-icon-theme.png" width="200" height="200" /></a></div>This is quite useful to get a good idea of the icons available in a package. You can select the icons you want to display using the <code>-w</code> option. The following command should provide you with a decent overview of the icon themes present in Debian:<br />
<br />
<pre>apt search -- -icon-theme | grep / | cut -d/ -f1 | xargs make-theme-image
</pre><br />
I hope you find it useful ! In any case, it's on <a href="https://github.com/fourmond/utils">github</a>, so feel free to patch and share.Vincent Fourmondhttp://www.blogger.com/profile/04388598885608111329noreply@blogger.com1tag:blogger.com,1999:blog-3019054489127059271.post-39010975653369833932017-04-03T22:12:00.000+02:002017-04-03T22:12:36.641+02:00Variations around ls -lrtI have been using almost compulsively <code>ls -lrt</code> for a long time now. As per the <a href="http://http://man7.org/linux/man-pages/man1/ls.1.html">ls man page</a>, this command lists the files of the current directory, with the latest files at the end, so that they are the ones that show up just above your next command-line. This is very convenient to work with, hmmm, not-so-well-organized directories, because it just shows what you're working on, and you can safely ignore the rest. Typical example is a big Downloads directory, for instance, but I use it everywhere. I quickly used <code>alias lrt="ls -lrt"</code> to make it easier, but... I though I might have as well a reliable way to <b>directly use</b> what I saw. So I came up with the following shell function (<a href="http://www.zsh.org/">zsh</a>, but probably works with most Bourne-like shells):<br />
<pre>lrt() {
ls -lrt "$@"
lrt="$(ls -rt "$@" | tail -n1)"
}
</pre>This small function runs <code>ls -lrt</code> as usual, but also sets the <code>$lrt</code> shell variable to the latest file, so you can use it in your next commands ! Especially useful for complex file names. Demonstration:<br />
<pre>22:05 vincent@ashitaka ~/Downloads lrt
[...]
-rw-r--r-- 1 vincent vincent 1490027 Apr 2 15:44 k.zip
-rw-r--r-- 1 vincent vincent 668566 Apr 3 22:05 1-s2.0-S0013468617305947-main.pdf
22:06 vincent@ashitaka ~/Downloads cp -v $lrt ~/nice-paper.pdf
'1-s2.0-S0013468617305947-main.pdf' -> '/home/vincent/nice-paper.pdf'
</pre>This saves typing the name of the <code>1-s2.0-S0013468617305947-main.pdf</code>: in this case, automatic completion doesn't help much, since many files in my <code>Downloads</code> directory start with the same orefix... I hope this helps !<br />
Vincent Fourmondhttp://www.blogger.com/profile/04388598885608111329noreply@blogger.com8tag:blogger.com,1999:blog-3019054489127059271.post-88308796716276291442017-02-02T22:58:00.000+01:002017-02-02T22:58:37.987+01:00Extended dataset generation possibilities of QSoasWhile the main focus of <a href="http://qsoas.org">QSoas</a> is the processing of experimental data, it also features commands to generate (calculate) datasets. The command <a href="http://qsoas.org/manual.html#cmd-generate-buffer">generate-buffer</a> creates a dataset of equally spaced points (you can change their number using the option <code>/samples</code>) between to limiting values, as below:</p><pre>QSoas> generate-buffer -2 2
</pre><div class="separator" style="clear: both; text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEibEt5zz4YlxRO5QJ-CP2rtoxA-Eo-w9HGFV0EINUuLdpnquZVUGe_9cXa_RtOUAlt4yCk3NnWCQyV3FOF8WV4KiOtisXBbBFHg8mooqSTsum0Wh5kin1vq_M-l07ut-4htRHEdk8kdysc/s1600/QSoas-generate.png" imageanchor="1" style="clear: right; float: right; margin-bottom: 1em; margin-left: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEibEt5zz4YlxRO5QJ-CP2rtoxA-Eo-w9HGFV0EINUuLdpnquZVUGe_9cXa_RtOUAlt4yCk3NnWCQyV3FOF8WV4KiOtisXBbBFHg8mooqSTsum0Wh5kin1vq_M-l07ut-4htRHEdk8kdysc/s200/QSoas-generate.png" width="200" height="152" /></a></div><p>By default, the <script type="math/tex">y</script> values are taken equal to <script type="math/tex">x</script>. However, <a href="http://qsoas.org/manual.html#cmd-generate-buffer">generate-buffer</a> also takes an optional formula to directly set the <script type="math/tex">y</script> values:<br />
<pre>QSoas> generate-buffer -10 10 sin(x)
</pre><p>From version <code>2.0</code>, it is possible to generate several datasets in a row using the <code>/number</code> option, and to color them using the <code>/style</code> option (but only since version <code>2.1</code>). Each dataset is generated according to the formula, and <code>number</code> is a special number that starts at 0 and increases by 1 for each dataset. Here's what I used to generate the picture on the right:<br />
<pre>QSoas> generate-buffer -2 2 sin(PI*x)**(number+1) /number=30 /style=red-to-blue
</pre><h4>About QSoas</h4><a href="http://qsoas.org">QSoas</a> is an open source data analysis program that focuses on flexibility and powerful fitting capacities. It is described in <a href="http://pubs.acs.org/doi/abs/10.1021/acs.analchem.6b00224">Fourmond, Anal. Chem., 2016, 88 (10), pp 5050–5052</a>.Vincent Fourmondhttp://www.blogger.com/profile/04388598885608111329noreply@blogger.com0tag:blogger.com,1999:blog-3019054489127059271.post-19588991209805224952017-01-10T08:47:00.000+01:002017-01-10T08:47:19.006+01:00Version 2.1 of QSoas is out <div class="separator" style="clear: both; text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgIKfRYClPJMhsd7D5CHfFadm3C1hFW_vvMjTyJpdm8PEQa3P8JKKJsgoJGQuKwa91JTQ7fcXQQ8fBhA7O3hljQtEzuVPmSklJ_dPtnP1mP9kEearGMzmhd1P3o4qKdjWD_pDpvCoxApmU/s1600/QSoas-solve.png" imageanchor="1" style="clear: right; float: right; margin-bottom: 1em; margin-left: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgIKfRYClPJMhsd7D5CHfFadm3C1hFW_vvMjTyJpdm8PEQa3P8JKKJsgoJGQuKwa91JTQ7fcXQQ8fBhA7O3hljQtEzuVPmSklJ_dPtnP1mP9kEearGMzmhd1P3o4qKdjWD_pDpvCoxApmU/s320/QSoas-solve.png" width="320" height="261" /></a></div>I have just released QSoas version 2.1. It brings in a new <a href="http://bip.cnrs-mrs.fr/bip06/qsoas/manual.html#cmd-solve">solve</a> command to solve arbitrary non-linear equations of one unknown. I took advantage of this command in the figure to solve the equation <script type="math/tex">\exp(x\,y)-x = 0</script> for <script type="math/tex">y</script>. It also provides a new way to reparametrize fits using the <a href="http://bip.cnrs-mrs.fr/bip06/qsoas/manual.html#cmd-reparametrize-fit">reparametrize-fit</a> command, a new series of fits to model the behaviour of an adsorbed 1- or 2-electrons catalyst on an electrode (these fits are discussed in great details in our recent review (DOI:<a href="http://dx.doi.org/10.1016/j.coelec.2016.11.002"> 10.1016/j.coelec.2016.11.002</a>), improvements in various commands, the possibility to now compile using Ruby 2.3 and the most recent version of the GSL library, and sketches for an emacs major mode, which you can activate (for QSoas script files, ending in <code>.cmds</code>) using the following snippet in <code>$HOME/.emacs</code>:<br />
<br />
<pre>(autoload 'qsoas-mode "$HOME/Prog/QSoas/misc/qsoas-mode.el" nil t)
(add-to-list 'auto-mode-alist '("\\.cmds$" . qsoas-mode))
</pre><br />
Of course, you'll have to adapt the path <code>$HOME/Prog/QSoas/misc/qsoas-mode.el</code> to the actual location of <code>qsoas-mode.el</code>.</p><p>As before, you can download the source code from <a href="http://bip.cnrs-mrs.fr/bip06/qsoas/downloads.html">our website</a>, and purchase the pre-built binaries following the links from that page too. Enjoy !Vincent Fourmondhttp://www.blogger.com/profile/04388598885608111329noreply@blogger.com0