| 1 |
#ifndef __PLINK2_GLM_H__ |
| 2 |
#define __PLINK2_GLM_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_adjust.h" |
| 22 |
#include "plink2_glm_shared.h" |
| 23 |
|
| 24 |
#ifdef __cplusplus |
| 25 |
namespace plink2 { |
| 26 |
#endif |
| 27 |
|
| 28 |
FLAGSET_DEF_START() |
| 29 |
kfGwasSsf0, |
| 30 |
kfGwasSsfZs = (1 << 0), |
| 31 |
kfGwasSsfDeleteOrigGlm = (1 << 1), |
| 32 |
kfGwasSsfRealRefAlleles = (1 << 2), |
| 33 |
kfGwasSsfAllowAmbiguousIndels = (1 << 3) |
| 34 |
FLAGSET_DEF_END(GwasSsfFlags); |
| 35 |
|
| 36 |
ENUM_U31_DEF_START() |
| 37 |
kGwasSsfRsidMode0 = 0, |
| 38 |
kGwasSsfRsidModeNo, |
| 39 |
kGwasSsfRsidModeInfer, |
| 40 |
kGwasSsfRsidModeYes |
| 41 |
ENUM_U31_DEF_END(GwasSsfRsidMode); |
| 42 |
|
| 43 |
typedef struct GwasSsfInfoStruct { |
| 44 |
NONCOPYABLE(GwasSsfInfoStruct); |
| 45 |
GwasSsfFlags flags; |
| 46 |
GwasSsfRsidMode rsid_mode; |
| 47 |
double a1freq_lower_limit; |
| 48 |
char* fname; |
| 49 |
char* list_fname; |
| 50 |
} GwasSsfInfo; |
| 51 |
|
| 52 |
void InitGlm(GlmInfo* glm_info_ptr); |
| 53 |
|
| 54 |
void CleanupGlm(GlmInfo* glm_info_ptr); |
| 55 |
|
| 56 |
void InitGwasSsf(GwasSsfInfo* gwas_ssf_info_ptr); |
| 57 |
|
| 58 |
void CleanupGwasSsf(GwasSsfInfo* gwas_ssf_info_ptr); |
| 59 |
|
| 60 |
HEADER_INLINE uint32_t IsGwasSsf(const GwasSsfInfo* gwas_ssf_info_ptr) { |
| 61 |
return (gwas_ssf_info_ptr->rsid_mode != kGwasSsfRsidMode0); |
| 62 |
} |
| 63 |
|
| 64 |
PglErr GwasSsfStandalone(const GwasSsfInfo* gsip, uint32_t max_thread_ct); |
| 65 |
|
| 66 |
PglErr GlmMain(const uintptr_t* orig_sample_include, const SampleIdInfo* siip, const uintptr_t* sex_nm, const uintptr_t* sex_male, const PhenoCol* pheno_cols, const char* pheno_names, const PhenoCol* covar_cols, const char* covar_names, const uintptr_t* orig_variant_include, const ChrInfo* cip, const uint32_t* variant_bps, const char* const* variant_ids, const uintptr_t* allele_idx_offsets, const AlleleCode* maj_alleles, const char* const* allele_storage, const GlmInfo* glm_info_ptr, const AdjustInfo* adjust_info_ptr, const APerm* aperm_ptr, const char* local_covar_fname, const char* local_pvar_fname, const char* local_psam_fname, const GwasSsfInfo* gsip, uint32_t raw_sample_ct, uint32_t orig_sample_ct, uint32_t pheno_ct, uintptr_t max_pheno_name_blen, uint32_t orig_covar_ct, uintptr_t max_covar_name_blen, uint32_t raw_variant_ct, uint32_t orig_variant_ct, uint32_t max_variant_id_slen, uint32_t max_allele_slen, uint32_t xchr_model, double ci_size, double vif_thresh, double ln_pfilter, double output_min_ln, uint32_t max_thread_ct, uintptr_t pgr_alloc_cacheline_ct, PgenFileInfo* pgfip, PgenReader* simple_pgrp, char* outname, char* outname_end); |
| 67 |
|
| 68 |
// void LogisticTest(); |
| 69 |
|
| 70 |
#ifdef __cplusplus |
| 71 |
} // namespace plink2 |
| 72 |
#endif |
| 73 |
|
| 74 |
#endif // __PLINK2_GLM_H__ |