Skip to main content

Biosaic

Overview

Biosaic(Bio-Mosaic) is a tokenizer library built for Enigma2. It contains: Tokenizer, Embedder for DNA & Amino Acid Protein Sequences. Has a VQ-VAE & Evoformer architecture based encoders that could convert sequences into embeddings and vice-versa for model training use-case.

Features

  • Tokenization: converts the sequences into K-Mers.
  • Encoding: converts sequences into embeddings for classification, training purposes.
  • Easy use: it's very basic and easy to use library.
  • SoTA encoder: Evoformer & VQ-VAE model are inspired from the AlphaFold-2

Prerequisites

System Requirements

  • Operating System: Linux, macOS, or Windows with support for GCC or Clang.
  • Python: Version 3.9 or higher.

Dependencies

  • Python Modules:
    • pickle: for loading and saving model files.
    • os: for file and path handling.
    • urllib: for loading the vocabs from repo.
    • tempfile: for loading the vocabs from repo.

Installation

1. From PyPI:

  pip install biosaic

2. Clone the Repo:

git clone https://github.com/delveopers/biosaic.git
cd biosaic

Usage

Create an instance of the tokenizer with a specified k-mer size, & split them into tokens, encode & decode them fastly:

import biosaic
from biosaic import tokenizer

token = tokenizer(mode="dna", kmer=3, continuous=True)
print(token.vocab_size)

sequence = "TCTTACATAGAAAGGAGCGGTATTTGGTATGAATTTATTTGCAACTGACTG"
encoded = token.encode(sequence)
decoded = token.decode(encoded)
tokenized = token.tokenize(sequence)

print(tokenized)
print(encoded[:100])
print(decoded[:300])
print(decoded == sequence)

For more information refer to the docs:

Output

84

['TCT', 'CTT', 'TTA', 'TAC', 'ACA', 'CAT', 'ATA', 'TAG', 'AGA', 'GAA', 'AAA', 'AAG', 'AGG', 'GGA', 'GAG', 'AGC', 'GCG', 'CGG', 'GGT', 'GTA', 'TAT', 'ATT', 'TTT', 'TTG', 'TGG', 'GGT', 'GTA', 'TAT', 'ATG', 'TGA', 'GAA', 'AAT', 'ATT', 'TTT', 'TTA', 'TAT', 'ATT', 'TTT', 'TTG', 'TGC', 'GCA', 'CAA', 'AAC', 'ACT', 'CTG', 'TGA', 'GAC', 'ACT', 'CTG']

[75, 51, 80, 69, 24, 39, 32, 70, 28, 52, 20, 22, 30, 60, 54, 29, 58, 46, 63, 64, 71, 35, 83, 82, 78, 63, 64, 71, 34, 76, 52, 23, 35, 83, 80, 71, 35, 83, 82, 77, 56, 36, 21, 27, 50, 76, 53, 27, 50]

TCTTACATAGAAAGGAGCGGTATTTGGTATGAATTTATTTGCAACTGACTG

True

Metadata

Release files for biosaic 0.1.5

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for biosaic 0.1.5
File Size Uploaded
biosaic-0.1.5.tar.gz 22.0 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for biosaic 0.1.5
File Interpreter ABI Platform
biosaic-0.1.5-py3-none-any.whl Python 3 none any Details

Total release size: 43.6 kB

Release files / biosaic-0.1.5.tar.gz

Download URL biosaic-0.1.5.tar.gz
Size 22.0 kB
Tags Source
SHA-256 checksum
How to use checksums
a821aac3debb59fa5d5a4e765c98df2e0c6133b56ba7ed6f37f439d72096e7e7
BLAKE2b-256 checksum
How to use checksums
f15432795547636285f548111d718aa61b503d7e31fd0edc2d7cdcfebf4b0adb
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.13.3

Release files / biosaic-0.1.5-py3-none-any.whl

Download URL biosaic-0.1.5-py3-none-any.whl
Size 21.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
bd829c1040a38cecac4c5d415d0b18b2754867e9f9f69465e602dd211b8b86d3
BLAKE2b-256 checksum
How to use checksums
0d27ccef022ec452b2161c6c286631d13bc284bcddda7054e073e3bd9940c2dd
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.13.3

Release history Release notifications | RSS feed

This release

0.1.5 This release

2 release files

0.1.4

2 release files

0.1.3

2 release files

0.1.2

2 release files

0.1.1

2 release files

0.1.0

2 release files

0.0.9

2 release files

0.0.8

2 release files

0.0.7

2 release files

0.0.6

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page