Skip to main content

🧬 Blixa Research Language (Blixa) - Core Syntax v1.0.9

Blixa is a domain-specific programming language designed exclusively for biological researchers. It provides a seamless, unified syntax to perform complex bioinformatics, single-cell analytics, structural biology, and statistical computations without requiring deep knowledge of the underlying scientific libraries or algorithms.

🏗️ Architecture & Philosophy

The language operates on a layered architecture: Researcher -> Biological Syntax -> Language Runtime -> Python Bridge -> Scientific Libraries -> Computation. Every command is highly contextualized to biological objects, returning usable results and preserving immutability. Analytical details, data transformations, and algorithm parameters are managed internally by the Runtime.

🧠 Smart Caching System

Blixa implements an intelligent, memory-aware caching engine to optimize performance and protect system resources. Each biological object and experiment maintains a local LRU (Least Recently Used) cache of up to 50 complex analytical results (e.g., differential expression, alignments, expression vectors).

  • Automatic Memory Protection: If the system's available RAM drops below 20%, the Runtime automatically evicts the oldest 25% of cached items without user intervention.
  • Zero Configuration: The system works silently in the background, drastically speeding up repetitive queries (like .find_cells() or .compare_all()).
  • Manual Override: You can force clear the memory at any time using the .clear_cache() universal method or the global clear_cache() function.

Global Caching

Blixa also provides a global LRU cache (size 100) that stores results of expensive operations across all objects (e.g., UMAP, PCA, markers). This prevents recomputation on identical datasets and operations. You can clear it manually with clear_global_cache().

Project Layout

  • core/: Contains the primary runtime objects (DNA, RNA, Protein, Gene, Cell, Cells, Experiment, Workflow, Result) and shared abstractions.
  • modules/: Specialized scientific libraries loaded dynamically (genomics, singlecell, proteomics, crispr, epigenetics, etc.).
  • transpiler/: Houses the custom DSL parser (BioParser) and the AST executor (PythonBridge).
  • exceptions/: Strict biological and sequence validation handlers (BioError, SequenceValidationError).

🧬 Core Objects

You can instantiate biological objects directly:

  • dna("ATGCGT") - DNA sequences.
  • rna("AUGCGU") - RNA sequences.
  • protein("MEEPQSD") - Amino acid sequences.
  • gene("PAX6") - Biological genes.
  • cell("stem") - Single-cell instances.
  • cells("experiment.h5ad") - Cell populations / scRNA-seq datasets.
  • experiment("name") - Multi-condition experiment design.
  • workflow("name") - Automated analytical pipelines.

Shared Universal Methods

All biological objects share a universal interface:

  • .value(), .len(), .at(pos), .slice(start, end), .head(n), .tail(n)
  • .find(seq), .find_all(seq), .rep(seq)
  • .valid(), .validate(), .info(), .summary(), .graph(type), .save(file), .clear_cache()

General & Statistical Functions

  • len(), mean(), median(), std(), distribution()
  • compare(), correlation(), align(), t_test(), anova(), fdr_correct()
  • load(file), save(data, file), export(data, file), integrate(), parallel(), clear_cache()

🚀 Getting Started

Here are four complete examples to get you started with Blixa.

Example 1: DNA Analysis

my_dna = dna("ATGCGTACGTAGCTAGCT")
print(my_dna.gc())                 # GC content
print(my_dna.rev_comp())           # Reverse complement
protein_seq = my_dna.translate()   # Translate to protein
print(protein_seq)

Example 2: Single-Cell Pipeline (with PBMC3k dataset)

use singlecell
use visualization

# Load dataset (you can also load your own .h5ad file)
sample = cells("pbmc3k.h5ad")

# Quality control and filtering
sample = sample.filter(min_genes=200, max_mito=0.05)

# Normalization and feature selection
sample = sample.normalize()
sample = sample.variable_genes()

# Dimensionality reduction and clustering
sample = sample.reduce("pca")
sample = sample.cluster("leiden", resolution=0.5)
sample = sample.umap()

# Visualize
sample.graph("umap", color="leiden")

# Find marker genes for cluster 0 vs cluster 1
markers = sample.markers(group1="0", group2="1")
markers.top(10).graph("volcano")

Example 3: CRISPR Guide Design

use crispr

my_gene = gene("BRCA1")
# Assume the gene has DNA sequence loaded
guides = my_gene.crispr_design(target_length=20)
best_guides = guides.efficiency().off_targets().top(5)
print(best_guides)

Example 4: Experiment and Differential Expression

use statistics

exp = experiment("my_experiment")
exp.add(control_sample, condition="control")
exp.add(treated_sample, condition="treated")

# Compare gene expression for a specific gene
result = exp.t_test("control", "treated", gene="TP53")
result = result.fdr_correct()
print(result.summary())

🧪 Domain-Specific Capabilities

1. Genomics (DNA & RNA)

  • DNA Methods: .gc(), .rev(), .comp(), .rev_comp(), .set(), .insert(), .delete(), .mutate(), .composition(), .codons(), .motifs(), .motif(), .promoter(), .orfs(), .transcribe(), .translate(table="standard"), .methylation(), .snp()
  • RNA Methods: .gc(), .rev(), .comp(), .rev_comp(), .translate(table="standard"), .dna(), .fold(), .structure()

2. Proteomics

  • Protein Methods: .weight(), .charge(), .pi(), .hydrophobicity(), .hydro(), .domains(), .structure(), .mutate(), .interact(), .bind(), .complex()
  • Note on protein.structure(): This method uses the ESMFold API (Meta AI) and requires an active internet connection. It sends your protein sequence to the remote API for structure prediction.

3. Single-Cell Transcriptomics

  • Cell Population (cells): .filter(min_genes, max_mito), .normalize(), .variable_genes(), .reduce("pca"), .cluster("leiden"), .umap(), .trajectory(), .pseudotime(), .find_cells(), .expression(), .distribution(), .correlation(), .markers(), .classify(), .de(), .gsea(), .batch_correct(), .integrate(), .lineage(), .variants(), .histone_mods(), .chromatin_state(), .atac_seq(), .pca_variance()
  • Single Cell (cell): .expression(), .markers(), .state(), .type, .label, .pluripotency_score(), .differentiate(), .reprogram(), .lineage()

4. Gene Analysis & CRISPR Engineering

  • Gene Methods: .dna(), .rna(), .protein(), .promoter(), .exons(), .introns(), .expression(), .cells(), .compare(), .query(), .enrich()
  • CRISPR (requires use crispr): .crispr_design(), .knockout(), .knockin(seq)

5. Experiment & Results Management

  • Experiment: .add(sample, cond), .get(name), .compare(c1, c2), .compare_all(), .timecourse(), .filter(), .normalize(), .cluster(), .t_test(), .anova(), .report(), .clear_cache()
  • Results: Analytical operations natively return a result object supporting: .info(), .summary(), .top(n), .sort(), .filter(), .select(), .at(idx), .column(name), .graph(), .fdr_correct(), .enrich(), .gsea(), .confusion_matrix()

🧩 Specialized Modules

To keep the core language stable, advanced domain capabilities are loaded dynamically:

use genomics
use transcriptomics
use singlecell
use proteomics
use structure
use stemcell
use crispr
use epigenetics
use statistics
use pathways
use variants
use integration
use visualization

⚙️ Workflows & Python Integration

Automating Pipelines

Workflows record abstract operations to be executed on multiple datasets:

workflow1 = workflow("neural_analysis")
with workflow1:
    sample.filter(min_genes=300)
    sample.normalize()
    sample.reduce("pca")
    sample.cluster("leiden")
    sample.umap()

workflow1.run(new_sample)
workflow1.save("neural_analysis")

Native Python Integration

Blixa supports native Python logic seamlessly inside a python: block:

python:
    for cell in sample:
        if cell.expression("pax6") > 3:
            print(cell.id)

🚀 Execution

To run a Blixa script .blx or enter the interactive REPL:

# Execute a script
blixa script.blx

# Start the interactive REPL
blixa

# Execute a one-liner
blixa --execute "dna('ATGC').gc()"

# Show version
blixa --version

📦 Installation & Dependencies

Basic Installation

pip install blixa

Full Installation (includes optional memory monitoring)

pip install blixa[full]

The optional psutil library enables advanced memory-aware cache eviction. If not installed, the cache will rely only on its LRU size limit, and a warning will be shown once.

Python Version

Requires Python >= 3.10.

Internet Access for Protein Structure Prediction

The protein.structure() method uses the ESMFold API (Meta AI) to predict 3D structures. An active internet connection is required, and the sequence must consist only of standard amino acids (length up to ~400 residues is recommended).


📝 License & Citation

Blixa is released under the MIT License. See LICENSE for details.

If you use Blixa in your research, please cite:

Ahmed Tarig Ahmed Abdalgaleel. (2026). Blixa: A Domain-Specific Language for Biological Research (Version 1.0.9). https://github.com/your-repo/blixa

Metadata

Release files for blixa 1.0.9

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

Source distribution (sdist)

Source distribution for blixa 1.0.9
File Size Uploaded
blixa-1.0.9.tar.gz 428.9 kB Details

Built distribution (wheel)

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

Total release size: 609.5 kB

Release files / blixa-1.0.9.tar.gz

Download URL blixa-1.0.9.tar.gz
Size 428.9 kB
Tags Source
SHA-256 checksum
How to use checksums
f4095dcb2d439ea2515b59d653033dab6e9536c99f2981a68f64117d84f7d32a
BLAKE2b-256 checksum
How to use checksums
9030aa0ea98188f74cdc475ffcf25886baa75e62b973bd8ad8014df7e6f652d3
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.15

Release files / blixa-1.0.9-py3-none-any.whl

Download URL blixa-1.0.9-py3-none-any.whl
Size 180.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
63a2da3a0eab88d1f99a78ef37f3a24f35d79d2d9ea6b7cb7e3be29e30bda867
BLAKE2b-256 checksum
How to use checksums
c5a27df5697c362d669187a39b2360674989f9c7ec07ba6cd8f5e900e5609374
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.15

Release history Release notifications | RSS feed

1.1.7

2 release files

1.1.6

2 release files

1.1.5

2 release files

1.1.4

2 release files

1.1.3

2 release files

1.1.2

2 release files

1.1.1

2 release files

1.1.0

2 release files

This release

1.0.9 This release

2 release files

1.0.8

2 release files

1.0.7

2 release files

1.0.6

2 release files

1.0.5

2 release files

1.0.4

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