Last active
November 28, 2021 11:41
-
-
Save PoisonAlien/42af27b733ac23e7271b6fab71581223 to your computer and use it in GitHub Desktop.
A minimal project template directory structure that I use for my Bioinformatic projects
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
#A minimal project template structure that I use for my Bioinformatic projects | |
#MIT License (Anand Mayakonda; [email protected]) | |
function usage() { | |
echo "createproject.sh - Create a project template directory structure | |
Usage: createproject.sh [option] <project_name> | |
<project_name> Project name should be intuitive, easy to understand, and less confusing. Required. | |
-d Prefixes <project_name> with ISO date for clarity. Optional but recommended." | |
} | |
if [ $# -lt 1 ];then | |
usage | |
exit | |
fi | |
USEDATE="false" | |
DT=`date +%Y-%m-%d` | |
USR=`whoami` | |
PROJ='' | |
PROJDIR='' | |
while getopts 'd' OPTION; do | |
case "${OPTION}" in | |
d) USEDATE="true" ;; | |
*) usage | |
exit 1;; | |
esac | |
done | |
PROJ="${@:${OPTIND}:1}" | |
if [[ ${USEDATE} = "true" ]]; then | |
PROJDIR="${DT}_${PROJ}" | |
else | |
PROJDIR=${PROJ} | |
fi | |
if [[ -d "${PROJDIR}" ]]; then | |
echo "ERROR: Requested project directory ${PROJDIR} already exists!" | |
exit 1; | |
fi | |
echo -e "Creating project directory \"${PROJDIR}\" with standardized subdirectories" | |
mkdir -p ${PROJDIR} | |
echo "Project created on ${DT} by the user: ${USR}" > ${PROJDIR}/README | |
mkdir -p ${PROJDIR}/00-extdata/ | |
echo "This directory contains any external data used for analysis" > ${PROJDIR}/00-extdata/README | |
mkdir -p ${PROJDIR}/01-src/ | |
echo "Any compiled codes (C/C++/GO/Rust etc) or binaries are hosted here" > ${PROJDIR}/01-src/README | |
mkdir -p ${PROJDIR}/02-data/ | |
echo "Any raw/tidy data (owned by the user) used for analysis are hosted here" > ${PROJDIR}/02-data/README | |
mkdir -p ${PROJDIR}/03-runme/ | |
echo "Scripts and codes (R/Python/Julia/Notebooks/Bash etc) used for actual analysis are stored and to be run from here" > ${PROJDIR}/03-runme/README | |
echo "Any output generated will go to 04-results" >> ${PROJDIR}/03-runme/README | |
mkdir -p ${PROJDIR}/04-results/ | |
echo "All results generated by scripts in 03-runme will be stored here" > ${PROJDIR}/04-results/README | |
mkdir -p ${PROJDIR}/05-tmp/ | |
echo "This is the temp directory to store intermediate results" > ${PROJDIR}/05-tmp/README | |
echo "Use it carefully and DO NOT DELETE unknown directories" >> ${PROJDIR}/05-tmp/README | |
echo -e "Done!" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment