Skip to main content

HFold: Python bindings for the HFold C++ library

Project description

How to test the hfold python package

1. Make sure you have ViennaRNA installed on your system

ViennaRNA package installation

The hfold package requires ViennaRNA to be installed before compilation.

  1. Download the ViennaRNA package: ViennaRNA-2.7.0.tar.gz

  2. Install the Package:

tar -zxvf ViennaRNA-2.7.0.tar.gz
cd ViennaRNA-2.7.0
./configure --without-perl
sudo make -j$(nproc)              # Linux
sudo make -j$(sysctl -n hw.ncpu)  # macOS
sudo make install

More info: ViennaRNA GitHub

2. Setup a Virtual Environment

Make sure you're in a virtual environment

python3 -m venv venv
source venv/bin/activate

3. Install Python Dependencies

Make sure you have pybind11 and setuptools installed

sudo apt install pybind11-dev # linux
brew install pybind11 # MacOS
python3 -m pip install pybind11 setuptools scikit-build

4. Build the Python Extension

From the project root:

pip install -v -e ./pylib/

5. Start Python

python3

6. Run Test Commands

Once in the Python shell, you can test hfold:

import hfold

# Basic sequence folding
hfold.hfold("AGGGCUAUCCUU", param_file="../params/rna_DirksPierce09.par")[0][0]

# Folding with suboptimal structures
hfold.hfold("AGGGCUAUCCUU", subopt=5, param_file="../params/rna_DirksPierce09.par")[0]

# Folding sequences from file
hfold.hfold(subopt=2, fileI="./sample_inputs/sample.txt", param_file="../params/rna_DirksPierce09.par")

Full List of Parameters

Parameter Type Description
sequence str RNA sequence
restriction str Folding constraint
pk_free bool Exclude pseudoknots
pk_only bool Only allow pseudoknots
dangles int Dangle configuration
subopt int Number of suboptimal structures
fileI str Input file path
fileO str Output file path
param_file str Thermodynamic parameters file
noConv_given bool Do not convert DNA into RNA
suppress_output bool Suppress console output

Build wheels

python -m pip install --upgrade cibuildwheel scikit-build-core twine pybind11 setuptools # install pre-req
cibuildwheel pylib --output-dir dist # build
python -m twine upload dist/* # upload

Project details


Download files

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

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distributions

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

hfold-0.0.4-cp313-cp313-macosx_11_0_arm64.whl (3.1 MB view details)

Uploaded CPython 3.13macOS 11.0+ ARM64

hfold-0.0.4-cp312-cp312-macosx_11_0_arm64.whl (2.7 MB view details)

Uploaded CPython 3.12macOS 11.0+ ARM64

hfold-0.0.4-cp311-cp311-macosx_11_0_arm64.whl (2.7 MB view details)

Uploaded CPython 3.11macOS 11.0+ ARM64

hfold-0.0.4-cp310-cp310-macosx_11_0_arm64.whl (2.7 MB view details)

Uploaded CPython 3.10macOS 11.0+ ARM64

hfold-0.0.4-cp39-cp39-macosx_11_0_arm64.whl (2.7 MB view details)

Uploaded CPython 3.9macOS 11.0+ ARM64

hfold-0.0.4-cp38-cp38-macosx_11_0_arm64.whl (2.7 MB view details)

Uploaded CPython 3.8macOS 11.0+ ARM64

File details

Details for the file hfold-0.0.4-cp313-cp313-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for hfold-0.0.4-cp313-cp313-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 69212ff1451d62438fd1dc0d0d9dadca8b7ce8b6a0d4c3027bfd1c3615e825da
MD5 3e48d4ef370631109d15db202184a954
BLAKE2b-256 2e1ef71ef486bbd354b02389586c3bd03f62292af694eed760c6d90d66b172ea

See more details on using hashes here.

File details

Details for the file hfold-0.0.4-cp312-cp312-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for hfold-0.0.4-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 e8d67ca0b155fa4e471ae04b0fb9e93fd56f65c101cd5dc623a73b259acb07b8
MD5 ba07babc762bbfdd23c5b8346475381b
BLAKE2b-256 8a39464633475c2b00d3e782d348d677d80b045937dd7dfbf0e26ff2f522e9eb

See more details on using hashes here.

File details

Details for the file hfold-0.0.4-cp311-cp311-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for hfold-0.0.4-cp311-cp311-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 2426d2732be838d7a91972a6065f5b8c6c029fa44ec6fdf556757f0cc7cd1665
MD5 4dbad6c47535eedbde929f2e016d97e6
BLAKE2b-256 1c80fccb6da5f97990e042caa48b601709b10311f98c4650a8a5e110f6a8e2e3

See more details on using hashes here.

File details

Details for the file hfold-0.0.4-cp310-cp310-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for hfold-0.0.4-cp310-cp310-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 1f8434ba6a35231db7914f8dc1e36bfd6c3b4d0c71379aca574265b56fbb960d
MD5 677e34e385d1562979b9881e753e2e1a
BLAKE2b-256 ff7dbcf832fb0996294e88559b1920421107128ab0086fce354039c7264accb4

See more details on using hashes here.

File details

Details for the file hfold-0.0.4-cp39-cp39-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for hfold-0.0.4-cp39-cp39-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 532f49f5a78188989ce2992bd1ef9dfb050bdaf4bf4de560e62514801134bf4e
MD5 0bc25b9d98e1105facec3f7e9d2c3bcc
BLAKE2b-256 7726a2d5795d980450ece1a195a53413d3c80a5c2e17d4597184d4aa1033ac67

See more details on using hashes here.

File details

Details for the file hfold-0.0.4-cp38-cp38-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for hfold-0.0.4-cp38-cp38-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 2ae312e69c0861b68e3227e185d06927d67f65c5cf4cf7ed180c6627b548fc61
MD5 c06dbbb0cd523a1369e46a0a7f464c06
BLAKE2b-256 d243dede323f1a9e0a86b4ae569c9c91872a1065f55f1843ad27bf5e8bf3bd80

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