Closed PierreENOlivier closed 6 years ago
@PierreOcean thanks for reporting the two issue.
re: avoid child taxa - if I understand your question, you are looking to use behavior documented here https://github.com/jhpoelen/eol-globi-data/wiki/API#excluding-child-taxa through https://github.com/ropensci/rglobi using get_interactions_by_taxa .
Sample of how to search for only exact taxon matches -
install.packages('rglobi')
rglobi::get_interactions_by_taxa(sourcetaxon = 'Aves', showfield = c('source_taxon_name'), otherkeys = list(limit=5, excludeChildTaxa='true'))
Observed result on 17 Aug 2017 :
source_taxon_name
1 Aves
2 Aves
3 Aves
4 Aves
5 Aves
When omitting the excludeChildTaxa key using
rglobi::get_interactions_by_taxa(sourcetaxon = 'Aves', showfield = c('source_taxon_name'), otherkeys = list(limit=5))
The result below was observed:
source_taxon_name
1 Gavia
2 Gavia
3 Gavia
4 Gavia
5 Gavia
Does this provide the behavior you were looking for? Curious to hear your thoughts!
As far as the second issue related to get_interaction_matrix, please open a separate issue in order to avoid mixing the different separate concerns. If you have troubles doing so, I'd be happy to do it for you.
@PierreOcean closing stale issue. I am assuming the issue has been resolved. If not, please comment/re-open the issue.
Hi,
I am not sure if it is really an issue but I have been trying to retrieve my predator-prey pairwise list according to my species list. I pass the function my species list as source and target taxa within a loop that search for every possible combinations. It takes a bit of time but works. My main issue is that some of my trophospecies are for example "a family", then the function retrieves every single child taxa and will even not retrieve the "predator"-"this family" link. Is there a way to avoid that? One way to get that list would be to use the get_interaction_matrix but then I lose information like the sources.
To sum up, how to match strictly the name I am providing to the function and not search for child taxa as well? LinkSearch is a vector and contains my trophospecies names.
`SearchPW <- data.frame() for(i in 1:length(LinkSearch)){ for(j in 1:length(LinkSearch)){ eval(parse(text= paste(" K = get_interactions_by_taxa(sourcetaxon = LinkSearch[", i, "] , interactiontype = ", "'eatenBy'", ", targettaxon = LinkSearch[", j, "])", sep="")))
print("Predator: ");print(LinkSearch[i])
SearchPW <- rbind(SearchPW, K) } }`
The second part is surely an issue. By convention, I put the predators in column and prey in rows in the interaction matrix. In order to do so, you need to search for source=prey, target=predator, interaction='eatenBy'. If I do so, I get an error message while the other way around was working.
get_interaction_matrix(source.taxon.names = SpeciesListWorms[[1]], target.taxon.names = SpeciesListWorms[[1]], interaction.type = 'eatenBy')
where SpeciesListWorms[[1]] is a vector containing my trophospecies' names.....Error in file(file, "rt") : cannot open the connection to 'http://api.globalbioticinteractions.org:80/interaction?&sourceTaxon=Ammodytidae&targetTaxon=Abramis%20brama&targetTaxon=Acartia&targetTaxon=Alburnus%20alburnus&targetTaxon=Ammodytes%20tobianus&targetTaxon=Ammodytidae&targetTaxon=Amphibalanus%20improvisus&targetTaxon=Amphipoda&targetTaxon=Arthropoda&targetTaxon=Asellus%20aquaticus&targetTaxon=Bathyporeia%20pilosa&targetTaxon=Belone%20belone&targetTaxon=Bithynia%20tentaculata&targetTaxon=Bivalvia&targetTaxon=Blicca%20bjoerkna&targetTaxon=Boccardia%20sp.&targetTaxon=Bosmina&targetTaxon=Bryozoa&targetTaxon=Calanoida&targetTaxon=Calliopius%20laeviusculus&targetTaxon=Cerastoderma%20glaucum&targetTaxon=Ceratopogonidae&targetTaxon=Cercopagis%20pengoi&targetTaxon=Chironomidae&targetTaxon=Chironomus%20plumosus&targetTaxon=Cladocera&targetTaxon=Clupea%20harengus&targetTaxon=Coleoptera&targetTaxon=Copepoda&targetTaxon=Coregonus%20albula&targetTaxon=Coregonus%20lavaretus&targetTaxon=Coregonus%20sp.&targetTax In addition: Warning message: In file(file, "rt") : cannot open URL 'http://api.globalbioticinteractions.org:80/interaction?&sourceTaxon=Ammodytidae&targetTaxon=Abramis%20brama&targetTaxon=Acartia&targetTaxon=Alburnus%20alburnus&targetTaxon=Ammodytes%20tobianus&targetTaxon=Ammodytidae&targetTaxon=Amphibalanus%20improvisus&targetTaxon=Amphipoda&targetTaxon=Arthropoda&targetTaxon=Asellus%20aquaticus&targetTaxon=Bathyporeia%20pilosa&targetTaxon=Belone%20belone&targetTaxon=Bithynia%20tentaculata&targetTaxon=Bivalvia&targetTaxon=Blicca%20bjoerkna&targetTaxon=Boccardia%20sp.&targetTaxon=Bosmina&targetTaxon=Bryozoa&targetTaxon=Calanoida&targetTaxon=Calliopius%20laeviusculus&targetTaxon=Cerastoderma%20glaucum&targetTaxon=Ceratopogonidae&targetTaxon=Cercopagis%20pengoi&targetTaxon=Chironomidae&targetTaxon=Chironomus%20plumosus&targetTaxon=Cladocera&targetTaxon=Clupea%20harengus&targetTaxon=Coleoptera&targetTaxon=Copepoda&targetTaxon=Coregonus%20albula&targetTaxon=Coregonus%20lavaretus&targetTaxon=Coregonus%20sp.&targetTaxon=Coregonus%20widegren... <truncated>
Thanks in advance,