EBI-Metagenomics / MGnifyR

R package for searching, downloading and analysis of EBI MGnify metagenomics data
https://ebi-metagenomics.github.io/MGnifyR/
Artistic License 2.0
19 stars 10 forks source link

Add warnings and checks #16

Closed RiboRings closed 1 year ago

RiboRings commented 1 year ago

Hi! I added the first warning when nothing is found.

It can be tested with:

mg <- MgnifyClient(cache_dir = "/tmp/mgcache")

# Get a list of studies from the Agricultural Wastewater:
# PROBLEM: biome_name was mispelled
agwaste_studies <- doQuery(mg, "studies",
                           biome_name = "Agricultural wastwater")
# Warning message:
# Nothing was found. Make sure that biome_name is correct. Returning empty query. 

# Get all samples from a particular study
# PROBLEM: study_accession does not exist
samps <- doQuery(mg, "samples",
                 study_accession = "MGYS00004521") # accession ID not valid
# Warning message:
# Nothing was found. Make sure that study_accession is correct. Returning empty query.

### Correct arguments ###
agwaste_studies <- doQuery(mg, "studies",
                           biome_name = "Agricultural wastewater")
samps <- doQuery(mg, "samples",
                 study_accession = "MGYS00004522")

I'm still getting familiar with the things to do. Is the right way to go?