DNA: a domain-specific language (transcription between UTF-8 text and DNA bases) based on YAML.
Project description
DNA
A domain-specific language (transcription between UTF-8 text and DNA bases) based on YAML.
Transcoding
Please refer to coding.py:
DNA_TO_BIN = {
"A": "00",
"C": "01",
"G": "10",
"T": "11"
}
BIN_TO_DNA = {
v: k
for k, v in DNA_TO_BIN.items()
}
DNA_COMPLEMENT = {
"A": "T",
"T": "A",
"C": "G",
"G": "C"
}
Installation
DNA can be installed from PyPI:
pip install dnadsl
or download the repository and run:
pip install .
as of the repository root folder.
Usage
Run dna --help for help:
$ dna --help
usage: dna [-h] [-m {encode,decode}] [-i INPUT_FILE] [-o OUTPUT_FILE] [-v]
+--------------------------------------------------+
| DNA |
| A domain-specific language |
| (transcription between UTF-8 text and DNA bases) |
| based on YAML. |
+--------------------------------------------------+
options:
-h, --help show this help message and exit
-m {encode,decode}, --mode {encode,decode}
Choose the mode of transcoding.
encode: UTF-8 to bases; decode: bases to UTF-8.
The default is: encode
-i INPUT_FILE, --input-file INPUT_FILE
The path of the input YAML file.
-o OUTPUT_FILE, --output-file OUTPUT_FILE
The path of the output YAML file.
-v, --version Print the version number of dna and exit.
Examples
-
Convert UTF-8 text to DNA bases, e.g., run
dna -m encode -i input_text.yml -o output_bases.yml:-
text_utf8: 😄😊
-
text_utf8: 😄😊 dna: positive_strand: sequence: TTAAGCTTGCGAGACATTAAGCTTGCGAGAGG binary: 11110000 10011111 10011000 10000100 11110000 10011111 10011000 10001010 text: 😄😊 negative_strand: sequence: AATTCGAACGCTCTGTAATTCGAACGCTCTCC binary: 00001111 01100000 01100111 01111011 00001111 01100000 01100111 01110101 text: "\x0F`g{\x0F`gu"
-
-
Convert DNA bases to UTF-8 text, e.g., run
dna -m decode -i input_bases.yml -o output_text.yml:-
positive_strand: TGAGGCTCGGCATGTTGTGAGATTTTAAGCTTGCAAGTCG
-
text_utf8: ❤️🐶 dna: positive_strand: sequence: TGAGGCTCGGCATGTTGTGAGATTTTAAGCTTGCAAGTCG binary: 11100010 10011101 10100100 11101111 10111000 10001111 11110000 10011111 10010000 10110110 text: ❤️🐶 negative_strand: sequence: ACTCCGAGCCGTACAACACTCTAAAATTCGAACGTTCAGC binary: 00011101 01100010 01011011 00010000 01000111 01110000 00001111 01100000 01101111 01001001 text: "\x1Db[\x10Gp\x0F`oI"
-
Packaging
The binaries are created with PyInstaller:
# Package it on Linux
pyinstaller --name DNA --onefile -p dna dna/__main__.py
# Package it on Windows
pyinstaller --name DNA --onefile --icon python.ico -p dna dna/__main__.py
Copyrights
DNA is a free, open-source software package (distributed under the GPLv3 license). The logo used in README.md is downloaded from Wikimedia Commons. The Python icon is downloaded from python.ico.
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
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 dnadsl-0.3.1.tar.gz.
File metadata
- Download URL: dnadsl-0.3.1.tar.gz
- Upload date:
- Size: 17.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
b3143369b49ace3d5630a4d6948191dafef71abcb01b01f2f2253914ec0bd0ca
|
|
| MD5 |
b164d0ed0be6dad0a8aa91f9bd871136
|
|
| BLAKE2b-256 |
6391af8c16556c92ec600c2611195f2a4f07f6297feaceef897813f807ca9dcc
|
Provenance
The following attestation bundles were made for dnadsl-0.3.1.tar.gz:
Publisher:
python-publish.yml on project-aico/dna
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
dnadsl-0.3.1.tar.gz -
Subject digest:
b3143369b49ace3d5630a4d6948191dafef71abcb01b01f2f2253914ec0bd0ca - Sigstore transparency entry: 491134339
- Sigstore integration time:
-
Permalink:
project-aico/dna@a9c1e71081d011cdbc57b4aef175bc01fdd1e02d -
Branch / Tag:
refs/tags/v0.3.1 - Owner: https://github.com/project-aico
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
python-publish.yml@a9c1e71081d011cdbc57b4aef175bc01fdd1e02d -
Trigger Event:
release
-
Statement type:
File details
Details for the file dnadsl-0.3.1-py3-none-any.whl.
File metadata
- Download URL: dnadsl-0.3.1-py3-none-any.whl
- Upload date:
- Size: 18.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
c43d7eae8f84afccf1df759242385910b13d448d60b839714171a41be7bf431d
|
|
| MD5 |
16c2e42002f1838a2d276a53812ec842
|
|
| BLAKE2b-256 |
223038f0dc5556d5cc67ae0b3085b2edc8ddd28e438970bfbb31094f1bdb34fd
|
Provenance
The following attestation bundles were made for dnadsl-0.3.1-py3-none-any.whl:
Publisher:
python-publish.yml on project-aico/dna
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
dnadsl-0.3.1-py3-none-any.whl -
Subject digest:
c43d7eae8f84afccf1df759242385910b13d448d60b839714171a41be7bf431d - Sigstore transparency entry: 491134384
- Sigstore integration time:
-
Permalink:
project-aico/dna@a9c1e71081d011cdbc57b4aef175bc01fdd1e02d -
Branch / Tag:
refs/tags/v0.3.1 - Owner: https://github.com/project-aico
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
python-publish.yml@a9c1e71081d011cdbc57b4aef175bc01fdd1e02d -
Trigger Event:
release
-
Statement type: