| 1 |
############### |
| 2 |
Usage examples |
| 3 |
############### |
| 4 |
|
| 5 |
.. note:: |
| 6 |
|
| 7 |
In the following examples, ``test_data`` can be replaced with the directory containing the FAST5 files |
| 8 |
from your own runs. If you are new to ONT sequencing, the ``test_data`` directory is shipped with ``poretools`` |
| 9 |
for experimentation. |
| 10 |
|
| 11 |
=================== |
| 12 |
poretools ``fastq`` |
| 13 |
=================== |
| 14 |
Extract sequences in FASTQ format from a set of FAST5 files. |
| 15 |
|
| 16 |
.. code-block:: bash |
| 17 |
|
| 18 |
poretools fastq test_data/*.fast5 |
| 19 |
|
| 20 |
Or, if there are too many files for your OS to do the wildcard expansion, just provide a directory. |
| 21 |
``poreutils`` will automatically find all of the FAST5 files in the directory. |
| 22 |
|
| 23 |
.. code-block:: bash |
| 24 |
|
| 25 |
poretools fastq test_data/ |
| 26 |
|
| 27 |
|
| 28 |
Extract sequences in FASTQ format from a set of FAST5 files. |
| 29 |
|
| 30 |
.. code-block:: bash |
| 31 |
|
| 32 |
poretools fastq test_data/ |
| 33 |
poretools fastq --min-length 5000 test_data/ |
| 34 |
poretools fastq --max-length 5000 test_data/ |
| 35 |
poretools fastq --type all test_data/ |
| 36 |
poretools fastq --type fwd test_data/ |
| 37 |
poretools fastq --type rev test_data/ |
| 38 |
poretools fastq --type 2D test_data/ |
| 39 |
poretools fastq --type fwd,rev test_data/ |
| 40 |
|
| 41 |
|
| 42 |
A type of "best" will extract the 2D read, if it exists. If not, it will extract either the template or complement read, whichever is available and has a better average Phred score. |
| 43 |
|
| 44 |
.. code-block:: bash |
| 45 |
|
| 46 |
poretools fastq --type best test_data/ |
| 47 |
|
| 48 |
|
| 49 |
Only extract sequence with more complement events than template. These are the so-called "high quality 2D reads" and are the most accurate sequences from a |
| 50 |
given run. |
| 51 |
|
| 52 |
.. code-block:: bash |
| 53 |
|
| 54 |
poretools fastq --type 2D --high-quality test_data/ |
| 55 |
|
| 56 |
The data in fastq format are returned in standard output. |
| 57 |
|
| 58 |
=================== |
| 59 |
poretools ``fasta`` |
| 60 |
=================== |
| 61 |
Extract sequences in FASTA format from a set of FAST5 files. |
| 62 |
|
| 63 |
.. code-block:: bash |
| 64 |
|
| 65 |
poretools fasta test_data/ |
| 66 |
poretools fasta --min-length 5000 test_data/ |
| 67 |
poretools fasta --max-length 5000 test_data/ |
| 68 |
poretools fasta --type all test_data/ |
| 69 |
poretools fasta --type fwd test_data/ |
| 70 |
poretools fasta --type rev test_data/ |
| 71 |
poretools fasta --type 2D test_data/ |
| 72 |
poretools fasta --type fwd,rev test_data/ |
| 73 |
poretools fasta --type best test_data/ |
| 74 |
|
| 75 |
The data in fasta format are returned in standard output. |
| 76 |
|
| 77 |
===================== |
| 78 |
poretools ``combine`` |
| 79 |
===================== |
| 80 |
Create a tarball from a set of FAST5 (HDF5) files. |
| 81 |
|
| 82 |
.. code-block:: bash |
| 83 |
|
| 84 |
# plain tar (recommended for speed) |
| 85 |
poretools combine -o foo.fast5.tar test_data/*.fast5 |
| 86 |
|
| 87 |
# gzip |
| 88 |
poretools combine -o foo.fast5.tar.gz test_data/*.fast5 |
| 89 |
|
| 90 |
# bzip2 |
| 91 |
poretools combine -o foo.fast5.tar.bz2 test_data/*.fast5 |
| 92 |
|
| 93 |
======================== |
| 94 |
poretools ``yield_plot`` |
| 95 |
======================== |
| 96 |
Create a collector's curve reflecting the sequencing yield over time for a set of reads. There are two types of plots. The first is the yield of reads over time: |
| 97 |
|
| 98 |
.. code-block:: bash |
| 99 |
|
| 100 |
poretools yield_plot --plot-type reads test_data/ |
| 101 |
|
| 102 |
The result should look something like:\ |
| 103 |
|
| 104 |
.. image:: _images/yield.reads.png |
| 105 |
:width: 400pt |
| 106 |
|
| 107 |
The second is the yield of base pairs over time: |
| 108 |
|
| 109 |
.. code-block:: bash |
| 110 |
|
| 111 |
poretools yield_plot --plot-type basepairs test_data/ |
| 112 |
|
| 113 |
The result should look something like: |
| 114 |
|
| 115 |
.. image:: _images/yield.bp.png |
| 116 |
:width: 400pt |
| 117 |
|
| 118 |
Of course, you can save to PDF or PNG with `--saveas`: |
| 119 |
|
| 120 |
.. code-block:: bash |
| 121 |
|
| 122 |
poretools yield_plot \ |
| 123 |
--plot-type basepairs \ |
| 124 |
--saveas foo.pdf\ |
| 125 |
test_data/ |
| 126 |
|
| 127 |
poretools yield_plot \ |
| 128 |
--plot-type basepairs \ |
| 129 |
--saveas foo.png\ |
| 130 |
test_data/ |
| 131 |
|
| 132 |
If you don't like the default aesthetics, try `--theme-bw`: |
| 133 |
|
| 134 |
.. code-block:: bash |
| 135 |
|
| 136 |
poretools yield_plot --theme-bw test_data/ |
| 137 |
|
| 138 |
|
| 139 |
====================== |
| 140 |
poretools ``squiggle`` |
| 141 |
====================== |
| 142 |
Make a "squiggle" plot of the signal over time for a given read or set of reads |
| 143 |
|
| 144 |
.. code-block:: bash |
| 145 |
|
| 146 |
poretools squiggle test_data/foo.fast5 |
| 147 |
|
| 148 |
|
| 149 |
The result should look something like: |
| 150 |
|
| 151 |
.. image:: _images/foo.fast5.png |
| 152 |
:width: 400pt |
| 153 |
|
| 154 |
If you don't like the default aesthetics, try `--theme-bw`: |
| 155 |
|
| 156 |
.. code-block:: bash |
| 157 |
|
| 158 |
poretools squiggle --theme-bw test_data/ |
| 159 |
|
| 160 |
|
| 161 |
Other options: |
| 162 |
|
| 163 |
.. code-block:: bash |
| 164 |
|
| 165 |
# save as PNG |
| 166 |
poretools squiggle --saveas png test_data/foo.fast5 |
| 167 |
|
| 168 |
# save as PDF |
| 169 |
poretools squiggle --saveas pdf test_data/foo.fast5 |
| 170 |
|
| 171 |
# make a PNG for each FAST5 file in a directory |
| 172 |
poretools squiggle --saveas png test_data/ |
| 173 |
|
| 174 |
==================== |
| 175 |
poretools ``winner`` |
| 176 |
==================== |
| 177 |
Report the longest read among a set of FAST5 files. |
| 178 |
|
| 179 |
.. code-block:: bash |
| 180 |
|
| 181 |
poretools winner test_data/ |
| 182 |
poretools winner --type all test_data/ |
| 183 |
poretools winner --type fwd test_data/ |
| 184 |
poretools winner --type rev test_data/ |
| 185 |
poretools winner --type 2D test_data/ |
| 186 |
poretools winner --type fwd,rev test_data/ |
| 187 |
poretools winner --type best test_data/ |
| 188 |
|
| 189 |
=================== |
| 190 |
poretools ``stats`` |
| 191 |
=================== |
| 192 |
Collect read size statistics from a set of FAST5 files. |
| 193 |
|
| 194 |
.. code-block:: bash |
| 195 |
|
| 196 |
poretools stats test_data/ |
| 197 |
total reads 2286.000000 |
| 198 |
total base pairs 8983574.000000 |
| 199 |
mean 3929.822397 |
| 200 |
median 4011.500000 |
| 201 |
min 13.000000 |
| 202 |
max 6864.000000 |
| 203 |
|
| 204 |
=================== |
| 205 |
poretools ``hist`` |
| 206 |
=================== |
| 207 |
Plot a histogram of read sizes from a set of FAST5 files. |
| 208 |
|
| 209 |
.. code-block:: bash |
| 210 |
|
| 211 |
poretools hist test_data/ |
| 212 |
poretools hist --min-length 1000 --max-length 10000 test_data/ |
| 213 |
|
| 214 |
poretools hist --num-bins 20 --max-length 10000 test_data/ |
| 215 |
|
| 216 |
If you don't like the default aesthetics, try `--theme-bw`: |
| 217 |
|
| 218 |
.. code-block:: bash |
| 219 |
|
| 220 |
poretools hist --theme-bw test_data/ |
| 221 |
|
| 222 |
The result should look something like: |
| 223 |
|
| 224 |
.. image:: _images/hist.png |
| 225 |
:width: 400pt |
| 226 |
|
| 227 |
===================== |
| 228 |
poretools ``nucdist`` |
| 229 |
===================== |
| 230 |
Look at the nucleotide composition of a set of FAST5 files. |
| 231 |
|
| 232 |
.. code-block:: bash |
| 233 |
|
| 234 |
poretools nucdist test_data/ |
| 235 |
A 78287 335291 0.233489714904 |
| 236 |
C 75270 335291 0.224491561062 |
| 237 |
T 92575 335291 0.276103444471 |
| 238 |
G 84754 335291 0.252777438106 |
| 239 |
N 4405 335291 0.0131378414571 |
| 240 |
|
| 241 |
====================== |
| 242 |
poretools ``qualdist`` |
| 243 |
====================== |
| 244 |
Look at the quality score composition of a set of FAST5 files. |
| 245 |
|
| 246 |
.. code-block:: bash |
| 247 |
|
| 248 |
poretools qualdist test_data/ |
| 249 |
! 0 83403 335291 0.248748102395 |
| 250 |
" 1 46151 335291 0.137644613187 |
| 251 |
# 2 47463 335291 0.141557632027 |
| 252 |
$ 3 34471 335291 0.102809201559 |
| 253 |
% 4 24879 335291 0.0742012162569 |
| 254 |
& 5 20454 335291 0.0610037251224 |
| 255 |
' 6 16783 335291 0.0500550268274 |
| 256 |
( 7 13699 335291 0.0408570465655 |
| 257 |
) 8 11356 335291 0.0338690868529 |
| 258 |
* 9 9077 335291 0.0270720061081 |
| 259 |
+ 10 6492 335291 0.0193622852984 |
| 260 |
, 11 4891 335291 0.014587328619 |
| 261 |
- 12 3643 335291 0.0108651887465 |
| 262 |
. 13 2585 335291 0.00770972080968 |
| 263 |
/ 14 1969 335291 0.0058725107444 |
| 264 |
0 15 1475 335291 0.00439916371152 |
| 265 |
1 16 1146 335291 0.00341792651756 |
| 266 |
2 17 902 335291 0.00269020045274 |
| 267 |
3 18 790 335291 0.00235616225905 |
| 268 |
4 19 619 335291 0.0018461575169 |
| 269 |
5 20 532 335291 0.00158668142002 |
| 270 |
6 21 440 335291 0.00131229290378 |
| 271 |
7 22 397 335291 0.00118404609727 |
| 272 |
8 23 379 335291 0.00113036138757 |
| 273 |
9 24 313 335291 0.000933517452004 |
| 274 |
: 25 327 335291 0.000975272226215 |
| 275 |
; 26 138 335291 0.000411582774366 |
| 276 |
< 27 121 335291 0.000360880548538 |
| 277 |
= 28 96 335291 0.000286318451733 |
| 278 |
> 29 76 335291 0.000226668774289 |
| 279 |
? 30 69 335291 0.000205791387183 |
| 280 |
@ 31 61 335291 0.000181931516205 |
| 281 |
A 32 48 335291 0.000143159225866 |
| 282 |
B 33 23 335291 6.8597129061e-05 |
| 283 |
C 34 14 335291 4.17547742111e-05 |
| 284 |
D 35 6 335291 1.78949032333e-05 |
| 285 |
F 37 3 335291 8.94745161666e-06 |
| 286 |
|
| 287 |
====================== |
| 288 |
poretools ``qualpos`` |
| 289 |
====================== |
| 290 |
Produce a box-whisker plot of qualoty score distribution over positions in reads. |
| 291 |
|
| 292 |
.. code-block:: bash |
| 293 |
|
| 294 |
poretools qualpos test_data/ |
| 295 |
|
| 296 |
The result should look something like: |
| 297 |
|
| 298 |
.. image:: _images/qualpos.png |
| 299 |
:width: 400pt |
| 300 |
|
| 301 |
===================== |
| 302 |
poretools ``tabular`` |
| 303 |
===================== |
| 304 |
Dump the length, name, seq, and qual of the sequence in one or a set of FAST5 files. |
| 305 |
|
| 306 |
.. code-block:: bash |
| 307 |
|
| 308 |
poretools tabular foo.fast5 |
| 309 |
length name sequence quals |
| 310 |
10 @channel_100_read_14_complement GTCCCCAACAACAC $%%'"$"%!) |
| 311 |
|
| 312 |
==================== |
| 313 |
poretools ``events`` |
| 314 |
==================== |
| 315 |
Extract the raw nanopore events from each FAST5 file. |
| 316 |
|
| 317 |
.. code-block:: bash |
| 318 |
|
| 319 |
poretools events test_data/ | head -5 |
| 320 |
file strand mean start stdv length model_state model_level move p_model_state mp_model_state p_mp_model_state p_A p_C p_G p_T raw_index |
| 321 |
test_data/2016_3_4_3507_1_ch120_read240_strand.fast5 template 58.3245290305 1559.89409031 1.34165996292 0.0146082337317 CGACTT 58.1304809188 0 0.0226559 CATCTT 0.0229866 0.284469 0.130683 0.137386 0.447461 |
| 322 |
test_data/2016_3_4_3507_1_ch120_read240_strand.fast5 template 50.1420877511 1559.90869854 0.921372775302 0.0348605577689 GACTTT 49.3934875964 1 0.0849836 GACTTT 0.0849836 0.257314 0.350541 0.101351 0.290794 |
| 323 |
test_data/2016_3_4_3507_1_ch120_read240_strand.fast5 template 47.5841029424 1559.9435591 0.771398562801 0.00763612217795 ACTTTG 48.2080162623 1 0.108899 TCTTTG 0.13079 0.000477931 0.00853333 0.306356 0.684632 |
| 324 |
test_data/2016_3_4_3507_1_ch120_read240_strand.fast5 template 51.5879264562 1559.95119522 0.684238307171 0.0112881806109 CTTTGA 52.7784154546 1 0.110625 CTTTGG 0.121103 4.69995e-06 0.00382846 0.0169048 0.979262 |
| 325 |
|
| 326 |
Extract the pre-basecalled events from each FAST5 file. |
| 327 |
|
| 328 |
.. code-block:: bash |
| 329 |
|
| 330 |
poretools events --pre-basecalled test_data/ | head -5 |
| 331 |
file strand mean start stdv length model_state model_level move p_model_state mp_model_state p_mp_model_state p_A p_C p_G p_T raw_index |
| 332 |
burn-in-run-2/ch100_file15_strand.fast5 pre_basecalled 51.4652695313 5352344 0.655003995591 35 |
| 333 |
burn-in-run-2/ch100_file15_strand.fast5 pre_basecalled 60.1776123047 5352379 1.05143911309 18 |
| 334 |
burn-in-run-2/ch100_file15_strand.fast5 pre_basecalled 48.9152374359 5352397 0.864834628834 67 |
| 335 |
burn-in-run-2/ch100_file15_strand.fast5 pre_basecalled 55.4002178596 5352464 1.75915620083 17 |
| 336 |
|
| 337 |
=================== |
| 338 |
poretools ``times`` |
| 339 |
=================== |
| 340 |
|
| 341 |
.. code-block:: bash |
| 342 |
|
| 343 |
poretools times test_data/ | head -5 |
| 344 |
channel filename read_length exp_starttime unix_timestamp duration unix_timestamp_end iso_timestamp day hour minute |
| 345 |
120 test_data/2016_3_4_3507_1_ch120_read240_strand.fast5 5826 1457127309 1457128868 47 1457128915 2016-03-04T15:01:08-0700 04 15 01 |
| 346 |
120 test_data/2016_3_4_3507_1_ch120_read353_strand.fast5 3399 1457127309 1457129863 28 1457129891 2016-03-04T15:17:43-0700 04 15 17 |
| 347 |
120 test_data/2016_3_4_3507_1_ch120_read415_strand.fast5 2640 1457127309 1457130808 24 1457130832 2016-03-04T15:33:28-0700 04 15 33 |
| 348 |
120 test_data/2016_3_4_3507_1_ch120_read418_strand.fast5 3487 1457127309 1457130851 31 1457130882 2016-03-04T15:34:11-0700 04 15 34 |
| 349 |
|
| 350 |
======================= |
| 351 |
poretools ``occupancy`` |
| 352 |
======================= |
| 353 |
Plot the throughput performance of each pore on the flowcell during a given sequencing run. |
| 354 |
|
| 355 |
.. code-block:: bash |
| 356 |
|
| 357 |
poretools occupancy test_data/ |
| 358 |
|
| 359 |
The result should look something like: |
| 360 |
|
| 361 |
.. image:: _images/occupancy.png |
| 362 |
:width: 400pt |
| 363 |
|
| 364 |
|
| 365 |
=================== |
| 366 |
poretools ``index`` |
| 367 |
=================== |
| 368 |
Tabulate all file location info and metadata such as ASIC ID and temperature from a set of FAST5 files |
| 369 |
|
| 370 |
.. code-block:: bash |
| 371 |
|
| 372 |
poretools index test_data | head -5 | column -t |
| 373 |
source_filename template_fwd_length complement_rev_length 2d_length asic_id asic_temp heatsink_temp channel exp_start_time exp_start_time_string_date exp_start_time_string_time start_time start_time_string_date start_time_string_time duration fast5_version |
| 374 |
test_data/2016_3_4_3507_1_ch120_read240_strand.fast5 5826 5011 5079 3571011476 30.37 36.99 120 1457127309 2016-Mar-04 (Fri) 14:35:09 1457128868 2016-Mar-04 (Fri) 15:01:08 47 metrichor1.16 |
| 375 |
test_data/2016_3_4_3507_1_ch120_read353_strand.fast5 3399 2962 2940 3571011476 30.37 36.99 120 1457127309 2016-Mar-04 (Fri) 14:35:09 1457129863 2016-Mar-04 (Fri) 15:17:43 28 metrichor1.16 |
| 376 |
test_data/2016_3_4_3507_1_ch120_read415_strand.fast5 2640 2244 2428 3571011476 30.37 36.99 120 1457127309 2016-Mar-04 (Fri) 14:35:09 1457130808 2016-Mar-04 (Fri) 15:33:28 24 metrichor1.16 |
| 377 |
test_data/2016_3_4_3507_1_ch120_read418_strand.fast5 3487 2950 3384 3571011476 30.37 36.99 120 1457127309 2016-Mar-04 (Fri) 14:35:09 1457130851 2016-Mar-04 (Fri) 15:34:11 31 metrichor1.16 |
| 378 |
|
| 379 |
|
| 380 |
====================== |
| 381 |
poretools ``metadata`` |
| 382 |
======================= |
| 383 |
Extract the metadata from the fast5 file |
| 384 |
|
| 385 |
.. code-block:: bash |
| 386 |
|
| 387 |
poretools metadata 013731_11rx_v2_3135_1_ch20_file19_strand.fast5 |
| 388 |
|
| 389 |
asic_id asic_temp heatsink_temp |
| 390 |
31037 28.11 37.88 |
| 391 |
|
| 392 |
poretools metadata --read 013731_11rx_v2_3135_1_ch20_file19_strand.fast5 |
| 393 |
filename scaling_used abasic_peak_height hairpin_polyt_level median_before start_time read_id read_number hairpin_peak_height abasic_found abasic_event_index duration start_mux hairpin_found hairpin_event_index |
| 394 |
013731_11rx_v2_3135_1_ch20_file19_strand.fast5 1 124.31769966 0.413218809334 226.393825112 4648221 3b4e45bf-6d42-45bc-9314-1d8a630971c2 19 125.783167256 1 2 195322 4 1 1478 |
| 395 |
|
| 396 |
|
| 397 |
|
| 398 |
|