Library to convert digital data into DNA sequences and vice versa
Project description
CodexGen
CodexGen is a Python library that allows you to convert digital data into DNA sequences and vice versa. It provides functionality to encode any data into a DNA sequence, which can then be decoded back to its original form. The library supports various types of data, including strings, booleans, dictionaries, and files.
Features
- Convert digital data (e.g., strings, dictionaries, files) into DNA sequences.
- Decode DNA sequences back to their original data format.
- Save and load files in DNA sequence format.
- Etc.
Installation
To install CodexGen, you can use pip:
pip install CodexGen
Alternatively, you can clone the repository and install it locally:
git clone https://github.com/Arifmaulanaazis/CodexGen.git
cd CodexGen
python setup.py install
Usage
Convert data to DNA sequence
You can convert any data to a DNA sequence using the CodexGen class:
from codexgen import CodexGen
# Initialize CodexGen instance
codexgen = CodexGen()
# Data to be converted
data = {"name": "Alice", "age": 30}
# Convert data to DNA sequence
dna_sequence = codexgen.to_dna(data)
print("DNA Sequence:", dna_sequence)
Decode a DNA sequence back to the original data
You can decode a DNA sequence back to the original data:
# Decode the DNA sequence
decoded_data = codexgen.to_binary(dna_sequence)
print("Decoded Data:", decoded_data)
Working with files
You can load and save files as DNA sequences using the load_file:
from codexgen import CodexGen
# Initialize CodexGen instance
codexgen = CodexGen()
# Convert file content to DNA sequence
file_content = codexgen.load_file("example.txt")
dna_sequence = codexgen.to_dna(file_content)
# Save DNA sequence to file
codexgen.save_file(dna_sequence, 'output.txt')
Running Tests
To run the tests for CodexGen, you can use TestCodexGen:
from codexgen import TestCodexCore, TestCodexUtils, TestCodexTransformer
# Run tests for CodexCore
test_core = TestCodexCore()
test_core.run_tests()
# Run tests for CodexUtils
test_utils = TestCodexUtils()
test_utils.run_tests()
# Run tests for CodexTransformer
test_transformer = TestCodexTransformer()
test_transformer.run_tests()
print("All tests completed.")
License
This library is licensed under the Apache License 2.0. See the LICENSE file for more details.
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 CodexGen-1.0.0.tar.gz.
File metadata
- Download URL: CodexGen-1.0.0.tar.gz
- Upload date:
- Size: 810.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.0.1 CPython/3.9.16
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
a103e77d2db9e53da9d98be307debef38c893966bbabdbbd89e1193ab53c7c0a
|
|
| MD5 |
1ebd10f172186bb355b81ed98dceb752
|
|
| BLAKE2b-256 |
421c03b071a48d38998672db2c6fcb62e50992f06fc76439c1902e109aad80fb
|
File details
Details for the file CodexGen-1.0.0-py3-none-any.whl.
File metadata
- Download URL: CodexGen-1.0.0-py3-none-any.whl
- Upload date:
- Size: 16.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.0.1 CPython/3.9.16
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
17d4a55328d12e89f8484a5aa5f68dbd3b95d7380b5c7f18c70f3fc5edb2457e
|
|
| MD5 |
c4bf4951bd1a5fc4f874f70cac8b4098
|
|
| BLAKE2b-256 |
dbefa29d193818e032928469cbb710be3dca869dbe835a011577085d8b000150
|