1 #ifndef __PLINK2_ADJUST_H__ 2 #define __PLINK2_ADJUST_H__ 3 4 // This file is part of PLINK 2.00, copyright (C) 2005-2020 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 kfAdjustColA1 = (1 << 9), 40 kfAdjustColUnadj = (1 << 10), 41 kfAdjustColGc = (1 << 11), 42 kfAdjustColQq = (1 << 12), 43 kfAdjustColBonf = (1 << 13), 44 kfAdjustColHolm = (1 << 14), 45 kfAdjustColSidakss = (1 << 15), 46 kfAdjustColSidaksd = (1 << 16), 47 kfAdjustColFdrbh = (1 << 17), 48 kfAdjustColFdrby = (1 << 18), 49 kfAdjustColDefault = (kfAdjustColChrom | kfAdjustColA1 | kfAdjustColUnadj | kfAdjustColGc | kfAdjustColBonf | kfAdjustColHolm | kfAdjustColSidakss | kfAdjustColSidaksd | kfAdjustColFdrbh | kfAdjustColFdrby), 50 kfAdjustColAll = ((kfAdjustColFdrby * 2) - kfAdjustColChrom) 51 FLAGSET_DEF_END(AdjustFlags); 52 53 typedef struct AdjustInfoStruct { 54 AdjustFlags flags; 55 double lambda; 56 } AdjustInfo; 57 58 typedef struct AdjustFileInfoStruct { 59 NONCOPYABLE(AdjustFileInfoStruct); 60 AdjustInfo base; 61 char* fname; 62 char* test_name; 63 char* chr_field; 64 char* pos_field; 65 char* id_field; 66 char* ref_field; 67 char* alt_field; 68 char* a1_field; 69 char* test_field; 70 char* p_field; 71 char* chisq_field; 72 } AdjustFileInfo; 73 74 void InitAdjust(AdjustInfo* adjust_info_ptr, AdjustFileInfo* adjust_file_info_ptr); 75 76 void CleanupAdjust(AdjustFileInfo* adjust_file_info_ptr); 77 78 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 char* const* loaded_a1, const AdjustInfo* adjust_info_ptr, const double* ln_pvals, const double* chisqs, uintptr_t orig_allele_ct, uint32_t max_allele_slen, double ln_pfilter, double output_min_ln, uint32_t skip_gc, uint32_t max_thread_ct, char* outname, char* outname_end); 79 80 PglErr AdjustFile(const AdjustFileInfo* afip, double ln_pfilter, double output_min_ln, uint32_t max_thread_ct, char* outname, char* outname_end); 81 82 #ifdef __cplusplus 83 } // namespace plink2 84 #endif 85 86 #endif // __PLINK2_ADJUST_H__ 87