# Wrong summary statistic file

**URL:** <https://discuss.hail.is/t/wrong-summary-statistic-file/3652>\
**Category:** Hail Query & hailctl\
**Created:** [November 19, 2023, 9:29am UTC](https://discuss.hail.is/t/wrong-summary-statistic-file/3652 "2023-11-19T09:29:56Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![guido](https://yyz2.discourse-cdn.com/flex036/user_avatar/discuss.hail.is/guido/32/1037_2.png) [@guido](https://discuss.hail.is/u/guido)\
**Post date:** [November 19, 2023, 9:29am UTC](https://discuss.hail.is/t/wrong-summary-statistic-file/3652/1 "2023-11-19T09:29:56Z")

</div>

I get the wrong summary statistic file. The following is my code. I don’t know if there is any mistakes in my pipeline.

```python
contig = "autosomes"
pipeline = 0

if contig == 'autosomes':
    contig_expr = 'c{1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22}'
else:
    contig_expr = contig

if contig not in set(['autosomes', 'chrX', 'chrXY']):
    raise ValueError(f'Invalid contig argument "{contig}" - must be one of {{"autosomes", "chrX", "chrXY"}}.')

ht_phenotypes = hl.read_table(project_path + f'data/processed/biomarker/biomarkers_gwas.pipeline_{pipeline}.ht')
ht_covariates = hl.read_table(project_path + f"data/processed/biomarker/gwas_covariates.ht")
ht_variants = hl.import_table(project_path + f'data/raw/gene/variants.tsv', impute=True, missing="")
ht_variants = ht_variants.annotate(variant = hl.parse_variant(ht_variants.variant))

mt = hl.import_bgen(
    path=project_path+ f'data/raw/gene/bgen/ukb_{contig_expr}_b0_v3.bgen',
    sample_file=project_path+ f'data/raw/gene/sample/{contig}.sample',
    entry_fields=['dosage'],
    variants=ht_variants.variant)

mt = mt.annotate_cols(
    phenotypes=ht_phenotypes[mt.s],
    covariates=ht_covariates[mt.s])

phenotypes = list(mt['phenotypes'].keys())
print(phenotypes)

ht = hl.linear_regression_rows(
    y=[[mt['phenotypes'][y]] for y in phenotypes],
    x=mt.dosage,
    covariates=[1, *[mt['covariates'][x] for x in list(mt['covariates'].keys())]],
    pass_through=['varid', 'rsid'])

ht = ht.annotate_globals(phenotypes=phenotypes)

ht.write(project_path + f"data/processed/gwas/biomarker_gwas_results.{contig}.pipeline_{pipeline}.ht",
         overwrite=True)

```

Thanks,  
Meng

---

<div class="post-metadata">

**Author:** ![guido](https://yyz2.discourse-cdn.com/flex036/user_avatar/discuss.hail.is/guido/32/1037_2.png) [@guido](https://discuss.hail.is/u/guido)\
**Post date:** [November 19, 2023, 12:31pm UTC](https://discuss.hail.is/t/wrong-summary-statistic-file/3652/2 "2023-11-19T12:31:17Z")

</div>

I found that the P column of summary statistic have NaN value. I don’t know why this happened and how can I get rid of it.

---

<div class="post-metadata">

**Author:** ![guido](https://yyz2.discourse-cdn.com/flex036/user_avatar/discuss.hail.is/guido/32/1037_2.png) [@guido](https://discuss.hail.is/u/guido)\
**Post date:** [November 19, 2023, 2:20pm UTC](https://discuss.hail.is/t/wrong-summary-statistic-file/3652/3 "2023-11-19T14:20:41Z")

</div>

I want to know whether hail can handle cases where the phenotype has NA.
