Skip to content

Commit

Permalink
add stuff
Browse files Browse the repository at this point in the history
  • Loading branch information
Zilong-Li committed Dec 22, 2024
1 parent 16c54b7 commit c3cf171
Show file tree
Hide file tree
Showing 5 changed files with 141 additions and 143 deletions.
14 changes: 7 additions & 7 deletions src/Cmd.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,8 @@ Param::Param(int argc, char **argv) {
opts.add<Value<uint>>("v", "verbose", "verbose level.\n"
"0: no message on screen\n"
"1: print messages to screen\n"
"2: enable debug information"
"2: enable verbose information\n"
"3: enable debug information"
, verbose, &verbose);
opts.add<Value<std::string>, Attribute::headline>("","PCA","PCA algorithms:");
auto svd_opt = opts.add<Value<uint>>("d", "svd", "SVD method to be applied. default 2 is recommended for big data.\n"
Expand Down Expand Up @@ -59,7 +60,6 @@ Param::Param(int argc, char **argv) {
opts.add<Value<double>, Attribute::advanced>("", "tol-rsvd", "tolerance for RSVD algorithm", tol, &tol);
opts.add<Value<double>, Attribute::advanced>("", "tol-em", "tolerance for EMU/PCAngsd algorithm", tolem, &tolem);
opts.add<Value<double>, Attribute::advanced>("", "tol-maf", "tolerance for MAF estimation by EM", tolmaf, &tolmaf);
opts.add<Switch, Attribute::hidden>("", "printu", "output eigen vector of each epoch (for tests)", &printu);

opts.add<Value<std::string>, Attribute::headline>("","INPUT","Input options:");
auto plinkfile = opts.add<Value<std::string>>("b", "bfile", "prefix of PLINK .bed/.bim/.fam files", "", &filein);
Expand All @@ -70,15 +70,15 @@ Param::Param(int argc, char **argv) {
auto beaglefile = opts.add<Value<std::string>>("G", "beagle", "path of BEAGLE file compressed by gzip", "", &filein);
opts.add<Value<std::string>>("f", "match-bim", "the .mbim file to be matched, where the 7th column is allele frequency", "", &filebim);
auto usvprefix = opts.add<Value<std::string>>("", "USV", "prefix of PCAone .eigvecs/.eigvals/.loadings/.mbim");
opts.add<Value<std::string>, Attribute::advanced>("", "read-U", "path of file with left singular vectors (.eigvecs)", "", &fileU);
opts.add<Value<std::string>, Attribute::advanced>("", "read-V", "path of file with right singular vectors (.loadings)", "", &fileV);
opts.add<Value<std::string>, Attribute::advanced>("", "read-S", "path of file with eigen values (.eigvals)", "", &fileS);
opts.add<Value<std::string>, Attribute::hidden>("", "read-U", "path of file with left singular vectors (.eigvecs)", "", &fileU);
opts.add<Value<std::string>, Attribute::hidden>("", "read-V", "path of file with right singular vectors (.loadings)", "", &fileV);
opts.add<Value<std::string>, Attribute::hidden>("", "read-S", "path of file with eigen values (.eigvals)", "", &fileS);

opts.add<Value<std::string>, Attribute::headline>("","OUTPUT","Output options:");
opts.add<Value<std::string>>("o", "out", "prefix of output files. default [pcaone]", fileout, &fileout);
opts.add<Switch>("V", "printv", "output the right eigenvectors with suffix .loadings", &printv);
opts.add<Switch>("", "ld", "output a binary matrix for downstream LD related analysis", &ld);
opts.add<Switch>("", "print-r2", "print LD r2 to *.ld.gz file for pairwise SNPs within a window", &print_r2);
opts.add<Switch>("D", "ld", "output a binary matrix for downstream LD related analysis", &ld);
opts.add<Switch>("R", "print-r2", "print LD r2 to *.ld.gz file for pairwise SNPs within a window", &print_r2);

opts.add<Value<std::string>, Attribute::headline>("","MISC","Misc options:");
opts.add<Value<double>>("", "maf", "exclude variants with MAF lower than this value", maf, &maf);
Expand Down
1 change: 0 additions & 1 deletion src/Cmd.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,6 @@ class Param {
bool groff = false;
bool cpmed = false;
bool printv = false;
bool printu = false;
bool impute = false;
bool noshuffle = false;
bool emu = false;
Expand Down
12 changes: 6 additions & 6 deletions src/FilePlink.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -77,14 +77,14 @@ void FileBed::read_all() {
for (k = 0; k < 4; ++k, ++j) {
if (j < nsamples) {
G(j, i) = BED2GENO[buf & 3];
if (G(j, i) != BED_MISSING_VALUE) {
// 0 indicate G(i,j) don't need to be predicted.
if (params.impute) C[i * nsamples + j] = 0;
} else {
buf >>= 2;
if (params.impute) {
// 1 indicate G(i,j) need to be predicted and updated.
if (params.impute) C[i * nsamples + j] = 1;
if (G(j, i) != BED_MISSING_VALUE)
C[i * nsamples + j] = 0;
else
C[i * nsamples + j] = 1;
}
buf >>= 2;
}
}
}
Expand Down
Loading

0 comments on commit c3cf171

Please sign in to comment.