Debian Codegraph @

docs/Fast5_to_seq_summary/CLI_usage.ipynb

raw
1 {
2 "cells": [
3 {
4 "cell_type": "markdown",
5 "metadata": {},
6 "source": [
7 "# Fast5_to_seq_summary CLI Usage"
8 ]
9 },
10 {
11 "cell_type": "markdown",
12 "metadata": {},
13 "source": [
14 "## Activate virtual environment"
15 ]
16 },
17 {
18 "cell_type": "code",
19 "execution_count": 1,
20 "metadata": {
21 "ExecuteTime": {
22 "end_time": "2020-01-09T16:59:07.547949Z",
23 "start_time": "2020-01-09T16:59:06.847121Z"
24 }
25 },
26 "outputs": [
27 {
28 "name": "stdout",
29 "output_type": "stream",
30 "text": [
31 "(pycoQC) "
32 ]
33 },
34 {
35 "ename": "",
36 "evalue": "1",
37 "output_type": "error",
38 "traceback": []
39 }
40 ],
41 "source": [
42 "# Using virtualenvwrapper here but can also be done with Conda \n",
43 "workon pycoQC"
44 ]
45 },
46 {
47 "cell_type": "markdown",
48 "metadata": {},
49 "source": [
50 "## Getting help"
51 ]
52 },
53 {
54 "cell_type": "code",
55 "execution_count": 2,
56 "metadata": {
57 "ExecuteTime": {
58 "end_time": "2020-01-09T16:59:11.017141Z",
59 "start_time": "2020-01-09T16:59:08.561543Z"
60 }
61 },
62 "outputs": [
63 {
64 "name": "stdout",
65 "output_type": "stream",
66 "text": [
67 "usage: Fast5_to_seq_summary [-h] [--version] --fast5_dir FAST5_DIR\n",
68 " --seq_summary_fn SEQ_SUMMARY_FN\n",
69 " [--max_fast5 MAX_FAST5] [--threads THREADS]\n",
70 " [--basecall_id BASECALL_ID]\n",
71 " [--fields FIELDS [FIELDS ...]] [--include_path]\n",
72 " [--verbose_level VERBOSE_LEVEL]\n",
73 "\n",
74 "Fast5_to_seq_summary generate a sequencing summary like file from a directory\n",
75 "containing Fast5 files\n",
76 "\n",
77 "optional arguments:\n",
78 " -h, --help show this help message and exit\n",
79 " --version, -v show program's version number and exit\n",
80 " --fast5_dir FAST5_DIR, -f FAST5_DIR\n",
81 " Directory containing fast5 files. Can contain multiple\n",
82 " subdirectories\n",
83 " --seq_summary_fn SEQ_SUMMARY_FN, -s SEQ_SUMMARY_FN\n",
84 " path of the summary sequencing file where to write the\n",
85 " data extracted from the fast5 files\n",
86 " --max_fast5 MAX_FAST5\n",
87 " Maximum number of file to try to parse. 0 to\n",
88 " deactivate (default: 0)\n",
89 " --threads THREADS, -t THREADS\n",
90 " Total number of threads to use. 1 thread is used for\n",
91 " the reader and 1 for the writer. Minimum 3 (default:\n",
92 " 4)\n",
93 " --basecall_id BASECALL_ID\n",
94 " id of the basecalling group. By default leave to 0,\n",
95 " but if you perfome multiple basecalling on the same\n",
96 " fast5 files, this can be used to indicate the\n",
97 " corresponding group (1, 2 ...) (default: 0)\n",
98 " --fields FIELDS [FIELDS ...]\n",
99 " list of field names corresponding to attributes to try\n",
100 " to fetch from the fast5 files (default: ['read_id',\n",
101 " 'run_id', 'channel', 'start_time',\n",
102 " 'sequence_length_template', 'mean_qscore_template',\n",
103 " 'calibration_strand_genome_template',\n",
104 " 'barcode_arrangement'])\n",
105 " --include_path If given, the absolute path to the corresponding file\n",
106 " is added in an extra column (default: False)\n",
107 " --verbose_level VERBOSE_LEVEL\n",
108 " Level of verbosity, from 2 (Chatty) to 0 (Nothing)\n",
109 " (default: 0)\n",
110 "(pycoQC) "
111 ]
112 },
113 {
114 "ename": "",
115 "evalue": "1",
116 "output_type": "error",
117 "traceback": []
118 }
119 ],
120 "source": [
121 "Fast5_to_seq_summary -h"
122 ]
123 },
124 {
125 "cell_type": "markdown",
126 "metadata": {},
127 "source": [
128 "## Usage examples"
129 ]
130 },
131 {
132 "cell_type": "markdown",
133 "metadata": {},
134 "source": [
135 "### Basic usage "
136 ]
137 },
138 {
139 "cell_type": "code",
140 "execution_count": 3,
141 "metadata": {
142 "ExecuteTime": {
143 "end_time": "2020-01-09T16:59:17.829814Z",
144 "start_time": "2020-01-09T16:59:15.026532Z"
145 },
146 "scrolled": true
147 },
148 "outputs": [
149 {
150 "name": "stdout",
151 "output_type": "stream",
152 "text": [
153 "22 reads [00:00, 811.31 reads/s]\n",
154 "Total reads: 22 / Average speed: 543.6 reads/s\n",
155 "\n",
156 "(pycoQC) (pycoQC) read_id\trun_id\tchannel\tstart_time\tsequence_length_template\tmean_qscore_template\tcalibration_strand_genome_template\n",
157 "5b7fadd0-c646-4c7b-9800-66ee658a5ca8\t40ebe55356ada6c830fa793745ef4c498d896c73\t150\t37\t468\t7.608\tfiltered_out\n",
158 "e6a8e4d0-7b3c-471a-be26-fa7857d12663\t40ebe55356ada6c830fa793745ef4c498d896c73\t318\t15\t392\t8.304\tfiltered_out\n",
159 "2c32553e-62c6-4c7a-bf05-249771364f04\t40ebe55356ada6c830fa793745ef4c498d896c73\t237\t11\t1151\t8.544\tfiltered_out\n",
160 "f8325de9-a77e-4616-a4a8-69ecf32e1688\t40ebe55356ada6c830fa793745ef4c498d896c73\t354\t16\t568\t8.206\tfiltered_out\n",
161 "6af04302-04c8-4d8d-8e87-aa69178b3f24\t40ebe55356ada6c830fa793745ef4c498d896c73\t36\t26\t832\t8.234\tfiltered_out\n",
162 "3e81c32a-f2ee-4719-a88d-e0affe93d26f\t40ebe55356ada6c830fa793745ef4c498d896c73\t348\t24\t1137\t8.124\tfiltered_out\n",
163 "68804104-71dc-465c-b82d-3a99a4689701\t40ebe55356ada6c830fa793745ef4c498d896c73\t38\t20\t1010\t8.325\tfiltered_out\n",
164 "37dfa1d5-5d84-486c-bf47-9eb6438f5645\t40ebe55356ada6c830fa793745ef4c498d896c73\t410\t30\t555\t8.219\tfiltered_out\n",
165 "3784283c-47cc-48ac-8d7b-7efd32123b56\t40ebe55356ada6c830fa793745ef4c498d896c73\t243\t20\t893\t8.54\tfiltered_out\n",
166 "(pycoQC) "
167 ]
168 },
169 {
170 "ename": "",
171 "evalue": "1",
172 "output_type": "error",
173 "traceback": []
174 }
175 ],
176 "source": [
177 "Fast5_to_seq_summary \\\n",
178 " -f data/ \\\n",
179 " -s results/summary_sequencing.tsv\n",
180 " \n",
181 "head results/summary_sequencing.tsv"
182 ]
183 },
184 {
185 "cell_type": "markdown",
186 "metadata": {},
187 "source": [
188 "### Multi-threading support"
189 ]
190 },
191 {
192 "cell_type": "code",
193 "execution_count": 4,
194 "metadata": {
195 "ExecuteTime": {
196 "end_time": "2020-01-09T16:59:22.029115Z",
197 "start_time": "2020-01-09T16:59:19.426510Z"
198 }
199 },
200 "outputs": [
201 {
202 "name": "stdout",
203 "output_type": "stream",
204 "text": [
205 "22 reads [00:00, 1129.77 reads/s]\n",
206 "Total reads: 22 / Average speed: 650.82 reads/s\n",
207 "\n",
208 "(pycoQC) (pycoQC) read_id\trun_id\tchannel\tstart_time\tsequence_length_template\tmean_qscore_template\tcalibration_strand_genome_template\n",
209 "5b7fadd0-c646-4c7b-9800-66ee658a5ca8\t40ebe55356ada6c830fa793745ef4c498d896c73\t150\t37\t468\t7.608\tfiltered_out\n",
210 "e6a8e4d0-7b3c-471a-be26-fa7857d12663\t40ebe55356ada6c830fa793745ef4c498d896c73\t318\t15\t392\t8.304\tfiltered_out\n",
211 "f8325de9-a77e-4616-a4a8-69ecf32e1688\t40ebe55356ada6c830fa793745ef4c498d896c73\t354\t16\t568\t8.206\tfiltered_out\n",
212 "2c32553e-62c6-4c7a-bf05-249771364f04\t40ebe55356ada6c830fa793745ef4c498d896c73\t237\t11\t1151\t8.544\tfiltered_out\n",
213 "6af04302-04c8-4d8d-8e87-aa69178b3f24\t40ebe55356ada6c830fa793745ef4c498d896c73\t36\t26\t832\t8.234\tfiltered_out\n",
214 "68804104-71dc-465c-b82d-3a99a4689701\t40ebe55356ada6c830fa793745ef4c498d896c73\t38\t20\t1010\t8.325\tfiltered_out\n",
215 "3e81c32a-f2ee-4719-a88d-e0affe93d26f\t40ebe55356ada6c830fa793745ef4c498d896c73\t348\t24\t1137\t8.124\tfiltered_out\n",
216 "37dfa1d5-5d84-486c-bf47-9eb6438f5645\t40ebe55356ada6c830fa793745ef4c498d896c73\t410\t30\t555\t8.219\tfiltered_out\n",
217 "3784283c-47cc-48ac-8d7b-7efd32123b56\t40ebe55356ada6c830fa793745ef4c498d896c73\t243\t20\t893\t8.54\tfiltered_out\n",
218 "(pycoQC) "
219 ]
220 },
221 {
222 "ename": "",
223 "evalue": "1",
224 "output_type": "error",
225 "traceback": []
226 }
227 ],
228 "source": [
229 "Fast5_to_seq_summary \\\n",
230 " -f data/ \\\n",
231 " -s results/summary_sequencing.tsv \\\n",
232 " -t 6\n",
233 " \n",
234 "head results/summary_sequencing.tsv"
235 ]
236 },
237 {
238 "cell_type": "markdown",
239 "metadata": {},
240 "source": [
241 "### Customize fields of the summary file"
242 ]
243 },
244 {
245 "cell_type": "code",
246 "execution_count": 5,
247 "metadata": {
248 "ExecuteTime": {
249 "end_time": "2020-01-09T16:59:26.605976Z",
250 "start_time": "2020-01-09T16:59:23.741610Z"
251 }
252 },
253 "outputs": [
254 {
255 "name": "stdout",
256 "output_type": "stream",
257 "text": [
258 "Check input data and options\n",
259 "Start processing fast5 files\n",
260 "22 reads [00:00, 821.28 reads/s]\n",
261 "Overall counts \tvalid files: 22\n",
262 "\n",
263 "fields found \tmean_qscore_template: 22\n",
264 "\tcalled_events: 22\n",
265 "\tduration: 22\n",
266 "\tstrand_score: 22\n",
267 "\n",
268 "fields not found \n",
269 "Total reads: 22 / Average speed: 464.09 reads/s\n",
270 "\n",
271 "(pycoQC) (pycoQC) mean_qscore_template\tcalled_events\tduration\tstrand_score\n",
272 "8.304\t1547\t23218\t-0.0008\n",
273 "8.325\t3846\t57697\t-0.0004\n",
274 "7.608\t1615\t24233\t-0.0007\n",
275 "8.219\t2080\t31208\t-0.0011\n",
276 "7.805\t1438\t21583\t-0.0006\n",
277 "8.544\t3740\t56107\t-0.0003\n",
278 "8.23\t2778\t51387\t-0.0007\n",
279 "8.741\t3117\t46767\t-0.0006\n",
280 "8.987\t4235\t63526\t-0.0003\n",
281 "(pycoQC) "
282 ]
283 },
284 {
285 "ename": "",
286 "evalue": "1",
287 "output_type": "error",
288 "traceback": []
289 }
290 ],
291 "source": [
292 "Fast5_to_seq_summary \\\n",
293 " -f data/ \\\n",
294 " -s results/custom_summary_sequencing.tsv \\\n",
295 " --verbose_level 1 \\\n",
296 " --fields mean_qscore_template called_events duration strand_score\n",
297 " \n",
298 "head results/custom_summary_sequencing.tsv"
299 ]
300 },
301 {
302 "cell_type": "markdown",
303 "metadata": {},
304 "source": [
305 "### Add file path"
306 ]
307 },
308 {
309 "cell_type": "code",
310 "execution_count": 6,
311 "metadata": {
312 "ExecuteTime": {
313 "end_time": "2020-01-09T16:59:30.169908Z",
314 "start_time": "2020-01-09T16:59:27.269554Z"
315 }
316 },
317 "outputs": [
318 {
319 "name": "stdout",
320 "output_type": "stream",
321 "text": [
322 "Check input data and options\n",
323 "Start processing fast5 files\n",
324 "22 reads [00:00, 493.99 reads/s]\n",
325 "Overall counts \tvalid files: 22\n",
326 "\n",
327 "fields found \tread_id: 22\n",
328 "\trun_id: 22\n",
329 "\tchannel: 22\n",
330 "\tstart_time: 22\n",
331 "\tsequence_length_template: 22\n",
332 "\tmean_qscore_template: 22\n",
333 "\tcalibration_strand_genome_template: 22\n",
334 "\n",
335 "fields not found \tbarcode_arrangement: 22\n",
336 "\n",
337 "Total reads: 22 / Average speed: 364.14 reads/s\n",
338 "\n",
339 "(pycoQC) (pycoQC) read_id\trun_id\tchannel\tstart_time\tsequence_length_template\tmean_qscore_template\tcalibration_strand_genome_template\tpath\n",
340 "5b7fadd0-c646-4c7b-9800-66ee658a5ca8\t40ebe55356ada6c830fa793745ef4c498d896c73\t150\t37\t468\t7.608\tfiltered_out\t/home/aleg/Programming/Packages/pycoQC/docs/Fast5_to_seq_summary/data/20180625_FAH77625_MN23126_sequencing_run_S1_57529_read_10_ch_150_strand.fast5\n",
341 "2c32553e-62c6-4c7a-bf05-249771364f04\t40ebe55356ada6c830fa793745ef4c498d896c73\t237\t11\t1151\t8.544\tfiltered_out\t/home/aleg/Programming/Packages/pycoQC/docs/Fast5_to_seq_summary/data/20180625_FAH77625_MN23126_sequencing_run_S1_57529_read_10_ch_237_strand.fast5\n",
342 "e6a8e4d0-7b3c-471a-be26-fa7857d12663\t40ebe55356ada6c830fa793745ef4c498d896c73\t318\t15\t392\t8.304\tfiltered_out\t/home/aleg/Programming/Packages/pycoQC/docs/Fast5_to_seq_summary/data/20180625_FAH77625_MN23126_sequencing_run_S1_57529_read_10_ch_318_strand.fast5\n",
343 "f8325de9-a77e-4616-a4a8-69ecf32e1688\t40ebe55356ada6c830fa793745ef4c498d896c73\t354\t16\t568\t8.206\tfiltered_out\t/home/aleg/Programming/Packages/pycoQC/docs/Fast5_to_seq_summary/data/20180625_FAH77625_MN23126_sequencing_run_S1_57529_read_10_ch_354_strand.fast5\n",
344 "3e81c32a-f2ee-4719-a88d-e0affe93d26f\t40ebe55356ada6c830fa793745ef4c498d896c73\t348\t24\t1137\t8.124\tfiltered_out\t/home/aleg/Programming/Packages/pycoQC/docs/Fast5_to_seq_summary/data/20180625_FAH77625_MN23126_sequencing_run_S1_57529_read_10_ch_348_strand.fast5\n",
345 "37dfa1d5-5d84-486c-bf47-9eb6438f5645\t40ebe55356ada6c830fa793745ef4c498d896c73\t410\t30\t555\t8.219\tfiltered_out\t/home/aleg/Programming/Packages/pycoQC/docs/Fast5_to_seq_summary/data/20180625_FAH77625_MN23126_sequencing_run_S1_57529_read_10_ch_410_strand.fast5\n",
346 "9a1c5296-2ab1-4abd-8d50-e059754cf332\t40ebe55356ada6c830fa793745ef4c498d896c73\t319\t33\t1235\t8.119\tfiltered_out\t/home/aleg/Programming/Packages/pycoQC/docs/Fast5_to_seq_summary/data/20180625_FAH77625_MN23126_sequencing_run_S1_57529_read_10_ch_319_strand.fast5\n",
347 "6af04302-04c8-4d8d-8e87-aa69178b3f24\t40ebe55356ada6c830fa793745ef4c498d896c73\t36\t26\t832\t8.234\tfiltered_out\t/home/aleg/Programming/Packages/pycoQC/docs/Fast5_to_seq_summary/data/20180625_FAH77625_MN23126_sequencing_run_S1_57529_read_10_ch_36_strand.fast5\n",
348 "0ef36fa0-7c3f-47f5-8410-027f50724701\t40ebe55356ada6c830fa793745ef4c498d896c73\t108\t26\t915\t9.407\tfiltered_out\t/home/aleg/Programming/Packages/pycoQC/docs/Fast5_to_seq_summary/data/20180625_FAH77625_MN23126_sequencing_run_S1_57529_read_10_ch_108_strand.fast5\n",
349 "(pycoQC) "
350 ]
351 },
352 {
353 "ename": "",
354 "evalue": "1",
355 "output_type": "error",
356 "traceback": []
357 }
358 ],
359 "source": [
360 "Fast5_to_seq_summary \\\n",
361 " -f data/ \\\n",
362 " -s results/fn_summary_sequencing.tsv \\\n",
363 " --verbose_level 1 \\\n",
364 " --include_path\n",
365 " \n",
366 "head results/fn_summary_sequencing.tsv"
367 ]
368 }
369 ],
370 "metadata": {
371 "celltoolbar": "Initialization Cell",
372 "hide_input": false,
373 "kernelspec": {
374 "display_name": "Bash",
375 "language": "bash",
376 "name": "bash"
377 },
378 "language_info": {
379 "codemirror_mode": "shell",
380 "file_extension": ".sh",
381 "mimetype": "text/x-sh",
382 "name": "bash"
383 },
384 "widgets": {
385 "state": {},
386 "version": "1.1.1"
387 }
388 },
389 "nbformat": 4,
390 "nbformat_minor": 1
391 }