Skip to content

ncbi_get_uid() fails when I mix up the ID and the database #100

Description

@stitam

This works, because the ID is listed in SRA:

webseq::ncbi_get_uid(term = "DRX061127", db = "sra")$uid
#> [1] 6133648

Created on 2025-07-15 with reprex v2.1.1

This gives an error:

webseq::ncbi_get_uid(term = "DRX061127", db = "nuccore")$uid
#> Error in hit$count: $ operator is invalid for atomic vectors

Created on 2025-07-15 with reprex v2.1.1

However, it works with random characters instead of an ID (no UID found, of course):

webseq::ncbi_get_uid(term = "vbaelvhjjzfv", db = "nuccore")$uid
#> [1] NA

Created on 2025-07-15 with reprex v2.1.1

And interestingly, it also works with the SRA ID if I set use_history = FALSE (no ID found, of course):

webseq::ncbi_get_uid(term = "DRX061127", db = "nuccore", use_history = FALSE)$uid
#> [1] NA

Created on 2025-07-15 with reprex v2.1.1

It seems the function only fails if the ID exists, but in a different database, and use_history = TRUE.

I did some digging and I think the issue is with rentrez, more specifically, with entrez_search().

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions