Coder Social home page Coder Social logo

project-template's Introduction

project-template

This is a template for R analysis projects for the Phanstiel lab.

How to use this template

  1. Create a repository from this template according to these instructions: https://docs.github.com/en/repositories/creating-and-managing-repositories/creating-a-repository-from-a-template

  2. Then clone your new repository locally:

    git clone https://github.com/{YourUserName}/{YourRepoName}.git
  3. Rename the project-template.Rproj file to {YourRepoName}.Rproj

  4. Either run the example with make:

    make

    Or clean out the example content and start your repo:

    • Remove scripts: rm scripts/processing/* scripts/analysis/* scripts/utils/*

    • Clear out Makefile objects and rules.

    • Replace README.md with your project description

What to put in README.md

The README contains information about your project. Here you can describe your analyses, processing steps, or approaches. Most importantly, the README should contain information about your raw data. Describe 1) how the raw data was generated, 2) where it was obtained, and 3) how it can be accessed for others. This is the perfect place to describe steps that were carried out on the command line or on a remote cluster.

Makefile

The Makefile is like a recipe book that describes the desired output files, the input files used to make them and the instructions for transforming inputs into outputs. Everytime you create an output file of any type, make sure to add it to the Makefile. This ensures that changes to your scripts will produce the most up-to-date outputs after running make.

In the terminal, navigate to the project directory and run make to build all objects and make clean to remove all objects. Alternatively, use the build tab in RStudio.

Resources for learning GNU make:

Directory organization

  • data
    • Contains all "processed" data for the project. Whether data is "processed" is subjective, however, we consider data to be processed if it was produced by an Rscript. Since the Makefile will generate the contents of this folder, files should not be tracked by git (add to .gitignore).
  • data/raw
    • Contains all input files needed for analysis that are not produced in this project. Example would be loop calls, .hic files, and other large data. Contents can be suborganized into folders as desired. Since these files are typically large, files are not tracked through git (add to .gitignore). However, these files should not be deleted since they are used to generate all processed data in the analysis.
  • scripts
    • Scripts contain all R scripts and functions that are used to generate output data objects, plots, and tables. Everything in this folder should be tracked with git to ensure reproducibility. For convenience we suggest using the following subdirectories:

      • scripts/processing

        • Processing data to create data objects. Files typically begin with "make" and correspond to an object in data (e.g. scripts/processing/makeObject1.R produces data/object1.rds).
      • scripts/analysis

        • Whenever you are using data objects to create a plot, table, report it should be placed in this folder. (e.g. scripts/analysis/surveyPlot1.R produces plots/surveyPlot1.pdf).
      • scripts/utils

        • Keep R functions that are used in more than one file here. Access them in other scripts by using the source() function.
  • plots
    • Output plots from scripts/processing. Can be suborganized into folders as desired. Since the Makefile will generate the contents of this folder, files should not be tracked by git (add to .gitignore).
  • tables
    • Output tables from scripts/processing. Can be suborganized into folders as desired. Since the Makefile will generate the contents of this folder, files should not be tracked by git (add to .gitignore).
  • renv

project-template's People

Contributors

ericsdavis avatar jpflores-13 avatar

Stargazers

Haeun (Hannah) Hwangbo avatar

Watchers

Doug Phanstiel avatar

Forkers

raab-lab

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.