Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
ENH: Automate running the R scripts
  • Loading branch information
pan14001 committed Mar 23, 2017
1 parent 2a87164 commit 0611956
Showing 1 changed file with 14 additions and 9 deletions.
23 changes: 14 additions & 9 deletions Makefile
Expand Up @@ -13,7 +13,7 @@ PYTHON := python
RSCRIPT := Rscript
TIME := command time --format "Completed in wall clock time [H:M:S]: %E"

# Make rule sources and targets
# Make rule sources, targets and helper functions
SOURCES_img_raw := data/April_14_2016.tar.xz
TARGETS_img_raw := data/April_14_2016
SOURCES_img_zproj := $(TARGETS_img_raw)
Expand Down Expand Up @@ -53,12 +53,12 @@ $(CELLPROFILER_OPTS_COMMON) \
--pipeline=$(SOURCES_cellprofiler_commands) \
--run-headless
endef
SOURCES_signif_wells := $(TARGETS_cellprofiler_db)
SOURCES_signif_wells := src/overlap-analysis.R $(TARGETS_cellprofiler_db)
TARGETS_signif_wells := results/tables/rnai-p_values.csv
SOURCES_plot_overlap := $(TARGETS_signif_wells)
TARGETS_plot_overlap := $(addsuffix results/plots/,)
SOURCES_plot_plates := $(TARGETS_signif_wells)
TARGETS_plot_plates := $(addsuffix results/plots/,)
SOURCES_plot_overlap := src/plots.R $(TARGETS_signif_wells)
TARGETS_plot_overlap := results/plots/rnai-hist-signif.png
SOURCES_plot_plates := src/plot-plates.R $(TARGETS_signif_wells)
TARGETS_plot_plates := results/plots/stddev-scatter.png
TARGETS_plots := $(TARGETS_plot_overlap) $(TARGETS_plot_plates)

# Functions
Expand All @@ -70,7 +70,7 @@ $(foreach path,$1,$(shell echo -n $(path) | sed 's#\(.*\)\.#\1%##'))
endef

.PHONY : all
all : z-projection cellprofiler plots ## (Default) Run full pipeline from image processing to plots.
all : z-projection cellprofiler stats plots ## (Default) Run full pipeline from image processing to plots.

# Self-documenting help modified from
# https://gist.github.com/prwhite/8168133#gistcomment-1737630
Expand Down Expand Up @@ -108,14 +108,19 @@ gui-cellprofiler : $(SOURCES_cellprofiler) ## Interactively run CellProfiler.
$(TARGETS_img_filelist) : $(abspath $(SOURCES_img_filelist))
find $< -type f | sort > $@

.PHONY : stats
stats : $(TARGETS_signif_wells) ## Find significant wells from cellprofiler measurements.
$(TARGETS_signif_wells) : $(SOURCES_signif_wells)
cd $(<D); $(RSCRIPT) $(<F)

.PHONY : plots
plots : $(TARGETS_plots)

$(TARGETS_plot_overlap) : $(SOURCES_plot_overlap)
$(RSCRIPT) src/plots.R
cd $(<D); $(RSCRIPT) $(<F)

$(TARGETS_plot_plates) : $(SOURCES_plot_plates)
$(RSCRIPT) src/plot-plates.R
cd $(<D); $(RSCRIPT) $(<F)

.PHONY : clean-all
clean-all : ## Delete all output.
Expand Down

0 comments on commit 0611956

Please sign in to comment.