waldronlab / bedbaser

An R client for bedbase.org
1 stars 0 forks source link

bedbase object representation #11

Open nsheff opened 1 month ago

nsheff commented 1 month ago

I think the representation you get when you print the bedbase client to screen is confusing:

api <- BEDbase()
api
service: bedbase
tags(); use bedbase$<tab completion>:
# A tibble: 32 x 3
   tag   operation                                                       summary
   <chr> <chr>                                                           <chr>  
 1 base  get_bedbase_db_stats_v1_stats_get                               Get su~
 2 base  service_info_v1_service_info_get                                GA4GH ~
 3 bed   bed_to_bed_search_v1_bed_search_bed_post                        Search~
 4 bed   get_bed_classification_v1_bed__bed_id__metadata_classification~ Get cl~
 5 bed   get_bed_embedding_v1_bed__bed_id__embedding_get                 Get em~
 6 bed   get_bed_files_v1_bed__bed_id__metadata_files_get                Get me~
 7 bed   get_bed_metadata_v1_bed__bed_id__metadata_get                   Get me~
 8 bed   get_bed_pephub_v1_bed__bed_id__metadata_raw_get                 Get ra~
 9 bed   get_bed_plots_v1_bed__bed_id__metadata_plots_get                Get pl~
10 bed   get_bed_stats_v1_bed__bed_id__metadata_stats_get                Get st~
# i 22 more rows
# i Use `print(n = ...)` to see more rows
tag values:
  base, bed, bedset, home, objects, search, NA
schemas():
  AccessMethod, AccessURL, BedClassification, BedEmbeddingResult,
  BedFiles
  # ... with 34 more elements

First, it says "use bedbase$ [tab completion]" -- but this doesn't work. It would be great if we could use tab completion (related to #10)

Then, I don't understand what is meant by "service" and "tags()"

The summaries of the operations in the table not actually visible.

Basically, I would suggest we think about the string representation and make it something more friendly to the user. Something like:

jwokaty commented 1 month ago

Hm, tab completion works for me with, for example

library(bedbaser)
api <- BEDbase()
api$get_ # start typing this and tab complete

This information is coming from the AnVIL service class. I think tags are the top level organizational headings in the API and the service in this case is "bedbase". I see that I forgot to include tags in the NAMESPACE, which I can correct, as well as link to AnVIL documentation in the vignette where I provide an example of how to use this. My thought on bedbaser--and this is just a guess--is that most users might use the convenience functions I created because they just need to get a bed file and do something with it but maybe there might be power users who want to do other things, so that's where the endpoints exposed by AnVIL will be useful. I think some of your questions can be answered with #9.