Skip to main content

Hi-Compass: A human hg38 cell-type specific Hi-C(10k for now) predict deep learning model

Project description

\n# Hi-Compass

Hi-Compass is a tool for predicting chromatin interactions (Hi-C matrices) from ATAC-seq data.

Installation

Prerequisites

Important Note: Hi-Compass requires PyTorch (version >= 1.13.1), but does not install it automatically since PyTorch installation methods vary depending on your system, CUDA version, and hardware. Please install PyTorch manually following the instructions at pytorch.org before installing Hi-Compass.

Installing via pip (recommended)

pip install hicompass

Dependencies

Hi-Compass depends on the following Python packages:

  • torch (>= 1.13.1) - must be installed manually
  • numpy
  • pandas
  • pyBigWig
  • scikit-image
  • cooler

These dependencies (except for PyTorch) will be automatically installed when using pip.

Usage

Command Line Interface

After installation, you can use the hicompass command:

hicompass predict --cell_type CELL_TYPE --atac_path PATH_TO_ATAC_BW_FILE --ctcf_path PATH_TO_CTCF_BW_FILE --dna_dir_path PATH_TO_DNA_DIR --model_path PATH_TO_MODEL

predict subcommand parameters

Required parameters:

  • --cell_type: Name of the cell type for prediction
  • --atac_path: Path to the ATAC-seq .bw file
  • --ctcf_path: Path to the general CTCF ChIP-seq .bw file
  • --dna_dir_path: Path to the DNA sequence fa.gz directory
  • --model_path: Path to the model weights file

Optional parameters:

  • --output_path: Output directory path (default: ./output/<cell_type>)
  • --device: Device to use for computation (e.g., "cuda:0" or "cpu", default: "cpu")
  • --chromosomes: Chromosomes to process (e.g., "1,3,5" or "1-22", default: "1-22")
  • --depth: Sequencing depth parameter (default: 800000)
  • --stride: Stride value for prediction (default: 50)
  • --batch_size: Batch size for prediction (default: 2)
  • --num_workers: Number of worker threads for data loading (default: 16)
  • --resolution: Resolution of the output Hi-C matrix in bp (default: 10000)
  • --window_size: Window size for prediction in bp (default: 2097152)

Python API

You can also use Hi-Compass in Python scripts:

from hicompass.models import ConvTransModel
from hicompass.chromosome_dataset import ChromosomeDataset
from hicompass.utils import merge_hic_segment

# Create dataset
dataset = ChromosomeDataset(
    chr_name_list=['chr1', 'chr2'],
    atac_path_list=['/path/to/atac.bw'],
    dna_dir_path='/path/to/dna/sequences',
    general_ctcf_bw_path='/path/to/ctcf.bw',
    stride=50,
    depth=800000
)

# Load model
model = ConvTransModel()
model.load_state_dict(torch.load('/path/to/model.pth'))

# Further processing...

Examples

Process a specific cell type with required parameters:

hicompass predict --cell_type gm12878 \
                  --atac_path /path/to/gm12878_ATAC.bw \
                  --ctcf_path /path/to/ctcf.bw \
                  --dna_dir_path /path/to/dna/sequences \
                  --model_path /path/to/model.pth

Process only chromosomes 1, 3, and 5:

hicompass predict --cell_type gm12878 \
                  --atac_path /path/to/gm12878_ATAC.bw \
                  --ctcf_path /path/to/ctcf.bw \
                  --dna_dir_path /path/to/dna/sequences \
                  --model_path /path/to/model.pth \
                  --chromosomes 1,3,5

Specify a custom output path and use GPU:

hicompass predict --cell_type gm12878 \
                  --atac_path /path/to/gm12878_ATAC.bw \
                  --ctcf_path /path/to/ctcf.bw \
                  --dna_dir_path /path/to/dna/sequences \
                  --model_path /path/to/model.pth \
                  --output_path /my/custom/output/directory \
                  --device cuda:0

Output

The tool generates a .cool file containing the predicted Hi-C matrix for the specified cell type. This file can be visualized using tools like Juicebox, HiCExplorer or just matplotlib.pyplot.imshow.

License

Hi-Compass is released under the MIT License.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

hicompass-0.1.5.tar.gz (19.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

hicompass-0.1.5-py3-none-any.whl (20.7 kB view details)

Uploaded Python 3

File details

Details for the file hicompass-0.1.5.tar.gz.

File metadata

  • Download URL: hicompass-0.1.5.tar.gz
  • Upload date:
  • Size: 19.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.11.0

File hashes

Hashes for hicompass-0.1.5.tar.gz
Algorithm Hash digest
SHA256 03caab2fbfe2032c52c269b92e105914fa4e9244e899e9279c404598870eb7f4
MD5 969f1b3991bd3d2362e6a4d1641c2edb
BLAKE2b-256 112181dbe1caf3453c48986f8a9bee56e32b3057860c4d6bb576bc0922936898

See more details on using hashes here.

File details

Details for the file hicompass-0.1.5-py3-none-any.whl.

File metadata

  • Download URL: hicompass-0.1.5-py3-none-any.whl
  • Upload date:
  • Size: 20.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.11.0

File hashes

Hashes for hicompass-0.1.5-py3-none-any.whl
Algorithm Hash digest
SHA256 cf3c4e5f3278e7f4b42e7e0685193f0bfa44003b12c5176fab61e015e8d3c36e
MD5 8637cbe48c831c4b84e73b4a0cae4522
BLAKE2b-256 2ab1da9f8b204006c1c602a2b51a8adc745c496deacfeafb157b8e8ef49029af

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page