Python Protein Subunit Syntax
Project description
PPSS - Python Protein Subunit Syntax
A simple Python package for defining protein subunit structures.
Installation
The simplest way to install this is to do as follows:
pip install ppss
You can also install the Poetry packaging and dependency tool and then clone this repository and install with poetry, as follows:
pipx install poetry
git clone https://github.com/sandyjmacdonald/ppss
cd ppss
poetry install
Usage
The simple example below defines a protein comprised of either an S1 plus S1 subunit, or just an S3 subunit. The bar (|) symbol here represents an OR condition or "alternation", while the + represents an AND condition or "concatenation". Subunit IDs can be any combination of upper and/or lowercase alphabetical and numerical characters.
from ppss import ProteinParser
# Instantiate the parser
parser = ProteinParser()
# Define a protein structure
protein_definition = "(S1 + S2) | S3"
# Parse the protein structure
structures = parser.parse(protein_definition)
# Display the structures
for structure in structures:
print(structure)
The two possible structures are printed:
S1 + S2
S3
The full grammar of the Lark parser is as follows:
?start: protein
protein: alternation
alternation: concatenation ("|" concatenation)*
concatenation: required_term ("+" term)*
?term: required_term
| optional_term
required_term: multiplicity
| subunit
| "(" alternation ")"
optional_term: optional
multiplicity: subunit "{" DIGIT+ "}"
| "(" alternation ")" "{" DIGIT+ "}"
optional: "[" alternation "]"
subunit: SUBUNIT
SUBUNIT: /[A-Za-z0-9]+/
DIGIT: "0" | "1" | "2" | "3" | "4" | "5" | "6" | "7" | "8" | "9"
%import common.WS
%ignore WS
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file ppss-0.2.0.tar.gz.
File metadata
- Download URL: ppss-0.2.0.tar.gz
- Upload date:
- Size: 4.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.8.3 CPython/3.12.5 Darwin/23.0.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
1662922fd7b37c092ea4d4150712bfbf9d6eabf790a6b497ec07453a6ca5f673
|
|
| MD5 |
8332135cd77c47dbbb46364642b4026f
|
|
| BLAKE2b-256 |
fd6364a17abc4cf57e937698ec6f572870b0ffe7e2b1142c25f36ff3b5e5b554
|
File details
Details for the file ppss-0.2.0-py3-none-any.whl.
File metadata
- Download URL: ppss-0.2.0-py3-none-any.whl
- Upload date:
- Size: 5.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.8.3 CPython/3.12.5 Darwin/23.0.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
6b903f8f2403d70b4f6085fd2fdffa6ebb6d12c061648e36c3421e424e0aead4
|
|
| MD5 |
11d537444b456c17aad4ff6a06bee8bf
|
|
| BLAKE2b-256 |
52222bf04f62f4e5598318cf2e56dc19b345b860ec4dd2c0eeda8a23656a79b8
|