Last updated: 2023-08-30

Checks: 2 0

Knit directory: lab-notes/

This reproducible R Markdown analysis was created with workflowr (version 1.7.0). The Checks tab describes the reproducibility checks that were applied when the results were created. The Past versions tab lists the development history.


Great! Since the R Markdown file has been committed to the Git repository, you know the exact version of the code that produced these results.

Great! You are using Git for version control. Tracking code development and connecting the code version to the results is critical for reproducibility.

The results in this page were generated with repository version ba8cc1d. See the Past versions tab to see a history of the changes made to the R Markdown and HTML files.

Note that you need to be careful to ensure that all relevant files for the analysis have been committed to Git prior to generating the results (you can use wflow_publish or wflow_git_commit). workflowr only checks the R Markdown file, but you know if there are other scripts or data files that it depends on. Below is the status of the Git repository when the results were generated:


Ignored files:
    Ignored:    analysis/doc_prefix.html

Note that any generated files, e.g. HTML, png, CSS, etc., are not included in this status report because it is ok for generated content to have uncommitted changes.


These are the previous versions of the repository in which changes were made to the R Markdown (analysis/workflowr.Rmd) and HTML (docs/workflowr.html) files. If you’ve configured a remote Git repository (see ?wflow_git_remote), click on the hyperlinks in the table below to view the files as they were in that past version.

File Version Author Date Message
html d9c3393 1onic 2023-08-28 Build site.
html d4afa3b 1onic 2023-07-12 Build site.
html 289324b 1onic 2023-07-12 Build site.
html be52451 1onic 2023-07-12 Build site.
html a73ac21 1onic 2023-06-13 Build site.
html 41874f0 1onic 2023-06-13 Build site.
html 75989aa 1onic 2023-06-13 Build site.
html 14b2f73 1onic 2023-06-13 Build site.
html 6f3f6a4 1onic 2023-05-17 Build site.
html 5192404 1onic 2023-05-17 Build site.
html 93a8936 1onic 2023-05-10 Build site.
html 454b232 1onic 2023-05-10 Build site.
html 6a1bef0 1onic 2023-05-10 Build site.
html b8fbbd1 1onic 2023-05-10 Build site.
html e5648db 1onic 2023-05-10 Build site.
html c0c4bf0 1onic 2023-04-26 Build site.
html 9fbd5e6 1onic 2023-04-26 Build site.
html 1478db1 1onic 2023-04-19 Build site.
html e1b57ff 1onic 2023-03-29 Build site.
html 7288d9c 1onic 2023-03-29 Build site.
html 3aef7a8 1onic 2023-03-29 Build site.
html 3f796b6 1onic 2023-03-22 Build site.
html cdae3ea 1onic 2023-03-10 Build site.
html 99420b0 1onic 2023-03-10 Build site.
html 0f70ffe 1onic 2023-03-10 Build site.
html e4922c1 1onic 2023-03-02 Build site.
html 2d991e9 1onic 2023-03-02 Build site.
html c350c44 1onic 2023-02-06 Build site.
html f12e92e 1onic 2023-02-06 Build site.
html 0b2cc20 1onic 2023-02-06 Build site.
html fdd0022 1onic 2023-02-06 Build site.
html 21d42f1 1onic 2023-01-27 Build site.
html e47cac4 1onic 2023-01-27 Build site.
html bce6cff 1onic 2023-01-11 Build site.
html c51b055 1onic 2023-01-11 Build site.
html baf3f16 1onic 2023-01-11 Build site.
html f1c0cc6 1onic 2023-01-11 Build site.
html cbbb209 1onic 2022-12-09 Build site.
html fec1e8a 1onic 2022-12-09 Build site.
html 5006f39 1onic 2022-08-04 Build site.
html a6f860c 1onic 2022-08-04 Build site.
html 57e862a 1onic 2022-08-04 Build site.
html d9c1a09 1onic 2022-08-04 Build site.
html 8a38159 1onic 2022-08-04 Build site.
html 12331d2 1onic 2022-08-04 Build site.
html c814105 1onic 2022-08-04 Build site.
html c92e0bf 1onic 2022-08-03 Build site.
html 16b143f 1onic 2022-07-20 Build site.
html 3393b21 1onic 2022-07-20 Build site.
Rmd 1b8ae73 1onic 2022-07-20 update
html a0de791 1onic 2022-07-20 Build site.
Rmd 48ff6a7 1onic 2022-07-20 update
html bdf7cc6 1onic 2022-07-20 Build site.
Rmd 85175e6 1onic 2022-07-20 update
html 02d90b5 1onic 2022-07-20 Build site.
Rmd 844942e 1onic 2022-07-20 update
html 0c1180e 1onic 2022-07-20 Build site.
Rmd 52c1955 1onic 2022-07-20 update
html 52e007d 1onic 2022-07-20 Build site.
Rmd 07aa3f2 1onic 2022-07-20 update
html 1b61926 1onic 2022-07-20 Build site.
html fd6de4c 1onic 2022-07-20 Build site.
Rmd 6c5bc54 1onic 2022-07-20 update

