ncbi / ncbi/datasets

found incorrect/missing assembly_link_type

Open
#436 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug
Dominant language
Jupyter Notebook
Stars
559
Forks
70
Avg merge
1m
Merged PRs (30d)
2

Description

Hi!

I have been playing around with python and the api library generated from (https://www.ncbi.nlm.nih.gov/datasets/docs/v2/openapi3/openapi3.docs.yaml)
and found a missing data typ or incorrect set data value when trying to get genome links. For accession number GCF_003957565.2. I get the following error:

ValidationError: 1 validation error for V2AssemblyLinksReplyAssemblyLink
assembly_link_type
  Input should be 'GDV_LINK', 'FTP_LINK', 'ASSEMBLY_PUBMED', 'BLAST_LINK', 'ASSEMBLY_NUCCORE_REFSEQ' or 'ASSEMBLY_NUCCORE_GENBANK' [type=enum, 
input_value='ASSEMBLY_NUCCORE', input_type=str]
    For further information visit https://errors.pydantic.dev/2.10/v/enum
 

The assembly_link_type that generate the error is "ASSEMBLY_NUCCORE" which one can see when using curl to fetch the data

curl -X GET "https://api.ncbi.nlm.nih.gov/datasets/v2/genome/accession/GCF_003957565.2/links" \
 -H 'accept: application/json' 

Result

{
  "assembly_links": [
    {
      "accession": "GCF_003957565.2",
      "assembly_link_type": "BLAST_LINK",
      "resource_link": "https://blast.ncbi.nlm.nih.gov/Blast.cgi?PAGE_TYPE=BlastSearch&PROG_DEF=blastn&BLAST_SPEC=GDH_GCF_003957565.2"
    },
    {
      "accession": "GCF_003957565.2",
      "assembly_link_type": "GDV_LINK",
      "resource_link": "https://www.ncbi.nlm.nih.gov/genome/gdv/browser/genome/?id=GCF_003957565.2"
    },
    {
      "accession": "GCF_003957565.2",
      "assembly_link_type": "FTP_LINK",
      "resource_link": "https://ftp.ncbi.nlm.nih.gov/genomes/all/GCF/003/957/565/GCF_003957565.2_bTaeGut1.4.pri"
    },
    {
      "accession": "GCF_003957565.2",
      "assembly_link_type": "ASSEMBLY_PUBMED",
      "resource_link": "https://www.ncbi.nlm.nih.gov/nuccore/?from_uid=10005361&linkname=assembly_pubmed"
    },
    {
      "accession": "GCF_003957565.2",
      "assembly_link_type": "ASSEMBLY_NUCCORE",
      "resource_link": "https://www.ncbi.nlm.nih.gov/nuccore/?from_uid=10005361&linkname=assembly_nuccore_refseq"
    },
    {
      "accession": "GCF_003957565.2",
      "assembly_link_type": "ASSEMBLY_NUCCORE_REFSEQ",
      "resource_link": "https://www.ncbi.nlm.nih.gov/nuccore/?from_uid=10005361&linkname=assembly_nuccore_refseq"
    },
    {
      "accession": "GCF_003957565.2",
      "assembly_link_type": "ASSEMBLY_NUCCORE_GENBANK",
      "resource_link": "https://www.ncbi.nlm.nih.gov/nuccore/?from_uid=10005361&linkname=assembly_nuccore_insdc"
    }
  ]
}

If we look at the yaml definition we can see "ASSEMBLY_NUCCORE" that isn't defined

https://github.com/ncbi/datasets/blob/d511fd7dc65cbd5a4645b3aff8600d665f10a81a/datasets.openapi.yaml#L11477-L11485

and the generate python code will not have it as a value

class V2AssemblyLinksReplyAssemblyLinkType(str, Enum):
    """
    V2AssemblyLinksReplyAssemblyLinkType
    """

    """
    allowed enum values
    """
    GDV_LINK = 'GDV_LINK'
    FTP_LINK = 'FTP_LINK'
    ASSEMBLY_PUBMED = 'ASSEMBLY_PUBMED'
    BLAST_LINK = 'BLAST_LINK'
    ASSEMBLY_NUCCORE_REFSEQ = 'ASSEMBLY_NUCCORE_REFSEQ'
    ASSEMBLY_NUCCORE_GENBANK = 'ASSEMBLY_NUCCORE_GENBANK'

    @classmethod
    def from_json(cls, json_str: str) -> Self:
        """Create an instance of V2AssemblyLinksReplyAssemblyLinkType from a JSON string"""
        return cls(json.loads(json_str))


Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with datasets.openapi.yaml around the assembly_link_type definition and compare it with the generated Python V2AssemblyLinksReplyAssemblyLinkType enum. Reproduce the response using the provided curl request and inspect how the generated client validates it. Done means the client accepts the API's ASSEMBLY_NUCCORE value and the generated definition remains consistent.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
api
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.