Skip to content

ldsc39 ./munge_sumstats.py has issue with *.gz file #5

Description

@YuandanZhang

The new version ./munge_sumstats.py has issue with *.gz file eg GCST90475762.h.tsv.gz,
it's works with the decompressed file: eg GCST90475762.h.tsv

LD Score Regression (LDSC)
Version 3.0.1
(C) 2014-2019 Brendan Bulik-Sullivan and Hilary Finucane
Broad Institute of MIT and Harvard / MIT Department of Mathematics
GNU General Public License v3
Call:
./munge_sumstats.py
--sumstats GCST90475762.h.tsv.gz
--out GCST90475762.h.tsv.gz
--merge-alleles eur_w_ld_chr/w_hm3.snplist
--chunksize 50000
--snp rsid
--N-col n
--a1 effect_allele
--a2 other_allele
--p p_value
--frq effect_allele_frequency
--signed-sumstats odds_ratio,1
--ignore variant_id

ERROR converting summary statistics:

Traceback (most recent call last):
File "bin/ldsc3/munge_sumstats.py", line 534, in munge_sumstats
file_cnames = read_header(args.sumstats) # note keys not cleaned
File "bin/ldsc3/munge_sumstats.py", line 125, in read_header
return [x.rstrip('\n') for x in openfunc(fh).readline().split()]
File "bin/ldsc3/munge_sumstats.py", line 125, in
return [x.rstrip('\n') for x in openfunc(fh).readline().split()]
TypeError: a bytes-like object is required, not 'str'

Conversion finished at Sun May 24 22:14:27 2026
Total time elapsed: 0.03s

LD Score Regression (LDSC)
Version 3.0.1
(C) 2014-2019 Brendan Bulik-Sullivan and Hilary Finucane
Broad Institute of MIT and Harvard / MIT Department of Mathematics
GNU General Public License v3
Call:
./munge_sumstats.py
--sumstats GCST90475762.h.tsv
--out GCST90475762.h.tsv
--merge-alleles eur_w_ld_chr/w_hm3.snplist
--chunksize 50000
--snp rsid
--N-col n
--a1 effect_allele
--a2 other_allele
--p p_value
--frq effect_allele_frequency
--signed-sumstats odds_ratio,1
--ignore variant_id

{'effect_allele': 'A1', 'other_allele': 'A2', 'odds_ratio': 'SIGNED_SUMSTAT', 'effect_allele_frequency': 'FRQ', 'p_value': 'P', 'rsid': 'SNP', 'n': 'N'}
Interpreting column names as follows:
effect_allele: Allele 1, interpreted as ref allele for signed sumstat.
other_allele: Allele 2, interpreted as non-ref allele for signed sumstat.
odds_ratio: Directional summary statistic as specified by --signed-sumstats.
effect_allele_frequency: Allele frequency
p_value: p-Value
rsid: Variant ID (e.g., rs number)
n: Sample size

Reading list of SNPs for allele merge from eur_w_ld_chr/w_hm3.snplist
Read 1217311 SNPs for allele merge.
Reading sumstats from GCST90475762.h.tsv into memory 50000 SNPs at a time.
.......................................................................................................................................................................................................................................................................................................................................................................................................... done
Read 19668723 SNPs from --sumstats file.
Removed 18462319 SNPs not in --merge-alleles.
Removed 0 SNPs with missing values.
Removed 0 SNPs with INFO <= 0.9.
Removed 24038 SNPs with MAF <= 0.01.
Removed 0 SNPs with out-of-bounds p-values.
Removed 289 variants that were not SNPs or were strand-ambiguous.
1182077 SNPs remain.
Removed 499 SNPs with duplicated rs numbers (1181578 SNPs remain).
Removed 0 SNPs with N < 275902.6666666667 (1181578 SNPs remain).
Median value of SIGNED_SUMSTATS was 1.000100010001, which seems sensible.
Removed 164 SNPs whose alleles did not match --merge-alleles (1181414 SNPs remain).
Writing summary statistics for 1217311 SNPs (1181414 with nonmissing beta) to GCST90475762.h.tsv.sumstats.gz.

Metadata:
Mean chi^2 = 2.6
Lambda GC = 2.21
Max chi^2 = 1328.987
5202 Genome-wide significant SNPs (some may have been removed by filtering).

Conversion finished at Mon May 25 11:45:11 2026
Total time elapsed: 1.0m:50.05s

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions