Commits

mchikina committed 8c61988

Actually added the files!

Comments (0)

Files changed (6)

tools/SVMfe/SVMfe.cpp

+#include <fstream>
+
+#include <vector>
+
+/*****************************************************************************
+ * This file is provided under the Creative Commons Attribution 3.0 license.
+ *
+ * You are free to share, copy, distribute, transmit, or adapt this work
+ * PROVIDED THAT you attribute the work to the authors listed below.
+ * For more information, please see the following web page:
+ * http://creativecommons.org/licenses/by/3.0/
+ *
+ * This file is a component of the Sleipnir library for functional genomics,
+ * authored by:
+ * Curtis Huttenhower (chuttenh@princeton.edu)
+ * Mark Schroeder
+ * Maria D. Chikina
+ * Olga G. Troyanskaya (ogt@princeton.edu, primary contact)
+ *
+ * If you use this library, the included executable tools, or any related
+ * code in your work, please cite the following publication:
+ * Curtis Huttenhower, Mark Schroeder, Maria D. Chikina, and
+ * Olga G. Troyanskaya.
+ * "The Sleipnir library for computational functional genomics"
+ *****************************************************************************/
+#include "stdafx.h"
+#include "cmdline.h"
+#include "statistics.h"
+
+using namespace SVMLight;
+//#include "../../extlib/svm_light/svm_light/kernel.h"
+
+vector<SVMLight::SVMLabel> ReadLabels(ifstream & ifsm) {
+
+	static const size_t c_iBuffer = 1024;
+	char acBuffer[c_iBuffer];
+	vector<string> vecstrTokens;
+	vector<SVMLight::SVMLabel> vecLabels;
+	while (!ifsm.eof()) {
+		ifsm.getline(acBuffer, c_iBuffer - 1);
+		acBuffer[c_iBuffer - 1] = 0;
+		vecstrTokens.clear();
+		CMeta::Tokenize(acBuffer, vecstrTokens);
+		if (vecstrTokens.empty())
+			continue;
+		if (vecstrTokens.size() != 2) {
+			cerr << "Illegal label line (" << vecstrTokens.size() << "): "
+					<< acBuffer << endl;
+			continue;
+		}
+		vecLabels.push_back(SVMLight::SVMLabel(vecstrTokens[0], atof(
+				vecstrTokens[1].c_str())));
+	}
+	return vecLabels;
+}
+
+struct SortResults {
+
+	bool operator()(const SVMLight::Result& rOne, const SVMLight::Result & rTwo) const {
+		return (rOne.Value > rTwo.Value);
+	}
+};
+
+void PrintResults(vector<SVMLight::Result> vecResults, ofstream & ofsm) {
+	sort(vecResults.begin(), vecResults.end(), SortResults());
+	int LabelVal;
+	for (size_t i = 0; i < vecResults.size(); i++) {
+		ofsm << vecResults[i].toString() << endl;
+	}
+}
+
+void EliminateSvec(SVMLight::SVECTOR *a, bool* p_bUseFeature) {
+	register SVMLight::WORD *ai;
+	ai = a->words;
+	register bool * pUse = p_bUseFeature;
+	size_t zeroed = 0;
+	pUse++; //the first one is junk since feature numbering starts at 1
+	while (ai->wnum) {
+		if (!*pUse) {
+			ai->weight = 0.0;
+			zeroed++;
+		}
+		ai++;
+		pUse++;
+	}
+	//cerr<<"Zeroed features ="<<zeroed<<endl;
+}
+void PrintSVec(SVMLight::SVECTOR *a) {
+	register SVMLight::WORD *ai;
+	ai = a->words;
+	while (ai->wnum) {
+
+		cerr << ' ' << ai->weight;
+		ai++;
+	}
+	cerr << endl;
+}
+
+void EliminateSample(SVMLight::SAMPLE& sample, bool* p_bUseFeature) {
+	for (size_t i = 0; i < sample.examples[0].x.totdoc; i++) {
+		EliminateSvec(sample.examples[0].x.doc[i]->fvec, p_bUseFeature);
+	}
+}
+
+void ZeroWordVec(vector<SVMLight::WORD>& vecWords) {
+	for (size_t i = 0; i < vecWords.size(); i++) {
+		vecWords[i].weight = 0;
+	}
+}
+
+void AddToWordVec(vector<SVMLight::WORD>& vecWords, double* a_fW) {
+	for (size_t i = 0; i < vecWords.size(); i++) {
+		//vecWords[i].weight += svec.words[i].weight;
+		vecWords[i].weight += a_fW[i];
+	}
+}
+
+void CombineWithWordVecMin(vector<SVMLight::WORD>& vecWords, double* a_fW) {
+	for (size_t i = 0; i < vecWords.size(); i++) {
+		if (vecWords[i].weight * vecWords[i].weight > a_fW[i] * a_fW[i]) {
+			vecWords[i].weight = a_fW[i];
+		}
+	}
+}
+
+void CombineWithWordVecMax(vector<SVMLight::WORD>& vecWords, double* a_fW) {
+	for (size_t i = 0; i < vecWords.size(); i++) {
+		if (vecWords[i].weight * vecWords[i].weight < a_fW[i] * a_fW[i]) {
+			vecWords[i].weight = a_fW[i];
+		}
+	}
+}
+
+
+vector<float> MeanDiff(SAMPLE &sample, size_t iNumFeat) {
+	size_t i, j, npos, nneg;
+	npos = nneg = 0;
+	for (i = 0; i < sample.n; i++) {
+		if (sample.examples->y.Class[i] > 0) {
+			npos++;
+		} else if (sample.examples->y.Class[i] < 0) {
+			nneg++;
+		}
+
+	}
+	vector<float> vecMeanDiff;
+	vecMeanDiff.resize(iNumFeat);
+	fill(vecMeanDiff.begin(), vecMeanDiff.end(), 0.0f);
+	float nfrac, pfrac;
+	nfrac = 1.0f / nneg;
+	pfrac = 1.0f / npos;
+	for (i = 0; i < sample.n; i++) {
+		if (sample.examples->y.Class[i] > 0) {
+			for (j = 0; j < iNumFeat; j++) {
+				vecMeanDiff[j]
+						+= sample.examples->x.doc[0]->fvec->words[j].weight;
+			}
+		} else if (sample.examples->y.Class[i] < 0) {
+			for (j = 0; j < iNumFeat; j++) {
+				vecMeanDiff[j] -= nfrac
+						* sample.examples->x.doc[0]->fvec->words[j].weight;
+			}
+		}
+
+	}
+	return vecMeanDiff;
+}
+bool SortWords(const SVMLight::WORD& first, const SVMLight::WORD& second) {
+	if (first.weight * first.weight < second.weight * second.weight)
+		return 1;
+	else
+		return 0;
+}
+struct ParamStruct {
+	vector<float> vecK, vecTradeoff;
+	vector<size_t> vecLoss;
+	vector<char*> vecNames;
+};
+
+ParamStruct ReadParamsFromFile(ifstream& ifsm, string outFile) {
+	static const size_t c_iBuffer = 1024;
+	char acBuffer[c_iBuffer];
+	char* nameBuffer;
+	vector<string> vecstrTokens;
+	size_t extPlace;
+	string Ext, FileName;
+	if ((extPlace = outFile.find_first_of(".")) != string::npos) {
+		FileName = outFile.substr(0, extPlace);
+		Ext = outFile.substr(extPlace, outFile.size());
+	} else {
+		FileName = outFile;
+		Ext = "";
+	}
+	ParamStruct PStruct;
+	size_t index = 0;
+	while (!ifsm.eof()) {
+		ifsm.getline(acBuffer, c_iBuffer - 1);
+		acBuffer[c_iBuffer - 1] = 0;
+		vecstrTokens.clear();
+		CMeta::Tokenize(acBuffer, vecstrTokens);
+		if (vecstrTokens.empty())
+			continue;
+		if (vecstrTokens.size() != 3) {
+			cerr << "Illegal params line (" << vecstrTokens.size() << "): "
+					<< acBuffer << endl;
+			continue;
+		}
+		if (acBuffer[0] == '#') {
+			cout << "skipping " << acBuffer << endl;
+		} else {
+			PStruct.vecLoss.push_back(atoi(vecstrTokens[0].c_str()));
+			PStruct.vecTradeoff.push_back(atof(vecstrTokens[1].c_str()));
+			PStruct.vecK.push_back(atof(vecstrTokens[2].c_str()));
+			PStruct.vecNames.push_back(new char[c_iBuffer]);
+			if (PStruct.vecLoss[index] == 4 || PStruct.vecLoss[index] == 5)
+				sprintf(PStruct.vecNames[index], "%s_l%d_c%4.6f_k%4.3f%s",
+						FileName.c_str(), PStruct.vecLoss[index],
+						PStruct.vecTradeoff[index], PStruct.vecK[index],
+						Ext.c_str());
+			else
+				sprintf(PStruct.vecNames[index], "%s_l%d_c%4.6f%s",
+						FileName.c_str(), PStruct.vecLoss[index],
+						PStruct.vecTradeoff[index], Ext.c_str());
+			index++;
+		}
+
+	}
+	cout << "DONE reading params file" << endl;
+	return PStruct;
+}
+
+int main(int iArgs, char** aszArgs) {
+	gengetopt_args_info sArgs;
+	CPCL PCL;
+	SVMLight::CSVMPERF SVM;
+	size_t i, j, iGene, jGene;
+	ifstream ifsm;
+	size_t elimSoFar, toElim;
+	if (cmdline_parser(iArgs, aszArgs, &sArgs)) {
+		cmdline_parser_print_help();
+		return 1;
+	}
+	CMeta Meta( sArgs.verbosity_arg, sArgs.random_arg );
+	SVM.SetVerbosity(sArgs.svm_verbosity_arg);
+	SVM.SetLossFunction(sArgs.error_function_arg);
+	if (sArgs.k_value_arg > 1) {
+		cerr << "k_value is >1. Setting default 0.5" << endl;
+		SVM.SetPrecisionFraction(0.5);
+	} else if (sArgs.k_value_arg <= 0) {
+		cerr << "k_value is <=0. Setting default 0.5" << endl;
+		SVM.SetPrecisionFraction(0.5);
+	} else {
+		SVM.SetPrecisionFraction(sArgs.k_value_arg);
+	}
+	SVM.SetTradeoff(sArgs.tradeoff_arg);
+	if (sArgs.slack_flag)
+		SVM.UseSlackRescaling();
+
+	if (!SVM.parms_check()) {
+		cerr << "Sanity check failed, see above errors" << endl;
+		return 1;
+	}
+
+	cerr << "SVM params are:" << endl;
+	cerr << "loss function\t" << SVM.struct_parm.loss_function << endl;
+	cerr << "k value\t" << SVM.struct_parm.prec_rec_k_frac << endl;
+	cerr << "tradeoff\t" << SVM.struct_parm.C << endl;
+
+	//  cout << "there are " << vecLabels.size() << " labels processed" << endl;
+	size_t iFile;
+	vector<string> PCLs;
+	if (sArgs.input_given) {
+		if (!PCL.Open(sArgs.input_arg, sArgs.skip_arg, sArgs.mmap_flag)) {
+			cerr << "Could not open input PCL" << endl;
+			return 1;
+		}
+	}
+
+	vector<SVMLight::SVMLabel> vecLabels;
+	set<string> setLabeledGenes;
+	if (sArgs.labels_given) {
+		ifsm.clear();
+		ifsm.open(sArgs.labels_arg);
+		if (ifsm.is_open())
+			vecLabels = ReadLabels(ifsm);
+		else {
+			cerr << "could not read label file" << endl;
+			return 1;
+		}
+		for (i = 0; i < vecLabels.size(); i++)
+			setLabeledGenes.insert(vecLabels[i].GeneName);
+	}
+
+	vector<SVMLabel> vecLabelsIndex;
+	size_t iIndex;
+	for (i = 0; i < vecLabels.size(); i++) {
+		iIndex = PCL.GetGene(vecLabels[i].GeneName);
+		if (iIndex != -1) {
+			vecLabelsIndex.push_back(vecLabels[i]);
+			vecLabelsIndex.back().index = iIndex;
+		}
+	}
+	vecLabels = vecLabelsIndex;
+
+	vector<SVMLight::SVMLabel> pTestVector[sArgs.cross_validation_arg];
+	vector<SVMLight::SVMLabel> pTrainVector[sArgs.cross_validation_arg];
+
+	size_t nCV = sArgs.cross_validation_arg;
+	size_t nLabels = (nCV) * (nCV - 1) + nCV;
+	size_t iC, iB;
+
+	for (i = 0; i < nCV; i++) {
+		pTestVector[i].reserve((size_t) vecLabels.size() / nCV + nCV);
+		pTrainVector[i].reserve((size_t) vecLabels.size() / (nCV) * (nCV - 1)
+				+ nCV);
+		for (j = 0; j < vecLabels.size(); j++) {
+			if (j % sArgs.cross_validation_arg == i) {
+				pTestVector[i].push_back(vecLabels[j]);
+			} else {
+				pTrainVector[i].push_back((vecLabels[j]));
+			}
+		}
+	}
+
+	vector<vector<size_t> >* pvecvecIndex[nCV];
+	for (iC = 0; iC < nCV; iC++) {
+		pvecvecIndex[iC] = new vector<vector<size_t> > ;
+		pvecvecIndex[iC]->resize(sArgs.bootstrap_arg);
+		cerr << "numer of vectors is " << pvecvecIndex[iC]->size() << endl;
+	}
+
+	//use for bootstrap
+	if (sArgs.bootstrap_arg > 1) {
+		for (iC = 0; iC < nCV; iC++) {
+			nLabels = pTrainVector[iC].size();
+
+			for (iB = 0; iB < sArgs.bootstrap_arg; iB++) {
+				//	pvecvecIndex[iC][iB].reserve(nLabels);
+				for (i = 0; i < nLabels; i++) {
+					iIndex = (size_t) (rand() / (float) RAND_MAX * nLabels);
+					(*pvecvecIndex[iC])[iB].push_back(iIndex);
+				}
+			}
+		}
+	} else {
+		for (iC = 0; iC < nCV; iC++) {
+			nLabels = pTrainVector[iC].size();
+			for (i = 0; i < nLabels; i++) {
+				(*pvecvecIndex[iC])[0].push_back(i);
+			}
+		}
+	}
+	//build all the samples since they are being reused
+
+
+
+	SVMLight::SAMPLE** pppTrainSample[nCV];
+
+	for (iC = 0; iC < nCV; iC++) {
+		cerr << iC << '\t' << pTrainVector[iC].size() << endl;
+
+		cerr << iC << '\t' << pvecvecIndex[iC]->size() << endl;
+		pppTrainSample[iC] = SVMLight::CSVMPERF::CreateSampleBootStrap(PCL,
+				pTrainVector[iC], (*pvecvecIndex[iC]));
+//		for (iB = 0; iB < sArgs.bootstrap_arg; iB++) {
+//			*pppTrainSample[iC][iB];
+//		}
+	}
+
+
+
+	//feature elimination data
+	size_t numFeat = PCL.GetExperiments() + 1;
+	bool* p_bUseFeature = new bool[numFeat + 1];
+
+	// file names
+	stringstream ss;
+	ss.setf( ios_base::fmtflags(), ios_base::floatfield );
+	ss << sArgs.output_arg;
+	ss << "_cv" << sArgs.cross_validation_arg;
+	ss << "_b" << sArgs.bootstrap_arg;
+	ss << "_l" << sArgs.error_function_arg;
+	if (sArgs.k_value_given)
+		ss << "_k" << sArgs.k_value_arg;
+	ss << "_c" << sArgs.tradeoff_arg;
+	string strBaseFile = ss.str();
+	static const size_t c_iBuffer = 1024;
+	char outFile[c_iBuffer];
+	ss << "_elim";
+	ofstream ofsmElim;
+	ofsmElim.open(ss.str().c_str());
+	vector<ofstream*> vecpOfsmIter;
+
+	size_t numIter;
+	size_t** ppFeatureInfo = new size_t*[nCV];
+	for (i = 0; i < nCV; i++)
+		ppFeatureInfo[i] = new size_t[numFeat];
+
+
+	vector<SVMLight::WORD> vecWav;
+		vector<SVMLight::WORD> vecWfe;
+		vecWav.resize(numFeat);
+		vecWfe.resize(numFeat);
+		//vectors to hold the result file
+		vector<SVMLight::Result> AllResults;
+
+	for (iC = 0; iC < nCV; iC++) {
+
+		cerr << "Cross validation round " << iC << endl;
+		size_t currNumFeat = numFeat;
+		elimSoFar = 0;
+		size_t iRound = 0;
+		size_t iOffset = 0;
+		set<size_t> sElim;
+		fill(p_bUseFeature, p_bUseFeature + numFeat, true);
+		while (currNumFeat >= sArgs.min_left_arg && iRound
+				<= sArgs.iter_max_arg) { //feature elimination loop
+			//maintenance
+			//reset the wnum values from the last sort
+			if (iC == 0) {
+				sprintf(outFile, "%s_round%d", strBaseFile.c_str(), iRound);
+				cerr << outFile << endl;
+				vecpOfsmIter.resize(iRound + 1);
+				vecpOfsmIter[iRound] = new ofstream(outFile);
+
+			}
+			cerr << "Elimination round " << iRound << endl;
+			for (i = 0; i < numFeat; i++)
+				vecWfe[i].wnum = (int32_t) i;
+			AllResults.resize(0); //clear results
+			ZeroWordVec(vecWfe);
+			ZeroWordVec(vecWav); //clear W
+
+			//do the learning and collecting
+
+			for (iB = 0; iB < sArgs.bootstrap_arg; iB++) {
+				cerr << "Bootstrap round " << iB << endl;
+				SVM.Learn(*pppTrainSample[iC][iB]);
+				if (sArgs.min_flag && iB) {
+					CombineWithWordVecMin(vecWfe, SVM.structmodel.w);
+				}
+				else if (sArgs.max_flag &&iB){
+					CombineWithWordVecMax (vecWfe, SVM.structmodel.w);
+				}
+				else {
+					AddToWordVec(vecWfe, SVM.structmodel.w);
+				}
+				AddToWordVec(vecWav, SVM.structmodel.w);
+				if (sArgs.verbosity_arg > 2) {
+					cerr << "W:";
+					SVM.WriteWeights(cerr);
+				}
+			}
+
+			SVM.ReplaceModel(vecWav);
+			AllResults = SVM.Classify(PCL, pTestVector[iC]);
+			cerr << "Classified " << AllResults.size() << endl;
+			for (j = 0; j < AllResults.size(); j++)
+				AllResults[j].CVround = iC;
+			/*AllResults.insert(AllResults.end(), tmpAllResults.begin(),
+					tmpAllResults.end());*/
+			PrintResults(AllResults, (*vecpOfsmIter[iRound]));
+
+			//			if (iRound > 0 || i > 0) //free the model if it exists
+			//			SVM.FreeModel();
+
+			if (sArgs.verbosity_arg > 1) {
+				cerr << "SUM:";
+				for (i = 0; i < vecWfe.size(); i++)
+					cerr << ' ' << vecWfe[i].weight;
+				cerr << endl;
+			}
+			//do the sorting
+			sort(vecWfe.begin(), vecWfe.end(), SortWords);
+			iRound++;
+			//eliminate (half for now)
+			if (sArgs.verbosity_arg > 4) {
+				cerr << "Before:";
+				for (i = 0; i < numFeat; i++)
+					cerr << (int) p_bUseFeature[i] << ' ';
+				cerr << endl;
+			}
+			i = 0;
+			while (!vecWfe[i].weight) {
+				i++;
+			}
+			//i--;
+			iOffset = i;
+			cerr << "Offset by number of features " << iOffset << endl;
+			cerr << "Number of Features " << currNumFeat << endl;
+			toElim = currNumFeat * sArgs.elim_fraction_arg;
+			cerr << "will eliminate " << toElim << " Features" << endl;
+
+			for (i = iOffset; i < toElim + iOffset; i++) {
+				elimSoFar++;
+				if (p_bUseFeature[(size_t) vecWfe[i].wnum]) {
+					if (sArgs.verbosity_arg > 1)
+						cerr << "Elimintating: " << vecWfe[i].wnum
+								<< " with weight " << vecWfe[i].weight << endl;
+					p_bUseFeature[(size_t) vecWfe[i].wnum] = false;
+					if (i)
+						ofsmElim << iC << '\t' << vecWfe[i].wnum << '\t'
+								<< PCL.GetExperiment(vecWfe[i].wnum - 1)
+								<< '\t' << iRound << endl;
+				}
+			}
+			cerr << "So far eliminated " << elimSoFar << " features" << endl;
+			if (sArgs.verbosity_arg > 4) {
+				cerr << "After:";
+				for (i = 0; i < numFeat; i++)
+					cerr << (int) p_bUseFeature[i] << ' ';
+				cerr << endl;
+			}
+			currNumFeat = numFeat - elimSoFar;
+			//= (size_t) (currNumFeat * (1 - sArgs.elim_fraction_arg));
+			for (iB = 0; iB < sArgs.bootstrap_arg; iB++) {
+				EliminateSample(*pppTrainSample[iC][iB], p_bUseFeature);
+			}
+			//EliminateSample(*ppTestSample[i], p_bUseFeature);
+		}
+		iRound++;
+		for (i = 1; i < numFeat; i++) {
+			if (p_bUseFeature[i])
+				ofsmElim << iC << '\t' << i << '\t' << PCL.GetExperiment(i - 1)
+						<< '\t' << iRound << endl;
+		}
+		for (i = 1; i < numFeat; i++) {
+			if (p_bUseFeature[i])
+				ofsmElim << iC << '\t' << i << '\t' << PCL.GetExperiment(i - 1)
+						<< '\t' << "final" << endl;
+		}
+
+	}
+
+	return 0;
+}
+

