Skip to main content
Glama
dna-seq
by dna-seq

Compute PRS

compute_prs
Read-onlyIdempotent

Calculate a polygenic risk score for one genome against a PGS model from a raw VCF, with options to infer genetic ancestry or embed published performance metrics on the result.

Instructions

Compute a polygenic risk score for one genome against one PGS model.

Pass the raw VCF directly; a separate normalize_vcf call is not needed. If this VCF has a fresh normalized cache, it is reused automatically; genotypes_path is the explicit Parquet fast path. For a trait panel — one genome or several — use compute_prs_by_trait(samples=[...]), then compare_genomes / build_prs_prompt / plot_trait_panel.

Reference restoration (F15/F22). reference_restoration fills a scoring variant's missing reference allele from the precomputed reference-allele universe (pulled from HuggingFace on first use) so a locus the sample is confidently hom-ref at scores as dose-0 instead of being dropped as unscorable-absent — recovering the ~50% coverage gap on genome-wide WGS scores. Default "auto" detects the input: whole-universe restoration for WGS, the matching chip scope for a genotyping array, off otherwise. Pass "off", "wgs", or a chip id (e.g. "gsa_v3") to force a scope. The result's variants_ref_resolved_panel / variants_ref_resolved_fasta counters show how many loci were recovered.

Set infer_ancestry=True to also infer and attach the sample's genetic ancestry (sample_ancestry). genotype_input_mode ("auto" / "variant_only" / "all_sites") controls how absent loci are read.

Set attach_performance=True to embed the score's best published performance (effect sizes, AUROC/C-index, evaluation ancestry) on the result in the same call. The result also carries detected_genome_build / build_mismatch from the VCF (F4).

Recommended follow-up: percentile then absolute_risk (disease traits), or build_prs_prompt(kind='score') for a reusable LLM write-up.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
pgs_idYes
vcf_pathYes
genome_buildNo
genotypes_pathNo
infer_ancestryNo
attach_performanceNo
genotype_input_modeNoauto
reference_restorationNoauto

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
scoreYesComputed polygenic risk score
pgs_idYesPGS Catalog Score ID
z_scoreNoStandardized score (score - reference_mean) / reference_std, set when a percentile was computed
ancestryNoAncestry superpopulation used for percentile (AFR, AMR, EAS, EUR, SAS)
match_rateYesFraction of scoring variants matched (0-1)
percentileNoEstimated population percentile (0-100) from theoretical distribution
performanceNoBest available performance metric from PGS Catalog
absolute_riskNoAbsolute disease risk estimate based on PRS z-score and prevalence data
reference_stdNoReference/theoretical distribution std used for the percentile and z-score
build_mismatchNoTrue when the detected VCF build differs from the genome_build used for scoring
reference_meanNoReference/theoretical distribution mean used for the percentile and z-score
trait_reportedNoReported trait for the score
variants_totalYesTotal number of variants in scoring file
sample_ancestryNoInferred genetic ancestry of the sample (super-pop + confidence, fine population, informational mixture); populated when ancestry inference is requested
theoretical_stdNoTheoretical population SD of PRS: sqrt(sum(w_i^2 * 2 * p_i * (1-p_i)))
theoretical_meanNoTheoretical population mean PRS computed from allele frequencies: sum(w_i * 2 * p_i)
variants_matchedYesNumber of scoring variants matched in VCF
variants_no_callNoScoring loci present in the genotype input but carrying a missing/no-call GT
percentile_methodNoMethod used to compute percentile: 'reference_panel', 'theoretical', or 'auroc_approx'
variants_observedNoScoring loci present in the genotype input with a genotype row
weight_mass_totalNoSum of |effect_weight| over all scoring variants (per-dosage formats use max|dosage_k_weight|)
genotype_input_modeNoHow absent genotype loci were interpreted during scoringplink_present_only
variants_maf_filledNoAbsent loci filled with population MAF dosage (2 * allelefrequency_effect) instead of being unscorable
weight_mass_matchedNoSum of |effect_weight| over matched scoring variants (per-dosage formats use max|dosage_k_weight|)
weight_mass_coverageNoC_wt: weight_mass_matched / weight_mass_total — fraction of total effect-weight mass carried by matched variants
detected_genome_buildNoGenome build inferred from the VCF header/contigs (None if undetectable or genotypes were pre-normalized)
has_allele_frequenciesNoWhether the scoring file contained allelefrequency_effect data
variants_assumed_hom_refNoAbsent loci treated as homozygous-reference under variant-only VCF semantics
variants_unscorable_absentNoAbsent loci that could not be scored because the reference allele was unknown
variants_ref_resolved_fastaNoAbsent loci whose missing reference allele was resolved from the reference FASTA faidx (subset of variants_assumed_hom_ref)
variants_ref_resolved_panelNoAbsent loci whose missing reference allele was resolved from the reference panel .pvar (subset of variants_assumed_hom_ref)
Install Server

TDQS

A4.8/5.0
Behavior5/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

Beyond the annotations (readOnly, idempotent), the description reveals behavioral details such as caching of normalized VCFs, automatic reuse of cached data, and the behavior of reference_restoration (auto, wgs, off) and genotype_input_mode. It also notes that ancestry inference and performance attachment are optional and controlled by flags.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is thorough but somewhat lengthy; it uses structured paragraphs and bold headings to organize information. While every sentence adds value, the level of detail might be slightly more than necessary, but it remains acceptable for a complex tool with many options.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness5/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

The description covers all aspects: purpose, usage, parameter semantics, and follow-up actions. It even hints at output fields like variants_ref_resolved_panel and detected_genome_build, providing a comprehensive context despite the lack of an explicit output schema.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The description provides detailed explanations for most parameters, including genotype_input_mode, reference_restoration, genotypes_path, infer_ancestry, and attach_performance. However, it does not explicitly explain the genome_build parameter, which is a minor gap given the schema has 0% description coverage.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the function: compute a polygenic risk score for one genome against one PGS model. It distinguishes from batch and trait-panel alternatives by explicitly noting 'one genome against one PGS model'.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines5/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

It provides explicit usage guidance, stating when to use compute_prs_by_trait for trait panels, and recommends follow-up operations like percentile, absolute_risk, or build_prs_prompt. It also explains the optional flags and their effects, giving a clear decision context.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Other Tools

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/dna-seq/just-prs-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server