owned this note
owned this note
Published
Linked with GitHub
# AsiaR meetup #2 | BioC Asia + targets
May 07, 2022 | 8a UTC
**AsiaR:** [Twitter](//twitter.com/AsiaR_comm) | [GitHub](//github.com/asiar-community) | [Slack](//asiar-community.slack.com) | [Email](asiar.community@gmail.com) | [Code of Conduct](https://github.com/AsiaR-community/coc)
## Speakers
- Kozo Nishida, RIKEN, Japan | [@Kozo2](//twitter.com/Kozo2) | kozo.nishida@gmail.com
- Joel Nitta | [@joel_nitta](//twitter.com/joel_nitta) | joelnitta@gmail.com | joelnitta.com | University of Tokyo
## Hosts
- Janani Ravi, Michigan State Univ, US | [@Janani137](//twitter.com/janani137) | jravilab.github.io
- Adithi R Upadhya, ILK Labs, India | [@AdithiUpadhya](//twitter.com/AdithiUpadhya)
## Attendees
Please add your names, affiliations, countries.
- Kozo Nishida, RIKEN, Japan | kozo.nishida@gmail.com
- Joel Nitta | [@joel_nitta](https://twitter.com/joel_nitta) | joelnitta@gmail.com | [https://joelnitta.com](https://joelnitta.com) | University of Tokyo
- Adithi R Upadhya, ILK Labs, India | RL-Bangalore, AsiaR | adithiru095@gmail.com
- Janani Ravi, Michigan State University | RLEL, W+DS, AsiaR | janani@msu.edu | jravilab.github.io
- Ayush Patel, Oxford Poverty and Human Development Initiative| [@ayushbipinpatel](https://twitter.com/ayushbipinpatel) | ayush.ap58@gmail.com | India
- Victor (Kwangchun) Lee, Korea R User Group | kwangchun.lee.7@gmail.com
- Chanakarn Nasamran
- Emi Tanaka
- Jeremy
- Kate Lu
- Oluwafemi Oyedele
Host future events? https://bit.ly/asiar_host_2022
## Questions for our speakers
[your name] [who is it for] How do we engage with BioC Asia?
[XYZ] [for particular speaker] Can I use `targets` to ...?
[Joel Nitta] [Kozo Nishida] Does [Amara](https://amara.org/) translate automatically or do I have to translate manually?
- No automated (AI) translation
[Victor (Kwangchun) Lee] [Kozo Nishida] Is there a way to harmonize tidyverse and Bioconductor?
[Ayush Patel] [Joel Nitta] Does `tar_target()` overwrite an object if an object with the same name already exists?
- No; `tar_target()` only **defines** the target, it doesn't create it. No targets get made until you run `tar_make()`. For that reason, you almost never run `tar_target()` yourself, you only write in the list at the end of the `_targets.R` file.
[Ayush Patel] [Joel Nitta] instead of `list(
tar_target(...)
tar_target(...)
)` in the _targets.R file would it be acceptable to write `map2(.x = list(data,summary),.y = list(....), .f = tar_target)`
- The targets list generally should be created with either `list()` or `tar_plan()`. If you want to generated targets programatically, you can use dynamic branching ([described in the manual](https://books.ropensci.org/targets/dynamic.html)).
[Jeremy] [Joel Nitta] Do you have an example which uses targets in rmarkdown code chunks?
- Yes! [See the gapminder example](https://github.com/joelnitta/targets_gapminder_example/blob/ffe9012c80e5d20a4a6041b75f731739f6bcb7d0/index.Rmd#L12-L15).
[Victor (Kwangchun) Lee] [Joel Nitta] What will be the main selling points of targets? (compared to other tools.)
- Main selling point is that it is (probably) the best tool if your code-base is mostly R. It is (probably) the best workflow manager **for R**. If you are mostly doing things in another language, maybe a different program would be better (for example, `snakemake` for python).
[Emi Tanaka] [Joel Nitta] What is the advantage of using `tar_group_by`?
- Since `tar_group_by` can be used to programmatically specify one target per group, if something about just one of those targets changed in the future, {targets} would only re-run that one and not the rest. If you used e.g., purrr it would have to re-run the whole loop.
[Adithi R Upadhya] [Joel Nitta] Does targets have its own parallel processing functions?
- No; you can choose from several backends. [More on this in the manual](https://books.ropensci.org/targets/hpc.html).
[Emi Tanaka] [Joel Nitta] Any tips for naming things?
- As often said, [naming things is hard](https://speakerdeck.com/jennybc/how-to-name-files)! One thing to remember is that if you re-name a target (without changing the command to create it), {targets} will see it as a **new target** and re-run the code. So you don't want to do this lightly for targets that take a long time to build.
- I recommend **against** naming targets with numbered prefixes to show order like `01_data_raw`, `02_data`, etc. **{targets} doesn't care about the order of the items in the targets list**, so it doesn't need to have things ordered sequentially. Also, you may want to change the number prefixes as your code grows, and then you run into the problem I mentioned above. Instead, I recommend trying to **name targets as clearly as possibly to describe what they contain**, and **functions to describe what they create**.
- Since almost all of the functions you write for a {targets} workflow are specific to that workflow, you can use specific names for arguments, e.g. in [my gapminder example](https://github.com/joelnitta/targets_gapminder_example), `gapminder` instead of `data` for the custom function [`fit_life_exp_mod()`](https://github.com/joelnitta/targets_gapminder_example/blob/main/R/functions.R). [Miles McBain's blogpost](https://www.milesmcbain.com/posts/the-drake-post/) on {drake}, the precursor to {targets}, has some good tips here ({drake} and {targets} are very similar so much of his blogpost still applies to {targets}).
## Other Notes
- Reproducibility is not binary, more like a spectrum. (excellent description by Joel Nitta)
- {targets} has friends, look up Targetopia
- `tar_plan()` syntax looks more convenient at the end of the _target.R file instead of the `list(tar_target())` approach
- Make scripts that load packages and have function definitions and store in a folder `R`. Source these files in the _target.R file
## Material
### BioC Asia
- [Slides](https://github.com/AsiaR-community/2022-bioCasia_targets/raw/main/Introduction%20to%20BioC%20Asia.pdf)
- [Blog introducing BioC Asia](https://www.r-consortium.org/blog/2021/05/28/bioconductor-asia-membership-increasing-due-to-going-virtual)
- https://amara.org Free platform for editing (translated) subtitles
- To join BioC Asia, [first join Bioconductor slack](https://bioc-community.herokuapp.com/) then find the BioC Asia channel
### {targets}
- [Slides](https://joelnitta.github.io/asiaR-targets-intro/)
- [Example workflow](https://github.com/joelnitta/targets_gapminder_example) using Gapminder data
- [Workshop materials in Japanese](https://togotv.dbcls.jp/20220331.html)
## Ideas/volunteers for future meetups
Interested in co-hosting future AsiaR events? https://bit.ly/asiar_host_2022