ropensci / rglobi

R library to access species interaction data of http://globalbioticinteractions.org
https://docs.ropensci.org/rglobi
Other
16 stars 10 forks source link

Search by interaction types #23

Closed tpoisot closed 7 years ago

tpoisot commented 8 years ago

It would be nice to be able to get an arbitrary number of interactions of a given type.

jhpoelen commented 8 years ago

You can select a bunch of pathogen - host interactions (or any other supported interaction), by

some_pathogen_host_interactions <- rglobi::get_interactions_by_taxa(sourcetaxon = NULL, interactiontype = 'pathogenOf')

Does that suit your needs? If not, what would you expect a more intuitive approach to look like?

jhpoelen commented 8 years ago

Also, please note that you use the limit and offset options to vary length and offset using the otherkeys param.

So, in order to only get 10 interactions of type pathogenOf after skipping 5 you can say:

some_pathogen_host_interactions <- rglobi::get_interactions_by_taxa(sourcetaxon = NULL, interactiontype = 'pathogenOf', otherkeys = list(limit = 10, offset = 5))
jhpoelen commented 8 years ago

@tpoisot just checking in to see whether the existing behavior to get an arbitrary number of interactions of a given type is sufficient.

jhpoelen commented 7 years ago

Added shortcut to earlier provided answer in rglobi. Should be available in the dev version and in next release.

new method get_interactions_by_type calls get_interactions_by_taxa as follows

get_interactions_by_type <- function(interactiontype = c("interactsWith"), ...) {
   get_interactions_by_taxa (sourcetaxon = NULL, interactiontype = interactiontype, ...)
}

Please holler / comment if you have more questions about this. For now, am assuming that your issue has been addressed.