tools/SVMfe/SVMfe.ggo

+package	"Dat2Dab"
+version	"1.0"
+purpose	"Performs recursive feature elimination with bagging"
+
+section "Main"
+option	"labels"			l	"labels_file"
+							string	typestr="filename"	yes
+option	"output"		o	"Output file "
+							string	typestr="filename"  yes
+option	"input"		i	"Input PCL file "
+							string	typestr="filename"  yes
+
+section "Options"
+
+
+
+option "skip"      s       "number of columns to skip in input pcls"   int default="0" no
+option	"normalize"		n	"Normalize PCLS to 0 mean 1 variance"
+							flag	off
+
+option	"mmap"	M	"Memory map binary input"
+							flag	off
+							
+							
+section "SVМ parameters"
+option "error_function" e   "Sets the loss function for SVM learning" int default="1" no
+option "k_value"    k   "k value used for prec_at_k and rekal_at_k in (0,1)" float default="0.5" no
+option "tradeoff"    C   "SVM tradeoff constant C" float default="0.01" no
+option	"slack"	S	"Use slack rescaling"
+							flag	off
+
+			
+section "Feature elimination"			
+option	"cross_validation"		c	"Number of cross-validation sets"			int default="5" no
+option  "bootstrap"       b       "Number of bootstraps to create per train set"  int default="5" no
+option "elim_fraction"  f   "Fraction of features to eliminate at every step" float default="0.5" no	
+option  "min"       N       "Take the miNimum weight value instead of averaging"  flag off	
+option  "max"       X       "Take the maXimun weight value instead of averaging"  flag off								
+option "min_left"	m     "Minimum number of features to leave"  int default="10"  no				
+option "iter_max"  x     "Maximum number of iterations to do" int default="1000"   no				
+option "random"   r  "Seed random generator" int default="1234" no 							
+section "Verbosity"
+option "svm_verbosity"  v     "sets the svm_struct verbosity" int default="0" no
+option "verbosity"  V     "sets the SVMfe verbosity" int default="0" no

tools/SVMfe/cmdline.c

+/*
+  File autogenerated by gengetopt version 2.22.5
+  generated with the following command:
+  /usr/bin/gengetopt -iSVMfe.ggo --default-optional -u -N -e 
+
+  The developers of gengetopt consider the fixed text that goes in all
+  gengetopt output files to be in the public domain:
+  we make no copyright claims on it.
+*/
+
+/* If we use autoconf.  */
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+#ifndef FIX_UNUSED
+#define FIX_UNUSED(X) (void) (X) /* avoid warnings for unused params */
+#endif
+
+#include <getopt.h>
+
+#include "cmdline.h"
+
+const char *gengetopt_args_info_purpose = "Performs recursive feature elimination with bagging";
+
+const char *gengetopt_args_info_usage = "Usage: Dat2Dab [OPTIONS]... [FILES]...";
+
+const char *gengetopt_args_info_description = "";
+
+const char *gengetopt_args_info_help[] = {
+  "  -h, --help                  Print help and exit",
+  "      --version               Print version and exit",
+  "\nMain:",
+  "  -l, --labels=filename       labels_file",
+  "  -o, --output=filename       Output file ",
+  "  -i, --input=filename        Input PCL file ",
+  "\nOptions:",
+  "  -s, --skip=INT              number of columns to skip in input pcls  \n                                (default=`0')",
+  "  -n, --normalize             Normalize PCLS to 0 mean 1 variance  \n                                (default=off)",
+  "  -M, --mmap                  Memory map binary input  (default=off)",
+  "\nSVМ parameters:",
+  "  -e, --error_function=INT    Sets the loss function for SVM learning  \n                                (default=`1')",
+  "  -k, --k_value=FLOAT         k value used for prec_at_k and rekal_at_k in \n                                (0,1)  (default=`0.5')",
+  "  -C, --tradeoff=FLOAT        SVM tradeoff constant C  (default=`0.01')",
+  "  -S, --slack                 Use slack rescaling  (default=off)",
+  "\nFeature elimination:",
+  "  -c, --cross_validation=INT  Number of cross-validation sets  (default=`5')",
+  "  -b, --bootstrap=INT         Number of bootstraps to create per train set  \n                                (default=`5')",
+  "  -f, --elim_fraction=FLOAT   Fraction of features to eliminate at every step  \n                                (default=`0.5')",
+  "  -N, --min                   Take the miNimum weight value instead of \n                                averaging  (default=off)",
+  "  -X, --max                   Take the maXimun weight value instead of \n                                averaging  (default=off)",
+  "  -m, --min_left=INT          Minimum number of features to leave  \n                                (default=`10')",
+  "  -x, --iter_max=INT          Maximum number of iterations to do  \n                                (default=`1000')",
+  "  -r, --random=INT            Seed random generator  (default=`1234')",
+  "\nVerbosity:",
+  "  -v, --svm_verbosity=INT     sets the svm_struct verbosity  (default=`0')",
+  "  -V, --verbosity=INT         sets the SVMfe verbosity  (default=`0')",
+    0
+};
+
+typedef enum {ARG_NO
+  , ARG_FLAG
+  , ARG_STRING
+  , ARG_INT
+  , ARG_FLOAT
+} cmdline_parser_arg_type;
+
+static
+void clear_given (struct gengetopt_args_info *args_info);
+static
+void clear_args (struct gengetopt_args_info *args_info);
+
+static int
+cmdline_parser_internal (int argc, char **argv, struct gengetopt_args_info *args_info,
+                        struct cmdline_parser_params *params, const char *additional_error);
+
+static int
+cmdline_parser_required2 (struct gengetopt_args_info *args_info, const char *prog_name, const char *additional_error);
+
+static char *
+gengetopt_strdup (const char *s);
+
+static
+void clear_given (struct gengetopt_args_info *args_info)
+{
+  args_info->help_given = 0 ;
+  args_info->version_given = 0 ;
+  args_info->labels_given = 0 ;
+  args_info->output_given = 0 ;
+  args_info->input_given = 0 ;
+  args_info->skip_given = 0 ;
+  args_info->normalize_given = 0 ;
+  args_info->mmap_given = 0 ;
+  args_info->error_function_given = 0 ;
+  args_info->k_value_given = 0 ;
+  args_info->tradeoff_given = 0 ;
+  args_info->slack_given = 0 ;
+  args_info->cross_validation_given = 0 ;
+  args_info->bootstrap_given = 0 ;
+  args_info->elim_fraction_given = 0 ;
+  args_info->min_given = 0 ;
+  args_info->max_given = 0 ;
+  args_info->min_left_given = 0 ;
+  args_info->iter_max_given = 0 ;
+  args_info->random_given = 0 ;
+  args_info->svm_verbosity_given = 0 ;
+  args_info->verbosity_given = 0 ;
+}
+
+static
+void clear_args (struct gengetopt_args_info *args_info)
+{
+  FIX_UNUSED (args_info);
+  args_info->labels_arg = NULL;
+  args_info->labels_orig = NULL;
+  args_info->output_arg = NULL;
+  args_info->output_orig = NULL;
+  args_info->input_arg = NULL;
+  args_info->input_orig = NULL;
+  args_info->skip_arg = 0;
+  args_info->skip_orig = NULL;
+  args_info->normalize_flag = 0;
+  args_info->mmap_flag = 0;
+  args_info->error_function_arg = 1;
+  args_info->error_function_orig = NULL;
+  args_info->k_value_arg = 0.5;
+  args_info->k_value_orig = NULL;
+  args_info->tradeoff_arg = 0.01;
+  args_info->tradeoff_orig = NULL;
+  args_info->slack_flag = 0;
+  args_info->cross_validation_arg = 5;
+  args_info->cross_validation_orig = NULL;
+  args_info->bootstrap_arg = 5;
+  args_info->bootstrap_orig = NULL;
+  args_info->elim_fraction_arg = 0.5;
+  args_info->elim_fraction_orig = NULL;
+  args_info->min_flag = 0;
+  args_info->max_flag = 0;
+  args_info->min_left_arg = 10;
+  args_info->min_left_orig = NULL;
+  args_info->iter_max_arg = 1000;
+  args_info->iter_max_orig = NULL;
+  args_info->random_arg = 1234;
+  args_info->random_orig = NULL;
+  args_info->svm_verbosity_arg = 0;
+  args_info->svm_verbosity_orig = NULL;
+  args_info->verbosity_arg = 0;
+  args_info->verbosity_orig = NULL;
+  
+}
+
+static
+void init_args_info(struct gengetopt_args_info *args_info)
+{
+
+
+  args_info->help_help = gengetopt_args_info_help[0] ;
+  args_info->version_help = gengetopt_args_info_help[1] ;
+  args_info->labels_help = gengetopt_args_info_help[3] ;
+  args_info->output_help = gengetopt_args_info_help[4] ;
+  args_info->input_help = gengetopt_args_info_help[5] ;
+  args_info->skip_help = gengetopt_args_info_help[7] ;
+  args_info->normalize_help = gengetopt_args_info_help[8] ;
+  args_info->mmap_help = gengetopt_args_info_help[9] ;
+  args_info->error_function_help = gengetopt_args_info_help[11] ;
+  args_info->k_value_help = gengetopt_args_info_help[12] ;
+  args_info->tradeoff_help = gengetopt_args_info_help[13] ;
+  args_info->slack_help = gengetopt_args_info_help[14] ;
+  args_info->cross_validation_help = gengetopt_args_info_help[16] ;
+  args_info->bootstrap_help = gengetopt_args_info_help[17] ;
+  args_info->elim_fraction_help = gengetopt_args_info_help[18] ;
+  args_info->min_help = gengetopt_args_info_help[19] ;
+  args_info->max_help = gengetopt_args_info_help[20] ;
+  args_info->min_left_help = gengetopt_args_info_help[21] ;
+  args_info->iter_max_help = gengetopt_args_info_help[22] ;
+  args_info->random_help = gengetopt_args_info_help[23] ;
+  args_info->svm_verbosity_help = gengetopt_args_info_help[25] ;
+  args_info->verbosity_help = gengetopt_args_info_help[26] ;
+  
+}
+
+void
+cmdline_parser_print_version (void)
+{
+  printf ("%s %s\n",
+     (strlen(CMDLINE_PARSER_PACKAGE_NAME) ? CMDLINE_PARSER_PACKAGE_NAME : CMDLINE_PARSER_PACKAGE),
+     CMDLINE_PARSER_VERSION);
+}
+
+static void print_help_common(void) {
+  cmdline_parser_print_version ();
+
+  if (strlen(gengetopt_args_info_purpose) > 0)
+    printf("\n%s\n", gengetopt_args_info_purpose);
+
+  if (strlen(gengetopt_args_info_usage) > 0)
+    printf("\n%s\n", gengetopt_args_info_usage);
+
+  printf("\n");
+
+  if (strlen(gengetopt_args_info_description) > 0)
+    printf("%s\n\n", gengetopt_args_info_description);
+}
+
+void
+cmdline_parser_print_help (void)
+{
+  int i = 0;
+  print_help_common();
+  while (gengetopt_args_info_help[i])
+    printf("%s\n", gengetopt_args_info_help[i++]);
+}
+
+void
+cmdline_parser_init (struct gengetopt_args_info *args_info)
+{
+  clear_given (args_info);
+  clear_args (args_info);
+  init_args_info (args_info);
+
+  args_info->inputs = 0;
+  args_info->inputs_num = 0;
+}
+
+void
+cmdline_parser_params_init(struct cmdline_parser_params *params)
+{
+  if (params)
+    { 
+      params->override = 0;
+      params->initialize = 1;
+      params->check_required = 1;
+      params->check_ambiguity = 0;
+      params->print_errors = 1;
+    }
+}
+
+struct cmdline_parser_params *
+cmdline_parser_params_create(void)
+{
+  struct cmdline_parser_params *params = 
+    (struct cmdline_parser_params *)malloc(sizeof(struct cmdline_parser_params));
+  cmdline_parser_params_init(params);  
+  return params;
+}
+
+static void
+free_string_field (char **s)
+{
+  if (*s)
+    {
+      free (*s);
+      *s = 0;
+    }
+}
+
+
+static void
+cmdline_parser_release (struct gengetopt_args_info *args_info)
+{
+  unsigned int i;
+  free_string_field (&(args_info->labels_arg));
+  free_string_field (&(args_info->labels_orig));
+  free_string_field (&(args_info->output_arg));
+  free_string_field (&(args_info->output_orig));
+  free_string_field (&(args_info->input_arg));
+  free_string_field (&(args_info->input_orig));
+  free_string_field (&(args_info->skip_orig));
+  free_string_field (&(args_info->error_function_orig));
+  free_string_field (&(args_info->k_value_orig));
+  free_string_field (&(args_info->tradeoff_orig));
+  free_string_field (&(args_info->cross_validation_orig));
+  free_string_field (&(args_info->bootstrap_orig));
+  free_string_field (&(args_info->elim_fraction_orig));
+  free_string_field (&(args_info->min_left_orig));
+  free_string_field (&(args_info->iter_max_orig));
+  free_string_field (&(args_info->random_orig));
+  free_string_field (&(args_info->svm_verbosity_orig));
+  free_string_field (&(args_info->verbosity_orig));
+  
+  
+  for (i = 0; i < args_info->inputs_num; ++i)
+    free (args_info->inputs [i]);
+
+  if (args_info->inputs_num)
+    free (args_info->inputs);
+
+  clear_given (args_info);
+}
+
+
+static void
+write_into_file(FILE *outfile, const char *opt, const char *arg, const char *values[])
+{
+  FIX_UNUSED (values);
+  if (arg) {
+    fprintf(outfile, "%s=\"%s\"\n", opt, arg);
+  } else {
+    fprintf(outfile, "%s\n", opt);
+  }
+}
+
+
+int
+cmdline_parser_dump(FILE *outfile, struct gengetopt_args_info *args_info)
+{
+  int i = 0;
+
+  if (!outfile)
+    {
+      fprintf (stderr, "%s: cannot dump options to stream\n", CMDLINE_PARSER_PACKAGE);
+      return EXIT_FAILURE;
+    }
+
+  if (args_info->help_given)
+    write_into_file(outfile, "help", 0, 0 );
+  if (args_info->version_given)
+    write_into_file(outfile, "version", 0, 0 );
+  if (args_info->labels_given)
+    write_into_file(outfile, "labels", args_info->labels_orig, 0);
+  if (args_info->output_given)
+    write_into_file(outfile, "output", args_info->output_orig, 0);
+  if (args_info->input_given)
+    write_into_file(outfile, "input", args_info->input_orig, 0);
+  if (args_info->skip_given)
+    write_into_file(outfile, "skip", args_info->skip_orig, 0);
+  if (args_info->normalize_given)
+    write_into_file(outfile, "normalize", 0, 0 );
+  if (args_info->mmap_given)
+    write_into_file(outfile, "mmap", 0, 0 );
+  if (args_info->error_function_given)
+    write_into_file(outfile, "error_function", args_info->error_function_orig, 0);
+  if (args_info->k_value_given)
+    write_into_file(outfile, "k_value", args_info->k_value_orig, 0);
+  if (args_info->tradeoff_given)
+    write_into_file(outfile, "tradeoff", args_info->tradeoff_orig, 0);
+  if (args_info->slack_given)
+    write_into_file(outfile, "slack", 0, 0 );
+  if (args_info->cross_validation_given)
+    write_into_file(outfile, "cross_validation", args_info->cross_validation_orig, 0);
+  if (args_info->bootstrap_given)
+    write_into_file(outfile, "bootstrap", args_info->bootstrap_orig, 0);
+  if (args_info->elim_fraction_given)
+    write_into_file(outfile, "elim_fraction", args_info->elim_fraction_orig, 0);
+  if (args_info->min_given)
+    write_into_file(outfile, "min", 0, 0 );
+  if (args_info->max_given)
+    write_into_file(outfile, "max", 0, 0 );
+  if (args_info->min_left_given)
+    write_into_file(outfile, "min_left", args_info->min_left_orig, 0);
+  if (args_info->iter_max_given)
+    write_into_file(outfile, "iter_max", args_info->iter_max_orig, 0);
+  if (args_info->random_given)
+    write_into_file(outfile, "random", args_info->random_orig, 0);
+  if (args_info->svm_verbosity_given)
+    write_into_file(outfile, "svm_verbosity", args_info->svm_verbosity_orig, 0);
+  if (args_info->verbosity_given)
+    write_into_file(outfile, "verbosity", args_info->verbosity_orig, 0);
+  
+
+  i = EXIT_SUCCESS;
+  return i;
+}
+
+int
+cmdline_parser_file_save(const char *filename, struct gengetopt_args_info *args_info)
+{
+  FILE *outfile;
+  int i = 0;
+
+  outfile = fopen(filename, "w");
+
+  if (!outfile)
+    {
+      fprintf (stderr, "%s: cannot open file for writing: %s\n", CMDLINE_PARSER_PACKAGE, filename);
+      return EXIT_FAILURE;
+    }
+
+  i = cmdline_parser_dump(outfile, args_info);
+  fclose (outfile);
+
+  return i;
+}
+
+void
+cmdline_parser_free (struct gengetopt_args_info *args_info)
+{
+  cmdline_parser_release (args_info);
+}
+
+/** @brief replacement of strdup, which is not standard */
+char *
+gengetopt_strdup (const char *s)
+{
+  char *result = 0;
+  if (!s)
+    return result;
+
+  result = (char*)malloc(strlen(s) + 1);
+  if (result == (char*)0)
+    return (char*)0;
+  strcpy(result, s);
+  return result;
+}
+
+int
+cmdline_parser (int argc, char **argv, struct gengetopt_args_info *args_info)
+{
+  return cmdline_parser2 (argc, argv, args_info, 0, 1, 1);
+}
+
+int
+cmdline_parser_ext (int argc, char **argv, struct gengetopt_args_info *args_info,
+                   struct cmdline_parser_params *params)
+{
+  int result;
+  result = cmdline_parser_internal (argc, argv, args_info, params, 0);
+
+  return result;
+}
+
+int
+cmdline_parser2 (int argc, char **argv, struct gengetopt_args_info *args_info, int override, int initialize, int check_required)
+{
+  int result;
+  struct cmdline_parser_params params;
+  
+  params.override = override;
+  params.initialize = initialize;
+  params.check_required = check_required;
+  params.check_ambiguity = 0;
+  params.print_errors = 1;
+
+  result = cmdline_parser_internal (argc, argv, args_info, &params, 0);
+
+  return result;
+}
+
+int
+cmdline_parser_required (struct gengetopt_args_info *args_info, const char *prog_name)
+{
+  int result = EXIT_SUCCESS;
+
+  if (cmdline_parser_required2(args_info, prog_name, 0) > 0)
+    result = EXIT_FAILURE;
+
+  return result;
+}
+
+int
+cmdline_parser_required2 (struct gengetopt_args_info *args_info, const char *prog_name, const char *additional_error)
+{
+  int error = 0;
+  FIX_UNUSED (additional_error);
+
+  /* checks for required options */
+  if (! args_info->labels_given)
+    {
+      fprintf (stderr, "%s: '--labels' ('-l') option required%s\n", prog_name, (additional_error ? additional_error : ""));
+      error = 1;
+    }
+  
+  if (! args_info->output_given)
+    {
+      fprintf (stderr, "%s: '--output' ('-o') option required%s\n", prog_name, (additional_error ? additional_error : ""));
+      error = 1;
+    }
+  
+  if (! args_info->input_given)
+    {
+      fprintf (stderr, "%s: '--input' ('-i') option required%s\n", prog_name, (additional_error ? additional_error : ""));
+      error = 1;
+    }
+  
+  
+  /* checks for dependences among options */
+
+  return error;
+}
+
+
+static char *package_name = 0;
+
+/**
+ * @brief updates an option
+ * @param field the generic pointer to the field to update
+ * @param orig_field the pointer to the orig field
+ * @param field_given the pointer to the number of occurrence of this option
+ * @param prev_given the pointer to the number of occurrence already seen
+ * @param value the argument for this option (if null no arg was specified)
+ * @param possible_values the possible values for this option (if specified)
+ * @param default_value the default value (in case the option only accepts fixed values)
+ * @param arg_type the type of this option
+ * @param check_ambiguity @see cmdline_parser_params.check_ambiguity
+ * @param override @see cmdline_parser_params.override
+ * @param no_free whether to free a possible previous value
+ * @param multiple_option whether this is a multiple option
+ * @param long_opt the corresponding long option
+ * @param short_opt the corresponding short option (or '-' if none)
+ * @param additional_error possible further error specification
+ */
+static
+int update_arg(void *field, char **orig_field,
+               unsigned int *field_given, unsigned int *prev_given, 
+               char *value, const char *possible_values[],
+               const char *default_value,
+               cmdline_parser_arg_type arg_type,
+               int check_ambiguity, int override,
+               int no_free, int multiple_option,
+               const char *long_opt, char short_opt,
+               const char *additional_error)
+{
+  char *stop_char = 0;
+  const char *val = value;
+  int found;
+  char **string_field;
+  FIX_UNUSED (field);
+
+  stop_char = 0;
+  found = 0;
+
+  if (!multiple_option && prev_given && (*prev_given || (check_ambiguity && *field_given)))
+    {
+      if (short_opt != '-')
+        fprintf (stderr, "%s: `--%s' (`-%c') option given more than once%s\n", 
+               package_name, long_opt, short_opt,
+               (additional_error ? additional_error : ""));
+      else
+        fprintf (stderr, "%s: `--%s' option given more than once%s\n", 
+               package_name, long_opt,
+               (additional_error ? additional_error : ""));
+      return 1; /* failure */
+    }
+
+  FIX_UNUSED (default_value);
+    
+  if (field_given && *field_given && ! override)
+    return 0;
+  if (prev_given)
+    (*prev_given)++;
+  if (field_given)
+    (*field_given)++;
+  if (possible_values)
+    val = possible_values[found];
+
+  switch(arg_type) {
+  case ARG_FLAG:
+    *((int *)field) = !*((int *)field);
+    break;
+  case ARG_INT:
+    if (val) *((int *)field) = strtol (val, &stop_char, 0);
+    break;
+  case ARG_FLOAT:
+    if (val) *((float *)field) = (float)strtod (val, &stop_char);
+    break;
+  case ARG_STRING:
+    if (val) {
+      string_field = (char **)field;
+      if (!no_free && *string_field)
+        free (*string_field); /* free previous string */
+      *string_field = gengetopt_strdup (val);
+    }
+    break;
+  default:
+    break;
+  };
+
+  /* check numeric conversion */
+  switch(arg_type) {
+  case ARG_INT:
+  case ARG_FLOAT:
+    if (val && !(stop_char && *stop_char == '\0')) {
+      fprintf(stderr, "%s: invalid numeric value: %s\n", package_name, val);
+      return 1; /* failure */
+    }
+    break;
+  default:
+    ;
+  };
+
+  /* store the original value */
+  switch(arg_type) {
+  case ARG_NO:
+  case ARG_FLAG:
+    break;
+  default:
+    if (value && orig_field) {
+      if (no_free) {
+        *orig_field = value;
+      } else {
+        if (*orig_field)
+          free (*orig_field); /* free previous string */
+        *orig_field = gengetopt_strdup (value);
+      }
+    }
+  };
+
+  return 0; /* OK */
+}
+
+
+int
+cmdline_parser_internal (
+  int argc, char **argv, struct gengetopt_args_info *args_info,
+                        struct cmdline_parser_params *params, const char *additional_error)
+{
+  int c;	/* Character of the parsed option.  */
+
+  int error = 0;
+  struct gengetopt_args_info local_args_info;
+  
+  int override;
+  int initialize;
+  int check_required;
+  int check_ambiguity;
+  
+  package_name = argv[0];
+  
+  override = params->override;
+  initialize = params->initialize;
+  check_required = params->check_required;
+  check_ambiguity = params->check_ambiguity;
+
+  if (initialize)
+    cmdline_parser_init (args_info);
+
+  cmdline_parser_init (&local_args_info);
+
+  optarg = 0;
+  optind = 0;
+  opterr = params->print_errors;
+  optopt = '?';
+
+  while (1)
+    {
+      int option_index = 0;
+
+      static struct option long_options[] = {
+        { "help",	0, NULL, 'h' },
+        { "version",	0, NULL, 0 },
+        { "labels",	1, NULL, 'l' },
+        { "output",	1, NULL, 'o' },
+        { "input",	1, NULL, 'i' },
+        { "skip",	1, NULL, 's' },
+        { "normalize",	0, NULL, 'n' },
+        { "mmap",	0, NULL, 'M' },
+        { "error_function",	1, NULL, 'e' },
+        { "k_value",	1, NULL, 'k' },
+        { "tradeoff",	1, NULL, 'C' },
+        { "slack",	0, NULL, 'S' },
+        { "cross_validation",	1, NULL, 'c' },
+        { "bootstrap",	1, NULL, 'b' },
+        { "elim_fraction",	1, NULL, 'f' },
+        { "min",	0, NULL, 'N' },
+        { "max",	0, NULL, 'X' },
+        { "min_left",	1, NULL, 'm' },
+        { "iter_max",	1, NULL, 'x' },
+        { "random",	1, NULL, 'r' },
+        { "svm_verbosity",	1, NULL, 'v' },
+        { "verbosity",	1, NULL, 'V' },
+        { 0,  0, 0, 0 }
+      };
+
+      c = getopt_long (argc, argv, "hl:o:i:s:nMe:k:C:Sc:b:f:NXm:x:r:v:V:", long_options, &option_index);
+
+      if (c == -1) break;	/* Exit from `while (1)' loop.  */
+
+      switch (c)
+        {
+        case 'h':	/* Print help and exit.  */
+          cmdline_parser_print_help ();
+          cmdline_parser_free (&local_args_info);
+          exit (EXIT_SUCCESS);
+
+        case 'l':	/* labels_file.  */
+        
+        
+          if (update_arg( (void *)&(args_info->labels_arg), 
+               &(args_info->labels_orig), &(args_info->labels_given),
+              &(local_args_info.labels_given), optarg, 0, 0, ARG_STRING,
+              check_ambiguity, override, 0, 0,
+              "labels", 'l',
+              additional_error))
+            goto failure;
+        
+          break;
+        case 'o':	/* Output file .  */
+        
+        
+          if (update_arg( (void *)&(args_info->output_arg), 
+               &(args_info->output_orig), &(args_info->output_given),
+              &(local_args_info.output_given), optarg, 0, 0, ARG_STRING,
+              check_ambiguity, override, 0, 0,
+              "output", 'o',
+              additional_error))
+            goto failure;
+        
+          break;
+        case 'i':	/* Input PCL file .  */
+        
+        
+          if (update_arg( (void *)&(args_info->input_arg), 
+               &(args_info->input_orig), &(args_info->input_given),
+              &(local_args_info.input_given), optarg, 0, 0, ARG_STRING,
+              check_ambiguity, override, 0, 0,
+              "input", 'i',
+              additional_error))
+            goto failure;
+        
+          break;
+        case 's':	/* number of columns to skip in input pcls.  */
+        
+        
+          if (update_arg( (void *)&(args_info->skip_arg), 
+               &(args_info->skip_orig), &(args_info->skip_given),
+              &(local_args_info.skip_given), optarg, 0, "0", ARG_INT,
+              check_ambiguity, override, 0, 0,
+              "skip", 's',
+              additional_error))
+            goto failure;
+        
+          break;
+        case 'n':	/* Normalize PCLS to 0 mean 1 variance.  */
+        
+        
+          if (update_arg((void *)&(args_info->normalize_flag), 0, &(args_info->normalize_given),
+              &(local_args_info.normalize_given), optarg, 0, 0, ARG_FLAG,
+              check_ambiguity, override, 1, 0, "normalize", 'n',
+              additional_error))
+            goto failure;
+        
+          break;
+        case 'M':	/* Memory map binary input.  */
+        
+        
+          if (update_arg((void *)&(args_info->mmap_flag), 0, &(args_info->mmap_given),
+              &(local_args_info.mmap_given), optarg, 0, 0, ARG_FLAG,
+              check_ambiguity, override, 1, 0, "mmap", 'M',
+              additional_error))
+            goto failure;
+        
+          break;
+        case 'e':	/* Sets the loss function for SVM learning.  */
+        
+        
+          if (update_arg( (void *)&(args_info->error_function_arg), 
+               &(args_info->error_function_orig), &(args_info->error_function_given),
+              &(local_args_info.error_function_given), optarg, 0, "1", ARG_INT,
+              check_ambiguity, override, 0, 0,
+              "error_function", 'e',
+              additional_error))
+            goto failure;
+        
+          break;
+        case 'k':	/* k value used for prec_at_k and rekal_at_k in (0,1).  */
+        
+        
+          if (update_arg( (void *)&(args_info->k_value_arg), 
+               &(args_info->k_value_orig), &(args_info->k_value_given),
+              &(local_args_info.k_value_given), optarg, 0, "0.5", ARG_FLOAT,
+              check_ambiguity, override, 0, 0,
+              "k_value", 'k',
+              additional_error))
+            goto failure;
+        
+          break;
+        case 'C':	/* SVM tradeoff constant C.  */
+        
+        
+          if (update_arg( (void *)&(args_info->tradeoff_arg), 
+               &(args_info->tradeoff_orig), &(args_info->tradeoff_given),
+              &(local_args_info.tradeoff_given), optarg, 0, "0.01", ARG_FLOAT,
+              check_ambiguity, override, 0, 0,
+              "tradeoff", 'C',
+              additional_error))
+            goto failure;
+        
+          break;
+        case 'S':	/* Use slack rescaling.  */
+        
+        
+          if (update_arg((void *)&(args_info->slack_flag), 0, &(args_info->slack_given),
+              &(local_args_info.slack_given), optarg, 0, 0, ARG_FLAG,
+              check_ambiguity, override, 1, 0, "slack", 'S',
+              additional_error))
+            goto failure;
+        
+          break;
+        case 'c':	/* Number of cross-validation sets.  */
+        
+        
+          if (update_arg( (void *)&(args_info->cross_validation_arg), 
+               &(args_info->cross_validation_orig), &(args_info->cross_validation_given),
+              &(local_args_info.cross_validation_given), optarg, 0, "5", ARG_INT,
+              check_ambiguity, override, 0, 0,
+              "cross_validation", 'c',
+              additional_error))
+            goto failure;
+        
+          break;
+        case 'b':	/* Number of bootstraps to create per train set.  */
+        
+        
+          if (update_arg( (void *)&(args_info->bootstrap_arg), 
+               &(args_info->bootstrap_orig), &(args_info->bootstrap_given),
+              &(local_args_info.bootstrap_given), optarg, 0, "5", ARG_INT,
+              check_ambiguity, override, 0, 0,
+              "bootstrap", 'b',
+              additional_error))
+            goto failure;
+        
+          break;
+        case 'f':	/* Fraction of features to eliminate at every step.  */
+        
+        
+          if (update_arg( (void *)&(args_info->elim_fraction_arg), 
+               &(args_info->elim_fraction_orig), &(args_info->elim_fraction_given),
+              &(local_args_info.elim_fraction_given), optarg, 0, "0.5", ARG_FLOAT,
+              check_ambiguity, override, 0, 0,
+              "elim_fraction", 'f',
+              additional_error))
+            goto failure;
+        
+          break;
+        case 'N':	/* Take the miNimum weight value instead of averaging.  */
+        
+        
+          if (update_arg((void *)&(args_info->min_flag), 0, &(args_info->min_given),
+              &(local_args_info.min_given), optarg, 0, 0, ARG_FLAG,
+              check_ambiguity, override, 1, 0, "min", 'N',
+              additional_error))
+            goto failure;
+        
+          break;
+        case 'X':	/* Take the maXimun weight value instead of averaging.  */
+        
+        
+          if (update_arg((void *)&(args_info->max_flag), 0, &(args_info->max_given),
+              &(local_args_info.max_given), optarg, 0, 0, ARG_FLAG,
+              check_ambiguity, override, 1, 0, "max", 'X',
+              additional_error))
+            goto failure;
+        
+          break;
+        case 'm':	/* Minimum number of features to leave.  */
+        
+        
+          if (update_arg( (void *)&(args_info->min_left_arg), 
+               &(args_info->min_left_orig), &(args_info->min_left_given),
+              &(local_args_info.min_left_given), optarg, 0, "10", ARG_INT,
+              check_ambiguity, override, 0, 0,
+              "min_left", 'm',
+              additional_error))
+            goto failure;
+        
+          break;
+        case 'x':	/* Maximum number of iterations to do.  */
+        
+        
+          if (update_arg( (void *)&(args_info->iter_max_arg), 
+               &(args_info->iter_max_orig), &(args_info->iter_max_given),
+              &(local_args_info.iter_max_given), optarg, 0, "1000", ARG_INT,
+              check_ambiguity, override, 0, 0,
+              "iter_max", 'x',
+              additional_error))
+            goto failure;
+        
+          break;
+        case 'r':	/* Seed random generator.  */
+        
+        
+          if (update_arg( (void *)&(args_info->random_arg), 
+               &(args_info->random_orig), &(args_info->random_given),
+              &(local_args_info.random_given), optarg, 0, "1234", ARG_INT,
+              check_ambiguity, override, 0, 0,
+              "random", 'r',
+              additional_error))
+            goto failure;
+        
+          break;
+        case 'v':	/* sets the svm_struct verbosity.  */
+        
+        
+          if (update_arg( (void *)&(args_info->svm_verbosity_arg), 
+               &(args_info->svm_verbosity_orig), &(args_info->svm_verbosity_given),
+              &(local_args_info.svm_verbosity_given), optarg, 0, "0", ARG_INT,
+              check_ambiguity, override, 0, 0,
+              "svm_verbosity", 'v',
+              additional_error))
+            goto failure;
+        
+          break;
+        case 'V':	/* sets the SVMfe verbosity.  */
+        
+        
+          if (update_arg( (void *)&(args_info->verbosity_arg), 
+               &(args_info->verbosity_orig), &(args_info->verbosity_given),
+              &(local_args_info.verbosity_given), optarg, 0, "0", ARG_INT,
+              check_ambiguity, override, 0, 0,
+              "verbosity", 'V',
+              additional_error))
+            goto failure;
+        
+          break;
+
+        case 0:	/* Long option with no short option */
+          /* Print version and exit.  */
+          if (strcmp (long_options[option_index].name, "version") == 0)
+          {
+          
+          
+            if (update_arg( 0 , 
+                 0 , &(args_info->version_given),
+                &(local_args_info.version_given), optarg, 0, 0, ARG_NO,
+                check_ambiguity, override, 0, 0,
+                "version", 'V',
+                additional_error))
+              goto failure;
+            cmdline_parser_free (&local_args_info);
+            return 0;
+          
+          }
+          
+          break;
+        case '?':	/* Invalid option.  */
+          /* `getopt_long' already printed an error message.  */
+          goto failure;
+
+        default:	/* bug: option not considered.  */
+          fprintf (stderr, "%s: option unknown: %c%s\n", CMDLINE_PARSER_PACKAGE, c, (additional_error ? additional_error : ""));
+          abort ();
+        } /* switch */
+    } /* while */
+
+
+
+  if (check_required)
+    {
+      error += cmdline_parser_required2 (args_info, argv[0], additional_error);
+    }
+
+  cmdline_parser_release (&local_args_info);
+
+  if ( error )
+    return (EXIT_FAILURE);
+
+  if (optind < argc)
+    {
+      int i = 0 ;
+      int found_prog_name = 0;
+      /* whether program name, i.e., argv[0], is in the remaining args
+         (this may happen with some implementations of getopt,
+          but surely not with the one included by gengetopt) */
+
+      i = optind;
+      while (i < argc)
+        if (argv[i++] == argv[0]) {
+          found_prog_name = 1;
+          break;
+        }
+      i = 0;
+
+      args_info->inputs_num = argc - optind - found_prog_name;
+      args_info->inputs =
+        (char **)(malloc ((args_info->inputs_num)*sizeof(char *))) ;
+      while (optind < argc)
+        if (argv[optind++] != argv[0])
+          args_info->inputs[ i++ ] = gengetopt_strdup (argv[optind-1]) ;
+    }
+
+  return 0;
+
+failure:
+  
+  cmdline_parser_release (&local_args_info);
+  return (EXIT_FAILURE);
+}

