Skip to content

Commit

Permalink
Merge branch 'master' of github.com:zhanxw/rvtests
Browse files Browse the repository at this point in the history
  • Loading branch information
zhanxw committed May 5, 2016
2 parents 7f4d2ba + a422487 commit b2b4760
Show file tree
Hide file tree
Showing 22 changed files with 1,114 additions and 700 deletions.
5 changes: 5 additions & 0 deletions ChangeLog
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
2016-05-04 Xiaowei Zhan <zhanxw@bunny.swmed.edu>

* Reduce memory consumption for logistic regression
* Clean codes

2016-04-22 Xiaowei Zhan <zhanxw@fantasia.csgstat.sph.umich.edu>

* Fix crash when analyzing large samples (>80,000)
Expand Down
6 changes: 0 additions & 6 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ $(DIR_EXEC_DBG):
mkdir -p $@

.PHONY: release debug profile lib lib-dbg clean tar doc

release: lib
$(MAKE) -C $(ROOT)/src release
$(MAKE) -C $(ROOT)/vcfUtils release
Expand All @@ -29,11 +28,6 @@ debug.vcfUtil: lib-dbg
profile: lib-dbg
$(MAKE) -C $(ROOT)/src profile
$(MAKE) -C $(ROOT)/vcfUtils profile
##################################################
GitVersion.h: .git/HEAD .git/index
-echo "const char *gitVersion = \"$(shell git rev-parse HEAD)\";" > $@
.git/HEAD .git/index:
-echo "const char *gitVersion = \"not-a-git-repo\"" > GitVersion.h

##################################################
## clean
Expand Down
6 changes: 5 additions & 1 deletion Makefile.common
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ GONCALO_LIB_DBG = $(ROOT)/libsrc/lib-dbg-goncalo.a
##################################################
## Common compiler options
CXX=g++
DEFAULT_CXXFLAGS = -D__STDC_LIMIT_MACROS -std=c++0x -Wall -Wno-unused-function $(OPENMP_FLAG)
DEFAULT_CXXFLAGS = -D__STDC_LIMIT_MACROS -std=c++0x -Wall -Wno-unused-function $(OPENMP_FLAG) -DGIT_VERSION="\"$(GIT_VERSION)\""

INCLUDE = $(THIRD_INC) $(REGRESSION_INC) $(VCF_INC) $(BASE_INC) $(GONCALO_INC)
LIB = $(REGRESSION_LIB) $(VCF_LIB) $(BASE_LIB) $(GONCALO_LIB) $(THIRD_LIB)
Expand Down Expand Up @@ -88,3 +88,7 @@ lint: *.cpp *.h
cpplint.py --filter=-legal/copyright $^


##################################################
## Git version
##################################################
GIT_VERSION := $(shell git rev-parse HEAD || echo Unknown)
30 changes: 15 additions & 15 deletions libVcf/VCFIndividual.h
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
#ifndef _VCFINDIVIDUAL_H_
#define _VCFINDIVIDUAL_H_

#include "VCFBuffer.h"
#include "VCFFunction.h"
#include "VCFValue.h"
#include "VCFBuffer.h"

#include <vector>

Expand All @@ -13,7 +13,7 @@ class VCFIndividual {
// FUNC parseFunction[4];
VCFIndividual() {
this->include(); // by default, enable everyone
};
}
/**
* 0-base index for beg and end, e.g.
* 0 1 2 3
Expand Down Expand Up @@ -50,27 +50,27 @@ class VCFIndividual {
fprintf(stderr, "Empty individual column - very strange!!\n");
fprintf(stderr, "vcfValue = %s\n", vcfValue.toStr());
}
};
}

const std::string& getName() const { return this->name; };
void setName(std::string& s) { this->name = s; };
void include() { this->inUse = true; };
void exclude() { this->inUse = false; };
bool isInUse() { return this->inUse; };
const std::string& getName() const { return this->name; }
void setName(std::string& s) { this->name = s; }
void include() { this->inUse = true; }
void exclude() { this->inUse = false; }
bool isInUse() { return this->inUse; }

const VCFValue& operator[](const unsigned int i) const
__attribute__((deprecated)) {
if (i >= fd.size()) {
FATAL("index out of bound!");
}
return (this->fd[i]);
};
}
VCFValue& operator[](const unsigned int i) __attribute__((deprecated)) {
if (i >= fd.size()) {
FATAL("index out of bound!");
}
return (this->fd[i]);
};
}
/**
* @param isMissing: index @param i does not exists. Not testing if the value
* in ith field is missing
Expand All @@ -82,7 +82,7 @@ class VCFIndividual {
}
*isMissing = this->fd[i].isMissing();
return (this->fd[i]);
};
}
/**
* @return VCFValue without checking missingness
*/
Expand All @@ -91,10 +91,10 @@ class VCFIndividual {
return VCFIndividual::defaultVCFValue;
}
return (this->fd[i]);
};
}

VCFValue& getSelf() { return this->self; };
const VCFValue& getSelf() const { return this->self; };
VCFValue& getSelf() { return this->self; }
const VCFValue& getSelf() const { return this->self; }

size_t size() const { return this->fd.size(); }
/**
Expand All @@ -105,7 +105,7 @@ class VCFIndividual {
if (i) fputc(':', fp);
this->fd[i].output(fp);
}
};
}

private:
bool inUse;
Expand Down
18 changes: 11 additions & 7 deletions libVcf/VCFInputFile.cpp
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
#include "VCFInputFile.h"
#include "Utils.h"

#include "IO.h"
#include "Utils.h"

#include "TabixReader.h"
#include "BCFReader.h"
#include "TabixReader.h"

// use current subset of included people
// to reconstruct a new VCF header line
Expand All @@ -29,7 +30,7 @@ void VCFInputFile::setRangeMode() {
this->mode = VCFInputFile::VCF_RANGE_MODE;
}
} else if (mode == VCF_RANGE_MODE) {
// Auto-merge should be handled by VCFInputFile, not in tabixReader
// Auto-merge should be handled by VCFInputFile, not in tabixReader
// if (this->autoMergeRange) {
// this->tabixReader->enableAutoMerge();
// }
Expand Down Expand Up @@ -204,12 +205,11 @@ void VCFInputFile::setRangeList(const RangeList& rl) {
if (rl.size() == 0) return;

this->setRangeMode();

RangeList l;
l.setRange(rl);
if (this->autoMergeRange)
l.sort();

if (this->autoMergeRange) l.sort();

if (mode == VCF_RANGE_MODE) {
this->tabixReader->setRange(l);
} else if (mode == BCF_MODE) {
Expand Down Expand Up @@ -243,3 +243,7 @@ int VCFInputFile::setSiteFile(const std::string& fn) {
}
return 0;
}

void VCFInputFile::getIncludedPeopleName(std::vector<std::string>* p) {
record.getIncludedPeopleName(p);
}
7 changes: 3 additions & 4 deletions libVcf/VCFInputFile.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
#define _VCFINPUTFILE_H_

// #include "tabix.h"
#include "VCFRecord.h"
#include "VCFFilter.h"
#include "VCFRecord.h"

class TabixReader;
class BCFReader;
Expand Down Expand Up @@ -115,9 +115,7 @@ class VCFInputFile {
r.addRange(chrom, begin, end);
this->setRange(r);
}
void setRange(const RangeList& rl) {
this->setRangeList(rl);
}
void setRange(const RangeList& rl) { this->setRangeList(rl); }
void setRangeList(const std::string& l) {
if (l.empty()) return;

Expand All @@ -140,6 +138,7 @@ class VCFInputFile {
VCFRecord& getVCFRecord() { return this->record; };
const char* getLine() const { return this->line.c_str(); };
const char* getFileName() const { return this->fileName.c_str(); };
void getIncludedPeopleName(std::vector<std::string>* p);

private:
void setRangeMode();
Expand Down
Loading

0 comments on commit b2b4760

Please sign in to comment.