[Genabel-commits] r1334 - pkg/filevector/fvfutil

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Tue Sep 10 17:23:44 CEST 2013


Author: lckarssen
Date: 2013-09-10 17:23:44 +0200 (Tue, 10 Sep 2013)
New Revision: 1334

Modified:
   pkg/filevector/fvfutil/text2fvf_main.cpp
   pkg/filevector/fvfutil/usage.cpp
Log:
FileVector Utilities: fixed a bug where the options listed in the examples didn't match the actual options in use. Moreover, the -d/--datatype option didn't work and lead to a core dump, because it didn't expect an argument (line 9).

The Erasmus MC holds the copyright of these changes.


Modified: pkg/filevector/fvfutil/text2fvf_main.cpp
===================================================================
--- pkg/filevector/fvfutil/text2fvf_main.cpp	2013-09-10 15:20:11 UTC (rev 1333)
+++ pkg/filevector/fvfutil/text2fvf_main.cpp	2013-09-10 15:23:44 UTC (rev 1334)
@@ -6,14 +6,14 @@
 
     int next_option;
     int quiet = 0;
-    const char * const short_options = "i:o:c:r:1:2:3:4:t:R:T:d";
+    const char * const short_options = "i:o:c:s:r:2:3:4:t:R:T:d:";
     const struct option long_options [] =
         {
             {"infile",    required_argument, NULL, 'i'},
             {"outfile",   required_argument, NULL, 'o'},
             {"skipcols",  required_argument, NULL, 'c'},
-            {"skiprows",  required_argument, NULL, 'r'},
-            {"rncol",     required_argument, NULL, '1'},
+            {"skiprows",  required_argument, NULL, 's'},
+            {"rownames",  required_argument, NULL, 'r'},
             {"cnrow",     required_argument, NULL, '2'},
             {"rnfile",    required_argument, NULL, '3'},
             {"cnfile",    required_argument, NULL, '4'},
@@ -33,12 +33,13 @@
     string nanString;
 
     unsigned long rownames = 0, colnames = 0, transpose = 0, skipcols = 0,
-    skiprows = 0, Rmatrix = 0;
+        skiprows = 0, Rmatrix = 0;
     unsigned short dataType = 0;
 
     do
     {
-        next_option = getopt_long(argc,argv,short_options,long_options,NULL);
+        next_option = getopt_long(argc, argv, short_options, long_options,
+                                  NULL);
         switch (next_option)
         {
             case 'i':
@@ -50,10 +51,10 @@
             case 'c':
                 skipcols = atoi(optarg);
                 break;
-            case 'r':
+            case 's':
                 skiprows = atoi(optarg);
                 break;
-            case '1':
+            case 'r':
                 rownames = atoi(optarg);
                 break;
             case '2':
@@ -74,6 +75,7 @@
                 Rmatrix=1;
                 break;
             case 'd':
+                cout << "optarg:" << optarg << flush;
                 dataType = dataTypeFromString(optarg);
                 break;
             case 'n':
@@ -89,7 +91,7 @@
 
     if (dataType == 0) {
         dataType = DOUBLE;
-        msg <<"No output data type specified. Using DOUBLE.\n";
+        msg << "No output data type specified. Using DOUBLE.\n";
     }
 
     // check that in- and out-filenames are supplied

Modified: pkg/filevector/fvfutil/usage.cpp
===================================================================
--- pkg/filevector/fvfutil/usage.cpp	2013-09-10 15:20:11 UTC (rev 1333)
+++ pkg/filevector/fvfutil/usage.cpp	2013-09-10 15:23:44 UTC (rev 1334)
@@ -22,18 +22,18 @@
         cout << "for which FVF will provide fast access. If you want it other way around,"<< endl;
         cout << "please specify '-t' option."<< endl;
         cout << ""<< endl;
-        cout << "EXAMPLES: " << progname << " -i test.mldose -o test.mldose.fvf -s 2 -r 1"<< endl;
+        cout << "EXAMPLES: " << progname << " -i test.mldose -o test.mldose.fvf -c 2 -r 1"<< endl;
         cout << "          Text matrix file contains two starting columns, first of which"<< endl;
         cout << "          contains subjects IDs."<< endl;
         cout << "          Command will convert text matrix provided in 'test.mldose' to "<< endl;
         cout << "          FVF-formated file 'test.mldose.fvf'. Columns will be stored as"<< endl;
         cout << "          the fast-access FVF 'variables'"<< endl;
         cout << ""<< endl;
-        cout << "          " << progname << " -i test.mldose -o test.mldose.fvf -s 2 -r 1 -t"<< endl;
+        cout << "          " << progname << " -i test.mldose -o test.mldose.fvf -c 2 -r 1 -t"<< endl;
         cout << "          Same as above, but transposing the matrix. Rows will be stores as"<< endl;
         cout << "          the fast-access FVF 'variables'"<< endl;
         cout << ""<< endl;
-        cout << "          " << progname << " -i test.mldose -o test.mldose.fvf -s 2 -r 1 --colnames=test.snplist"<< endl;
+        cout << "          " << progname << " -i test.mldose -o test.mldose.fvf -c 2 -r 1 --colnames=test.snplist"<< endl;
         cout << "          Same as example 1, but we tell that column names are stored in file"<< endl;
         cout << "          'test.snplist' (mind the full format used: '--colnames=CFILE')"<< endl;
         cout << ""<< endl;



More information about the Genabel-commits mailing list