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.6.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.6-py3-none-any.whl (20.5 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: hicompass-0.1.6.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.6.tar.gz
Algorithm Hash digest
SHA256 0b77b8e3972b53b17698d753f62ea15ecbddee258acbfe7561632a1124f5a1d9
MD5 b7a518276973ef5324db59b7927f5335
BLAKE2b-256 4b8d0b3a8e2e235c60f0bb8610bd7cd28f7b20cc11609d025f5ae7c6f1ddb4c8

See more details on using hashes here.

File details

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

File metadata

  • Download URL: hicompass-0.1.6-py3-none-any.whl
  • Upload date:
  • Size: 20.5 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.6-py3-none-any.whl
Algorithm Hash digest
SHA256 7e2c60665adfc5dab2147e0e05b6b3f9b51b53ee31109ad6bc70e93a7ed279ab
MD5 d02ca9151605fbebea8a6ff9e3a860ee
BLAKE2b-256 b74a4910ad76d86f3bc640e94d18b668c0461bd16f12a57000934a353ccf54fb

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