Skip to content

Commit

Permalink
changed name of utils.h to libgab.h
Browse files Browse the repository at this point in the history
  • Loading branch information
grenaud committed Dec 3, 2020
1 parent 9e03716 commit 4e2e95f
Show file tree
Hide file tree
Showing 9 changed files with 49 additions and 49 deletions.
8 changes: 4 additions & 4 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,8 @@ samtools_target = $(SAMTOOLS)-$(wildcard $(SAMTOOLS))
samtools_present = $(SAMTOOLS)-$(SAMTOOLS)
samtools_absent = $(SAMTOOLS)-

all: | $(bamtools_target) $(samtools_target) utils.o testUtils targetTest PutProgramInHeaderHTS.o gzstream/gzstream.o FastQObj.o FastQParser.o libgab.a
# all: utils.o testUtils ReconsReferenceBAM.o PutProgramInHeader.o PutProgramInHeaderHTS.o gzstream/gzstream.o FastQObj.o FastQParser.o testRecons testRecons.o
all: | $(bamtools_target) $(samtools_target) libgab.o testUtils targetTest PutProgramInHeaderHTS.o gzstream/gzstream.o FastQObj.o FastQParser.o libgab.a
# all: libgab.o testUtils ReconsReferenceBAM.o PutProgramInHeader.o PutProgramInHeaderHTS.o gzstream/gzstream.o FastQObj.o FastQParser.o testRecons testRecons.o


$(bamtools_present):
Expand Down Expand Up @@ -88,8 +88,8 @@ targetTest: targetTest.o libgab.a gzstream/libgzstream.a
testRecons: testRecons.o libgab.a ${BAMTOOLSLIBOBJ} ReconsReferenceBAM.o gzstream/libgzstream.a
${CXX} $(LDFLAGS) -o $@ $^ $(LDLIBS)

libgab.a: utils.o
ar cr libgab.a utils.o
libgab.a: libgab.o
ar cr libgab.a libgab.o

test: all
./test.sh
Expand Down
2 changes: 1 addition & 1 deletion PutProgramInHeader.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
#include <api/BamWriter.h>
#include <api/BamAux.h>

#include "utils.h"
#include "libgab.h"

using namespace std;
using namespace BamTools;
Expand Down
2 changes: 1 addition & 1 deletion PutProgramInHeaderHTS.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
/* #include <stdlib.h> */


#include "utils.h"
#include "libgab.h"

using namespace std;

Expand Down
3 changes: 3 additions & 0 deletions libgab.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#include "libgab.h"


74 changes: 37 additions & 37 deletions utils.h → libgab.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#ifndef utils_h
#define utils_h
#ifndef libgab_h
#define libgab_h


#include <stdint.h>
Expand Down Expand Up @@ -120,7 +120,7 @@ inline int base2int(const char c){
return 3;
if(_c == 'T')
return 4;
cerr<<"utils.h base2int() Invalid base "<<c<<endl;
cerr<<"libgab.h base2int() Invalid base "<<c<<endl;
exit(1);
}

Expand All @@ -134,7 +134,7 @@ inline int baseResolved2int(const char c){
return 2;
if(_c == 'T')
return 3;
cerr<<"utils.h baseResolved2int() Invalid base "<<c<<endl;
cerr<<"libgab.h baseResolved2int() Invalid base "<<c<<endl;
exit(1);
}

Expand All @@ -153,7 +153,7 @@ inline int dimer2index(const char c1,const char c2){
if(_c2 == 'T')
return 2;

cerr<<"Utils.h:1 dimer2index invalid dimer "<<c1<<" "<<c2<<endl;
cerr<<"Libgab.h:1 dimer2index invalid dimer "<<c1<<" "<<c2<<endl;
exit(1);
}

Expand All @@ -167,7 +167,7 @@ inline int dimer2index(const char c1,const char c2){
if(_c2 == 'T')
return 5;

cerr<<"Utils.h:2 dimer2index invalid dimer "<<c1<<" "<<c2<<endl;
cerr<<"Libgab.h:2 dimer2index invalid dimer "<<c1<<" "<<c2<<endl;
exit(1);
}

Expand All @@ -181,7 +181,7 @@ inline int dimer2index(const char c1,const char c2){
if(_c2 == 'T')
return 8;

cerr<<"Utils.h:3 dimer2index invalid dimer "<<c1<<" "<<c2<<endl;
cerr<<"Libgab.h:3 dimer2index invalid dimer "<<c1<<" "<<c2<<endl;
exit(1);
}

Expand All @@ -196,13 +196,13 @@ inline int dimer2index(const char c1,const char c2){
if(_c2 == 'G')
return 11;

cerr<<"Utils.h:4 dimer2index invalid dimer "<<c1<<" "<<c2<<endl;
cerr<<"Libgab.h:4 dimer2index invalid dimer "<<c1<<" "<<c2<<endl;
exit(1);
}



cerr<<"Utils.h:5 dimer2index invalid dimer "<<c1<<" "<<c2<<endl;
cerr<<"Libgab.h:5 dimer2index invalid dimer "<<c1<<" "<<c2<<endl;
exit(1);
}

Expand All @@ -220,7 +220,7 @@ inline int dimer2indexInt(const int c1,const int c2){
if(c2 == 3)
return 2;

cerr<<"Utils.h:1 dimer2indexInt invalid dimer "<<c1<<" "<<c2<<endl;
cerr<<"Libgab.h:1 dimer2indexInt invalid dimer "<<c1<<" "<<c2<<endl;
exit(1);
}

Expand All @@ -234,7 +234,7 @@ inline int dimer2indexInt(const int c1,const int c2){
if(c2 == 3)
return 5;

cerr<<"Utils.h:2 dimer2indexInt invalid dimer "<<c1<<" "<<c2<<endl;
cerr<<"Libgab.h:2 dimer2indexInt invalid dimer "<<c1<<" "<<c2<<endl;
exit(1);
}

Expand All @@ -248,7 +248,7 @@ inline int dimer2indexInt(const int c1,const int c2){
if(c2 == 3)
return 8;

cerr<<"Utils.h:3 dimer2indexInt invalid dimer "<<c1<<" "<<c2<<endl;
cerr<<"Libgab.h:3 dimer2indexInt invalid dimer "<<c1<<" "<<c2<<endl;
exit(1);
}

Expand All @@ -263,13 +263,13 @@ inline int dimer2indexInt(const int c1,const int c2){
if(c2 == 2)
return 11;

cerr<<"Utils.h:4 dimer2indexInt invalid dimer "<<c1<<" "<<c2<<endl;
cerr<<"Libgab.h:4 dimer2indexInt invalid dimer "<<c1<<" "<<c2<<endl;
exit(1);
}



cerr<<"Utils.h:5 dimer2indexInt invalid dimer "<<c1<<" "<<c2<<endl;
cerr<<"Libgab.h:5 dimer2indexInt invalid dimer "<<c1<<" "<<c2<<endl;
exit(1);
}

Expand All @@ -292,7 +292,7 @@ inline int twoBases2index(const char c1,const char c2){
if(_c2 == 'T')
return 3;

cerr<<"Utils.h:1 twoBases2index invalid dimer "<<c1<<" "<<c2<<endl;
cerr<<"Libgab.h:1 twoBases2index invalid dimer "<<c1<<" "<<c2<<endl;
exit(1);
}

Expand All @@ -309,7 +309,7 @@ inline int twoBases2index(const char c1,const char c2){
if(_c2 == 'T')
return 7;

cerr<<"Utils.h:2 twoBases2index invalid dimer "<<c1<<" "<<c2<<endl;
cerr<<"Libgab.h:2 twoBases2index invalid dimer "<<c1<<" "<<c2<<endl;
exit(1);
}

Expand All @@ -326,7 +326,7 @@ inline int twoBases2index(const char c1,const char c2){
return 11;


cerr<<"Utils.h:3 twoBases2index invalid dimer "<<c1<<" "<<c2<<endl;
cerr<<"Libgab.h:3 twoBases2index invalid dimer "<<c1<<" "<<c2<<endl;
exit(1);
}

