forked from SchlossLab/new_project
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
149 lines (115 loc) · 5.61 KB
/
Makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
REFS = data/references
FIGS = results/figures
TABLES = results/tables
PROC = data/process
FINAL = submission/
# utility function to print various variables. For example, running the
# following at the command line:
#
# make print-BAM
#
# will generate:
# BAM=data/raw_june/V1V3_0001.bam data/raw_june/V1V3_0002.bam ...
print-%:
@echo '$*=$($*)'
MAKEFLAGS += --warn-undefined-variables
SHELL := bash
.SHELLFLAGS := -eu -o pipefail
################################################################################
#
# Part 1: Get the references
#
# We will need several reference files to complete the analyses including the
# SILVA reference alignment and RDP reference taxonomy.
#
################################################################################
# We want the latest greatest reference alignment and the SILVA reference
# alignment is the best reference alignment on the market. This version is from
# v123 and described at http://blog.mothur.org/2015/12/03/SILVA-v123-reference-files/
# We will use the SEED v. 123, which contain 12,083 bacterial sequences. This
# also contains the reference taxonomy. We will limit the databases to only
# include bacterial sequences.
$(REFS)/silva.seed.align :
wget -N http://mothur.org/w/images/1/15/Silva.seed_v123.tgz
tar xvzf Silva.seed_v123.tgz silva.seed_v123.align silva.seed_v123.tax
mothur "#get.lineage(fasta=silva.seed_v123.align, taxonomy=silva.seed_v123.tax, taxon=Bacteria);degap.seqs(fasta=silva.seed_v123.pick.align, processors=8)"
mv silva.seed_v123.pick.align $(REFS)/silva.seed.align
rm Silva.seed_v123.tgz silva.seed_v123.*
$(REFS)/silva.v4.align : $(REFS)/silva.seed.align
mothur "#pcr.seqs(fasta=$(REFS)/silva.seed.align, start=11894, end=25319, keepdots=F, processors=8)"
mv $(REFS)/silva.seed.pcr.align $(REFS)/silva.v4.align
# Next, we want the RDP reference taxonomy. The current version is v10 and we
# use a "special" pds version of the database files, which are described at
# http://blog.mothur.org/2014/10/28/RDP-v10-reference-files/
$(REFS)/trainset14_032015.% :
wget -N http://www.mothur.org/w/images/8/88/Trainset14_032015.pds.tgz
tar xvzf Trainset14_032015.pds.tgz trainset14_032015.pds/trainset14_032015.pds.*
mv trainset14_032015.pds/* $(REFS)/
rmdir trainset14_032015.pds
rm Trainset14_032015.pds.tgz
################################################################################
#
# Part 2: Run data through mothur
#
# Process fastq data through the generation of files that will be used in the
# overall analysis.
#
################################################################################
# Change stability to the * part of your *.files file that lives in data/raw/
BASIC_STEM = data/mothur/stability.trim.contigs.good.unique.good.filter.unique.precluster
# here we go from the raw fastq files and the files file to generate a fasta,
# taxonomy, and count_table file that has had the chimeras removed as well as
# any non bacterial sequences.
# Edit code/get_good_seqs.batch to include the proper name of your *files file
$(BASIC_STEM).denovo.uchime.pick.pick.count_table $(BASIC_STEM).pick.pick.fasta $(BASIC_STEM).pick.pds.wang.pick.taxonomy : code/get_good_seqs.batch\
data/references/silva.v4.align\
data/references/trainset14_032015.pds.fasta\
data/references/trainset14_032015.pds.tax
mothur code/get_good_seqs.batch;\
rm data/mothur/*.map
# here we go from the good sequences and generate a shared file and a
# cons.taxonomy file based on OTU data
# Edit code/get_shared_otus.batch to include the proper root name of your files file
# Edit code/get_shared_otus.batch to include the proper group names to remove
$(BASIC_STEM).pick.pick.pick.opti_mcc.unique_list.shared $(BASIC_STEM).pick.pick.pick.opti_mcc.unique_list.0.03.cons.taxonomy : code/get_shared_otus.batch\
$(BASIC_STEM).denovo.uchime.pick.pick.count_table\
$(BASIC_STEM).pick.pick.fasta\
$(BASIC_STEM).pick.pds.wang.pick.taxonomy
mothur code/get_shared_otus.batch
rm $(BASIC_STEM).denovo.uchime.pick.pick.pick.count_table
rm $(BASIC_STEM).pick.pick.pick.fasta
rm $(BASIC_STEM).pick.pds.wang.pick.pick.taxonomy;
# now we want to get the sequencing error as seen in the mock community samples
# Edit code/get_error.batch to include the proper root name of your files file
# Edit code/get_error.batch to include the proper group names for your mocks
$(BASIC_STEM).pick.pick.pick.error.summary : code/get_error.batch\
$(BASIC_STEM).denovo.uchime.pick.pick.count_table\
$(BASIC_STEM).pick.pick.fasta\
$(REFS)/HMP_MOCK.v4.fasta
mothur code/get_error.batch
################################################################################
#
# Part 3: Figure and table generation
#
# Run scripts to generate figures and tables
#
################################################################################
################################################################################
#
# Part 4: Pull it all together
#
# Render the manuscript
#
################################################################################
$(FINAL)/manuscript.% : \ #include data files that are needed for paper don't leave this line with a : \
$(FINAL)/mbio.csl\
$(FINAL)/references.bib\
$(FINAL)/manuscript.Rmd
R -e 'render("$(FINAL)/manuscript.Rmd", clean=FALSE)'
mv $(FINAL)/manuscript.knit.md submission/manuscript.md
rm $(FINAL)/manuscript.utf8.md
write.paper : $(TABLES)/table_1.pdf $(TABLES)/table_2.pdf\ #customize to include
$(FIGS)/figure_1.pdf $(FIGS)/figure_2.pdf\ # appropriate tables and
$(FIGS)/figure_3.pdf $(FIGS)/figure_4.pdf\ # figures
$(FINAL)/manuscript.Rmd $(FINAL)/manuscript.md\
$(FINAL)/manuscript.tex $(FINAL)/manuscript.pdf