File: cli.rst

package info (click to toggle)
python-cooler 0.10.3-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 32,600 kB
  • sloc: python: 11,033; makefile: 173; sh: 31
file content (1448 lines) | stat: -rw-r--r-- 34,830 bytes parent folder | download
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
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
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
.. _cli-reference:

CLI Reference
=============

.. toctree::
   :maxdepth: 1


Quick reference
---------------

.. program:: cooler
.. code-block:: shell

    cooler [OPTIONS] COMMAND [ARGS]...


.. list-table::
    :widths: 25 100
    :align: left
    :header-rows: 1

    * - Data ingest
      -
    * - `cooler cload`_
      - Create a cooler from genomic point pairs and bins.
    * - `cooler load`_
      - Create a cooler from a pre-binned matrix.

.. list-table::
    :widths: 25 100
    :align: left
    :header-rows: 1

    * - Reduction
      -
    * - `cooler merge`_
      - Merge multiple coolers with identical axes.
    * - `cooler coarsen`_
      - Coarsen a cooler to a lower resolution.
    * - `cooler zoomify`_
      - Generate a multi-resolution cooler file by coarsening.

.. list-table::
    :widths: 25 100
    :align: left
    :header-rows: 1

    * -  Normalization
      -
    * - `cooler balance`_
      - Out-of-core matrix balancing.

.. list-table::
    :widths: 25 100
    :align: left
    :header-rows: 1

    * -  Export/visualization
      -
    * - `cooler info`_
      - Display a cooler’s info and metadata.
    * - `cooler dump`_
      - Dump a cooler’s data to a text stream.
    * - `cooler show`_
      - Display and browse a cooler with matplotlib.

.. list-table::
    :widths: 25 100
    :align: left
    :header-rows: 1

    * -  File manipulation/info
      -
    * - `cooler tree`_
      - Display a file’s data hierarchy.
    * - `cooler attrs`_
      - Display a file’s attribute hierarchy.
    * - `cooler ls`_
      - List all coolers inside a file.
    * - `cooler cp`_
      - Copy a cooler from one file to another or within the same file.
    * - `cooler mv`_
      - Rename a cooler within the same file.
    * - `cooler ln`_
      - Create a hard, soft or external link to a cooler.

.. list-table::
    :widths: 25 100
    :align: left
    :header-rows: 1

    * -  Helper commands
      -
    * - `cooler makebins`_
      - Generate fixed-width genomic bins.
    * - `cooler digest`_
      - Generate fragment-delimited genomic bins.
    * - `cooler csort`_
      - Sort and index a contact list.


.. rubric:: Options

.. option:: -v, --verbose

    Verbose logging.

.. option:: -d, --debug

    On error, drop into the post-mortem debugger shell.

.. option:: -V, --version

    Show the version and exit.

