Question

Well i have a pipeline which runs some data for me with the help of a makefile. This pipeline creates an enormous amount of redundant files which i want to clean.

I have 1 makefile to run the pipeline. And the pipeline itself is connected to much other makefiles. so i added this code to the pipeline chipcap.mk file:

.PHONY cleanintermediate    
cleanintermediate: $(CHIPCAP_OUTPUT)
        rm -rf $(SAMPLE)clipsync.trimsync.fastq
        rm -rf $(SAMPLE)clipsync.fastq
        rm -rf $(SAMPLE)clip.fastq
        rm -rf $(SAMPLE).fastq
        rm -rf $(SAMPLE).wig && $(RM) -rf $(SAMPLE).wig.idx
        rm -rf $(SAMPLE).sam

Now i run my file like this make -f run_samples.mk This script will invoke the pipeline and start running all samples separately the command that run_samples.mk gives to the pipeline is:

all: pool1_negCTRL pool1R2R1 pool1SP1 pool2Posctrl pool2R2R2 pool2Input

getCommand = $(MAKE) -f /data/DIV5/SASC/project-064-ronald-svdz/analysis/pipelines/chipcap/chipcap.mk \
        IN_DIR=/data/DIV5/SASC/project-064-ronald-svdz/input/$(1) \
        OUT_DIR=/data/DIV5/SASC/project-064-ronald-svdz/analysis/runs/$(2) \
        CHIPCAP_VER=0.1.2 \
        FASTQ_EXT=fastq \
        CHIPCAP_INPUT=$(3) \
        CHIPCAP_QC_MODE=cliptrim \
        GZIP_EXT=gz \
        MACS14_EXE=/home/sajvanderzeeuw/.virtualenvs/ronald/bin/macs \
        PYTHON_EXE=/home/sajvanderzeeuw/.virtualenvs/ronald/bin/python2.7 \
        OPT_MACS14_mfold=$(4),$(5)
        #OPT_MACS14_control=control.bam

#Negative control sample
pool1_negCTRL:
        $(call getCommand,pool1,pool1_negCTRL_monday_test,pool1-negCTRL_S1_L001_R1_001.fastq.gz,15,30)

How can i say to run_samples.mk that also cleanintermediate(which is in chipcap.mk) should be executed. I've been puzzling a lot but cant find the right way to do it.

Was it helpful?

Solution

cleanintermediate: $(CHIPCAP_OUTPUT)

in chipcap.mk should become cleanintermediate: all

In runchipcap.mk add cleanintermediate to getCommand

getCommand = $(MAKE) -f /data/DIV5/SASC/project-064-ronald-svdz/analysis/pipelines/chipcap/chipcap.mk \
        IN_DIR=/data/DIV5/SASC/project-064-ronald-svdz/input/$(1) \
        OUT_DIR=/data/DIV5/SASC/project-064-ronald-svdz/analysis/runs/$(2) \
        CHIPCAP_VER=0.1.2 \
        FASTQ_EXT=fastq \
        CHIPCAP_INPUT=$(3) \
        CHIPCAP_QC_MODE=cliptrim \
        GZIP_EXT=gz \
        MACS14_EXE=/home/sajvanderzeeuw/.virtualenvs/ronald/bin/macs \
        PYTHON_EXE=/home/sajvanderzeeuw/.virtualenvs/ronald/bin/python2.7 \
        OPT_MACS14_mfold=$(4),$(5) cleanintermediate
        #OPT_MACS14_control=control.bam
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top