Skip to content

Commit

Permalink
start with eaf get stuck at local optimal
Browse files Browse the repository at this point in the history
  • Loading branch information
Zilong-Li committed Jan 31, 2024
1 parent 45aba95 commit 0fcf704
Show file tree
Hide file tree
Showing 5 changed files with 2 additions and 19 deletions.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ CXX = g++

# CXXFLAGS = -std=c++17 -Wall -O3 -g -fsanitize=address
# CXXFLAGS = -std=c++17 -Wall -O3 -march=native -DNDEBUG
CXXFLAGS = -std=c++17 -Wall -O3 -mavx2 -fPIC -DNDEBUG
CXXFLAGS = -std=c++17 -Wall -O3 -mavx2
INC = -I./src -I./inst/include -I$(HTSDIR)
LDFLAGS = -L$(HTSDIR) -Wl,-rpath,$(HTSDIR)
LIBS = $(HTSDIR)/libhts.a -llzma -lbz2 -lm -lz -lpthread
Expand Down
2 changes: 1 addition & 1 deletion src/common.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ struct Options
double ftol{1e-6}; // threshold for F
double qtol{1e-6}; // threshold for Q
bool noaccel{0}, noscreen{0}, single_chunk{0}, debug{0}, collapse{0};
bool nQ{0}, nP{0}, nF{0}, nR{0}, aQ{0}, oVCF{0}, eAF{1}, eHap{1};
bool nQ{0}, nP{0}, nF{0}, nR{0}, aQ{0}, oVCF{0}, eHap{0};
std::string out, in_beagle, in_vcf, in_bin, in_impute, in_joint;
std::string samples{""}, region{""}, in_plink{""}, in_qfile{""}, in_pfile{""}, in_rfile{""};
std::string opts_in_effect{"Options in effect:\n "};
Expand Down
11 changes: 0 additions & 11 deletions src/fastphase.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -42,16 +42,6 @@ void FastPhaseK2::setFlags(double tol_p, double tol_f, double tol_q, bool debug_
NR = nR;
}

void FastPhaseK2::setStartPoint(const std::unique_ptr<BigAss> & genome)
{
for(size_t ic = 0; ic < genome->pos.size(); ic++)
{
MyArr1D af = estimate_af_by_gl(genome->gls[ic], genome->nsamples, genome->pos[ic].size()).cast<MyFloat>();
const int S = pos_chunk[ic + 1] - pos_chunk[ic];
for(int s = 0; s < S; s++) F.row(pos_chunk[ic] + s) = af(s);
}
}

void FastPhaseK2::initIteration()
{
// initial temp variables
Expand Down Expand Up @@ -216,7 +206,6 @@ int run_impute_main(Options & opts)
FastPhaseK2 faith(genome->nsamples, genome->nsnps, opts.C, opts.seed);
faith.setFlags(opts.ptol, opts.ftol, opts.qtol, opts.debug, opts.nQ, opts.nP, opts.nF, opts.nR);
faith.initRecombination(genome->pos, opts.in_rfile);
if(opts.eAF) faith.setStartPoint(genome);
double loglike, diff, prevlike{std::numeric_limits<double>::lowest()};
for(int it = 0; SIG_COND && it <= opts.nimpute; it++)
{
Expand Down
1 change: 0 additions & 1 deletion src/fastphase.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,6 @@ class FastPhaseK2

void initRecombination(const Int2D & pos, std::string rfile = "", int B = 1, double Ne = 20000);
void setFlags(double, double, double, bool, bool, bool, bool, bool);
void setStartPoint(const std::unique_ptr<BigAss> & genome);
void protectPars();
void initIteration();
void updateIteration();
Expand Down
5 changes: 0 additions & 5 deletions src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -176,10 +176,6 @@ int main(int argc, char * argv[])
.help("seed for reproducibility")
.default_value(999)
.scan<'i', int>();
cmd_impute.add_argument("--no-eaf")
.help("do not start with eaf")
.default_value(false)
.implicit_value(true);
cmd_impute.add_argument("--write-hapsum")
.help("write Hapsum instead of AE into parse.bin")
.default_value(false)
Expand Down Expand Up @@ -295,7 +291,6 @@ int main(int argc, char * argv[])
opts.seed = cmd_impute.get<int>("--seed");
opts.chunksize = cmd_impute.get<int>("--chunksize");
opts.single_chunk = cmd_impute.get<bool>("--single-chunk");
opts.eAF = !cmd_impute.get<bool>("--no-eaf");
opts.eHap = cmd_impute.get<bool>("--write-hapsum");
opts.collapse = cmd_impute.get<bool>("--collapse");
opts.tol_r = cmd_impute.get<double>("--minRecombRate");
Expand Down

0 comments on commit 0fcf704

Please sign in to comment.