{% if section_only -%}
# {{ section_header }}
{% else -%}
# {{ symbol }} ({{ name }})

Entrez ID: {{ entrez_id }}
{% if genomic_coordinates %}Chromosome (GRCh38): {{ genomic_coordinates }}{% elif location %}Location: {{ location }}{% endif %}
{% if uniprot_id %}UniProt: {{ uniprot_id }}{% endif %}
{% if gene_type %}Type: {{ gene_type }}{% endif %}
Source: NCBI Gene / MyGene.info

{% if summary -%}
## Summary (NCBI Gene)

{{ summary }}
{% endif -%}
{% if clinical_diseases -%}
Diseases: {{ clinical_diseases | join(", ") }}
{% endif -%}
{% if clinical_drugs -%}
Drugs: {{ clinical_drugs | join(", ") }}
{% endif -%}
{% if aliases -%}
## Aliases (NCBI Gene / MyGene.info)

Aliases are alternate names used in literature and databases when a paper does not use the HGNC symbol.

{{ aliases | join(", ") }}
{% endif -%}
{% endif -%}
{% if pathways -%}
## Pathways

| Source | ID | Name |
|---|---|---|
{% for pathway in pathways -%}
| {{ pathway.source }} | {{ pathway.id }} | {{ pathway.name | truncate(75) }} |
{% endfor -%}
{% endif -%}
{% if ontology -%}
## Ontology (Enrichr)

Note: single-gene Enrichr p-values are exploratory and should be interpreted cautiously.

| Term | P-value | Library |
|---|---|---|
{% for lib in ontology -%}
{% for term in lib.terms -%}
| {{ term.name | truncate(45) }} | {{ term.p_value | pval }} | {{ lib.library }} |
{% endfor -%}
{% endfor -%}
{% endif -%}
{% if diseases -%}
## Diseases (Enrichr)

| Term | P-value | Library |
|---|---|---|
{% for lib in diseases -%}
{% for term in lib.terms -%}
| {{ term.name | truncate(45) }} | {{ term.p_value | pval }} | {{ lib.library }} |
{% endfor -%}
{% endfor -%}
{% endif -%}
{% if show_diagnostics_section -%}
## Diagnostics

{% if diagnostic_rows -%}
| Accession | Name | Type | Manufacturer / Lab | Source | Genes | Conditions |
|---|---|---|---|---|---|---|
{% for row in diagnostic_rows -%}
| {{ row.accession }} | {{ row.name }} | {{ row.test_type or "-" }} | {{ row.manufacturer_or_lab or "-" }} | {{ row.source_label }} | {{ row.genes_cell }} | {{ row.conditions_cell }} |
{% endfor -%}
{% elif diagnostics_note -%}
{{ diagnostics_note }}
{% else -%}
No diagnostic tests found for this gene.
{% endif -%}
{% endif -%}
{% if protein -%}
## Protein (UniProt)

- Accession: {{ protein.accession }}
- Name: {{ protein.name }}
{% if protein.alternative_names %}- Also known as: {{ protein.alternative_names | join(", ") }}
{% endif %}{% if protein.length %}- Length: {{ protein.length }} aa{% endif %}{% if protein.isoforms %}
- Isoforms ({{ protein.isoforms | length }}): {% for iso in protein.isoforms %}{{ iso.name }}{% if iso.length %} ({{ iso.length }} aa){% endif %}{% if not loop.last %}, {% endif %}{% endfor %}
{%- endif %}
{% if protein.function %}- Function: {{ protein.function }}{% endif %}
{% endif -%}
{% if go_terms -%}
## GO Terms (QuickGO)

| ID | Name | Aspect | Evidence |
|---|---|---|---|
{% for term in go_terms -%}
| {{ term.id }} | {{ term.name | truncate(42) }} | {{ term.aspect or "-" }} | {{ term.evidence or "-" }} |
{% endfor -%}
{% endif -%}
{% if interactions -%}
## Interactions (STRING)
{% for row in interactions -%}
{{ row.partner }}: {% if row.score is not none %}{{ row.score | score }}{% else %}-{% endif %}
{% endfor -%}
{% endif -%}
{% if show_funding_section -%}
## Funding (NIH Reporter)

