QC of GWAS Summary Statistics
This class consists of several general quality control checks for GWAS with full summary statistics. There are several checks included:
-
Genomic control lambda (median of the distribution of Chi2 statistics divided by expected for Chi2 with df=1). Lambda should be reasonably close to 1. Ideally not bigger than 2.
-
P-Z check: the linear regression between log10 of reported p-values and log10 of p-values inferred from betas and standard errors. Intercept of the regression should be close to 0, slope close to 1.
-
Mean beta check: mean of beta. Should be close to 0.
-
The N_eff check: It estimates the ratio between effective sample size and the expected one and checks its distribution. It is possible to conduct only if the effective allele frequency is provided in the study. The median ratio is always close to 1, standard error should be close to 0.
-
Number of SNPs and number of significant SNPs.
gentropy.method.sumstat_quality_controls.SummaryStatisticsQC
¶
Summary statistics QC methods.
This module contains methods for quality control of GWAS summary statistics. The list of methods includes:
- sumstat_qc_beta_check: This is the mean beta check. The mean beta should be close to 0.
- sumstat_qc_pz_check: This is the PZ check. It runs a linear regression between reported p-values and p-values inferred from z-scores.
- sumstat_n_eff_check: This is the effective sample size check. It estimates the ratio between the effective sample size and the expected one and checks its distribution.
- gc_lambda_check: This is the genomic control lambda check.
- number_of_snps: This function calculates the number of SNPs and the number of SNPs with a p-value less than 5e-8.
Source code in src/gentropy/method/sumstat_quality_controls.py
16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 |
|
gc_lambda_check(gwas_for_qc: SummaryStatistics, limit: int = 10000000) -> DataFrame
staticmethod
¶
The genomic control lambda check for QC of GWAS summary statstics.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
gwas_for_qc |
SummaryStatistics
|
The instance of the SummaryStatistics class. |
required |
limit |
int
|
The limit for the number of variants to be used for the estimation. |
10000000
|
Returns:
Name | Type | Description |
---|---|---|
DataFrame |
DataFrame
|
PySpark DataFrame with the genomic control lambda for each study. |
Source code in src/gentropy/method/sumstat_quality_controls.py
193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 |
|
get_quality_control_metrics(gwas: SummaryStatistics, limit: int = 100000000, min_count: int = 100000, n_total: int = 100000) -> DataFrame
staticmethod
¶
The function calculates the quality control metrics for the summary statistics.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
gwas |
SummaryStatistics
|
The instance of the SummaryStatistics class. |
required |
limit |
int
|
The limit for the number of variants to be used for the estimation. |
100000000
|
min_count |
int
|
The minimum number of variants to be used for the estimation. |
100000
|
n_total |
int
|
The total sample size. |
100000
|
Returns:
Name | Type | Description |
---|---|---|
DataFrame |
DataFrame
|
PySpark DataFrame with the quality control metrics for the summary statistics. |
Source code in src/gentropy/method/sumstat_quality_controls.py
253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 |
|
number_of_snps(gwas_for_qc: SummaryStatistics, pval_threhod: float = 5e-08) -> DataFrame
staticmethod
¶
The function caluates number of SNPs and number of SNPs with p-value less than 5e-8.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
gwas_for_qc |
SummaryStatistics
|
The instance of the SummaryStatistics class. |
required |
pval_threhod |
float
|
The threshold for the p-value. |
5e-08
|
Returns:
Name | Type | Description |
---|---|---|
DataFrame |
DataFrame
|
PySpark DataFrame with the number of SNPs and number of SNPs with p-value less than threshold. |
Source code in src/gentropy/method/sumstat_quality_controls.py
226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 |
|
sumstat_n_eff_check(gwas_for_qc: SummaryStatistics, n_total: int = 100000, limit: int = 10000000, min_count: int = 100) -> DataFrame
staticmethod
¶
The effective sample size check for QC of GWAS summary statstics.
It estiamtes the ratio between effective sample size and the expected one and checks it's distribution. It is possible to conduct only if the effective allele frequency is provided in the study. The median rartio is always close to 1, but standard error could be inflated.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
gwas_for_qc |
SummaryStatistics
|
The instance of the SummaryStatistics class. |
required |
n_total |
int
|
The reported sample size of the study. The QC metrics is robust toward the sample size. |
100000
|
limit |
int
|
The limit for the number of variants to be used for the estimation. |
10000000
|
min_count |
int
|
The minimum number of variants to be used for the estimation. |
100
|
Returns:
Name | Type | Description |
---|---|---|
DataFrame |
DataFrame
|
PySpark DataFrame with the effective sample size ratio for each study. |
Source code in src/gentropy/method/sumstat_quality_controls.py
114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 |
|
sumstat_qc_beta_check(gwas_for_qc: SummaryStatistics) -> DataFrame
staticmethod
¶
The mean beta check for QC of GWAS summary statstics.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
gwas_for_qc |
SummaryStatistics
|
The instance of the SummaryStatistics class. |
required |
Returns:
Name | Type | Description |
---|---|---|
DataFrame |
DataFrame
|
PySpark DataFrame with the mean beta for each study. |
Source code in src/gentropy/method/sumstat_quality_controls.py
33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 |
|
sumstat_qc_pz_check(gwas_for_qc: SummaryStatistics, limit: int = 10000000) -> DataFrame
staticmethod
¶
The PZ check for QC of GWAS summary statstics. It runs linear regression between reported p-values and p-values infered from z-scores.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
gwas_for_qc |
SummaryStatistics
|
The instance of the SummaryStatistics class. |
required |
limit |
int
|
The limit for the number of variants to be used for the estimation. |
10000000
|
Returns:
Name | Type | Description |
---|---|---|
DataFrame |
DataFrame
|
PySpark DataFrame with the results of the linear regression for each study. |
Source code in src/gentropy/method/sumstat_quality_controls.py
68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 |
|