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

Add new gather_images function #33

Merged
merged 4 commits into from
Mar 1, 2022
Merged

Conversation

bschilder
Copy link
Contributor

Description

There are multiple images per species, and not all image UIDs are valid.
This function makes searching for a valid image for each species much easier.
Searches for the best name match per \code{species} and
iteratively tries image UIDs until a viable image is found.

Parallelisation also implemented via parallel::mclapply to help speed up these queries.

Example

species <- c("Mus_musculus","Pan_troglodytes","Homo_sapiens")
res <- rphylopic::gather_images(species=species)

Unit tests added in: tests/testthat/test-gather_images.R

Copy link
Collaborator

@sckott sckott left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks! this is a good idea. A few requests for change:

  • Please use markdown docs, see https://roxygen2.r-lib.org/articles/markdown.html
  • I don't use package parallel much. If someone doesn't want to run things in parallel, is that possible with the function as is?
  • for the utility functions added, I don't think they each need their own file given their simplicity, please put them in the file zzz.R OR put them both in a file like gather_images_utils.R or similar
  • various comments on the code

DESCRIPTION Outdated
@@ -4,7 +4,7 @@ Description: Work with 'Phylopic' web service (<http://phylopic.org/api/>)
to get 'silhouette' images of 'organisms', search names, and more.
Includes functions for adding 'silhouettes' to both base plots and
'ggplot2' plots.
Version: 0.3.2.91
Version: 0.3.3
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

keep the dev version on please, e.g., 0.3.3.91

NEWS.md Outdated
@@ -1,3 +1,10 @@
Version: 0.3.3
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I probably don't document this, but I try to push only even number versions to CRAN - change to 0.3.4 please

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This seems to conflict with your previous request. Could you clarify?
#33 (comment)

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Makes sense to have the version in the NEWS file be the next to go to cran whereas the version in the DESCRIPTION file i like to use the dev version until the cran push

R/gather_images.R Show resolved Hide resolved
tests/testthat/test-gather_images.R Outdated Show resolved Hide resolved
tests/testthat/test-gather_images.R Outdated Show resolved Hide resolved
tests/testthat/test-gather_images.R Show resolved Hide resolved
R/gather_images.R Show resolved Hide resolved
R/gather_images.R Outdated Show resolved Hide resolved
@bschilder
Copy link
Contributor Author

bschilder commented Feb 23, 2022

I'm afraid I don't have time atm to learn this alternative syntax, but feel free to modify to your preference after merging.

  • I don't use package parallel much. If someone doesn't want to run things in parallel, is that possible with the function as is?

The default is mc.cores=1, which is equivalent to single-threaded lapply. I always make single-threaded the default because CRAN/Bioc checks require this.

  • for the utility functions added, I don't think they each need their own file given their simplicity, please put them in the file zzz.R OR put them both in a file like gather_images_utils.R or similar

I suppose this is a matter of coding preference, I always put separate functions in separate file to make them easy to find.

  • various comments on the code

Addressing these now.

@sckott sckott added this to the v0.4 milestone Mar 1, 2022
@sckott sckott merged commit 6b3a27c into palaeoverse:master Mar 1, 2022
@sckott
Copy link
Collaborator

sckott commented Mar 1, 2022

Thanks, looks good

@bschilder
Copy link
Contributor Author

Thanks for all your great work @sckott !

@sckott
Copy link
Collaborator

sckott commented Mar 2, 2022

& thx for your contribution

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

Successfully merging this pull request may close these issues.

2 participants