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

Uploaded Python 3

File details

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

File metadata

  • Download URL: hicompass-0.1.4.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.4.tar.gz
Algorithm Hash digest
SHA256 099f60027b04e1f0685c9f716331bee24d43ae2f6df7b214feef9893c507f2ee
MD5 329707fce8ca8d50c0b01258cdd38854
BLAKE2b-256 60c02d1c208a3bd5eb4bc3379371404b7cf47c4f9f4f63e9a4ac5555047994f5

See more details on using hashes here.

File details

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

File metadata

  • Download URL: hicompass-0.1.4-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.4-py3-none-any.whl
Algorithm Hash digest
SHA256 7272dc47723dfc045ee05fc2dbd5c9d61c9256ea2796fdabc18c2d20f2d5dd2a
MD5 571ae8db08f5d7481393aca3f5617eed
BLAKE2b-256 8a99481cd21ecd8acd80a7fe29f7c906851c3171aa7f48b488f1eade6f7abba0

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