Setting up workflowR on Midway3/Midway2

The point of this short memo is to go over requirements, setting up, and working on a workflowR environment using a template from our Lab group.

First Step: Installing Environment

In order to run workflowR, you need to first setup a working environment for the template. In order to do this we will use conda/miniconda.

  1. Create a env.yaml file:
name: workflowr
channels:
  - conda-forge
  - bioconda
  - defaults
dependencies:
  - python>=3.7
  - mamba
  - r-workflowr
  - r-base
  - gh
  - r-data.table
  - r-tidyverse
  1. Create the conda enviroment with the config above (assuming conda is setup):
conda env create -f path/to/env.yaml

Second Step: Configuring the Environment

The goal of this step is now to configuring your environement to your Github account and setup Github pages.

conda activate workflowr
  1. Clone template and check Github pages:

Prior to cloning the github template, create a new github repositoyry under your account. For example we will create: “MyworkflowR” repository. Make sure to enable Github pages for your repository here. Then, clone the repo, re-initialize it, and change the origin remote to point to your new repository.

mkdir -p path/to/folder
cd path/to/folder
git clone https://github.com/XuanyaoLiuLab/wflowr_template.git
cd wflowr_template
git init
git remote set-url origin https://github.com/USERNAME/MyworkflowR.git

This should transfer over the origin for the cloned template over to the new repository you just created: “MyworkflowR”, in your github account USERNAME.

  1. Personal Access Tokens:

It is now time to setup git with our personal access tokens.

Go to your account settings here. Create a new token to use with this enviroment. Copy this token temporarily.

The token should look like this: ghp_cgq4ZrHmFu0lLNl7ajKAwgNPnT5zhF00000

Third Step: Pushing First Update

This next step is aimed at publishing our cloned template to our new repository: “MyworkflowR”. The workflowR template was made by Lili in our lab group.

git push -u origin master

Normally this will be the way you update your workflowr to Github. If you have not logged in before using the CLI/git, you will be prompted for a username and password:

$ git push -u origin master
Username: <your-username>
Password: <your-token>

Here enter your username and token from above. These will be cached for later. Here are some optional troubleshooting commands:

git config --global credential.https://github.com.username USERNAME
git config --global user.name "USERNAME"
git config --global user.email "0000000+USERNAME@users.noreply.github.com"

(Example Modification) Fourth Step: Modyfying .RMD inside Template

This step is not necessary but aims to give an example where we modify a workflowR page (.RMD), then upload and publish our page to our new workflowR.

  1. First make changes to the .RMD markdown file in wflowr_template/analysis*. For example, we add a figure and a table.

  2. Run wflow_publish in order to build HTML pages + commit pages from all .RMDs in analysis folder.

In R terminal:

library("workflowr")
setwd('path/to/folder/wflowr_template')
wflow_publish("analysis/*.Rmd", "update", republish = TRUE)
  1. Git add and commit any additional files, such as the figures, tables, etc.
git add data/table.csv
git add docs/figureA.png
git commit --all
  1. Push changes/checkout developmental branch
git push -u origin master

Industry Best Practices

This section outline best practices to follow when there are multiple people working on a github repository at once. In our example and generally for workflowR, this is not necessary since logs are typically unique to each lab member. But sometimes that is not the case, for example, when multiple people are working on a new R package that may use workflowR pages to demonstrate usage/tutorials/notes or when multiple lab members want to combine workflowR notes.

The group repository should be set up such that a single/or all people can approve the PR in step 11.

  1. After you’ve selected a feature to work on, create a branch in your local repo to build it in.
    • $ git checkout -b username/short_description_of_feature
  2. Implement the requested feature, make sure all tests are passing, and commit all changes in the new branch.
  3. Checkout the master branch locally.
    • $ git checkout master
  4. Pull down the master branch from GitHub to get the most up to date changes from others. If you practice git workflow as described here you should never have a merge conflict at this step.
    • $ git pull origin master
  5. Make sure all tests are passing on master and then checkout your new branch.
    • $ git checkout username/short_description_of_feature
  6. From your new branch, merge in your local master branch.
    • $ git merge master
  7. Resolve any merge conflicts, make sure all tests are passing on the new branch, and then commit all changes from the merge.
    • $ git add .
    • $ git commit -m "Merge in master."
  8. Push the feature branch to the remote repo.
    • git push --set-upstream origin username/short_description_of_feature
  9. Submit a pull request on GitHub asking to merge the branch into master.
  10. A teammate reviews the code for quality and functionality.
  11. The teammate merges the pull request and deletes your branch from GitHub.