Skip to content

Conversation

@bilalebi
Copy link
Contributor

@bilalebi bilalebi commented Nov 13, 2025

Description

Added two REST endpoints that will be used by the structural variant page

Related JIRA Issue(s)

Main JIRA ticket: https://embl.atlassian.net/browse/ENSPLAT-269
Sub task: https://embl.atlassian.net/browse/ENSPLAT-271

Review App URL(s)

https://ensembl.github.io/ensembl-web-metadata-api/

⚠️ Won't work until Ensembl/ensembl-metadata-api#172 is merged and deployed

Example(s)

/api/metadata/genome_groups

Request:

http://127.0.0.1:8014/api/metadata/genome_groups?group_type=structural_variant

Response:

{
  "genome_groups": [
    {
      "id": "grch38-group",
      "type": "structural_variant",
      "name": null,
      "reference_genome": {
        "genome_id": "a7335667-93e7-11ec-a39d-005056b38ce3",
        "genome_tag": "grch38",
        "common_name": "Human",
        "scientific_name": "Homo sapiens",
        "species_taxonomy_id": "9606",
        "type": null,
        "is_reference": true,
        "assembly": {
          "accession_id": "GCA_000001405.29",
          "name": "GRCh38.p14",
          "url": "https://identifiers.org/insdc.gca/GCA_000001405.29"
        },
        "release": {
          "name": "2025-02",
          "type": "integrated",
          "is_current": true
        }
      }
    },
    {
      "id": "t2t-group",
      "type": "structural_variant",
      "name": null,
      "reference_genome": {
        "genome_id": "4c07817b-c7c5-463f-8624-982286bc4355",
        "genome_tag": "t2t-chm13",
        "common_name": "Human",
        "scientific_name": "Homo sapiens",
        "species_taxonomy_id": "9606",
        "type": null,
        "is_reference": false,
        "assembly": {
          "accession_id": "GCA_009914755.4",
          "name": "T2T-CHM13v2.0",
          "url": "https://identifiers.org/insdc.gca/GCA_009914755.4"
        },
        "release": {
          "name": "2025-02",
          "type": "integrated",
          "is_current": true
        }
      }
    }
  ]
}

/api/metadata/genome_groups/{group_id}/genomes

Request:

http://127.0.0.1:8014/api/metadata/genome_groups/grch38-group/genomes

Response:

{
  "genomes": [
    {
      "genomeUuid": "a7335667-93e7-11ec-a39d-005056b38ce3",
      "genome_tag": "grch38",
      "common_name": "Human",
      "scientific_name": "Homo sapiens",
      "species_taxonomy_id": "9606",
      "type": null,
      "is_reference": true,
      "assembly": {
        "accession": "https://identifiers.org/insdc.gca/GCA_000001405.29",
        "name": "GRCh38.p14"
      },
      "release": {
        "releaseLabel": "2025-02",
        "releaseType": "integrated",
        "isCurrent": true
      }
    },
    {
      "genomeUuid": "4c07817b-c7c5-463f-8624-982286bc4355",
      "genome_tag": "t2t-chm13",
      "common_name": "Human",
      "scientific_name": "Homo sapiens",
      "species_taxonomy_id": "9606",
      "type": null,
      "is_reference": false,
      "assembly": {
        "accession": "https://identifiers.org/insdc.gca/GCA_009914755.4",
        "name": "T2T-CHM13v2.0"
      },
      "release": {
        "releaseLabel": "2025-02",
        "releaseType": "integrated",
        "isCurrent": true
      }
    }
  ]
}

Dependencies

⚠️ Don't merge this one until Ensembl/ensembl-metadata-api#172 is!

@bilalebi bilalebi self-assigned this Nov 13, 2025
assembly_name: str = Field(alias="assemblyName")
is_reference: bool = Field(alias="isReference", default=False)
is_group_reference: bool = Field(alias="isGroupReference", default=False)
release: Release = None
Copy link
Contributor

@azangru azangru Nov 14, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have all sorts of questions about this PR, which arose after trying to understand this Genome model.

  1. Is the /genome_groups endpoint intended to provide data both for this part of the UI:
Image

and for this part of the UI:

Image

I understand that the first image shows "organism groups", and the second one shows "genome groups" — are you planning to keep this distinction, or are you planning to somehow unite both at the level of the json api?

  1. Especially if we expect the two images above to be generated from data from different endpoints, then could you remind me what the reference_genome in the JSON payload was intended for?

Copy link
Contributor

@azangru azangru Nov 14, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry; I realised that I was being stupid and that we are actually talking about the structural variants UI 🤦‍♂️

image

In that case yes, I remember why we needed the reference genome for group.

But even so:

Perhaps @EbiArnie should also be among the reviewers then, since there are overlapping concerns.

Copy link
Contributor

@veidenberg veidenberg Nov 18, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd address search needs in its own PR, this more compact payload is good for SV. I don't think we even need the release info for the genome selection dropdowns.
@azangru do the payload fields here cover the different genome labelling options in the dropdown?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We would need:

- genome_id
- genome_tag
- common_name
- scientific_name
- type (a json object)
- is_reference
- assembly (a json object)

But at that point, adding the release probably shouldn't be a problem.

group_id: str = Field(alias="groupId")
group_type: str = Field(alias="groupType")
group_name: str | None = Field(alias="groupName", default=None)
reference_genome: Genome = Field(alias="referenceGenome")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Doesn't a group also need a count?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think the SV app uses counts anywhere.

genome_groups: list[GenomeGroup] = Field(alias="genomeGroups")

class GenomesInGroupResponse(BaseModel):
genomes: list[Genome] = Field(alias="genomes")
Copy link
Contributor

@azangru azangru Nov 14, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Genomes in group should match the search results payload, I think. If we want them to populate the table in the same way other search results do:

Image

@bilalebi
Copy link
Contributor Author

@azangru I updated the output to use the same model used by /explain (please see the updated output exmaples in the PR description) and removed group_ from GenomeGroup attributes

Copy link
Contributor

@veidenberg veidenberg left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good for SV app requirements (has genome id, common name, assembly name).

id: str = Field(alias="groupId")
type: str = Field(alias="groupType")
name: str | None = Field(alias="groupName", default=None)
reference_genome: BaseGenomeDetails = Field(alias="referenceGenome")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just remember that this is a nullable field. We should always have a reference genome for structural variant groups, but not for other groups.

Copy link
Contributor Author

@bilalebi bilalebi Nov 20, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The object name is kinda deceiving at this stage, I think of changing it to SVGenomeGroup because it's SV specific

@bilalebi bilalebi merged commit ddeea5d into main Nov 20, 2025
3 checks passed
@azangru azangru deleted the add-genome-groups branch November 20, 2025 16:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants