How to make a patch to GenABEL

by Nicola Pirastu

OK, so you want to fix something that's not working in one of the GenABEL suite packages and don't know where to start. Actually it's easier than you think.

The first thing you need to do is to download the last version of the GenABEL suite source code with the command:

svn co svn://svn.r-forge.r-project.org/svnroot/genabel/pkg

it is important to use 'co' (checkout) option and not export because otherwise the command 'diff' needed to make the patch will not work.

You will now notice that a new directory has been created called './pkg' Inside you will find a directory for each package.

You can find the source for each function in the corresponding package directory in the R directory so for example the source for polygenic will be in './pkg/GenABEL/R/polygenic.R'.

Now open the file you intend to fix and make all the changes you intend to make. Once you are done go to the 'pkg' directory and recompile the package you have fixed using the command (assuming you made changes to the GenABEL package)

R CMD INSTALL GenABEL

Open R and check that you actually fixed the problem. If this is the case also run

R CMD check GenABEL

to verify that everything is working fine. If everything goes well you are ready to make the patch that can be sent to the maintainers.

At this point it is important to update your version of the source code by going to the pkg directory and running:

svn update

This is important since it probably took you some time to make the patch and probably other changes have been made which could complicate the creation of the patch.

Now it is time for the actual creation of the patch. From the root directory of the 'pkg' directory run

svn diff ./pkg > patch_file_name

This is your patch file.

Now to check that it works fine, you could copy back the original version of the function (for example from an svn checkout in a temporary directory) and try if the patch works from the directory where you have created it with

patch -p0 -i patch_file_name

Rerun the 'R CMD' commands and re-check everything and you are ready to submit the patch file to the community. Don't forget to describe what you fixed (if possible including a bug number from the bug tracker) and maybe give an example of the new/improved functionality.