[Genabel-commits] r840 - in pkg/ProbABEL: doc src

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Sun Feb 19 18:37:31 CET 2012


Author: lckarssen
Date: 2012-02-19 18:37:31 +0100 (Sun, 19 Feb 2012)
New Revision: 840

Added:
   pkg/ProbABEL/doc/packaging.txt
Modified:
   pkg/ProbABEL/src/data.h
Log:
Added instructions about packaging for Debian and Ubuntu to the ProbABEL documentation.

Added: pkg/ProbABEL/doc/packaging.txt
===================================================================
--- pkg/ProbABEL/doc/packaging.txt	                        (rev 0)
+++ pkg/ProbABEL/doc/packaging.txt	2012-02-19 17:37:31 UTC (rev 840)
@@ -0,0 +1,45 @@
+This file explains how to generate packages (deb, rpm) for different Linux
+distributions.
+
+* Debian (and Ubuntu) packages
+** Install the necessary requirements
+   The following packages need to be installed (in addition to the
+   ones you need to compile the source anyway):
+   - dh-make
+   - fakeroot
+   - lintian
+** Building the package
+   First check to see if everything compiles and all files are included
+   in the automake files:
+    ./configure
+    make distcheck
+   If there are no errors, a tar.gz file of the source should be
+   created. Let's create the package.
+    cd dist-packages/deb
+   Debian packages must have lowercase letters, so we'll make a copy
+   of the tar.gz file
+    tar -xzf ../../ProbABEL-0.2-0-beta.tar.gz
+    mv ProbABEL-0.2-0-beta probabel-0.2-0-beta
+    cd probabel-0.2-0-beta
+    dh_make --single --email youremail at example.com \
+     --file ../probabel-0.2-0-beta.tar.gz --copyright gpl2 \
+     --packagename probabel
+
+   Hit the enter key to confirm the settings. Several files need to be
+   edited (or at least checked to see if they are still up to date).
+   - debian/control
+   - debian/changelog
+   - debian/copyright
+   - debian/README.Debian
+   dh_make also creates several example scripts in the debian/
+   directory. We don't need them, so they can be delete:
+    rm debian/*.ex
+   Now the package can be built:
+    dpkg-buildpackage -rfakeroot -us -uc
+   This creates a ~.deb~ file in the parent directory. As a
+   final touch you can check you package for errors with
+    lintian ../probabel_0.2-0-beta-1_amd64.deb
+   Several warnings will show up (e.g. binaries without man-pages),
+   but we ignore these for now. If you are interested in a more
+   detailed explanation of the warnings, add the -i option to the
+   lintian command.

Modified: pkg/ProbABEL/src/data.h
===================================================================
--- pkg/ProbABEL/src/data.h	2012-02-19 15:50:28 UTC (rev 839)
+++ pkg/ProbABEL/src/data.h	2012-02-19 17:37:31 UTC (rev 840)
@@ -14,6 +14,10 @@
 #include "fvlib/Logger.h"
 #include "fvlib/Transposer.h"
 
+/* Number of columns in info files */
+#define N_MACH_COLS 7
+#define N_MINIMAC_COLS 13
+
 extern bool is_interaction_excluded;
 
 void error(const char * format, ...)
@@ -813,17 +817,31 @@
 		}
 		char tmp[100];
 		unsigned int nlin=0;
+		unsigned int ncols=0;
 		while (fscanf(infile,"%s", tmp)!=EOF) {
 			nlin++;
 		}
 		fclose(infile);
-		if (nlin % 7)
+		if (! (nlin % N_MACH_COLS))
 		{
-			fprintf(stderr,"mlinfo: number of columns != 7 in %s",filename);
+			/* The number of columns is as expected from MaCH output */
+			ncols = N_MACH_COLS;
+		} else if (! (nlin % N_MINIMAC_COLS))
+		{
+			/* The number of columns is as expected from Minimac output */
+			ncols = N_MINIMAC_COLS;
+		}
+		else
+		{
+			fprintf(stderr,
+				"info file: number of columns != %i or %i in %s\nIs this file really in MaCH or Minimac format?",
+				N_MACH_COLS,
+				N_MINIMAC_COLS,
+				filename);
 			exit(1);
 		}
-		nsnps = int(nlin/7) - 1;
-		printf("Number of SNPs = %d\n",nsnps);
+		nsnps = int(nlin/ncols) - 1;
+		printf("Number of SNPs = %d\n", nsnps);
 		name = new std::string [nsnps];
 		A1 = new std::string [nsnps];
 		A2 = new std::string [nsnps];
@@ -837,8 +855,8 @@
 			fprintf(stderr,"mlinfo: cannot open file %s",filename);
 			exit(1);
 		}
-		for (int i =0;i<7;i++) fscanf(infile,"%s", tmp);
-		for (int i =0;i<nsnps;i++)
+		for (int i=0; i<ncols; i++) fscanf(infile,"%s", tmp);
+		for (int i=0; i<nsnps; i++)
 		{
 			fscanf(infile,"%s", tmp);
 			name[i] = tmp;
@@ -855,6 +873,16 @@
 			fscanf(infile,"%s", tmp);
 			Rsq[i] = atof(tmp);
 			map[i] = "-999";
+			if (ncols > N_MACH_COLS)
+			{
+				/* More than N_MACH_COLS columns.
+				   Read the remaining columns and forget them
+				 */
+				for (int j=0; j++; j=ncols-N_MACH_COLS)
+				{
+				       fscanf(infile, "%s", tmp);
+				}
+			}
 		}
 		fclose(infile);
 		if (mapname!=NULL)



More information about the Genabel-commits mailing list