Pipeline¶
hicstuff.pipeline.full_pipeline is hicstuff pipeline: its arguments are
the command's options (see Using the Python API).
Each step is a function of its own: align_reads, bam2pairs,
filter_pcr_dup, pairs2cool, pairs2binnedcool, pairs2metacool,
cool2mcool, balance, pairs2matrix.
hicstuff.stats reads the statistics of a run from its log, as
hicstuff stats does, and hicstuff.log holds the logger every module writes
to.
hicstuff.pipeline ¶
Handle generation of graal-compatible contact maps from fastq files. cmdoret, 20190322
align_reads ¶
align_reads(reads, genome, out_bam, tmp_dir=None, threads=1, aligner='bowtie2', iterative=False, min_qual=30, read_len=None, backend=None)
Select and call correct alignment method and generate logs accordingly. Alignments are filtered so that there at most one alignment per read. Alignments are sorted by read name in the output file.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
reads
|
str
|
Path to the fastq file with Hi-C reads. |
required |
genome
|
str or BwaIndex
|
Path to the genome bowtie2/bwa index prefix if using bowtie2 or bwa, or to the fasta if using minimap2. With bwa in-process, an index loaded by hicstuff.bwamem.load_index also works, so that it is loaded once for several files; a path is loaded, or indexed if it has no index. |
required |
out_bam
|
str
|
Path to the output BAM file containing mapped Hi-C reads. |
required |
tmp_dir
|
str
|
Path where temporary files are stored. |
None
|
threads
|
int
|
Number of threads to run alignments in parallel. |
1
|
aligner
|
bool
|
Use minimap2 or bwa instead of bowtie2. |
'bowtie2'
|
iterative
|
bool
|
Wether to use the iterative mapping procedure (truncating reads and extending iteratively) |
False
|
min_qual
|
int
|
Minimum mapping quality required to keep an alignment during iterative mapping. |
30
|
read_len
|
int
|
Maximum read length to expect in the fastq file. Optionally used in iterative alignment mode. Estimated from the first read by default. Useful if input fastq is a composite of different read lengths. |
None
|
backend
|
str
|
How bwa runs: "binary" (the bwa program), "python" (in-process with pybwa) or "auto", for which see hicstuff.bwamem.resolve_backend. None reads the environment variable HICSTUFF_ALIGNER_BACKEND. |
None
|
Source code in src/hicstuff/pipeline.py
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 | |
bam2pairs ¶
bam2pairs(bam1, bam2, out_pairs, info_contigs, min_qual=30, tmp_dir=None, threads=1, five_prime=False)
Make a .pairs file from two Hi-C bam files sorted by read names.
The Hi-C mates are matched by read identifier, without /1 or /2 suffix,
walking both files in the order they are sorted in: samtools sort -n
(natural) order, or samtools sort -N (lexicographical) order if both
headers say so. Reads whose mate is missing from the other file are
skipped. Files that turn out not to be in that order are walked in the
other one, as other tools (Picard, sambamba sort -n) sort names in
lexicographical order without saying so. Files in neither order are
sorted again with samtools sort -n in a temporary directory, so that
no pair is lost.
Pairs where at least one reads maps with MAPQ below min_qual threshold are
discarded. Pairs are sorted by readID and stored in upper triangle (first
pair higher).
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
bam1
|
str
|
Path to the name-sorted BAM file with aligned Hi-C forward reads. |
required |
bam2
|
str
|
Path to the name-sorted BAM file with aligned Hi-C reverse reads. |
required |
out_pairs
|
str
|
Path to the output space-separated .pairs file with columns readID, chr1 pos1 chr2 pos2 strand1 strand2 |
required |
info_contigs
|
str
|
Path to the info contigs file, to get info on chromosome sizes and order. |
required |
min_qual
|
int
|
Minimum mapping quality required to keep a Hi-C pair. |
30
|
tmp_dir
|
str
|
Directory in which to sort BAM files that are in neither read name order. Defaults to the directory of out_pairs. |
None
|
threads
|
int
|
Number of threads to sort them with. |
1
|
five_prime
|
bool
|
Whether each mate's position is its aligned 5' end, the first base of the read that aligns, at the end of the sequenced molecule, as pairtools records it. Otherwise it is the leftmost base of the alignment: the 5' end of a forward-strand mate, but the 3' end of a reverse-strand one. |
False
|
Source code in src/hicstuff/pipeline.py
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 | |
filter_pcr_dup ¶
Filter out PCR duplicates from a pairs file sorted by COORD_SORT_KEYS, using overrrepresented exact coordinates. If multiple fragments have two reads with the exact same coordinates, only one of those fragments is kept.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
pairs_idx_file
|
str
|
Path to an indexed pairs file containing the Hi-C reads. |
required |
filtered_file
|
str
|
Path to the output pairs file after removing duplicates. |
required |
Source code in src/hicstuff/pipeline.py
sort_and_compress_pairs ¶
Sort a pairs file by chr1, chr2, pos1, pos2 (the standard order for pairs files) and compress it in the BGZF format, so that pairix can index it: with bgzip, on several threads, if it is installed, otherwise with pysam, on one thread.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
pairs_file
|
str
|
Path to the input, uncompressed pairs file. |
required |
out_file
|
str
|
Path to the output sorted and compressed pairs file. |
required |
tmp_dir
|
str
|
Directory where temporary files will be created. |
None
|
threads
|
int
|
Number of threads used for sorting and bgzip compression. |
1
|
Source code in src/hicstuff/pipeline.py
pairs2cool ¶
Make a cooler file from the pairs file. See: https://github.com/mirnylab/cooler/ for more informations.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
pairs_file
|
str
|
Path to the pairs file containing input contact data. |
required |
cool_file
|
str
|
Path to the output cool file name to generate. |
required |
bins_file
|
str
|
Path to the file containing genomic segmentation information. (fragments_list.txt). |
required |
Source code in src/hicstuff/pipeline.py
pairs2binnedcool ¶
Make a binned cooler file from the pairs file. See: https://github.com/mirnylab/cooler/ for more informations.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
pairs_file
|
str
|
Path to the pairs file containing input contact data. |
required |
cool_file
|
str
|
Path to the output cool file name to generate. |
required |
binning
|
int
|
If mat_fmt is set to "cool", the cool file will be further binned to this resolution. |
required |
info_contigs
|
Path or str
|
The path to the contigs info file |
required |
Source code in src/hicstuff/pipeline.py
pairs2metacool ¶
Make a metacool file from the pairs file, with one bin per fragment, with
metacooler create pairs, through its Python function
metacooler.from_pairs. See: https://pypi.org/project/metacooler/.
A metacool file is a cool file, which cooler reads, with metacooler's
genomes and contigs on top of it. Its contigs are not yet assigned to
genomes: all of them are in metacooler's __unbinned__ genome, longest
first, as metacooler create pairs orders them by default, until
metacooler reassign assigns them. Unlike cooler, metacooler does not
store the contig of each bin as an HDF5 enum, which takes a time that grows
with the square of the number of contigs.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
pairs_file
|
str
|
Path to the pairs file containing input contact data. |
required |
metacool_file
|
str
|
Path to the output metacool file name to generate. |
required |
bins_file
|
str
|
Path to the file containing genomic segmentation information. (fragments_list.txt). |
required |
exclude
|
None, str or list of str
|
The contigs to leave out of the matrix, comma-separated, as in pairs2cool. |
required |
threads
|
int
|
Number of threads binning the pairs. |
1
|
cmd
|
str or None
|
The command line that ran the pipeline, stored in the file's metadata as the command that made it. None stores no command. |
None
|
Source code in src/hicstuff/pipeline.py
cool2mcool ¶
Zoomify a binned cooler file. See: https://github.com/mirnylab/cooler/ for more informations.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
cool_file
|
str
|
Path to an existing binned .cool file. |
required |
output_file
|
str
|
Path to the new multi-resolution .mcool file. |
required |
Source code in src/hicstuff/pipeline.py
balance ¶
Balance a binned cooler file, every resolution of a .mcool file, with
cooler balance. See: https://github.com/mirnylab/cooler/ for more informations.
Balancing never stops the pipeline. When cooler balance fails at a
resolution, a warning carrying cooler's error is logged and that
resolution stays as it was; when the weights it stores did not
converge, a warning says so. "Matrix balanced" is logged only for the
resolutions that got weights.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
cool_file
|
str
|
Path to an existing binned .(m)cool file. |
required |
balancing_args
|
str
|
Extra arguments passed to |
required |
threads
|
int
|
Number of processes used to balance, unless set in |
1
|
Returns:
| Type | Description |
|---|---|
list of str
|
The URIs of the resolutions that hold balancing weights. |
Source code in src/hicstuff/pipeline.py
pairs2matrix ¶
Generate the matrix by counting the number of occurences of each combination of restriction fragments in a pairs file.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
pairs_file
|
str
|
Path to a Hi-C pairs file, with frag1 and frag2 columns added. |
required |
mat_file
|
str
|
Path where the matrix will be written. |
required |
fragments_file
|
str
|
Path to the fragments_list.txt file. Used to know total matrix size in case some observations are not observed at the end. |
required |
mat_fmt
|
str
|
The format to use when writing the matrix. Can be graal or bg2 format. |
'graal'
|
threads
|
int
|
Number of threads to use in parallel. |
1
|
tmp_dir
|
str
|
Temporary directory for sorting files. If None given, will use the system default. |
None
|
Source code in src/hicstuff/pipeline.py
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 | |
check_tool ¶
expand_inputs ¶
The files that an input argument of hicstuff pipeline names.
An argument that is a path that exists is that file, whatever characters
its name holds. Otherwise, it is a comma-separated list of paths, each of
which may be a glob pattern (with *, ? or [...]), replaced by
the files it matches, sorted by name.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
arg
|
str
|
A path, comma-separated paths, or glob patterns. |
required |
Returns:
| Type | Description |
|---|---|
list of str
|
The paths of the files, in the order given. |
Raises:
| Type | Description |
|---|---|
ValueError
|
If a pattern matches no file, or a list holds an empty item. |
Examples:
Source code in src/hicstuff/pipeline.py
split_inputs ¶
The R1 and R2 files given by the input arguments of hicstuff pipeline.
Each argument is expanded by :func:expand_inputs. From fastq or BAM
files, two arguments are the R1 files and the R2 files. More arguments,
as the shell gives them for unquoted glob patterns such as
lib1_*_R1.fq.gz lib1_*_R2.fq.gz, must be even in number: the first
half are the R1 files, the second half the R2 files. From pairs, every
argument is a pairs file.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
args
|
list of str
|
The input arguments, as given on the command line. |
required |
start_stage
|
str
|
The start stage of the pipeline: "fastq", "bam", "pairs" or "pairs_idx". |
'fastq'
|
Returns:
| Type | Description |
|---|---|
tuple of (list of str, list of str)
|
The R1 files and the R2 files, in matching order; the files and an empty list from pairs, or from a single argument. |
Raises:
| Type | Description |
|---|---|
ValueError
|
If the R1 and R2 files cannot be told apart, or an argument names no
file (see :func: |
Examples:
>>> split_inputs(["a_R1.fq.gz,b_R1.fq.gz", "a_R2.fq.gz,b_R2.fq.gz"])
(['a_R1.fq.gz', 'b_R1.fq.gz'], ['a_R2.fq.gz', 'b_R2.fq.gz'])
>>> split_inputs(["a_R1.fq.gz", "b_R1.fq.gz", "a_R2.fq.gz", "b_R2.fq.gz"])
(['a_R1.fq.gz', 'b_R1.fq.gz'], ['a_R2.fq.gz', 'b_R2.fq.gz'])
Source code in src/hicstuff/pipeline.py
check_fastq_pairs ¶
Check that several pairs of fastq files can be read as one library.
Every file must exist and be given once, and the R1 and R2 files of each pair must start with the same read: Illumina names both mates of a read pair alike, with an optional /1 or /2.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
forward
|
list of str
|
The R1 files. |
required |
reverse
|
list of str
|
The R2 files, in the order of their R1 files. |
required |
Raises:
| Type | Description |
|---|---|
ValueError
|
If a file is missing or given twice, or the files of a pair do not start with the same read. |
Source code in src/hicstuff/pipeline.py
concatenate_fastq ¶
Concatenate fastq files into one, gzip-compressed if any of them is.
The gzip files are copied as they are, which makes a valid gzip file of several members, read as one by Python, htslib and the aligners. With a gzip file among them, the plain files are compressed; otherwise the output is a plain file. A plain file that does not end with a newline gets one.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
files
|
list of str
|
The fastq files, plain or gzip-compressed, in the order to write them. |
required |
out_file
|
str
|
Path of the concatenated file. |
required |
Source code in src/hicstuff/pipeline.py
full_pipeline ¶
full_pipeline(genome, input1, input2=None, aligner=None, centromeres=None, exclude=None, circular=False, distance_law=False, enzyme=5000, filter_events=False, force=False, mapping='normal', mat_fmt=None, binning=0, zoomify=True, balancing_args=None, min_qual=30, min_size=0, no_cleanup=False, out_dir=None, pcr_duplicates=False, plot=False, prefix=None, read_len=None, remove_centros=None, start_stage='fastq', threads=1, tmp_dir=None, skip_count=False, aligner_backend=None, cmd=None)
Run the whole hicstuff pipeline. Starting from fastq files and a genome to obtain a contact matrix.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
genome
|
str
|
Path to the bowtie2/bwa index prefix if using bowtie2/bwa or to the genome in fasta format if using minimap2. |
required |
input1
|
str or list of str
|
Path to the Hi-C reads in fastq format (forward), the aligned Hi-C reads in BAM format, or the pairs file, depending on the value of start_stage. From fastq, a list of files: the R1 files of several pairs of fastq files (lanes or runs of a library), read as one library. |
required |
input2
|
str or list of str
|
Path to the Hi-C reads in fastq format (reverse), the aligned Hi-C reads in BAM format, or None, depending on the value of start_stage. From fastq, a list of files: the R2 files, in the order of their R1 files. Each pair must start with the same read; the R1 files are concatenated in the temporary directory, as are the R2 files, and aligned as one pair of files. |
None
|
binning
|
int
|
If mat_fmt is set to "cool", the cool file will be further binned to this resolution. |
0
|
zoomify
|
bool
|
Whether to zoomify binned cool matrix (only used if mat_fmt == "cool" and binning is set) |
True
|
balancing_args
|
str
|
Extra arguments passed to |
None
|
enzyme
|
int or strtest_data / genome / fa
|
|
5000
|
circular
|
bool
|
Use if the genome is circular. |
False
|
out_dir
|
str or None
|
Path where output files should be written. Current directory by default. |
None
|
tmp_dir
|
str or None
|
Path where temporary files will be written. Creates a "tmp" folder in out_dir by default. |
None
|
plot
|
bool
|
Whether plots should be generated at different steps of the pipeline. Plots are saved in a "plots" directory inside out_dir. |
False
|
min_qual
|
int
|
Minimum mapping quality required to keep a pair of Hi-C reads. |
30
|
min_size
|
int
|
Minimum contig size required to keep it. Shorter contigs are left out of the fragments list, and pairs with a mate on one of them are discarded. |
0
|
threads
|
int
|
Number of threads to use for parallel operations. |
1
|
no_cleanup
|
bool
|
Whether temporary files should be deleted at the end of the pipeline. |
False
|
mapping
|
str
|
normal|iterative|cutsite|5spm. Use normal, iterative, cutsite or 5spm
mapping. "normal": Normal alignement. "iterative": Truncates and extends
reads until unambiguous alignment. "cutsite": Digest reads at religation
sites and build new pairs from the fragments created. "5spm": Align the
mates with |
'normal'
|
filter_events
|
bool
|
Filter spurious or uninformative 3C events. Requires a restriction enzyme. |
False
|
force
|
bool
|
If True, overwrite existing files with the same name as output. |
False
|
prefix
|
str or None
|
Choose a common name for output files instead of default graal names. |
None
|
start_stage
|
str
|
Step at which the pipeline should start. Can be "fastq", "bam", "pairs" or "pairs_idx". With starting from bam allows to skip alignment and start from named-sorted bam files. With "pairs", a single pairs file is given as input, and with "pairs_idx", the pairs in the input must already be attributed to fragments and fragment attribution is skipped. |
'fastq'
|
mat_fmt
|
str or None
|
Select the output matrix format. Can be either "bg2" for the bedgraph2 format, "cool" for Mirnylab's cool format, "metacool" for metacooler's cool format for metagenomes, with one bin per fragment, graal for a plain text COO format compatible with Koszullab's instagraal software, or "none" for no matrix: the run ends with its pairs file, which tools that build their own contact maps read (metaTOR, metacooler). Options of the cool matrix, binning other than 0 and balancing_args that is not blank, are refused with metacool and none, and exclude that is not blank with none. None, the default, writes a cool matrix, or a metacool matrix, with a warning, when it holds MANY_CONTIGS contigs or more (those that min_size and exclude keep) and binning is 0. |
None
|
aligner
|
str
|
Read alignment software to use. Can be either "minimap2", "bwa" or "bowtie2". Defaults to bowtie2, and to bwa in mapping mode 5spm, which only aligns with bwa. |
None
|
pcr_duplicates
|
bool
|
If True, PCR duplicates will be filtered based on genomic positions. Pairs where both reads have exactly the same coordinates are considered duplicates and only one of those will be conserved. |
False
|
distance_law
|
bool
|
If True, generates a distance law file with the values of the probabilities to have a contact between two distances for each chromosomes or arms if the file with the positions has been given. The values are not normalized, or averaged. |
False
|
centromeres
|
None or str
|
If not None, path of file with Positions of the centromeres separated by a space and in the same order than the chromosomes. |
None
|
exclude
|
None or str
|
If not None, the name of the chromosomes to remove (e.g. "2u,chrM") |
None
|
read_len
|
int
|
Maximum read length to expect in the fastq file. Optionally used in iterative alignment mode. Estimated from the first read by default. Useful if input fastq is a composite of different read lengths. |
None
|
remove_centros
|
None or int
|
If the distance law is computed, this is the number of kb that will be removed around the centromere position given by in the centromere file. |
None
|
skip_count
|
bool
|
If True, skip counting reads in the input FASTQ files. Useful for very large files where counting is slow. |
False
|
aligner_backend
|
str
|
How bwa runs: "binary" (the bwa program), "python" (in-process with pybwa) or "auto". None reads the environment variable HICSTUFF_ALIGNER_BACKEND, and is auto if it is not set. auto runs the bwa program if it is on PATH and pybwa otherwise, and in mapping mode 5spm pybwa first. |
None
|
cmd
|
str
|
The command line that ran the pipeline, written to the log header after the date. None leaves it out. |
None
|
Source code in src/hicstuff/pipeline.py
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 1449 1450 1451 1452 1453 1454 1455 1456 1457 1458 1459 1460 1461 1462 1463 1464 1465 1466 1467 1468 1469 1470 1471 1472 1473 1474 1475 1476 1477 1478 1479 1480 1481 1482 1483 1484 1485 1486 1487 1488 1489 1490 1491 1492 1493 1494 1495 1496 1497 1498 1499 1500 1501 1502 1503 1504 1505 1506 1507 1508 1509 1510 1511 1512 1513 1514 1515 1516 1517 1518 1519 1520 1521 1522 1523 1524 1525 1526 1527 1528 1529 1530 1531 1532 1533 1534 1535 1536 1537 1538 1539 1540 1541 1542 1543 1544 1545 1546 1547 1548 1549 1550 1551 1552 1553 1554 1555 1556 1557 1558 1559 1560 1561 1562 1563 1564 1565 1566 1567 1568 1569 1570 1571 1572 1573 1574 1575 1576 1577 1578 1579 1580 1581 1582 1583 1584 1585 1586 1587 1588 1589 1590 1591 1592 1593 1594 1595 1596 1597 1598 1599 1600 1601 1602 1603 1604 1605 1606 1607 1608 1609 1610 1611 1612 1613 1614 1615 1616 1617 1618 1619 1620 1621 1622 1623 1624 1625 1626 1627 1628 1629 1630 1631 1632 1633 1634 1635 1636 1637 1638 1639 1640 1641 1642 1643 1644 1645 1646 1647 1648 1649 1650 1651 1652 1653 1654 1655 1656 1657 1658 1659 1660 1661 1662 1663 1664 1665 1666 1667 1668 1669 1670 1671 1672 1673 1674 1675 1676 1677 1678 1679 1680 1681 1682 1683 1684 1685 1686 1687 1688 1689 1690 1691 1692 1693 1694 1695 1696 1697 1698 1699 1700 1701 1702 1703 1704 1705 1706 1707 1708 1709 1710 1711 1712 1713 1714 1715 1716 1717 1718 1719 1720 1721 1722 1723 1724 1725 1726 1727 1728 1729 1730 1731 1732 1733 1734 1735 1736 1737 1738 1739 1740 1741 1742 1743 1744 1745 1746 1747 1748 1749 1750 1751 1752 1753 1754 1755 1756 1757 1758 1759 1760 1761 1762 1763 1764 1765 1766 1767 1768 1769 1770 1771 1772 1773 1774 1775 1776 1777 1778 1779 1780 1781 1782 1783 1784 1785 1786 1787 1788 1789 1790 1791 1792 1793 1794 1795 1796 1797 1798 1799 1800 1801 1802 1803 1804 1805 1806 1807 1808 1809 1810 1811 1812 1813 1814 1815 1816 1817 1818 1819 1820 1821 1822 1823 1824 1825 1826 1827 1828 1829 1830 1831 1832 1833 1834 1835 1836 1837 1838 1839 1840 1841 1842 1843 1844 1845 1846 1847 1848 1849 1850 1851 1852 1853 1854 1855 1856 1857 1858 1859 1860 1861 1862 1863 1864 1865 1866 1867 1868 1869 1870 1871 1872 1873 1874 1875 1876 1877 1878 1879 1880 1881 1882 1883 1884 1885 1886 1887 1888 1889 1890 1891 1892 1893 1894 1895 1896 1897 1898 1899 1900 1901 1902 1903 1904 1905 1906 1907 1908 1909 1910 1911 1912 1913 1914 1915 1916 1917 1918 1919 1920 1921 1922 1923 1924 1925 1926 1927 1928 1929 1930 1931 1932 1933 1934 1935 1936 1937 1938 1939 1940 1941 1942 1943 1944 1945 1946 1947 1948 1949 1950 1951 1952 1953 1954 1955 1956 1957 1958 1959 1960 1961 1962 1963 1964 1965 1966 1967 1968 1969 1970 1971 1972 1973 1974 1975 1976 1977 1978 1979 1980 1981 1982 1983 1984 1985 1986 1987 1988 1989 1990 1991 1992 1993 1994 1995 1996 1997 1998 1999 2000 2001 2002 2003 2004 2005 2006 2007 2008 2009 2010 2011 2012 2013 2014 2015 2016 2017 2018 2019 2020 2021 2022 2023 2024 2025 2026 2027 2028 2029 2030 2031 2032 2033 2034 2035 2036 2037 2038 2039 2040 2041 2042 2043 2044 2045 2046 2047 2048 2049 2050 2051 2052 2053 2054 2055 2056 2057 2058 2059 2060 2061 2062 2063 2064 2065 2066 2067 2068 2069 2070 2071 2072 2073 2074 2075 2076 2077 2078 2079 2080 2081 2082 2083 2084 2085 2086 2087 2088 2089 2090 2091 2092 2093 2094 2095 2096 2097 2098 2099 2100 2101 2102 2103 2104 2105 2106 2107 2108 2109 2110 2111 2112 2113 2114 2115 2116 2117 2118 2119 2120 2121 2122 2123 2124 2125 2126 2127 2128 2129 2130 2131 2132 2133 2134 2135 2136 2137 2138 2139 2140 2141 2142 2143 2144 2145 2146 2147 2148 2149 2150 2151 2152 2153 2154 2155 2156 2157 2158 2159 2160 2161 2162 2163 2164 2165 2166 2167 | |
hicstuff.stats ¶
get_pipeline_stats ¶
Get stats after pipeline execution.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
log_file
|
str
|
Path to hicstuff log file. |
required |
Returns:
| Name | Type | Description |
|---|---|---|
list |
A single list containing stats about hicstuff pipeline execution: - Number of sequenced pairs from fastqs - Number (% of total reads) of unmapped reads - Number (% of total reads) of mapped reads - Number (% of total reads) of pairs - Number (% of total pairs) of pairs on contigs shorter than the minimum size - Number (% of total pairs) of filtered pairs - Number (% of total pairs) of loops - Number (% of total pairs) of uncuts - Number (% of total pairs) of abnormal (-- and ++) - Number (% of total pairs) of deduplicated pairs [Number (% of total pairs) of PCR duplicates] - From all pairs used in contact matrix: - Number (% of matrix) of cis pairs - Number (% of matrix) of trans pairs - Trans ratio |
Source code in src/hicstuff/stats.py
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 | |
hicstuff.log ¶
Basic logging
Basic logging setup with two handlers (standard error and log file). By default the log file is disabled, but can be enabled or changed using set_file_handler.
remove_file_handler ¶
Detach and close the log file handler set by set_file_handler, if any. Other handlers of the logger are left alone.
Source code in src/hicstuff/log.py
set_file_handler ¶
Change the file handler for custom log file location
The handler set by a previous call is replaced. File handlers attached to the logger by other code (an application, pytest) are left alone.