Welcome! This repository will allow you to measure the quality and reproducibility of 3D genome data. It computes the following:

Quality scores per sample using

Reproducibility for pairs of samples using



  1. Make sure you have R>=3.4.0 (needed for HiCRep).

  2. Install Anaconda2, which contains python as well as a set of commonly used packages. 3DChromatin_ReplicateQC is compatible with Python 2.

  3. First clone the repository:

git clone http://github.com/kundajelab/3DChromatin_ReplicateQC

Then, run the following installation command:


Note if you are installing locally: There are a few parameters you can provide to the installation script, to point it to your desired python installation (where you installed anaconda, e.g. /home/anaconda/bin/python), R installation, R library and modules. Thus, you can run the above as described in the following example.

Assume the following:

Then, your installation commands would look as below:

3DChromatin_ReplicateQC/install_scripts/install_3DChromatin_ReplicateQC.sh --pathtopython /home/my_anaconda2/bin/python --pathtor /home/my_R/bin/R --rlib /home/my_R_libraries --modules module1,module2` 

Note that to call 3DChromatin_ReplicateQC you will need to use the full path to it, which will be in the example above /home/my_anaconda2/bin/3DChromatin_ReplicateQC, rather than simply 3DChromatin_ReplicateQC.

Quick start

Say you want to compare 2 contact maps. For this example, we will use a subset of datasets from Rao et al., 2014. First, configure the files used in the example:


Then run all methods (both QC and reproducibility as follows):

cd 3DChromatin_ReplicateQC
3DChromatin_ReplicateQC run_all --metadata_samples examples/metadata.samples --metadata_pairs examples/metadata.pairs --bins examples/Bins.w50000.bed.gz --outdir examples/output 


The scores are summarized in the output directory under scores/.

Notes about the genomewide scores

Note that the genomewide scores are computed as follows:

Also note that the genomewide scores are computed considering all chromosomes by default. If the option --subset_chromosomes is used, then the genomewide score refers to the genomewide score obtained by considering only the subset of chromosomes specified in --subset_chromosomes.


Before running 3DChromatin_ReplicateQC, make sure to have the following files:

3DChromatin_ReplicateQC takes the following inputs:

Analyzing multiple dataset pairs

To analyze multiple pairs of contact maps (or multiple contact maps if just computing QC), all you need to do is add any additional datasets you want to analyze to the --metadata_samples file and any additional pairs of datasets you want to compare to the --metadata_pairs files.

Parameters file

The parameters file specifies the parameters to be used with 3DChromatin_ReplicateQC. The format of the file is: method_name parameter_name parameter_value. The default parameters file used by 3DChromatin_ReplicateQC is:

GenomeDISCO|subsampling lowest
GenomeDISCO|tmin        3
GenomeDISCO|tmax    3
GenomeDISCO|norm    sqrtvc
GenomeDISCO|scoresByStep    no
GenomeDISCO|removeDiag      yes
GenomeDISCO|transition      yes
HiCRep|h    5
HiCRep|maxdist  5000000
HiC-Spector|n   20
QuASAR|rebinning    resolution
SGE|text    "-l h_vmem=3G"
slurm|text  "--mem 3G"

Note: all of the above parameters need to be specified in the parameters file.

Here are details about setting these parameters:

GenomeDISCO parameters

HiCRep parameters

HiC-Spector parameters

QuASAR parameters

Job submission parameters

Note about normalization: At the moment, the different methods operate on different types of normalizations. For GenomeDISCO, the user can specify the desired normalization. For HiCRep and HiC-Spector the scores are computed on the provided data, without normalization. Thus, if you have normalized data, then you can provide that as an input, and set GenomeDISCO|norm to uniform. If you have raw data, then your HiCRep and HiC-Spector scores will be run on the raw data, and GenomeDISCO will be run on the normalization you specify with GenomeDISCO|norm.

Running 3DChromatin_ReplicateQC step by step

3DChromatin_ReplicateQC consists of multiple steps, which are run in sequence by default. However, the user may decide to run the steps individually, which can be useful for instance when running 3DChromatin_ReplicateQC with job submission engines that runs the comparisons in parallel as separate jobs.

3DChromatin_ReplicateQC steps


Preprocesses all datasets provided in --metadata_samples.

Example command:

3DChromatin_ReplicateQC preprocess --metadata_samples examples/metadata.samples --bins examples/Bins.w50000.bed.gz --outdir examples/output --parameters_file examples/example_parameters.txt


Runs QC methods on all samples provided in --metadata_samples. Note that this step is only compatible with --methods QuASAR-QC, since this is the only method that provides sample-level quality scores. If you provide any other methods to this step in addition to QuASAR-QC, they will not be run.

Example command:

3DChromatin_ReplicateQC qc --metadata_samples examples/metadata.samples --outdir examples/output --methods QuASAR-QC


Runs reproducibility methods on all samples pairs provided in --metadata_pairs. Note that the only methods that can be run with this step are: GenomeDISCO, HiCRep, HiC-Spector and QuASAR-Rep. If QuASAR-QC is provided here, it will not be run.

Example command:

3DChromatin_ReplicateQC concordance --metadata_pairs examples/metadata.pairs --outdir examples/output --methods GenomeDISCO,HiCRep,HiC-Spector,QuASAR-Rep 


Summarizes scores across all comparisons.

Example command:

3DChromatin_ReplicateQC summary --metadata_samples examples/metadata.samples --metadata_pairs examples/metadata.pairs --bins examples/Bins.w50000.bed.gz --outdir examples/output --methods GenomeDISCO,HiCRep,HiC-Spector,QuASAR-Rep,QuASAR-QC


Clean up superfluous files, leaving only the scores.

Example command:

3DChromatin_ReplicateQC cleanup --outdir examples/output

Running this code with job submission engines

It is possible to run 3DChromatin_ReplicateQC with job submission engines, specifically either SGE or slurm. To do so, modify the parameters SGE|text or slurm|text respectively, to add any additional parameters to the job run.

Then, run the steps sequentially (that is, wait for all jobs of a given step to complete before launching the next step), while specifying --running_mode to either sge or slurm.

For instance, an example analysis workflow for SGE would be:

3DChromatin_ReplicateQC preprocess --running_mode sge --metadata_samples examples/metadata.samples --bins examples/Bins.w50000.bed.gz --outdir examples/output --parameters_file examples/example_parameters.txt
3DChromatin_ReplicateQC qc --running_mode sge --metadata_samples examples/metadata.samples --outdir examples/output --methods QuASAR-QC
3DChromatin_ReplicateQC concordance --running_mode sge --metadata_pairs examples/metadata.pairs --outdir examples/output --methods GenomeDISCO,HiCRep,HiC-Spector,QuASAR-Rep
3DChromatin_ReplicateQC summary --running_mode sge --metadata_samples examples/metadata.samples --metadata_pairs examples/metadata.pairs --bins examples/Bins.w50000.bed.gz --outdir examples/output --methods GenomeDISCO,HiCRep,HiC-Spector,QuASAR-Rep,QuASAR-QC
3DChromatin_ReplicateQC cleanup --running_mode sge --outdir examples/output

Similarly, for slurm, change sge to slurm for the --running_mode.

More questions about this repository?

Contact Oana Ursu (oursu@stanford.edu)

Or submit an issue for this repository.



This repository was put together by Oana Ursu. Thanks to Michael Sauria for providing wrapper scripts around the QuASAR method, Tao Yang for his assistance in integrating HiCRep into this repository, and Koon-Kiu Yan for his assistance in integrating HiC-Spector into this repository.


Thanks to the Noble lab (Gurkan Yardminci, Jie Liu, Charles Grant), as well as Michael Sauria for testing the code out and for suggestions for improvement.

docker (coming soon)

Thanks to Anna Shcherbina for help making this code dockerized.