Skip to main content

AAindex (aaindex1/2/3) to clean pandas DataFrames

Project description

PyAAindex

pyaaindex provides cleaned pandas DataFrames from AAindex (aaindex1, aaindex2, aaindex3).

Install

pip install pyaaindex

Quick Start

from pyaaindex.api import get_features, to_frame

# Fetch features by ID. The package automatically resolves across aaindex1, 2, and 3.
data = get_features(["ARGP820101", "ALTS910101"])

# data['idx1'] -> single pandas.DataFrame for aaindex1 features
# data['idx2'] -> dict formatted for aaindex2 pair matrices
# data['idx3'] -> dict formatted for aaindex3 pair matrices

print(data['idx1'])
#             A     C     D     E     F  ...
# ARGP...  0.61  1.07  0.46  0.47  2.02

# Pair matrices are returned as `{feature_name: {aa1: [values]}}` where [values] are sorted alphabetically based on aa2.
print(data['idx2']['ALTS910101']['A'])
# [3.0, -3.0, 0.0, ...]

# Convert JSON array matrices to pandas DataFrames
df_dict = to_frame(data['idx2'])
print(df_dict['ALTS910101']) 
# Returns a full DataFrame where rows=aa1, columns=aa2

Output Shapes

idx1 (single amino-acid index)

The idx1 key returns a single pandas DataFrame.

  • Index: Canonical amino acids (A, C, D, E, F, G, H, I, K, L, M, N, P, Q, R, S, T, V, W, Y).
  • Columns: The calculated feature weights.

idx2 and idx3 (pair data)

The idx2 and idx3 keys return a Python dictionary (JSON-friendly).

  • Structure: {feature_name: {amino_acid_1: [values]}}
  • Sorting: The [values] are strictly aligned in alphabetical order by aa2.

To manipulate idx2 or idx3 as Pandas figures, pass the dictionary payload into to_frame():

# Convert dict -> Dict[str, pd.DataFrame]
frames = to_frame(data['idx2'])
df = frames['ALTS910101']

This utility dynamically restores the alphabetical columns and assigns the index for instant usability.

Acknowledgments

  1. https://www.genome.jp/aaindex/
  2. Kawashima, S., Pokarowski, P., Pokarowska, M., Kolinski, A., Katayama, T., and Kanehisa, M.; AAindex: amino acid index database, progress report 2008. Nucleic Acids Res. 36, D202-D205 (2008). [PMID:17998252]

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

pyaaindex-0.2.0.tar.gz (10.4 kB view details)

Uploaded Source

Built Distribution

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

pyaaindex-0.2.0-py3-none-any.whl (9.3 kB view details)

Uploaded Python 3

File details

Details for the file pyaaindex-0.2.0.tar.gz.

File metadata

  • Download URL: pyaaindex-0.2.0.tar.gz
  • Upload date:
  • Size: 10.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.8.4

File hashes

Hashes for pyaaindex-0.2.0.tar.gz
Algorithm Hash digest
SHA256 405f1ac01382343056d09c104c83e5b25bdec6614689e1965c13787b4f8a041f
MD5 df7be405a24ca23c983562a8128f9ffa
BLAKE2b-256 6be5305d9275165e03eb091c59f04f0c430c2b692d3dbb53f296f1c0820c38dd

See more details on using hashes here.

File details

Details for the file pyaaindex-0.2.0-py3-none-any.whl.

File metadata

  • Download URL: pyaaindex-0.2.0-py3-none-any.whl
  • Upload date:
  • Size: 9.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.8.4

File hashes

Hashes for pyaaindex-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 405c35644eec362f737450d16c5452a93cea63ffef50c1c18b73bef4e349667c
MD5 095d020c05316e089a8363c85a6a63dc
BLAKE2b-256 3cfe547b6366fe7d94ddb2315409838ec5cfe1ecbd9adb627475540929b0b8a9

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