Skip to main content

sherlock-tools

Python library behind the nf-core/sherlock pipeline, which looks for shared genetic signals between two traits and narrows them down to tissue, cell type, gene and SNP.

The pipeline's bin/ scripts import it, but it also works on its own in Python.

What it does

QualityControl cleans and harmonises one set of GWAS summary statistics (built on polars):

  • fixes data types, strips chr, keeps autosomes (1-22)
  • removes missing values, indels, palindromic, duplicated and multi-allelic SNPs
  • MAF and (optional) INFO filters
  • liftover between GRCh37 and GRCh38 (UCSC chain file)
  • optional removal of the MHC and APOE regions
  • aligns betas to the risk allele
  • writes one sample size column N (effective N for case/control traits)

Output columns follow LDSC naming: SNP CHR BP A1 A2 BETA SE P N [FRQ] [INFO], with A1 as the effect allele.

Install

pip install sherlock-tools

Requires Python >= 3.12.

Example

import polars as pl
from sherlock_tools.preprocessing import QualityControl

sumstats = pl.read_csv("AD.tsv", separator="\t")

qc = QualityControl(
    sumstats=sumstats,
    snp_col="SNP", chr_col="CHR", pos_col="BP",
    a1_col="A1", a2_col="A2",
    beta_col="BETA", se_col="SE", pval_col="P",
    n_col="N",
    maf_thresh=0.01,
    freq_col="FRQ",
    genome_build="GRCh37",
    target_genome_build="GRCh38",
    chain_file="hg19ToHg38.over.chain",
    trait_type="cc",
)

clean = qc.run()

Development install

pip install -e "sherlock-tools[dev]"
pytest sherlock-tools/tests

Licence

MIT

Metadata

Release files for sherlock-tools 0.1.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for sherlock-tools 0.1.2
File Size Uploaded Provenance Actions
sherlock_tools-0.1.2.tar.gz 7.7 kB Without provenance Details for sherlock_tools-0.1.2.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for sherlock-tools 0.1.2
File Interpreter ABI Platform Actions
sherlock_tools-0.1.2-py3-none-any.whl Python 3 none any Details for sherlock_tools-0.1.2-py3-none-any.whl

Total release size: 14.0 kB

Release files / sherlock_tools-0.1.2.tar.gz

Download URL sherlock_tools-0.1.2.tar.gz
Size 7.7 kB
Tags Source
SHA-256 checksum
How to use checksums
5ffe1456e6d4eb236236ea228eb9d5e11a48d0f0ebb7effa1355d602966c92ca
BLAKE2b-256 checksum
How to use checksums
6fca7dced7a4b1120145beba2ebdb00053ac4874c1a536fc0cc5c4db0337d820
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.12.3 {"installer":{"name":"uv","version":"0.12.3","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

Release files / sherlock_tools-0.1.2-py3-none-any.whl

Download URL sherlock_tools-0.1.2-py3-none-any.whl
Size 6.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
29e53a0563d904fa99f1fb1ff4547c68732ae9b3d647deff54475311b1ea7ac1
BLAKE2b-256 checksum
How to use checksums
ddd3a0b052e7d4be0d326501b81701def5e0d1016b4cec06c797c04b5b7522ca
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.12.3 {"installer":{"name":"uv","version":"0.12.3","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

Security for sherlock-tools 0.1.2

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page