Newer
Older
{
"cells": [
{
"cell_type": "markdown",
"metadata": {},
"source": [
"***\n",
"\n",
"[<img src=\"Images/up-arrow.png\" alt=\"Top\" width=2% align=\"right\">](#home \"Go back to the top\")\n",
"\n",
"\n",
"# <span style=\"color: #3987C4;\">I - Workflow configuration <a class=\"anchor\" id=\"workflow\"></a></span>\n",
"\n",
"### <span style=\"color: #919395\"> _Parameters_ <a class=\"anchor\" id=\"configinput\"></a></span>\n"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"print(out_dir, ref_file, vec_file, group_file, fastq_dir) #,cpus)"
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
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"### <span style=\"color: #919395\">_Preparing Genome Reference for next analysis_\n",
"\n",
"#### __Genome indexation__ and __Genome dashboard__\n",
"\n",
"This step is done with `bwa index` if index are absent. Indexation is required before performing reads mapping against genome reference."
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"#from pathlib import Path\n",
"import sys\n",
"\n",
"sys.path.append(\"/home/christine/Documents/Dev/frangiPANe_snake/workflow\")\n",
"from scripts import generate_stats as gs\n",
"gs.dashboard_genome2(\"400\",png,csv)"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"### <span style=\"color: #919395\">_Analyzing Group File_</span> "
]
},
{
"cell_type": "code",
"execution_count": 1,
"metadata": {},
"outputs": [
{
"ename": "NameError",
"evalue": "name 'read_group_file' is not defined",
"output_type": "error",
"traceback": [
"\u001b[0;31m---------------------------------------------------------------------------\u001b[0m",
"\u001b[0;31mNameError\u001b[0m Traceback (most recent call last)",
"\u001b[0;32m<ipython-input-1-e7c314ec7bb8>\u001b[0m in \u001b[0;36m<module>\u001b[0;34m\u001b[0m\n\u001b[1;32m 1\u001b[0m \u001b[0;31m# Reading group file\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m----> 2\u001b[0;31m \u001b[0mid_dict\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mdf_group\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mread_group_file\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mgroup_file\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mvalue\u001b[0m\u001b[0;34m,\u001b[0m\u001b[0mlogger\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 3\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 4\u001b[0m \u001b[0;31m# Group file dashboard\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 5\u001b[0m \u001b[0mdashboard_group\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mdf_group\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n",
"\u001b[0;31mNameError\u001b[0m: name 'read_group_file' is not defined"
]
}
],
"source": [
"# Reading group file\n",
"id_dict, df_group = read_group_file(group_file.value,logger)\n",
"\n",
"# Group file dashboard\n",
"dashboard_group(df_group)\n",
"bgc('LightBlue')"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"***\n",
"\n",
"[<img src=\"Images/up-arrow.png\" alt=\"Top\" width=2% align=\"right\">](#home \"Go back to the top\")\n",
"\n",
"\n",
"# <span style=\"color: #3987C4;\">II - frangiPANe Workflow <a class=\"anchor\" id=\"workflow\"></a></span>\n",
"\n",
"### <span style=\"color: #919395\"> _1 - Stats about raw data (fastq files)_\n",
"\n",
"#### __Generating fastq statistics with `fastq_stats`__\n",
" \n",
"After this stat analysis, several files have been created and saved into 00_fastq_stats directory :\n",
"* one file (fastq-stat) by fastq file\n",
"* one file with all stats : all_fastq-stats.csv"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"#Raw data dashboard\n",
"dashboard_fastq(fastqstat_csv,total_genome_size,df_group)"
]
},
{
"cell_type": "markdown",
"metadata": {
"tags": []
},
"source": [
"### <span style=\"color: #919395\">_2 - Mapping the individuals reads against the reference genome_ <a class=\"anchor\" id=\"mapping\"></a></span>"
]
},
{
"cell_type": "markdown",
"metadata": {
"tags": []
},
"source": [
"#### __Generating mapping stats <a class=\"anchor\" id=\"mappingstat\">__\n",
" \n",
"Statistics are generated by `samtools flagstat` and they are saved into the directory _01_mapping-against_reference_ and the subdirectory _stat_\n",
"\n",
"* One \"flagtstat file\" is generated for each bam file (http://www.htslib.org/doc/samtools-flagstat.html).\n",
"\n",
"* _all_flagstat.csv_ file compiling all the stats\n"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"### Dashboard\n",
"dashboard_flagstat(stat_file,df_group)\n",
"\n",
"bgc('LightBlue')"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"[<img src=\"Images/up-arrow.png\" alt=\"Top\" width=2% align=\"right\">](#home \"Go back to the top\")\n",
"\n",
"\n",
"### <span style=\"color: #919395\">3 - Assembly of the individuals' reads that do not map (properly) on the reference genome <a class=\"anchor\" id=\"assembly\"></a></span>\n"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"tags": []
},
"outputs": [],
"source": [
"dashboard_ab(stat_len,stats_N,stats_L,output_assembly_testplots)\n",
"\n",
"bgc('LightBlue')"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"#### __Assembly step 2 : assembly with the final k value__\n",
"\n",
"### Running ABySS for each individual\n"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"dashboard_assembly(stat_file,df_group)\n"
]
},
{
"cell_type": "markdown",
"metadata": {
"tags": []
},
"source": [
"[<img src=\"Images/up-arrow.png\" alt=\"Top\" width=2% align=\"right\">](#home \"Go back to the top\")\n",
" \n",
"### <span style=\"color: #919395\"> 4 - Removing contamination<a class=\"anchor\" id=\"contamination\"></a></span>\n",
"\n",
"#### __VecScreen__\n"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"dashboard_ass(final_stat_file,df_group)\n",
"\n",
"bgc('LightBlue')\n"
]
},
{
"cell_type": "markdown",
"metadata": {
"tags": []
},
"source": [
"[<img src=\"Images/up-arrow.png\" alt=\"Top\" width=2% align=\"right\">](#home \"Go back to the top\")\n",
" \n",
"### <span style=\"color: #919395\"> 5 - Reducing Sequence Redundancy<a class=\"anchor\" id=\"redundancy\"></a></span>\n",
"\n",
"frangiPANe uses CD-HIT to cluster sequences and to reduce sequence redundancy (inter and intra-species).\n"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"#Dashboard\n",
"dashboard_cdhit(df_cdhit)\n",
"\n",
"bgc('LightBlue')"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"[<img src=\"Images/up-arrow.png\" alt=\"Top\" width=2% align=\"right\">](#home \"Go back to the top\")\n",
" \n",
"### <span style=\"color: #919395\"> 6 - Anchoring Clusters on Reference Genome<a class=\"anchor\" id=\"anchoring\"></a></span>\n",
"\n",
"#### __Generating panreference__\n"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"dashboard_flagstat(stat2_file,df_group)\n",
"\n",
"\n",
"bgc('LightBlue')"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"#### __Panreference dashboard__\n"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"dashboard_anchoring(cdhit_fasta,panref_keep_file,panref_bed_file, output_dir, anc_stat_dict)\n",
"\n",
"bgc('LightBlue')"
]
}
],
"metadata": {
"hide_input": false,
"kernelspec": {
"display_name": "Python 3",
"language": "python",
"name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.8.10"
}
},
"nbformat": 4,
"nbformat_minor": 4
}