很抱歉,如果这是一个副本,但我似乎无法在任何地方找到它。
我正在制作一个创建大量中间文件的makefile,其中很多都是非常大的。我已经设置了makefile,所以我会随着时间的推移删除这些中间文件,但似乎它不会再回来咬我了。
例如,如果file10仅依赖于file9,我会依赖于:
file10 : file9
file9 : file8
etc...
如果我正在创建file10
的步骤,我会删除除file9之外的所有内容。但是,如果我删除所有文件,然后执行命令:
make file10
正在创建所有中间文件...我已尝试将文件名标记为.INTERMEDIATE : file8 file7 ... etc
和.SECONDARY : ...
,但这似乎并未改变无论如何。
我意识到这可能是make的一个很好的功能,但是我想知道我是否可以以任何方式禁用它?
谢谢!
编辑:这是完整的makefile。对于某些人来说,这可能有点草率,我是非常新的makefiles。有一点需要注意,' fastq-dump'函数将为文件提供* _1.fastq和(在某些情况下)也为* _2.fastq。这就是为什么依赖性在开始时很奇怪
## all : execute all functions in this makefile (currently not being implemented)
all:
## run_bqsr : runs bqsr on data using SNPs identified using SAMTOOLS mpileup command
.PHONY : run_bqsr
run_bqsr : $(BAMFILE)_recal_data.grp
module load R_3.2.2 && java -jar /opt/gatk/3.3-0/GenomeAnalysisTK.jar -T BaseRecalibrator -nct 8 -R $(REF_GENOME_PATH) -I $(BAMFILE)_realigned_reads.bam -BQSR $(BAMFILE)_recal_data.grp -o $(BAMFILE)_post_recal_data.grp -plots $(BAMFILE)_after_recal.pdf
%_recal_data.grp : %_mpileup.bcf
module load module load R_3.2.2 && java -jar /opt/gatk/3.3-0/GenomeAnalysisTK.jar -T BaseRecalibrator -nct 8 -R $(REF_GENOME_PATH) -I $*_realigned_reads.bam -knownSites $*_mpileup.bcf -o $*_recal_data.grp -plots $*_before_recal.pdf
# create a reference of 'known' SNPs using samtools mpileup. use the -B option to increase sensitivity (important not to include false negatives in analysis because it will mess up the process of adjusting base scores
%_mpileup.bcf : %_realigned_reads.bam
module load samtools_1.2 && samtools mpileup -C50 --BCF -B -f $(REF_GENOME_PATH) $*_realigned_reads.bam -o $*_mpileup.bcf
## realign_indels : realign raw sequencing reads around indels using GATK's RealignerTargetCreator and IndelRealiner
.PHONY : realign_indels
realign_indels : $(BAMFILE)_realigned_reads.bam
%_realigned_reads.bam : %_target_intervals.list
java -jar /opt/gatk/3.3-0/GenomeAnalysisTK.jar -T IndelRealigner -R $(REF_GENOME_PATH) -I $(BAMFILE)_dedup_reads.bam -targetIntervals $*_target_intervals.list -o $*_realigned_reads.bam && rm $(BAMFILE)_dedup_reads.ba* $(BAMFILE)_target_intervals.list
%_target_intervals.list : $(BAMFILE)_dedup_reads.bam
java -jar /opt/gatk/3.3-0/GenomeAnalysisTK.jar -T RealignerTargetCreator -nt 8 -R $(REF_GENOME_PATH) -I $(BAMFILE)_dedup_reads.bam -o $*_target_intervals.list
## remove_dups : remove duplicate reads from SAMfiles, sort, and convert to a single merged BAM file
.PHONY : remove_dups
remove_dups : $(BAMFILE)_dedup_reads.bam
$(BAMFILE)_dedup_reads.bam : $(SAMFILES)
mkdir -p $(BAMFILE_DIR)/metrics; java -jar /opt/picard/1.72/MarkDuplicates.jar $(addprefix I=, $(SAMFILES)) OUTPUT=$(BAMFILE)_dedup_reads.bam M=$(BAMFILE_DIR)/metrics/$(QUERY_INPUT).metrics && java -jar /opt/picard/1.72/BuildBamIndex.jar I=$(BAMFILE)_dedup_reads.bam && rm -r $(SAMFILE_TEMPDIR)/* $(FASTQ_DIR)/*
#mark samfiles and fastq files as secondary:
.INTERMEDIATE : $(SAMFILE_TEMPDIR)/* $(FASTQ_DIR)/*
## map_fastqs : map fastq files to appropriate genome
.PHONY : map_fastqs
map_fastqs : $(SAMFILES)
%_sorted.sam : $(FASTQs)
module load bwa_0.7.13; mkdir -p $(dir $*) ; if echo $(PAIRED) | grep $(notdir $*); then bwa mem -M -R '@RG\tID:$(notdir $*)$(RG)' $(REF_GENOME_PATH) $(FASTQ_DIR)/$(notdir $*)_1.fastq $(FASTQ_DIR)/$(notdir $*)_2.fastq > $*.sam ; else bwa mem -M -R '@RG\tID:$(notdir $*)$(RG)' $(REF_GENOME_PATH) $(FASTQ_DIR)/$(notdir $*)_1.fastq > $*.sam; fi && java -jar /opt/picard/1.72/SortSam.jar I=$*.sam O=$*_sorted.sam SORT_ORDER=coordinate
## print_fastqs : print full path fastq files to be written
.PHONY : print_fastqs
print_fastqs :
@echo $(addprefix ../FASTQ/$(QUERY_INPUT)/,$(ALL_FASTQs))
## get_fastqs : get all fastq files for particular query:
.PHONY : get_fastqs
get_fastqs : $(ALL_FASTQs)
%_2.fastq : %_1.fastq
$(MARK_READS_EXE) $*_1.fastq && $(MARK_READS_EXE) $*_2.fastq
%_1.fastq :
mkdir -p $(dir $*); cd $(dir $*); $(FASTQDUMP_EXE) --split-files -F -I -X 10000 $(notdir $*)
#$(ALL_FASTQs) : $(FASTQs)
# echo $* $<
## give_org : print organism of this biosample
.PHONY : give_org
give_org :
@echo $(ORGANISM)
## print_SRRs : print the SRR files that will be downloaded
.PHONY : print_SRRs
print_SRRs :
@printf '\nPAIRED = $(PAIRED)\nUNPAIRED = $(UNPAIRED)\n'
## clean : clean up temporary files
.PHONY : clean
clean :
rm $(FASTQ_DIR)/SRR* $(SAMFILE_TEMPDIR)/*.sam $(BAMFILE_DIR)/$(QUERY_INPUT)*
## help : print help statement
.PHONY : help
help : makefile
@sed -n 's/^##//p' $<
答案 0 :(得分:1)
假设我已正确理解您的问题与您的makefile有何关联,%_1.fastq :
没有任何先决条件,这意味着make 始终重制任何匹配的目标这种模式如果不存在的话。
如果它有任何先决条件,那么添加它们,如果没有,那么这些文件根本就不是中间文件,你需要通过使用类似
之类的明确目标来告诉make。$(filter %_1.fastq,$(ALL_FASTQs)):
# Recipe
你可以对.PRECIOUS: %_1.fastq
做同样的事情,虽然这会在配方失败时留下文件的额外效果,这可能不是你想要的。