Skip to content

Jianhua-Wang/smunger

Repository files navigation

smunger

pypi python

License: MIT

munger for GWAS summary statistics

Features

  • define column properties

    • required columns: CHR, BP, EA, NEA
    • optional columns: BETA, SE, P, EAF, MAF
    • Auxiliary columns: OR, OR_SE, Z
    • Data types
    • Data ranges
    • Allow missing values and default missing values
  • semi-automatically header mapping

    • read first five rows and display in terminal
    • guess header map by common column names
    • manually check if the mapping is correct
    • input the right column number if it is wrong
    • check if OR, OR_SE, Z are present if BETA, SE are absent
    • save the final column map to json for further munging
  • data munging

    • EA ≠ NEA
    • if EAF presents, MAF = min(EAF, 1-EAF)
    • convert OR/ORSE to BETA/SE, if BETA, SE are absent and OR, ORSE are present
    • remove duplicate SNPs with same chr-bp-sorted(EA,NEA), keep the one with lowest P
    • output: \t separated, bgzip compress, tabix index.
    • optional output: significant SNPs, munge report
    CHR BP rsID EA NEA EAF MAF BETA SE P OR OR_SE Z
    type int int str str str float float float float float float float float
    allow null False False True False False False False True False True True False True
    null value 0 0.999 1 0
    range [1,23] (0,inf) only contains ‘ACGT’ only contains ‘ACGT’ [0,1] [0,0.5] (-inf,inf) (0, inf) (0,1) (0, inf) (0, inf) (-inf,inf)
  • liftover

    • guess genome build
    • liftover
  • annotate

    • annotate rsID

Credits

This package was created with Cookiecutter and the waynerv/cookiecutter-pypackage project template.