tools/SVMfe/cmdline.h

+/** @file cmdline.h
+ *  @brief The header file for the command line option parser
+ *  generated by GNU Gengetopt version 2.22.5
+ *  http://www.gnu.org/software/gengetopt.
+ *  DO NOT modify this file, since it can be overwritten
+ *  @author GNU Gengetopt by Lorenzo Bettini */
+
+#ifndef CMDLINE_H
+#define CMDLINE_H
+
+/* If we use autoconf.  */
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include <stdio.h> /* for FILE */
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* __cplusplus */
+
+#ifndef CMDLINE_PARSER_PACKAGE
+/** @brief the program name (used for printing errors) */
+#define CMDLINE_PARSER_PACKAGE "Dat2Dab"
+#endif
+
+#ifndef CMDLINE_PARSER_PACKAGE_NAME
+/** @brief the complete program name (used for help and version) */
+#define CMDLINE_PARSER_PACKAGE_NAME "Dat2Dab"
+#endif
+
+#ifndef CMDLINE_PARSER_VERSION
+/** @brief the program version */
+#define CMDLINE_PARSER_VERSION "1.0"
+#endif
+
+/** @brief Where the command line options are stored */
+struct gengetopt_args_info
+{
+  const char *help_help; /**< @brief Print help and exit help description.  */
+  const char *version_help; /**< @brief Print version and exit help description.  */
+  char * labels_arg;	/**< @brief labels_file.  */
+  char * labels_orig;	/**< @brief labels_file original value given at command line.  */
+  const char *labels_help; /**< @brief labels_file help description.  */
+  char * output_arg;	/**< @brief Output file .  */
+  char * output_orig;	/**< @brief Output file  original value given at command line.  */
+  const char *output_help; /**< @brief Output file  help description.  */
+  char * input_arg;	/**< @brief Input PCL file .  */
+  char * input_orig;	/**< @brief Input PCL file  original value given at command line.  */
+  const char *input_help; /**< @brief Input PCL file  help description.  */
+  int skip_arg;	/**< @brief number of columns to skip in input pcls (default='0').  */
+  char * skip_orig;	/**< @brief number of columns to skip in input pcls original value given at command line.  */
+  const char *skip_help; /**< @brief number of columns to skip in input pcls help description.  */
+  int normalize_flag;	/**< @brief Normalize PCLS to 0 mean 1 variance (default=off).  */
+  const char *normalize_help; /**< @brief Normalize PCLS to 0 mean 1 variance help description.  */
+  int mmap_flag;	/**< @brief Memory map binary input (default=off).  */
+  const char *mmap_help; /**< @brief Memory map binary input help description.  */
+  int error_function_arg;	/**< @brief Sets the loss function for SVM learning (default='1').  */
+  char * error_function_orig;	/**< @brief Sets the loss function for SVM learning original value given at command line.  */
+  const char *error_function_help; /**< @brief Sets the loss function for SVM learning help description.  */
+  float k_value_arg;	/**< @brief k value used for prec_at_k and rekal_at_k in (0,1) (default='0.5').  */
+  char * k_value_orig;	/**< @brief k value used for prec_at_k and rekal_at_k in (0,1) original value given at command line.  */
+  const char *k_value_help; /**< @brief k value used for prec_at_k and rekal_at_k in (0,1) help description.  */
+  float tradeoff_arg;	/**< @brief SVM tradeoff constant C (default='0.01').  */
+  char * tradeoff_orig;	/**< @brief SVM tradeoff constant C original value given at command line.  */
+  const char *tradeoff_help; /**< @brief SVM tradeoff constant C help description.  */
+  int slack_flag;	/**< @brief Use slack rescaling (default=off).  */
+  const char *slack_help; /**< @brief Use slack rescaling help description.  */
+  int cross_validation_arg;	/**< @brief Number of cross-validation sets (default='5').  */
+  char * cross_validation_orig;	/**< @brief Number of cross-validation sets original value given at command line.  */
+  const char *cross_validation_help; /**< @brief Number of cross-validation sets help description.  */
+  int bootstrap_arg;	/**< @brief Number of bootstraps to create per train set (default='5').  */
+  char * bootstrap_orig;	/**< @brief Number of bootstraps to create per train set original value given at command line.  */
+  const char *bootstrap_help; /**< @brief Number of bootstraps to create per train set help description.  */
+  float elim_fraction_arg;	/**< @brief Fraction of features to eliminate at every step (default='0.5').  */
+  char * elim_fraction_orig;	/**< @brief Fraction of features to eliminate at every step original value given at command line.  */
+  const char *elim_fraction_help; /**< @brief Fraction of features to eliminate at every step help description.  */
+  int min_flag;	/**< @brief Take the miNimum weight value instead of averaging (default=off).  */
+  const char *min_help; /**< @brief Take the miNimum weight value instead of averaging help description.  */
+  int max_flag;	/**< @brief Take the maXimun weight value instead of averaging (default=off).  */
+  const char *max_help; /**< @brief Take the maXimun weight value instead of averaging help description.  */
+  int min_left_arg;	/**< @brief Minimum number of features to leave (default='10').  */
+  char * min_left_orig;	/**< @brief Minimum number of features to leave original value given at command line.  */
+  const char *min_left_help; /**< @brief Minimum number of features to leave help description.  */
+  int iter_max_arg;	/**< @brief Maximum number of iterations to do (default='1000').  */
+  char * iter_max_orig;	/**< @brief Maximum number of iterations to do original value given at command line.  */
+  const char *iter_max_help; /**< @brief Maximum number of iterations to do help description.  */
+  int random_arg;	/**< @brief Seed random generator (default='1234').  */
+  char * random_orig;	/**< @brief Seed random generator original value given at command line.  */
+  const char *random_help; /**< @brief Seed random generator help description.  */
+  int svm_verbosity_arg;	/**< @brief sets the svm_struct verbosity (default='0').  */
+  char * svm_verbosity_orig;	/**< @brief sets the svm_struct verbosity original value given at command line.  */
+  const char *svm_verbosity_help; /**< @brief sets the svm_struct verbosity help description.  */
+  int verbosity_arg;	/**< @brief sets the SVMfe verbosity (default='0').  */
+  char * verbosity_orig;	/**< @brief sets the SVMfe verbosity original value given at command line.  */
+  const char *verbosity_help; /**< @brief sets the SVMfe verbosity help description.  */
+  
+  unsigned int help_given ;	/**< @brief Whether help was given.  */
+  unsigned int version_given ;	/**< @brief Whether version was given.  */
+  unsigned int labels_given ;	/**< @brief Whether labels was given.  */
+  unsigned int output_given ;	/**< @brief Whether output was given.  */
+  unsigned int input_given ;	/**< @brief Whether input was given.  */
+  unsigned int skip_given ;	/**< @brief Whether skip was given.  */
+  unsigned int normalize_given ;	/**< @brief Whether normalize was given.  */
+  unsigned int mmap_given ;	/**< @brief Whether mmap was given.  */
+  unsigned int error_function_given ;	/**< @brief Whether error_function was given.  */
+  unsigned int k_value_given ;	/**< @brief Whether k_value was given.  */
+  unsigned int tradeoff_given ;	/**< @brief Whether tradeoff was given.  */
+  unsigned int slack_given ;	/**< @brief Whether slack was given.  */
+  unsigned int cross_validation_given ;	/**< @brief Whether cross_validation was given.  */
+  unsigned int bootstrap_given ;	/**< @brief Whether bootstrap was given.  */
+  unsigned int elim_fraction_given ;	/**< @brief Whether elim_fraction was given.  */
+  unsigned int min_given ;	/**< @brief Whether min was given.  */
+  unsigned int max_given ;	/**< @brief Whether max was given.  */
+  unsigned int min_left_given ;	/**< @brief Whether min_left was given.  */
+  unsigned int iter_max_given ;	/**< @brief Whether iter_max was given.  */
+  unsigned int random_given ;	/**< @brief Whether random was given.  */
+  unsigned int svm_verbosity_given ;	/**< @brief Whether svm_verbosity was given.  */
+  unsigned int verbosity_given ;	/**< @brief Whether verbosity was given.  */
+
+  char **inputs ; /**< @brief unamed options (options without names) */
+  unsigned inputs_num ; /**< @brief unamed options number */
+} ;
+
+/** @brief The additional parameters to pass to parser functions */
+struct cmdline_parser_params
+{
+  int override; /**< @brief whether to override possibly already present options (default 0) */
+  int initialize; /**< @brief whether to initialize the option structure gengetopt_args_info (default 1) */
+  int check_required; /**< @brief whether to check that all required options were provided (default 1) */
+  int check_ambiguity; /**< @brief whether to check for options already specified in the option structure gengetopt_args_info (default 0) */
+  int print_errors; /**< @brief whether getopt_long should print an error message for a bad option (default 1) */
+} ;
+
+/** @brief the purpose string of the program */
+extern const char *gengetopt_args_info_purpose;
+/** @brief the usage string of the program */
+extern const char *gengetopt_args_info_usage;
+/** @brief all the lines making the help output */
+extern const char *gengetopt_args_info_help[];
+
+/**
+ * The command line parser
+ * @param argc the number of command line options
+ * @param argv the command line options
+ * @param args_info the structure where option information will be stored
+ * @return 0 if everything went fine, NON 0 if an error took place
+ */
+int cmdline_parser (int argc, char **argv,
+  struct gengetopt_args_info *args_info);
+
+/**
+ * The command line parser (version with additional parameters - deprecated)
+ * @param argc the number of command line options
+ * @param argv the command line options
+ * @param args_info the structure where option information will be stored
+ * @param override whether to override possibly already present options
+ * @param initialize whether to initialize the option structure my_args_info
+ * @param check_required whether to check that all required options were provided
+ * @return 0 if everything went fine, NON 0 if an error took place
+ * @deprecated use cmdline_parser_ext() instead
+ */
+int cmdline_parser2 (int argc, char **argv,
+  struct gengetopt_args_info *args_info,
+  int override, int initialize, int check_required);
+
+/**
+ * The command line parser (version with additional parameters)
+ * @param argc the number of command line options
+ * @param argv the command line options
+ * @param args_info the structure where option information will be stored
+ * @param params additional parameters for the parser
+ * @return 0 if everything went fine, NON 0 if an error took place
+ */
+int cmdline_parser_ext (int argc, char **argv,
+  struct gengetopt_args_info *args_info,
+  struct cmdline_parser_params *params);
+
+/**
+ * Save the contents of the option struct into an already open FILE stream.
+ * @param outfile the stream where to dump options
+ * @param args_info the option struct to dump
+ * @return 0 if everything went fine, NON 0 if an error took place
+ */
+int cmdline_parser_dump(FILE *outfile,
+  struct gengetopt_args_info *args_info);
+
+/**
+ * Save the contents of the option struct into a (text) file.
+ * This file can be read by the config file parser (if generated by gengetopt)
+ * @param filename the file where to save
+ * @param args_info the option struct to save
+ * @return 0 if everything went fine, NON 0 if an error took place
+ */
+int cmdline_parser_file_save(const char *filename,
+  struct gengetopt_args_info *args_info);
+
+/**
+ * Print the help
+ */
+void cmdline_parser_print_help(void);
+/**
+ * Print the version
+ */
+void cmdline_parser_print_version(void);
+
+/**
+ * Initializes all the fields a cmdline_parser_params structure 
+ * to their default values
+ * @param params the structure to initialize
+ */
+void cmdline_parser_params_init(struct cmdline_parser_params *params);
+
+/**
+ * Allocates dynamically a cmdline_parser_params structure and initializes
+ * all its fields to their default values
+ * @return the created and initialized cmdline_parser_params structure
+ */
+struct cmdline_parser_params *cmdline_parser_params_create(void);
+
+/**
+ * Initializes the passed gengetopt_args_info structure's fields
+ * (also set default values for options that have a default)
+ * @param args_info the structure to initialize
+ */
+void cmdline_parser_init (struct gengetopt_args_info *args_info);
+/**
+ * Deallocates the string fields of the gengetopt_args_info structure
+ * (but does not deallocate the structure itself)
+ * @param args_info the structure to deallocate
+ */
+void cmdline_parser_free (struct gengetopt_args_info *args_info);
+
+/**
+ * Checks that all the required options were specified
+ * @param args_info the structure to check
+ * @param prog_name the name of the program that will be used to print
+ *   possible errors
+ * @return
+ */
+int cmdline_parser_required (struct gengetopt_args_info *args_info,
+  const char *prog_name);
+
+
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+#endif /* CMDLINE_H */

tools/SVMfe/stdafx.cpp

+//testing
+/*****************************************************************************
+* This file is provided under the Creative Commons Attribution 3.0 license.
+*
+* You are free to share, copy, distribute, transmit, or adapt this work
+* PROVIDED THAT you attribute the work to the authors listed below.
+* For more information, please see the following web page:
+* http://creativecommons.org/licenses/by/3.0/
+*
+* This file is a component of the Sleipnir library for functional genomics,
+* authored by:
+* Curtis Huttenhower (chuttenh@princeton.edu)
+* Mark Schroeder
+* Maria D. Chikina
+* Olga G. Troyanskaya (ogt@princeton.edu, primary contact)
+*
+* If you use this library, the included executable tools, or any related
+* code in your work, please cite the following publication:
+* Curtis Huttenhower, Mark Schroeder, Maria D. Chikina, and
+* Olga G. Troyanskaya.
+* "The Sleipnir library for computational functional genomics"
+*****************************************************************************/
+#include "stdafx.h"
+
+/*!
+ * \page Dat2Dab Dat2Dab
+ * 
+ * Dat2Dab converts tab-delimited text DAT files into binary DAB files and vice versa.  It can also convert
+ * PCL and DAS files (see Sleipnir::CDat), perform a variety of normalizations or filters during the
+ * conversion process, or lookup individual genes' or gene pairs' values from DAB files.
+ * 
+ * \section sec_usage Usage
+ * 
+ * \subsection ssec_usage_basic Basic Usage
+ * 
+ * \code
+ * Dat2Dab -i <data.dab> -o <data.dat>
+ * \endcode
+ * 
+ * Convert the input binary DAB file \c data.dab into the output tab-delimited text DAT file \c data.dat.
+ * 
+ * \code
+ * Dat2Dab -o <data.dab> -n -f -d < <data.dat>
+ * \endcode
+ * 
+ * Read a text DAT file \c data.dat from standard input, allowing duplicates, normalize all scores to the
+ * range [0,1], then invert them and save the results to the binary DAB file \c data.dab.
+ * 
+ * \code
+ * Dat2Dab -i <data.dab> -m -l <gene1> -L <gene2>
+ * \endcode
+ * 
+ * Open the binary DAB file \c data.dab using memory mapping and output the score for the gene pair \c gene1
+ * and \c gene2.
+ * 
+ * \subsection ssec_usage_detailed Detailed Usage
+ * 
+ * \include Dat2Dab/Dat2Dab.ggo
+ * 
+ * <table><tr>
+ *	<th>Flag</th>
+ *	<th>Default</th>
+ *	<th>Type</th>
+ *	<th>Description</th>
+ * </tr><tr>
+ *	<td>-i</td>
+ *	<td>stdin</td>
+ *	<td>DAT/DAB file</td>
+ *	<td>Input DAT, DAB, DAS, or PCL file.</td>
+ * </tr><tr>
+ *	<td>-o</td>
+ *	<td>stdout</td>
+ *	<td>DAT/DAB file</td>
+ *	<td>Output DAT, DAB, or DAS file.</td>
+ * </tr><tr>
+ *	<td>-f</td>
+ *	<td>off</td>
+ *	<td>Flag</td>
+ *	<td>If on, output one minus the input's values.</td>
+ * </tr><tr>
+ *	<td>-n</td>
+ *	<td>off</td>
+ *	<td>Flag</td>
+ *	<td>If on, normalize input edges to the range [0,1] before processing.</td>
+ * </tr><tr>
+ *	<td>-z</td>
+ *	<td>off</td>
+ *	<td>Flag</td>
+ *	<td>If on, normalize input edges to z-scores (subtract mean, divide by standard deviation) before
+ *		processing.</td>
+ * </tr><tr>
+ *	<td>-r</td>
+ *	<td>off</td>
+ *	<td>Flag</td>
+ *	<td>If on, transform input values to integer ranks before processing.</td>
+ * </tr><tr>
+ *	<td>-g</td>
+ *	<td>None</td>
+ *	<td>Text gene list</td>
+ *	<td>If given, use only gene pairs for which both genes are in the list.  For details, see
+ *		Sleipnir::CDat::FilterGenes.</td>
+ * </tr><tr>
+ *	<td>-c</td>
+ *	<td>None</td>
+ *	<td>Double</td>
+ *	<td>If given, remove all input edges below the given cutoff (after optional normalization).</td>
+ * </tr><tr>
+ *	<td>-e</td>
+ *	<td>off</td>
+ *	<td>Flag</td>
+ *	<td>If on, replace all missing values with zeros.</td>
+ * </tr><tr>
+ *	<td>-d</td>
+ *	<td>off</td>
+ *	<td>Flag</td>
+ *	<td>If on, allow (with a warning) duplicate pairs in text-based input.</td>
+ * </tr><tr>
+ *	<td>-G</td>
+ *	<td>off</td>
+ *	<td>Flag</td>
+ *	<td>If on, only print list of genes that would be included in the normal output file.</td>
+ * </tr><tr>
+ *	<td>-l</td>
+ *	<td>None</td>
+ *	<td>String</td>
+ *	<td>If given, lookup all values for pairs involving the requested gene.</td>
+ * </tr><tr>
+ *	<td>-L</td>
+ *	<td>None</td>
+ *	<td>String</td>
+ *	<td>If given with \c -l, lookup all values for the requested gene pair.</td>
+ * </tr><tr>
+ *	<td>-t</td>
+ *	<td>None</td>
+ *	<td>Gene text file</td>
+ *	<td>If given with \c -l, lookup all pairs between \c -l and the given gene set.  If given alone,
+ *		lookup all pairs between genes in the given set.</td>
+ * </tr><tr>
+ *	<td>-p</td>
+ *	<td>None</td>
+ *	<td>Gene pair text file</td>
+ *	<td>Tab-delimited text file containing two columns, both gene IDs.  If given, replace each gene ID
+ *		from the first column with the corresponding ID in the second column.</td>
+ * </tr><tr>
+ *	<td>-b</td>
+ *	<td>off</td>
+ *	<td>Flag</td>
+ *	<td>If given, produce output in a tab-delimited half matrix table.  Not recommended for DAT/DABs with
+ *		more than a few dozen genes!</td>
+ * </tr><tr>
+ *	<td>-s</td>
+ *	<td>2</td>
+ *	<td>Integer</td>
+ *	<td>Number of columns to skip between the initial ID column and the first experimental (data) column
+ *		in the input PCL.</td>
+ * </tr><tr>
+ *	<td>-m</td>
+ *	<td>off</td>
+ *	<td>Flag</td>
+ *	<td>If given, memory map the input files when possible.  DAT and PCL inputs cannot be memmapped.</td>
+ * </tr></table>
+ */

