Hic_qc on Biowulf

hic_qc is a command-line tool for checking the quality of Hi-C sequencing libraries using reads aligned to a reference genome or assembly. It measures long-range contacts, contacts between contigs, mapping quality, duplicate reads, and the distribution of distances between read pairs. The tool produces summary statistics, plots, and an optional report that can help identify weak Hi-C signal or possible problems with the library or assembly.

Documentation
Important Notes

Interactive job
Interactive jobs should be used for debugging, graphics, or applications that cannot be run as batch jobs.

Allocate an interactive session and run the program. Sample session:

[user@biowulf]$ sinteractive
salloc.exe: Pending job allocation 46116226
salloc.exe: job 46116226 queued and waiting for resources
salloc.exe: job 46116226 has been allocated resources
salloc.exe: Granted job allocation 46116226
salloc.exe: Waiting for resource configuration
salloc.exe: Nodes cn4224 are ready for job

[user@cn4224 ~]$ module load hic_qc
[+] Loading hic_qc  1.2  on cn4224 

[user@cn4224 ~]$ mkdir /data/$USER/HIC_QC-TEST
[user@cn4224 ~]$ cd /data/$USER/HIC_QC-TEST

[user@cn4224 ~]$ git clone https://github.com/phasegenomics/hic_qc.git

[user@cn4224 ~]$ cd hic_qc/tests/collateral
[user@cn4224 ~]$ hic_qc.py -b input/abc_test.bam -n 2
[hic_qc - 2026-08-25 16:22:06,213] parsing the first 2 read pairs in bam file tests/collateral/input/abc_test.bam to QC Hi-C library quality
[hic_qc - 2026-08-25 16:22:28,011] Number of contigs (more is harder):
[hic_qc - 2026-08-25 16:22:28,013] 1,288
[hic_qc - 2026-08-25 16:22:28,014] Number of contigs greater than 10KB (longer contigs are better):
[hic_qc - 2026-08-25 16:22:28,014] 229
[hic_qc - 2026-08-25 16:22:28,015] N50 of input assembly (longer contigs are better):
[hic_qc - 2026-08-25 16:22:28,016] 33,438
[hic_qc - 2026-08-25 16:22:28,017] Length of input assembly (bigger is harder):
[hic_qc - 2026-08-25 16:22:28,017] 12,059,467
[hic_qc - 2026-08-25 16:22:28,018] Counts of zero distances (many is a sign of bad prep):
[hic_qc - 2026-08-25 16:22:28,019] 2 of total 5 40.00%
[hic_qc - 2026-08-25 16:22:28,019] Count of same-contig read pairs with distance > 10KB (many is a sign of good prep):
[hic_qc - 2026-08-25 16:22:28,020] 0 of total 5 0.00%
[hic_qc - 2026-08-25 16:22:28,021] Proportion of reads mapping to contigs > 10 Kbp with inserts > 10 Kbp:
[hic_qc - 2026-08-25 16:22:28,022] 0 of total 4 0.00%
[hic_qc - 2026-08-25 16:22:28,022] Count of read pairs with mates mapping to different chromosomes/contigs (sign of good prep IF same genome):
[hic_qc - 2026-08-25 16:22:28,023] 0 of total 5 0.00%
[hic_qc - 2026-08-25 16:22:28,024] Count of split reads (more is usually good, as indicates presence of Hi-C junction in read):
[hic_qc - 2026-08-25 16:22:28,025] 0 of total 10 0.00%
[hic_qc - 2026-08-25 16:22:28,025] Count of MAPQ zero reads (bad, ambiguously mapped):
[hic_qc - 2026-08-25 16:22:28,026] 1 of total 10 20.00%
[hic_qc - 2026-08-25 16:22:28,027] Count of duplicate reads (-1 if insufficient to estimate; duplicates are bad; WILL ALWAYS BE ZERO UNLESS BAM FILE IS PREPROCESSED TO SET THE DUPLICATES FLAG):
[hic_qc - 2026-08-25 16:22:28,028] 0 of total 10 0.00%

[user@cn4224 ~]$ exit
salloc.exe: Relinquishing job allocation 46116226

[user@biowulf ~]$

Batch job
Most jobs should be run as batch jobs.

Create a batch input file (e.g. hic_qc.sh) similar to the following.

#! /bin/bash

module load hic_qc

cd /data/${USER}/HIC_QC-TEST/hic_qc/tests/collateral

hic_qc.py -b input/abc_test.bam -n 2

Submit these jobs using the Slurm sbatch command.

Swarm of Jobs
A swarm of jobs is an easy way to submit a set of independent commands requiring identical resources.

Create a swarmfile for the first step of the pipeline (e.g. hic_qc.swarm). For example:

hic_qc.py \
    -b /data/${USER}/HIC_QC-TEST/hic_qc/tests/collateral/input/abc_test.bam \
    -n 2 \
    -o /data/${USER}/HIC_QC-TEST/hic_qc/tests/collateral/run1

hic_qc.py \
    -b /data/${USER}/HIC_QC-TEST/hic_qc/tests/collateral/input/abc_test.bam \
    -n 2 \
    -o /data/${USER}/HIC_QC-TEST/hic_qc/tests/collateral/run2

hic_qc.py \
    -b /data/${USER}/HIC_QC-TEST/hic_qc/tests/collateral/input/abc_test.bam \
    -n 2 \
    -o /data/${USER}/HIC_QC-TEST/hic_qc/tests/collateral/run3

Submit this job using the swarm command.

swarm -f hic_qc.swarm [-g #] --module hic_qc
where
-g # Number of Gigabytes of memory required for each process (1 line in the swarm command file)
--module hic_qc Loads the hic_qc module for each subjob in the swarm