See the cooler_cli.ipynb Jupyter Notebook for specific examples on usage: (https://github.com/open2c/cooler-binder).

----

cooler cload
------------


    Create a cooler from genomic pairs and bins.

    Choose a subcommand based on the format of the input contact list.



.. program:: cooler cload
.. code-block:: shell

    cooler cload [OPTIONS] COMMAND [ARGS]...

.. rubric:: Commands

.. hlist::
  :columns: 4

  * .. object:: hiclib
  * .. object:: pairix
  * .. object:: pairs
  * .. object:: tabix


----

cooler cload pairs
------------------


    Bin any text file or stream of pairs.

    Pairs data need not be sorted. Accepts compressed files.
    To pipe input from stdin, set PAIRS_PATH to '-'.


    BINS : One of the following

        <TEXT:INTEGER> : 1. Path to a chromsizes file, 2. Bin size in bp

        <TEXT> : Path to BED file defining the genomic bin segmentation.

    PAIRS_PATH : Path to contacts (i.e. read pairs) file.

    COOL_PATH : Output COOL file path or URI.



.. program:: cooler cload pairs
.. code-block:: shell

    cooler cload pairs [OPTIONS] BINS PAIRS_PATH COOL_PATH

.. rubric:: Arguments

.. option:: BINS

    Required argument

.. option:: PAIRS_PATH

    Required argument

.. option:: COOL_PATH

    Required argument

.. rubric:: Options

.. option:: --metadata <metadata>

    Path to JSON file containing user metadata.

.. option:: --assembly <assembly>

    Name of genome assembly (e.g. hg19, mm10)

.. option:: -c1, --chrom1 <chrom1>

    chrom1 field number (one-based)  [required]

.. option:: -p1, --pos1 <pos1>

    pos1 field number (one-based)  [required]

.. option:: -c2, --chrom2 <chrom2>

    chrom2 field number (one-based)  [required]

.. option:: -p2, --pos2 <pos2>

    pos2 field number (one-based)  [required]

.. option:: --chunksize <chunksize>

    Number of input lines to load at a time

.. option:: -0, --zero-based

    Positions are zero-based  [default: False]

.. option:: --comment-char <comment_char>

    Comment character that indicates lines to ignore.  [default: #]

.. option:: -N, --no-symmetric-upper

    Create a complete square matrix without implicit symmetry. This allows for distinct upper- and lower-triangle values

.. option:: --input-copy-status <input_copy_status>

    Copy status of input data when using symmetric-upper storage. | `unique`: Incoming data comes from a unique half of a symmetric map, regardless of how the coordinates of a pair are ordered. `duplex`: Incoming data contains upper- and lower-triangle duplicates. All input records that map to the lower triangle will be discarded! | If you wish to treat lower- and upper-triangle input data as distinct, use the ``--no-symmetric-upper`` option.   [default: unique]

.. option:: --field <field>

    Specify quantitative input fields to aggregate into value columns using the syntax ``--field <field-name>=<field-number>``. Optionally, append ``:`` followed by ``dtype=<dtype>`` to specify the data type (e.g. float), and/or ``agg=<agg>`` to specify an aggregation function different from sum (e.g. mean). Field numbers are 1-based. Passing 'count' as the target name will override the default behavior of storing pair counts. Repeat the ``--field`` option for each additional field.

.. option:: --temp-dir <temp_dir>

    Create temporary files in a specified directory. Pass ``-`` to use the platform default temp dir.

.. option:: --no-delete-temp

    Do not delete temporary files when finished.

.. option:: --max-merge <max_merge>

    Maximum number of chunks to merge before invoking recursive merging  [default: 200]

.. option:: --storage-options <storage_options>

    Options to modify the data filter pipeline. Provide as a comma-separated list of key-value pairs of the form 'k1=v1,k2=v2,...'. See http://docs.h5py.org/en/stable/high/dataset.html#filter-pipeline for more details.

.. option:: -a, --append

    Pass this flag to append the output cooler to an existing file instead of overwriting the file.


----

cooler cload pairix
-------------------


    Bin a pairix-indexed contact list file.


    BINS : One of the following

        <TEXT:INTEGER> : 1. Path to a chromsizes file, 2. Bin size in bp

        <TEXT> : Path to BED file defining the genomic bin segmentation.

    PAIRS_PATH : Path to contacts (i.e. read pairs) file.

    COOL_PATH : Output COOL file path or URI.

    See also: 'cooler csort' to sort and index a contact list file

    Pairix on GitHub: <https://github.com/4dn-dcic/pairix>.



.. program:: cooler cload pairix
.. code-block:: shell

    cooler cload pairix [OPTIONS] BINS PAIRS_PATH COOL_PATH

.. rubric:: Arguments

.. option:: BINS

    Required argument

.. option:: PAIRS_PATH

    Required argument

.. option:: COOL_PATH

    Required argument

.. rubric:: Options

.. option:: --metadata <metadata>

    Path to JSON file containing user metadata.

.. option:: --assembly <assembly>

    Name of genome assembly (e.g. hg19, mm10)

.. option:: -p, --nproc <nproc>

    Number of processes to split the work between.  [default: 8]

.. option:: -0, --zero-based

    Positions are zero-based  [default: False]

.. option:: -s, --max-split <max_split>

    Divide the pairs from each chromosome into at most this many chunks. Smaller chromosomes will be split less frequently or not at all. Increase ths value if large chromosomes dominate the workload on multiple processors.  [default: 2]


----

cooler cload tabix
------------------


    Bin a tabix-indexed contact list file.


    BINS : One of the following

        <TEXT:INTEGER> : 1. Path to a chromsizes file, 2. Bin size in bp

        <TEXT> : Path to BED file defining the genomic bin segmentation.

    PAIRS_PATH : Path to contacts (i.e. read pairs) file.

    COOL_PATH : Output COOL file path or URI.

    See also: 'cooler csort' to sort and index a contact list file

    Tabix manpage: <http://www.htslib.org/doc/tabix.html>.



.. program:: cooler cload tabix
.. code-block:: shell

    cooler cload tabix [OPTIONS] BINS PAIRS_PATH COOL_PATH

.. rubric:: Arguments

.. option:: BINS

    Required argument

.. option:: PAIRS_PATH

    Required argument

.. option:: COOL_PATH

    Required argument

.. rubric:: Options

.. option:: --metadata <metadata>

    Path to JSON file containing user metadata.

.. option:: --assembly <assembly>

    Name of genome assembly (e.g. hg19, mm10)

.. option:: -p, --nproc <nproc>

    Number of processes to split the work between.  [default: 8]

.. option:: -c2, --chrom2 <chrom2>

    chrom2 field number (one-based)

.. option:: -p2, --pos2 <pos2>

    pos2 field number (one-based)

.. option:: -0, --zero-based

    Positions are zero-based  [default: False]

.. option:: -s, --max-split <max_split>

    Divide the pairs from each chromosome into at most this many chunks. Smaller chromosomes will be split less frequently or not at all. Increase ths value if large chromosomes dominate the workload on multiple processors.  [default: 2]


----

cooler cload hiclib
-------------------


    Bin a hiclib HDF5 contact list (frag) file.


    BINS : One of the following

        <TEXT:INTEGER> : 1. Path to a chromsizes file, 2. Bin size in bp

        <TEXT> : Path to BED file defining the genomic bin segmentation.

    PAIRS_PATH : Path to contacts (i.e. read pairs) file.

    COOL_PATH : Output COOL file path or URI.

    hiclib on BitBucket: <https://github.com/mirnylab/hiclib-legacy>.



.. program:: cooler cload hiclib
.. code-block:: shell

    cooler cload hiclib [OPTIONS] BINS PAIRS_PATH COOL_PATH

.. rubric:: Arguments

.. option:: BINS

    Required argument

.. option:: PAIRS_PATH

    Required argument

.. option:: COOL_PATH

    Required argument

.. rubric:: Options

.. option:: --metadata <metadata>

    Path to JSON file containing user metadata.

.. option:: --assembly <assembly>

    Name of genome assembly (e.g. hg19, mm10)

.. option:: -c, --chunksize <chunksize>

    Control the number of pixels handled by each worker process at a time.  [default: 100000000]


----

cooler load
-----------


    Create a cooler from a pre-binned matrix.

    BINS_PATH : One of the following

        <TEXT:INTEGER> : 1. Path to a chromsizes file, 2. Bin size in bp

        <TEXT> : Path to BED file defining the genomic bin segmentation.

    PIXELS_PATH : Text file containing nonzero pixel values. May be gzipped.
    Pass '-' to use stdin.

    COOL_PATH : Output COOL file path or URI.

    **Notes**

    Two input format options (tab-delimited).
    Input pixel file may be compressed.

    COO: COO-rdinate sparse matrix format (a.k.a. ijv triple).
    3 columns: "bin1_id, bin2_id, count",

    BG2: 2D version of the bedGraph format.
    7 columns: "chrom1, start1, end1, chrom2, start2, end2, count"

    **Examples**

    cooler load -f bg2 <chrom.sizes>:<binsize> in.bg2.gz out.cool



.. program:: cooler load
.. code-block:: shell

    cooler load [OPTIONS] BINS_PATH PIXELS_PATH COOL_PATH

.. rubric:: Arguments

.. option:: BINS_PATH

    Required argument

.. option:: PIXELS_PATH

    Required argument

.. option:: COOL_PATH

    Required argument

.. rubric:: Options

.. option:: -f, --format <format>

    'coo' refers to a tab-delimited sparse triplet file (bin1, bin2, count). 'bg2' refers to a 2D bedGraph-like file (chrom1, start1, end1, chrom2, start2, end2, count).  [required]

.. option:: --metadata <metadata>

    Path to JSON file containing user metadata.

.. option:: --assembly <assembly>

    Name of genome assembly (e.g. hg19, mm10)

.. option:: --field <field>

    Add supplemental value fields or override default field numbers for the specified format. Specify quantitative input fields to aggregate into value columns using the syntax ``--field <field-name>=<field-number>``. Optionally, append ``:`` followed by ``dtype=<dtype>`` to specify the data type (e.g. float). Field numbers are 1-based. Repeat the ``--field`` option for each additional field.

.. option:: -c, --chunksize <chunksize>

    Size (in number of lines/records) of data chunks to read and process from the input file at a time. These chunks will be saved as temporary partial Coolers and merged at the end. Also specifies the size of the buffer during the merge step.

.. option:: --count-as-float

    Store the 'count' column as floating point values instead of as integers. Can also be specified using the `--field` option.

.. option:: --one-based

    Pass this flag if the bin IDs listed in a COO file are one-based instead of zero-based.

.. option:: --comment-char <comment_char>

    Comment character that indicates lines to ignore.  [default: #]

.. option:: -N, --no-symmetric-upper

    Create a complete square matrix without implicit symmetry. This allows for distinct upper- and lower-triangle values

.. option:: --input-copy-status <input_copy_status>

    Copy status of input data when using symmetric-upper storage. | `unique`: Incoming data comes from a unique half of a symmetric matrix, regardless of how element coordinates are ordered. Execution will be aborted if duplicates are detected. `duplex`: Incoming data contains upper- and lower-triangle duplicates. All lower-triangle input elements will be discarded! | If you wish to treat lower- and upper-triangle input data as distinct, use the ``--no-symmetric-upper`` option instead.   [default: unique]

.. option:: --temp-dir <temp_dir>

    Create temporary files in a specified directory. Pass ``-`` to use the platform default temp dir.

.. option:: --no-delete-temp

    Do not delete temporary files when finished.

.. option:: --storage-options <storage_options>

    Options to modify the data filter pipeline. Provide as a comma-separated list of key-value pairs of the form 'k1=v1,k2=v2,...'. See http://docs.h5py.org/en/stable/high/dataset.html#filter-pipeline for more details.

.. option:: -a, --append

    Pass this flag to append the output cooler to an existing file instead of overwriting the file.


----

cooler merge
------------


    Merge multiple coolers with identical axes.

    OUT_PATH : Output file path or URI.

    IN_PATHS : Input file paths or URIs of coolers to merge.

    **Notes**

    Data columns merged:

        pixels/bin1_id, pixels/bin2_id, pixels/<value columns>

    Data columns preserved:

        chroms/name, chroms/length
        bins/chrom, bins/start, bins/end

    Additional columns in the the input files are not transferred to the output.



.. program:: cooler merge
.. code-block:: shell

    cooler merge [OPTIONS] OUT_PATH [IN_PATHS]...

.. rubric:: Arguments

.. option:: OUT_PATH

    Required argument

.. option:: IN_PATHS

    Optional argument(s)

.. rubric:: Options

.. option:: -c, --chunksize <chunksize>

    Size of the merge buffer in number of pixel table rows.  [default: 20000000]

.. option:: --field <field>

    Specify the names of value columns to merge as '<name>'. Repeat the `--field` option for each one. Use '<name>,dtype=<dtype>' to specify the dtype. Include ',agg=<agg>' to specify an aggregation function different from 'sum'.

.. option:: -a, --append

    Pass this flag to append the output cooler to an existing file instead of overwriting the file.


----

cooler coarsen
--------------


    Coarsen a cooler to a lower resolution.

    Works by pooling *k*-by-*k* neighborhoods of pixels and aggregating.
    Each chromosomal block is coarsened individually.

    COOL_PATH : Path to a COOL file or Cooler URI.



.. program:: cooler coarsen
.. code-block:: shell

    cooler coarsen [OPTIONS] COOL_PATH

.. rubric:: Arguments

.. option:: COOL_PATH

    Required argument

.. rubric:: Options

.. option:: -k, --factor <factor>

    Gridding factor. The contact matrix is coarsegrained by grouping each chromosomal contact block into k-by-k element tiles  [default: 2]

.. option:: -n, -p, --nproc <nproc>

    Number of processes to use for batch processing chunks of pixels [default: 1, i.e. no process pool]

.. option:: -c, --chunksize <chunksize>

    Number of pixels allocated to each process  [default: 10000000]

.. option:: --field <field>

    Specify the names of value columns to merge as '<name>'. Repeat the `--field` option for each one. Use '<name>,dtype=<dtype>' to specify the dtype. Include ',agg=<agg>' to specify an aggregation function different from 'sum'.

.. option:: -o, --out <out>

    Output file or URI  [required]

.. option:: -a, --append

    Pass this flag to append the output cooler to an existing file instead of overwriting the file.


----

cooler zoomify
--------------


    Generate a multi-resolution cooler file by coarsening.

    COOL_PATH : Path to a COOL file or Cooler URI.



.. program:: cooler zoomify
.. code-block:: shell

    cooler zoomify [OPTIONS] COOL_PATH

.. rubric:: Arguments

.. option:: COOL_PATH

    Required argument

.. rubric:: Options

.. option:: -n, -p, --nproc <nproc>

    Number of processes to use for batch processing chunks of pixels [default: 1, i.e. no process pool]

.. option:: -c, --chunksize <chunksize>

    Number of pixels allocated to each process  [default: 10000000]

.. option:: -r, --resolutions <resolutions>

    Comma-separated list of target resolutions. Use suffixes B or N to specify a progression: B for binary (geometric steps of factor 2), N for nice (geometric steps of factor 10 interleaved with steps of 2 and 5). Examples: 1000B=1000,2000,4000,8000,... 1000N=1000,2000,5000,10000,... 5000N=5000,10000,25000,50000,... 4DN is an alias for 1000,2000,5000N [default: B]

.. option:: --balance

    Apply balancing to each zoom level. Off by default.

.. option:: --balance-args <balance_args>

    Additional arguments to pass to cooler balance. To deal with space ambiguity, use quotes to pass multiple arguments, e.g. ``--balance-args '--nproc 8 --ignore-diags 3'``. Note that nproc for balancing must be specified independently of zoomify arguments.

.. option:: -i, --base-uri <base_uri>

    One or more additional base coolers to aggregate from, if needed.

.. option:: -o, --out <out>

    Output file or URI

.. option:: --field <field>

    Specify the names of value columns to merge as '<name>'. Repeat the ``--field`` option for each one. Use '<name>:dtype=<dtype>' to specify the dtype. Include ',agg=<agg>' to specify an aggregation function different from 'sum'.

.. option:: --legacy

    Use the legacy layout of integer-labeled zoom levels.


----

cooler balance
--------------


    Out-of-core matrix balancing.

    Matrix must be symmetric. See the help for various filtering options to
    mask out poorly mapped bins.

    COOL_PATH : Path to a COOL file.



.. program:: cooler balance
.. code-block:: shell

    cooler balance [OPTIONS] COOL_PATH

.. rubric:: Arguments

.. option:: COOL_PATH

    Required argument

.. rubric:: Options

.. option:: --cis-only

    Calculate weights against intra-chromosomal data only instead of genome-wide.

.. option:: --trans-only

    Calculate weights against inter-chromosomal data only instead of genome-wide.

.. option:: --ignore-diags <ignore_diags>

    Number of diagonals of the contact matrix to ignore, including the main diagonal. Examples: 0 ignores nothing, 1 ignores the main diagonal, 2 ignores diagonals (-1, 0, 1), etc.  [default: 2]

.. option:: --ignore-dist <ignore_dist>

    Distance from the diagonal in bp to ignore. The maximum of the corresponding number of diagonals and `--ignore-diags` will be used.

.. option:: --mad-max <mad_max>

    Ignore bins from the contact matrix using the 'MAD-max' filter: bins whose log marginal sum is less than ``mad-max`` median absolute deviations below the median log marginal sum of all the bins in the same chromosome.  [default: 5]

.. option:: --min-nnz <min_nnz>

    Ignore bins from the contact matrix whose marginal number of nonzeros is less than this number.  [default: 10]

.. option:: --min-count <min_count>

    Ignore bins from the contact matrix whose marginal count is less than this number.  [default: 0]

.. option:: --blacklist <blacklist>

    Path to a 3-column BED file containing genomic regions to mask out during the balancing procedure, e.g. sequence gaps or regions of poor mappability.

.. option:: -p, --nproc <nproc>

    Number of processes to split the work between.  [default: 8]

.. option:: -c, --chunksize <chunksize>

    Control the number of pixels handled by each worker process at a time.  [default: 10000000]

.. option:: --tol <tol>

    Threshold value of variance of the marginals for the algorithm to converge.  [default: 1e-05]

.. option:: --max-iters <max_iters>

    Maximum number of iterations to perform if convergence is not achieved.  [default: 200]

.. option:: --name <name>

    Name of column to write to.  [default: weight]

.. option:: -f, --force

    Overwrite the target dataset, 'weight', if it already exists.

.. option:: --check

    Check whether a data column 'weight' already exists.

.. option:: --stdout

    Print weight column to stdout instead of saving to file.

.. option:: --convergence-policy <convergence_policy>

    What to do with weights when balancing doesn't converge in max_iters. 'store_final': Store the final result, regardless of whether the iterations converge to the specified tolerance; 'store_nan': Store a vector of NaN values to indicate that the matrix failed to converge; 'discard': Store nothing and exit gracefully; 'error': Abort with non-zero exit status.  [default: store_final]


----

cooler info
-----------


    Display a cooler's info and metadata.

    COOL_PATH : Path to a COOL file or cooler URI.



.. program:: cooler info
.. code-block:: shell

    cooler info [OPTIONS] COOL_PATH

.. rubric:: Arguments

.. option:: COOL_PATH

    Required argument

.. rubric:: Options

.. option:: -f, --field <field>

    Print the value of a specific info field.

.. option:: -m, --metadata

    Print the user metadata in JSON format.

.. option:: -o, --out <out>

    Output file (defaults to stdout)


----

cooler dump
-----------


    Dump a cooler's data to a text stream.

    COOL_PATH : Path to COOL file or cooler URI.



.. program:: cooler dump
.. code-block:: shell

    cooler dump [OPTIONS] COOL_PATH

.. rubric:: Arguments

.. option:: COOL_PATH

    Required argument

.. rubric:: Options

.. option:: -t, --table <table>

    Which table to dump. Choosing 'chroms' or 'bins' will cause all pixel-related options to be ignored. Note that for coolers stored in symmetric-upper mode, 'pixels' only holds the upper triangle values of the matrix.  [default: pixels]

.. option:: -c, --columns <columns>

    Restrict output to a subset of columns, provided as a comma-separated list.

.. option:: -H, --header

    Print the header of column names as the first row.  [default: False]

.. option:: --na-rep <na_rep>

    Missing data representation. Default is empty ''.

.. option:: --float-format <float_format>

    Format string for floating point numbers (e.g. '.12g', '03.2f').  [default: g]

.. option:: -r, --range <range>

    The coordinates of a genomic region shown along the row dimension, in UCSC-style notation. (Example: chr1:10,000,000-11,000,000). If omitted, the entire contact matrix is printed.

.. option:: -r2, --range2 <range2>

    The coordinates of a genomic region shown along the column dimension. If omitted, the column range is the same as the row range.

.. option:: -f, --fill-lower

    For coolers using 'symmetric-upper' storage, populate implicit areas of the genomic query box by generating lower triangle pixels. If not specified, only upper triangle pixels are reported. This option has no effect on coolers stored in 'square' mode.  [default: False]

.. option:: -b, --balanced, --no-balance

    Apply balancing weights to data. This will print an extra column called `balanced`  [default: False]

.. option:: --join

    Print the full chromosome bin coordinates instead of bin IDs. This will replace the `bin1_id` column with `chrom1`, `start1`, and `end1`, and the `bin2_id` column with `chrom2`, `start2` and `end2`.  [default: False]

.. option:: --annotate <annotate>

    Join additional columns from the bin table against the pixels. Provide a comma separated list of column names (no spaces). The merged columns will be suffixed by '1' and '2' accordingly.

.. option:: --one-based-ids

    Print bin IDs as one-based rather than zero-based.

.. option:: --one-based-starts

    Print start coordinates as one-based rather than zero-based.

.. option:: -k, --chunksize <chunksize>

    Sets the number of pixel records loaded from disk at one time. Can affect the performance of joins on high resolution datasets.   [default: 1000000]

.. option:: -o, --out <out>

    Output text file If .gz extension is detected, file is written using zlib. Default behavior is to stream to stdout.


----

cooler show
-----------


    Display and browse a cooler in matplotlib.

    COOL_PATH : Path to a COOL file or Cooler URI.

    RANGE : The coordinates of the genomic region to display, in UCSC notation.
    Example: chr1:10,000,000-11,000,000



.. program:: cooler show
.. code-block:: shell

    cooler show [OPTIONS] COOL_PATH RANGE

.. rubric:: Arguments

.. option:: COOL_PATH

    Required argument

.. option:: RANGE

    Required argument

.. rubric:: Options

.. option:: -r2, --range2 <range2>

    The coordinates of a genomic region shown along the column dimension. If omitted, the column range is the same as the row range. Use to display asymmetric matrices or trans interactions.

.. option:: -b, --balanced

    Show the balanced contact matrix. If not provided, display the unbalanced counts.

.. option:: -o, --out <out>

    Save the image of the contact matrix to a file. If not specified, the matrix is displayed in an interactive window. The figure format is deduced from the extension of the file, the supported formats are png, jpg, svg, pdf, ps and eps.

.. option:: --dpi <dpi>

    The DPI of the figure, if saving to a file

.. option:: -s, --scale <scale>

    Scale transformation of the colormap: linear, log2 or log10. Default is log10.

.. option:: -f, --force

    Force display very large matrices (>=10^8 pixels). Use at your own risk as it may cause performance issues.

.. option:: --zmin <zmin>

    The minimal value of the color scale. Units must match those of the colormap scale. To provide a negative value use a equal sign and quotes, e.g. -zmin='-0.5'

.. option:: --zmax <zmax>

    The maximal value of the color scale. Units must match those of the colormap scale. To provide a negative value use a equal sign and quotes, e.g. -zmax='-0.5'

.. option:: --cmap <cmap>

    The colormap used to display the contact matrix. See the full list at http://matplotlib.org/examples/color/colormaps_reference.html

.. option:: --field <field>

    Pixel values to display.  [default: count]


----

cooler tree
-----------


    Display a file's data hierarchy.



.. program:: cooler tree
.. code-block:: shell

    cooler tree [OPTIONS] URI

.. rubric:: Arguments

.. option:: URI

    Required argument

.. rubric:: Options

.. option:: -L, --level <level>


----

cooler attrs
------------


    Display a file's attribute hierarchy.



.. program:: cooler attrs
.. code-block:: shell

    cooler attrs [OPTIONS] URI

.. rubric:: Arguments

.. option:: URI

    Required argument

.. rubric:: Options

.. option:: -L, --level <level>


----

cooler ls
---------


    List all coolers inside a file.



.. program:: cooler ls
.. code-block:: shell

    cooler ls [OPTIONS] COOL_PATH

.. rubric:: Arguments

.. option:: COOL_PATH

    Required argument

.. rubric:: Options

.. option:: -l, --long

    Long listing format


----

cooler cp
---------


    Copy a cooler from one file to another or within the same file.

    See also: h5copy, h5repack tools from HDF5 suite.



.. program:: cooler cp
.. code-block:: shell

    cooler cp [OPTIONS] SRC_URI DST_URI

.. rubric:: Arguments

.. option:: SRC_URI

    Required argument

.. option:: DST_URI

    Required argument

.. rubric:: Options

.. option:: -w, --overwrite

    Truncate and replace destination file if it already exists.


----

cooler mv
---------


    Rename a cooler within the same file.



.. program:: cooler mv
.. code-block:: shell

    cooler mv [OPTIONS] SRC_URI DST_URI

.. rubric:: Arguments

.. option:: SRC_URI

    Required argument

.. option:: DST_URI

    Required argument

.. rubric:: Options

.. option:: -w, --overwrite

    Truncate and replace destination file if it already exists.


----

cooler ln
---------


    Create a hard link to a cooler (rather than a true copy) in the same file.
    Also supports soft links (in the same file) or external links (different
    files).



.. program:: cooler ln
.. code-block:: shell

    cooler ln [OPTIONS] SRC_URI DST_URI

.. rubric:: Arguments

.. option:: SRC_URI

    Required argument

.. option:: DST_URI

    Required argument

.. rubric:: Options

.. option:: -w, --overwrite

    Truncate and replace destination file if it already exists.

.. option:: -s, --soft

    Creates a soft link rather than a hard link if the source and destination file are the same. Otherwise, creates an external link. This type of link uses a path rather than a pointer.


----

cooler makebins
---------------


    Generate fixed-width genomic bins.

    Output a genome segmentation at a fixed resolution as a BED file.

    CHROMSIZES_PATH : UCSC-like chromsizes file, with chromosomes in desired
    order.

    BINSIZE : Resolution (bin size) in base pairs <int>.



.. program:: cooler makebins
.. code-block:: shell

    cooler makebins [OPTIONS] CHROMSIZES_PATH BINSIZE

.. rubric:: Arguments

.. option:: CHROMSIZES_PATH

    Required argument

.. option:: BINSIZE

    Required argument

.. rubric:: Options

.. option:: -o, --out <out>

    Output file (defaults to stdout)

.. option:: -H, --header

    Print the header of column names as the first row.  [default: False]

.. option:: -i, --rel-ids <rel_ids>

    Include a column of relative bin IDs for each chromosome. Choose whether to report them as 0- or 1-based.


----

cooler digest
-------------


    Generate fragment-delimited genomic bins.

    Output a genome segmentation of restriction fragments as a BED file.

    CHROMSIZES_PATH : UCSC-like chromsizes file, with chromosomes in desired
    order.

    FASTA_PATH : Genome assembly FASTA file or folder containing FASTA files
    (uncompressed).

    ENZYME : Name of restriction enzyme



.. program:: cooler digest
.. code-block:: shell

    cooler digest [OPTIONS] CHROMSIZES_PATH FASTA_PATH ENZYME

.. rubric:: Arguments

.. option:: CHROMSIZES_PATH

    Required argument

.. option:: FASTA_PATH

    Required argument

.. option:: ENZYME

    Required argument

.. rubric:: Options

.. option:: -o, --out <out>

    Output file (defaults to stdout)

.. option:: -H, --header

    Print the header of column names as the first row.  [default: False]

.. option:: -i, --rel-ids <rel_ids>

    Include a column of relative bin IDs for each chromosome. Choose whether to report them as 0- or 1-based.


----

cooler csort
------------


    Sort and index a contact list.

    Order the mates of each pair record so that all contacts are upper
    triangular with respect to the chromosome ordering given by the chromosomes
    file, sort contacts by genomic location, and index the resulting file.

    PAIRS_PATH : Contacts (i.e. read pairs) text file, optionally compressed.

    CHROMOSOMES_PATH : File listing desired chromosomes in the desired order.
    May be tab-delimited, e.g. a UCSC-style chromsizes file. Contacts mapping to
    other chromosomes will be discarded.

    **Notes**

    - csort can also be used to sort and index a text representation of
      a contact *matrix* in bedGraph-like format. In this case, substitute
      `pos1` and `pos2` with `start1` and `start2`, respectively.
    - Requires Unix tools: sort, bgzip + tabix or pairix.

    If indexing with Tabix, the output file will have the following properties:

    - Upper triangular: the read pairs on each row are assigned to side 1 or 2
      in such a way that (chrom1, pos1) is always "less than" (chrom2, pos2)
    - Rows are lexicographically sorted by chrom1, pos1, chrom2, pos2;
      i.e. "positionally sorted"
    - Compressed with bgzip [*]
    - Indexed using Tabix [*] on chrom1 and pos1.

    If indexing with Pairix, the output file will have the following properties:

    - Upper triangular: the read pairs on each row are assigned to side 1 or 2
      in such a way that (chrom1, pos1) is always "less than" (chrom2, pos2)
    - Rows are lexicographically sorted by chrom1, chrom2, pos1, pos2; i.e.
      "block sorted"
    - Compressed with bgzip [*]
    - Indexed using Pairix [+] on chrom1, chrom2 and pos1.

    [*] Tabix manpage: <http://www.htslib.org/doc/tabix.html>.
    [+] Pairix on Github: <https://github.com/4dn-dcic/pairix>



.. program:: cooler csort
.. code-block:: shell

    cooler csort [OPTIONS] PAIRS_PATH CHROMOSOMES_PATH

.. rubric:: Arguments

.. option:: PAIRS_PATH

    Required argument

.. option:: CHROMOSOMES_PATH

    Required argument

.. rubric:: Options

.. option:: -c1, --chrom1 <chrom1>

    chrom1 field number in the input file (starting from 1)  [required]

.. option:: -c2, --chrom2 <chrom2>

    chrom2 field number  [required]

.. option:: -p1, --pos1 <pos1>

    pos1 field number  [required]

.. option:: -p2, --pos2 <pos2>

    pos2 field number  [required]

.. option:: -i, --index <index>

    Select the preset sort and indexing options  [default: pairix]

.. option:: --flip-only

    Only flip mates; no sorting or indexing. Write to stdout.  [default: False]

.. option:: -p, --nproc <nproc>

    Number of processors  [default: 8]

.. option:: -0, --zero-based

    Read positions are zero-based  [default: False]

.. option:: --sep <sep>

    Data delimiter in the input file  [default: \t]

.. option:: --comment-char <comment_char>

    Comment character to skip header  [default: #]

.. option:: --sort-options <sort_options>

    Quoted list of additional options to `sort` command

.. option:: -o, --out <out>

    Output gzip file

.. option:: -s1, --strand1 <strand1>

    strand1 field number (deprecated)

.. option:: -s2, --strand2 <strand2>

    strand2 field number (deprecated)


----