{% if funding_rows -%}
| Project | PI | Organization | FY | Amount |
|---|---|---|---|---|
{% for row in funding_rows -%}
| {{ row.project_title }} | {{ row.pi_name }} | {{ row.organization }} | {{ row.fiscal_year }} | {{ row.award_amount }} |
{% endfor -%}

{{ funding_summary }}
{% elif funding_note -%}
{{ funding_note }}
{% else -%}
No NIH funding data found for this query.
{% endif -%}
{% endif -%}
{% if show_civic_section -%}
## CIViC

{% if civic -%}
- Evidence Items: {{ civic.evidence_total_count }}
- Assertions: {{ civic.assertion_total_count }}
{% if civic.assertions -%}
| Assertion | AMP Level | Disease | Therapies |
|---|---|---|---|
{% for row in civic.assertions -%}
| {{ row.name }} | {{ row.amp_level or "-" }} | {{ row.disease or "-" }} | {% if row.therapies %}{{ row.therapies | join(", ") }}{% else %}-{% endif %} |
{% endfor -%}
{% elif civic.evidence_items -%}
| Evidence | Level | Disease | Therapies |
|---|---|---|---|
{% for row in civic.evidence_items -%}
| {{ row.name }} | {{ row.evidence_level }} | {{ row.disease or "-" }} | {% if row.therapies %}{{ row.therapies | join(", ") }}{% else %}-{% endif %} |
{% endfor -%}
{% else -%}
No CIViC records returned for this gene query.
{% endif -%}
{% else -%}
No CIViC records returned for this gene query.
{% endif -%}
{% endif -%}
{% if show_expression_section -%}
## Expression (GTEx)

{% if expression and expression.tissues -%}
| Tissue | Median TPM |
|---|---|
{% for row in expression.tissues -%}
| {{ row.tissue }} | {{ row.median_tpm | score }} |
{% endfor -%}
{% else -%}
No GTEx expression records returned for this gene query.
{% endif -%}
{% endif -%}
{% if show_hpa_section -%}
## Human Protein Atlas

{% if hpa and (hpa.tissues or hpa.subcellular_main_location or hpa.subcellular_additional_location or hpa.reliability or hpa.protein_summary or hpa.rna_summary) -%}
{% if hpa.tissues -%}
| Tissue | Level |
|---|---|
{% for row in hpa.tissues -%}
| {{ row.tissue }} | {{ row.level }} |
{% endfor -%}
{% endif -%}
{% if hpa.reliability %}- Reliability: {{ hpa.reliability }}{% endif %}
{% if hpa.protein_summary %}- Protein summary: {{ hpa.protein_summary }}{% endif %}
{% if hpa.rna_summary %}- RNA summary: {{ hpa.rna_summary }}{% endif %}
{% if hpa.subcellular_main_location %}- Subcellular main locations: {{ hpa.subcellular_main_location | join(", ") }}{% endif %}
{% if hpa.subcellular_additional_location %}- Subcellular additional locations: {{ hpa.subcellular_additional_location | join(", ") }}{% endif %}
{% else -%}
No Human Protein Atlas records returned for this gene query.
{% endif -%}
{% endif -%}
{% if show_druggability_section -%}
## Druggability (DGIdb / Open Targets)

{% if druggability -%}
{% if druggability.categories -%}
Categories: {{ druggability.categories | join(", ") }}
{% endif -%}
{% if druggability.tractability -%}
### OpenTargets tractability

| Modality | Tractable | Evidence |
|---|---|---|
{% for row in druggability.tractability -%}
| {{ row.modality }} | {% if row.tractable %}yes{% else %}no{% endif %} | {% if row.evidence_labels %}{{ row.evidence_labels | join(", ") }}{% else %}-{% endif %} |
{% endfor -%}
{% endif -%}
{% if druggability.safety_liabilities -%}
### OpenTargets safety liabilities

