Skip to content

Instantly share code, notes, and snippets.

@explodecomputer
Last active December 5, 2025 07:34
Show Gist options
  • Select an option

  • Save explodecomputer/aac46b07170a10a4559c73f5a2266d85 to your computer and use it in GitHub Desktop.

Select an option

Save explodecomputer/aac46b07170a10a4559c73f5a2266d85 to your computer and use it in GitHub Desktop.
Reset RHDS project
#!/bin/bash
set -e
MY_GITHUB_URL=$1
if [ -z "${MY_GITHUB_URL}" ]; then
echo "Please MY_GITHUB_URL as the argument to this script"
exit 1;
fi
# create relevant directories
mkdir -p ${WORK}/data/rhds/data
mkdir -p ${WORK}/data/rhds/results
# Get the relevant results file
wget -O ${WORK}/data/rhds/results/combined-clin-pred-proteins.txt https://raw.githubusercontent.com/MRCIEU/rhds-tcga/refs/heads/raw/combined-clin-pred-proteins.txt
# Get the relevant scripts
if [ -d ~/rhds_template ]; then
echo "exists"
rm -rf ~/rhds_template
fi
git clone https://github.com/explodecomputer/rhds ~/rhds_template
cd ~/rhds_template
# Update my github repo with these scripts
git remote set-url origin $MY_GITHUB_URL
git push -f
# Create new config files
> config.env
echo "datadir=\"$(realpath $WORK/data/rhds/data)\"" >> config.env
echo "resultsdir=\"$(realpath $WORK/data/rhds/results)\"" >> config.env
# Install the R packages
Rscript -e "install.packages('renv'); renv::restore()"
# Check that it works
Rscript scripts/analysis.r
@explodecomputer
Copy link
Author

This will

  1. Create the data directories in the $WORK directory
  2. Download the data
  3. Create a new code directory at ~/rhds_template
  4. Download the code and renv.lock files
  5. Push to your github repo
  6. Create a config file
  7. Restore renv packages

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment