Skip to content

Add nucleotideSequence filter support to occ_download #853

Description

@jhnwllr

Background

PR #851 successfully added support for all 13 nucleotideSequence.* filter parameters to occ_search() and occ_count() functions. However, occ_download() uses a different mechanism (predicate-based downloads via the GBIF download API) and does not yet support these filters.

Current Status

Supported in:

  • occ_search() - uses GET /occurrence/search
  • occ_count() - wraps occ_search()

Not yet supported in:

  • occ_download() - uses POST /occurrence/download/request with predicate JSON

Requested Feature

Add support for the following nucleotideSequence filters in the download predicate DSL:

  1. nucleotideSequence.nucleotideSequenceID (string)
  2. nucleotideSequence.targetGene (string) - vocabulary reference
  3. nucleotideSequence.sequence (string)
  4. nucleotideSequence.sequenceLength (numeric/range)
  5. nucleotideSequence.gcContent (numeric/range)
  6. nucleotideSequence.nonIupacFraction (numeric/range)
  7. nucleotideSequence.nonACGTNFraction (numeric/range)
  8. nucleotideSequence.nFraction (numeric/range)
  9. nucleotideSequence.nRunsCapped (numeric/range)
  10. nucleotideSequence.naturalLanguageDetected (boolean)
  11. nucleotideSequence.endsTrimmed (boolean)
  12. nucleotideSequence.gapsOrWhitespaceRemoved (boolean)
  13. nucleotideSequence.invalid (boolean)
  14. isSequenced (boolean)

Implementation Requirements

  1. Predicate DSL Updates (R/download_predicate_dsl.r):

    • Add nucleotideSequence parameters to allowed predicate keys
    • Ensure proper handling of dot notation in parameter names
    • Support appropriate operators for each parameter type (equals, range, boolean)
  2. Examples:

# Download all ITS1 sequences
occ_download(pred("nucleotideSequence.targetGene", "ITS1"))

# Download sequences with specific GC content range
occ_download(
  pred("nucleotideSequence.targetGene", "COI"),
  pred_gte("nucleotideSequence.gcContent", 0.4),
  pred_lte("nucleotideSequence.gcContent", 0.6)
)

# Download valid sequences only
occ_download(pred("nucleotideSequence.invalid", FALSE))

# Complex query combining taxonomy and sequence filters
occ_download(
  pred("taxonKey", 212),  # Aves
  pred("nucleotideSequence.targetGene", "COI"),
  pred_gte("nucleotideSequence.sequenceLength", 500),
  pred("nucleotideSequence.invalid", FALSE)
)

Activity

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

Metadata

Metadata

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions