A lightweight functional programming-inspired bioinformatics library for Scala 3.
Helix makes it easy to work with DNA sequences, including validation, nucleotide counting, and random sequence generation, all in a clean and expressive way.
- ✅ Validate DNA sequences
- ✅ Convert DNA from/to strings
- ✅ Count nucleotide frequencies
- ✅ Generate random DNA sequences
- ✅ Pretty-print results in the terminal with colors and tables
- ✅ Fully immutable and FP-oriented design
Currently, you can clone the repository and use it locally:
git clone https://github.com/Deyan2306/helix.git
cd helixThen build/run with:
-
Scala CLI
scala-cli run src
-
sbt
sbt run
Create a Main.scala in your project:
import co.helix._
import scala.util.Random
object Main extends App {
val dnaStr = "ACGTACGT"
val dnaResult = DNA.fromString(dnaStr)
// Pretty print validation
PrettyPrinter.printValidation(dnaResult)
dnaResult match {
case Right(validDNA) =>
// Count nucleotides
val counts = Helix.countNucleotides(validDNA)
PrettyPrinter.printCounts(counts)
// Generate and print random DNA
val randomDNA = Helix.randomDNA(10, new Random())
PrettyPrinter.printRandomDNA(randomDNA)
case Left(_) => // Already printed error
}
}✅ Valid DNA: ACGTACGT
Nucleotide Counts:
┌────────────┬───────┐
│ Name │ Count │
├────────────┼───────┤
│ Adenine │ 2 │
│ Cytosine │ 2 │
│ Guanine │ 2 │
│ Thymine │ 2 │
└────────────┴───────┘
🔹 Random DNA (length: 10):
GCTTAGCATA
src/
main/
scala/
co/
helix/
Nucleotide.scala # Defines Nucleotide type
DNA.scala # DNA class with validation
Helix.scala # Core functions (count, random DNA)
PrettyPrinter.scala# Colorful terminal printing
- Add RNA support
- Add complementary strand computation
- Add ASCII double helix visualization
- Publish as a Scala package
Contributions, issues, and feature requests are welcome! Feel free to fork the repo and submit a PR.
Deyan Sirakov 📧 Email: deyan.sirakov2006@abv.bg 🌐 GitHub: Deyan2306
This project is licensed under the MIT License.