Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

new API for BacDiveR #96

Closed
1 task done
katrinleinweber opened this issue Sep 29, 2018 · 3 comments
Closed
1 task done

new API for BacDiveR #96

katrinleinweber opened this issue Sep 29, 2018 · 3 comments
Assignees
Milestone

Comments

@katrinleinweber
Copy link
Collaborator

katrinleinweber commented Sep 29, 2018

Currently, the API looks as follows:

I'm considering a more stringent design, that

  1. reads more fluently, e.g.:
    • retrieve_by_culture(collection_no = "…")
    • …_sequence(accession ="…")
    • …_taxon(name = "…") (maybe with genus = "…", species = "…", subspecies = "…" separately & optionally)
  2. hides the actual data download/retrieval …_by_id() through the bacdive_id endpoint from the user. The 3 "front" functions above could return the URLs or IDs to be downloaded, which could be fed into …_by_id().

Additional considerations:

  1. maybe use download as the verb (although less common than retrieve)
  2. maybe use BD_ or bd_ in front like ROpenSci's function naming guide suggests. This would be a workable abbreviation for BacDive data, but is already in use by other packages (not with _download or _retrieve, though).
  3. or BacDive_… or bacbive_…?

Feedback on this major change, the naming details, etc. is very welcome :-)

graph TD

A(BD_retrieve_culture) --chr: collectionno--> J
B(BD_retrieve_sequence) --chr: accession--> J
C(BD_retrieve_by_taxon) --chr: name, genus, species, subspecies--> J
J[.json] --> SM

SM(single_or_multi?) --chr--> E
SM--multi--> G
G(aggregate_result_URLs) --chr_list--> E

D(BD_retrieve_by_search) --chr: query_URL--> Q
Q[.csv] --> E
E(extract_IDs) --chr_list--> U

I(BD_retrieve_by_id) --chr: ID--> U

U(construct_URL) --chr: URL--> S
S[dataset_or_sets]
@katrinleinweber
Copy link
Collaborator Author

katrinleinweber commented Jan 3, 2019

I need to simplify that scheme to a flowchart with only high-level function calls & server responses:

graph TD

FC(function calls)
SR[server response]

cul(BD_retrieve_culture<br>collectionno='chr') --> JU
seq(BD_retrieve_sequence<br>accession='chr') --> JU
JU[.json url] -- JSON2list --> rb_URL

tax(BD_retrieve_by_taxon<br>name='chr')--> JR
JR[.json results] --> rb_URL

rb_adv(BD_retrieve_by_search<br>query_URL='chr') --> CSV
CSV[.csv] -- lines2list --> rb_ID

rb_ID(BD_retrieve_by_id<br>ID='chr')--> rb_URL

rb_URL(BD_retrieve_by_URL<br>URL='chr') --> DSL
DSL[list with 1 or more dataset*s]


classDef public fill:white
class cul,seq,tax,rb_adv public

classDef WS stroke:#A30000
class cul,seq,tax,I WS

classDef AdvSearch stroke:#5290b2
class rb_adv AdvSearch

classDef semi_public fill:lightgrey
class rb_ID,rb_URL semi_public

@katrinleinweber
Copy link
Collaborator Author

katrinleinweber commented Jan 20, 2019

An alternative, simpler idea might be to provide the above-mentioned "front" functions in parallel to (or on top of) the current retrieve_data(searchTerm = "…" , searchType = "…"):

graph TD

cul(bd_culture<br>collectionno='chr') --Type='culturecollectionno'--> rd

seq(bd_sequence<br>accession='chr') --Type='sequence'--> rd

tax(bd_taxon<br>name='chr')--Type='taxon'--> rd

bd_id --Type='bacdive_id'--> rd

rd(retrieve_data<br>Term='chr', Type='chr') --> DSL
DSL[list with 1 or more dataset*s]

rb_adv(bd_download_adv<br>searchURL='chr')--unchanged, just renamed-->DSL

This might lend itself to later converting this into object-oriented code.

@katrinleinweber
Copy link
Collaborator Author

Or dive_in...:

  • ...to_taxon(name = ...)
  • ...to_culture(collection_number = ...)
  • ...to_sequence(accession = ...)
  • ...to_dataset(id = ...)
    ?

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

No branches or pull requests

1 participant