Expand All @@ -343,13 +343,13 @@ inline int twoBases2index(const char c1,const char c2){
if(_c2 == 'T')
return 15;

cerr<<"Utils.h:4 twoBases2index invalid dimer "<<c1<<" "<<c2<<endl;
cerr<<"Libgab.h:4 twoBases2index invalid dimer "<<c1<<" "<<c2<<endl;
exit(1);
}



cerr<<"Utils.h:5 twoBases2index invalid dimer "<<c1<<" "<<c2<<endl;
cerr<<"Libgab.h:5 twoBases2index invalid dimer "<<c1<<" "<<c2<<endl;
exit(1);
}

Expand Down Expand Up @@ -388,7 +388,7 @@ inline char complement(const char c){
if(c == 'N')
return 'N';

cerr<<"Utils.h: complement: Invalid base pair="<<c<<endl;
cerr<<"Libgab.h: complement: Invalid base pair="<<c<<endl;
exit(1);
}

Expand All @@ -410,7 +410,7 @@ inline int complementInt(const int c){
/* return 0; */


cerr<<"Utils.h: complementInt: Invalid base pair="<<c<<endl;
cerr<<"Libgab.h: complementInt: Invalid base pair="<<c<<endl;
exit(1);
}

Expand Down Expand Up @@ -548,13 +548,13 @@ inline vector<string> allTokensWhiteSpaces(const string & toparse){

/* inline vector<string> allTokens(const string & toparse,const string & delim){ */
/* if(delim.size() == 0){ */
/* cerr<<"Utils.h: allTokens: delim must have at least one char"<<endl; */
/* cerr<<"Libgab.h: allTokens: delim must have at least one char"<<endl; */
/* exit(1); */
/* } */
/* /\* if(delim.size() == 1) *\/ */
/* /\* return allTokens(toparse,delim[0]); *\/ */

/* cerr<<"Utils.h: allTokens: to implement"<<endl; */
/* cerr<<"Libgab.h: allTokens: to implement"<<endl; */
/* exit(1); */

/* /\* vector<string> toReturn; *\/ */
Expand Down Expand Up @@ -613,7 +613,7 @@ T destringify( const string& s ){
istringstream i(s);
T x;
if (!(i >> x)){
cerr<<"Utils.cpp: destringify() Unable to convert string=\""<<s<<"\""<<endl;
cerr<<"Libgab.cpp: destringify() Unable to convert string=\""<<s<<"\""<<endl;
exit(1);
}
return x;
Expand Down Expand Up @@ -861,7 +861,7 @@ inline int randomInt(int minV,int maxV){


if( (maxV) < (minV) ){
cerr<<"Utils.h randomInt cannot generate an int between "<<minV<<" and "<<maxV<<endl;
cerr<<"Libgab.h randomInt cannot generate an int between "<<minV<<" and "<<maxV<<endl;
exit(1);
}

Expand All @@ -884,7 +884,7 @@ inline long double randomLongDouble(long double minV,long double maxV){


if( (maxV) < (minV) ){
cerr<<"Utils.h randomInt cannot generate an int between "<<minV<<" and "<<maxV<<endl;
cerr<<"Libgab.h randomInt cannot generate an int between "<<minV<<" and "<<maxV<<endl;
exit(1);
}

Expand Down Expand Up @@ -980,7 +980,7 @@ inline int randomBPExceptIntTS(const int c){
return 1;


cerr<<"Utils.h randomBPExceptIntTS wrong input: "<<c<<endl;
cerr<<"Libgab.h randomBPExceptIntTS wrong input: "<<c<<endl;
exit(1);
}

Expand Down Expand Up @@ -1019,7 +1019,7 @@ inline int randomBPExceptIntTV(const int c){
/* } */


cerr<<"Utils.h randomBPExceptIntTV wrong input: "<<c<<endl;
cerr<<"Libgab.h randomBPExceptIntTV wrong input: "<<c<<endl;
exit(1);
}

Expand Down Expand Up @@ -1142,7 +1142,7 @@ inline int allelePair2Int(char bp1,char bp2){
}


cerr<<"Utils.h allelePair2Int invalid 2 bp: "<<bp1<<" and "<<bp2<<endl;
cerr<<"Libgab.h allelePair2Int invalid 2 bp: "<<bp1<<" and "<<bp2<<endl;
exit(1);

}
Expand Down Expand Up @@ -1184,7 +1184,7 @@ inline int isPotentialTransition(const char bp1,const char bp2){
}


cerr<<"Utils.h isPotentialTransition invalid 2 bp: "<<bp1<<" and "<<bp2<<endl;
cerr<<"Libgab.h isPotentialTransition invalid 2 bp: "<<bp1<<" and "<<bp2<<endl;
exit(1);

}
Expand Down Expand Up @@ -1226,13 +1226,13 @@ inline string getTimeString(){

inline double correlation(const vector<double>& x, const vector<double>& y){
if(x.size() == 0){
cerr<<"Utils.h correlation() ERROR: the size of x is zero"<<endl;
cerr<<"Libgab.h correlation() ERROR: the size of x is zero"<<endl;
exit(1);

}

if(x.size() != y.size()){
cerr<<"Utils.h correlation() ERROR: the size of x is not the same as the size of y"<<endl;
cerr<<"Libgab.h correlation() ERROR: the size of x is not the same as the size of y"<<endl;
exit(1);
}

Expand Down Expand Up @@ -1314,15 +1314,15 @@ inline vector<T> vectorDist(const vector<T> & toEvaluate){
m2=toEvaluate[0];
m1=toEvaluate[1];
if(m2>m1){
cerr<<"utils.h vectorDist() vector is unsorted"<<endl;
cerr<<"libgab.h vectorDist() vector is unsorted"<<endl;
exit(1);
}
toReturn.push_back( (m1-m2) );

for(unsigned int i=2;i<toEvaluate.size();i++){
m=toEvaluate[i];
if(m1>m){
cerr<<"utils.h vectorDist() vector is unsorted"<<endl;
cerr<<"libgab.h vectorDist() vector is unsorted"<<endl;
exit(1);
}

Expand Down Expand Up @@ -1374,7 +1374,7 @@ inline string getCWD(const char *arg){
if(returnRealpath == NULL){
returnRealpath=getENV(arg);
if(returnRealpath == NULL){
cerr<<"utils.h getCWD failed on "<<*arg<<endl;
cerr<<"libgab.h getCWD failed on "<<*arg<<endl;
exit(1);
}
}
Expand Down Expand Up @@ -1412,7 +1412,7 @@ inline string getFullPath(const string & st){
char * returnRealpath = realpath(stT.c_str(), actualpath);

if(returnRealpath == NULL){
cerr<<"utils.h getFullPath failed on "<<st<<endl;
cerr<<"libgab.h getFullPath failed on "<<st<<endl;
exit(1);
}

Expand Down Expand Up @@ -2169,7 +2169,7 @@ inline char dinucleotide2uipac(const char & b1_,const char & b2_){

}

cerr<<"utils.h dinucleotide2uipac() Invalid bases "<<b1_<<" "<<b2_<<endl;
cerr<<"libgab.h dinucleotide2uipac() Invalid bases "<<b1_<<" "<<b2_<<endl;
exit(1);

}
Expand Down
2 changes: 1 addition & 1 deletion targetTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
#include <fstream>
#include <memory>

#include "utils.h"
#include "libgab.h"

using namespace std;
int randIn(int n){
Expand Down
2 changes: 1 addition & 1 deletion testRecons.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
#include "api/BamAux.h"

#include "ReconsReferenceBAM.h"
#include "utils.h"
#include "libgab.h"

using namespace std;

Expand Down
2 changes: 1 addition & 1 deletion testUtils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
#include <fstream>
#include <memory>

#include "utils.h"
#include "libgab.h"

using namespace std;
int randIn(int n){
Expand Down
3 changes: 0 additions & 3 deletions utils.cpp

This file was deleted.

0 comments on commit 4e2e95f

Please sign in to comment.