R’s matplot function in MATLAB

By default, MATLAB’s plot function draws no markers in the figure that it produces. One may explicitly specify a marker and a line style following the line specification string syntax; however, only one marker type and line style may be applied to a single data set.

Further we present a simple MATLAB function that implements the same functionality as R’s matplot function and allows to set style for each data line shown.

Continue reading

Creating GIF animations of protein molecules with PyMOL

PyMOL is an open-source molecular visualization system useful for producing high-quality figures of protein structures. Besides static figures, PyMOL can also generate animations with the mpng command that writes movie frames to separate files. However, mpng provides no options to customize the produced images. Here we describe an appoach to get a customized looped animation in PyMOL and present a Python script implementing it. The script is based on Maximilian Ebert’s solution from the PyMOL mailing list.

Continue reading

Determining OS X version in Makefile

There is a number of ways to set up compilation options depending on an environment, including sophisticated tools like Autoconf and CMake. The most basic and commonly used approach is to include environment-specific options in a makefile for GNU Make. A typical example is choosing different options for Linux, Windows and OS X. Here we extend this example by considering the OS X version.

Continue reading

Fast vector product in MATLAB

The MATLAB function cross implements the vector product for two kinds of input data: a pair of vectors and a pair of N-D arrays. Surprisingly, it works slower for successive computations of cross products for 3-D vector pairs than the following naive implementation.


function C = cross3d(A, B)

C = [A(2)*B(3) - A(3)*B(2), ...
     A(3)*B(1) - A(1)*B(3), ...
     A(1)*B(2) - A(2)*B(1)];

end

Further, we estimate the median running time of cross and cross3d in a reproducible way using MATLAB scripts.

Continue reading