tools/SVMfe/stdafx.h

+/*****************************************************************************
+* This file is provided under the Creative Commons Attribution 3.0 license.
+*
+* You are free to share, copy, distribute, transmit, or adapt this work
+* PROVIDED THAT you attribute the work to the authors listed below.
+* For more information, please see the following web page:
+* http://creativecommons.org/licenses/by/3.0/
+*
+* This file is a component of the Sleipnir library for functional genomics,
+* authored by:
+* Curtis Huttenhower (chuttenh@princeton.edu)
+* Mark Schroeder
+* Maria D. Chikina
+* Olga G. Troyanskaya (ogt@princeton.edu, primary contact)
+*
+* If you use this library, the included executable tools, or any related
+* code in your work, please cite the following publication:
+* Curtis Huttenhower, Mark Schroeder, Maria D. Chikina, and
+* Olga G. Troyanskaya.
+* "The Sleipnir library for computational functional genomics"
+*****************************************************************************/
+#ifndef STDAFX_H
+#define STDAFX_H
+
+#include <time.h>
+#include <string.h>
+#include <stdint.h>
+#include <fstream>
+#include <omp.h>
+using namespace std;
+
+#include "pclset.h"
+#include "dat.h"
+#include "genome.h"
+#include "meta.h"
+#include "svmperf.h"
+using namespace Sleipnir;
+#endif // STDAFX_H