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

Uploaded Python 3

File details

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

File metadata

  • Download URL: hicompass-0.1.7.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.7.tar.gz
Algorithm Hash digest
SHA256 d80e5f158054b4ac439778ecfbf18f3c1f1ddbfe0c8b586fd79297a05eadc1ad
MD5 87af8893d944888f9550535fba70d79f
BLAKE2b-256 4e60a1c182d6bd5cc8f235fdd2ea07da6283f072cc78e80118961c5f184694f2

See more details on using hashes here.

File details

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

File metadata

  • Download URL: hicompass-0.1.7-py3-none-any.whl
  • Upload date:
  • Size: 20.4 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.7-py3-none-any.whl
Algorithm Hash digest
SHA256 729e43dc21b445f4f117ce55ce10c55192ab5ad272388ce5a546118ed11076e4
MD5 a452983c9f57280e75a9c196ac5f966c
BLAKE2b-256 80c79dfccfa73445132c71c726e0ceb6316ae317335a7f930e1ec820652eb4e7

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