A Go package that provides a DNA-style progress bar with base complementing, designed to look like a DNA polymerase in action.
- DNA Complementing: Automatically generates complement strand (A↔T, G↔C, others→N)
- Custom Sequences: Use your own DNA sequence as the top strand
- Visual Design: Looks like DNA replication with zipper, strands, and primer
- Thread Safe: Safe to use from multiple goroutines
- Customizable Width: Match header text or use sequence length
go get github.com/yourusername/polybarpackage main
import (
"time"
"github.com/William-Gardner-Biotech/polybar"
)
func main() {
// Create progress bar with custom DNA sequence
pb := polybar.New("ATCG-NNTA-GCTA", "DNA-SEQUENCING")
// Start with total of 100 steps
pb.Start(100)
// Simulate work with progress updates
for i := 0; i < 100; i++ {
// Do some work...
time.Sleep(50 * time.Millisecond)
pb.Update()
}
pb.Finish()
}// Use sequence length as width (no header padding)
pb := polybar.New("ATCGATCGATCG", "")
// Set progress directly instead of incrementing
pb.Start(1000)
pb.SetProgress(250) // 25% complete
pb.SetProgress(500) // 50% complete
pb.Finish()- A ↔ T (Adenine ↔ Thymine)
- G ↔ C (Guanine ↔ Cytosine)
- - → - (Gap remains gap)
- Any other character → N (Unknown base)
Creates a new DNA progress bar.
topStrand: DNA sequence for the top strand (will be complemented)header: Optional header text. If provided, strands are padded/truncated to match width
Start(total int): Initialize progress bar with total stepsUpdate(): Increment progress by 1 and refresh displaySetProgress(completed int): Set current progress valueFinish(): Complete progress bar and add final newline
MIT License