| Event | Datasource | Effect | Biosample |
|---|---|---|---|
{% for row in druggability.safety_liabilities -%}
| {{ row.event }} | {{ row.datasource or "-" }} | {{ row.effect_direction or "-" }} | {{ row.biosample or "-" }} |
{% endfor -%}
{% endif -%}
{% if druggability.interactions -%}
| Drug | Interaction Types | Score | Approved | Sources |
|---|---|---|---|---|
{% for row in druggability.interactions -%}
| {{ row.drug }} | {% if row.interaction_types %}{{ row.interaction_types | join(", ") }}{% else %}-{% endif %} | {% if row.score is not none %}{{ row.score | score }}{% else %}-{% endif %} | {% if row.approved is none %}-{% elif row.approved %}yes{% else %}no{% endif %} | {{ row.source_count }} |
{% endfor -%}
{% else -%}
No DGIdb interactions returned for this gene query.
{% endif -%}
{% else -%}
No DGIdb interactions returned for this gene query.
{% endif -%}
{% endif -%}
{% if show_clingen_section -%}
## ClinGen

{% if clingen -%}
{% if clingen.validity -%}
### Gene-Disease Validity

| Disease | Classification | Review Date | MOI |
|---|---|---|---|
{% for row in clingen.validity -%}
| {{ row.disease | truncate(55) }} | {{ row.classification }} | {{ row.review_date or "-" }} | {{ row.moi or "-" }} |
{% endfor -%}
{% endif -%}
{% if clingen.haploinsufficiency or clingen.triplosensitivity -%}
### Dosage Sensitivity

- Haploinsufficiency: {{ clingen.haploinsufficiency or "No evidence" }}
- Triplosensitivity: {{ clingen.triplosensitivity or "No evidence" }}
{% endif -%}
{% if not clingen.validity and not clingen.haploinsufficiency and not clingen.triplosensitivity -%}
No ClinGen records returned for this gene query.
{% endif -%}
{% else -%}
No ClinGen records returned for this gene query.
{% endif -%}
{% endif -%}
{% if show_constraint_section -%}
## Constraint (gnomAD)

{% if constraint -%}
- Source: {{ constraint.source }}
- Version: {{ constraint.source_version }}
- Reference genome: {{ constraint.reference_genome }}
{% if constraint.transcript %}- Transcript: {{ constraint.transcript }}{% endif %}
{% if constraint.pli is defined and constraint.pli is not none %}- pLI: {{ constraint.pli | score }}{% endif %}
{% if constraint.loeuf is defined and constraint.loeuf is not none %}- LOEUF: {{ constraint.loeuf | score }}{% endif %}
{% if constraint.mis_z is defined and constraint.mis_z is not none %}- mis_z: {{ constraint.mis_z | score }}{% endif %}
{% if constraint.syn_z is defined and constraint.syn_z is not none %}- syn_z: {{ constraint.syn_z | score }}{% endif %}
{% if (constraint.pli is not defined or constraint.pli is none) and (constraint.loeuf is not defined or constraint.loeuf is none) and (constraint.mis_z is not defined or constraint.mis_z is none) and (constraint.syn_z is not defined or constraint.syn_z is none) -%}
No gnomAD constraint metrics returned for this gene query.
{% endif -%}
{% else -%}
No gnomAD constraint metrics returned for this gene query.
{% endif -%}
{% endif -%}
{% if show_disgenet_section -%}
## DisGeNET

{% if disgenet and disgenet.associations -%}
| Disease | UMLS CUI | Score | PMIDs | Trials | EL | EI |
|---|---|---|---|---|---|---|
{% for row in disgenet.associations -%}
| {{ row.disease_name | truncate(45) }} | {{ row.disease_cui }} | {{ row.score | score }} | {% if row.publication_count is defined and row.publication_count is not none %}{{ row.publication_count }}{% else %}-{% endif %} | {% if row.clinical_trial_count is defined and row.clinical_trial_count is not none %}{{ row.clinical_trial_count }}{% else %}-{% endif %} | {{ row.evidence_level or "-" }} | {% if row.evidence_index is defined and row.evidence_index is not none %}{{ row.evidence_index | score }}{% else %}-{% endif %} |
{% endfor -%}
{% else -%}
No DisGeNET associations returned for this gene query.
{% endif -%}
{% endif -%}
{% if sections_block %}{{ sections_block }}
{% endif -%}
{% if related_block %}{{ related_block }}
{% endif -%}
