| 1 |
#ifndef __PLINK2_ADJUST_H__ |
| 2 |
#define __PLINK2_ADJUST_H__ |
| 3 |
|
| 4 |
// This file is part of PLINK 2.0, copyright (C) 2005-2025 Shaun Purcell, |
| 5 |
// Christopher Chang. |
| 6 |
// |
| 7 |
// This program is free software: you can redistribute it and/or modify it |
| 8 |
// under the terms of the GNU General Public License as published by the Free |
| 9 |
// Software Foundation, either version 3 of the License, or (at your option) |
| 10 |
// any later version. |
| 11 |
// |
| 12 |
// This program is distributed in the hope that it will be useful, but WITHOUT |
| 13 |
// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
| 14 |
// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for |
| 15 |
// more details. |
| 16 |
// |
| 17 |
// You should have received a copy of the GNU General Public License |
| 18 |
// along with this program. If not, see <http://www.gnu.org/licenses/>. |
| 19 |
|
| 20 |
|
| 21 |
#include "plink2_common.h" |
| 22 |
|
| 23 |
#ifdef __cplusplus |
| 24 |
namespace plink2 { |
| 25 |
#endif |
| 26 |
|
| 27 |
FLAGSET_DEF_START() |
| 28 |
kfAdjust0, |
| 29 |
kfAdjustGc = (1 << 0), |
| 30 |
kfAdjustLog10 = (1 << 1), |
| 31 |
kfAdjustZs = (1 << 2), |
| 32 |
kfAdjustInputLog10 = (1 << 3), |
| 33 |
|
| 34 |
kfAdjustColChrom = (1 << 4), |
| 35 |
kfAdjustColPos = (1 << 5), |
| 36 |
kfAdjustColRef = (1 << 6), |
| 37 |
kfAdjustColAlt1 = (1 << 7), |
| 38 |
kfAdjustColAlt = (1 << 8), |
| 39 |
kfAdjustColMaybeprovref = (1 << 9), |
| 40 |
kfAdjustColProvref = (1 << 10), |
| 41 |
kfAdjustColA1 = (1 << 11), |
| 42 |
kfAdjustColUnadj = (1 << 12), |
| 43 |
kfAdjustColGc = (1 << 13), |
| 44 |
kfAdjustColQq = (1 << 14), |
| 45 |
kfAdjustColBonf = (1 << 15), |
| 46 |
kfAdjustColHolm = (1 << 16), |
| 47 |
kfAdjustColSidakss = (1 << 17), |
| 48 |
kfAdjustColSidaksd = (1 << 18), |
| 49 |
kfAdjustColFdrbh = (1 << 19), |
| 50 |
kfAdjustColFdrby = (1 << 20), |
| 51 |
kfAdjustColDefault = (kfAdjustColChrom | kfAdjustColMaybeprovref | kfAdjustColA1 | kfAdjustColUnadj | kfAdjustColGc | kfAdjustColBonf | kfAdjustColHolm | kfAdjustColSidakss | kfAdjustColSidaksd | kfAdjustColFdrbh | kfAdjustColFdrby), |
| 52 |
kfAdjustColAll = ((kfAdjustColFdrby * 2) - kfAdjustColChrom) |
| 53 |
FLAGSET_DEF_END(AdjustFlags); |
| 54 |
|
| 55 |
typedef struct AdjustInfoStruct { |
| 56 |
AdjustFlags flags; |
| 57 |
double lambda; |
| 58 |
} AdjustInfo; |
| 59 |
|
| 60 |
typedef struct AdjustFileInfoStruct { |
| 61 |
NONCOPYABLE(AdjustFileInfoStruct); |
| 62 |
AdjustInfo base; |
| 63 |
char* fname; |
| 64 |
char* test_name; |
| 65 |
char* chr_field; |
| 66 |
char* pos_field; |
| 67 |
char* id_field; |
| 68 |
char* ref_field; |
| 69 |
char* alt_field; |
| 70 |
char* provref_field; |
| 71 |
char* a1_field; |
| 72 |
char* test_field; |
| 73 |
char* p_field; |
| 74 |
char* chisq_field; |
| 75 |
} AdjustFileInfo; |
| 76 |
|
| 77 |
void InitAdjust(AdjustInfo* adjust_info_ptr, AdjustFileInfo* adjust_file_info_ptr); |
| 78 |
|
| 79 |
void CleanupAdjust(AdjustFileInfo* adjust_file_info_ptr); |
| 80 |
|
| 81 |
PglErr Multcomp(const uintptr_t* variant_include, const ChrInfo* cip, const char* const* chr_ids, const uint32_t* variant_bps, const char* const* variant_ids, const uintptr_t* allele_include, const uintptr_t* allele_idx_offsets, const char* const* allele_storage, const uintptr_t* nonref_flags, const char* const* loaded_a1, const AdjustInfo* adjust_info_ptr, const double* ln_pvals, const double* chisqs, uint32_t raw_variant_ct, uintptr_t orig_allele_ct, uint32_t max_allele_slen, PgenGlobalFlags gflags, double ln_pfilter, double output_min_ln, uint32_t skip_gc, uint32_t max_thread_ct, char* outname, char* outname_end); |
| 82 |
|
| 83 |
PglErr AdjustFile(const AdjustFileInfo* afip, double ln_pfilter, double output_min_ln, uint32_t max_thread_ct, char* outname, char* outname_end); |
| 84 |
|
| 85 |
#ifdef __cplusplus |
| 86 |
} // namespace plink2 |
| 87 |
#endif |
| 88 |
|
| 89 |
#endif // __PLINK2_ADJUST_H__ |