seq

by seq-lang

seq-lang / seq

A high-performance, Pythonic language for bioinformatics

220 Stars 16 Forks Last release: about 2 months ago (v0.9.10) Apache License 2.0 1.9K Commits 20 Releases

Available items

No Items, yet!

The developer of this repository has not created any items for sale yet. Need a bug fixed? Help with integration? A different license? Create a request here:

Seq

Seq — a language for bioinformatics

Build Status Gitter Version License

Introduction

A strongly-typed and statically-compiled high-performance Pythonic language!

Seq is a programming language for computational genomics and bioinformatics. With a Python-compatible syntax and a host of domain-specific features and optimizations, Seq makes writing high-performance genomics software as easy as writing Python code, and achieves performance comparable to (and in many cases better than) C/C++.

Think of Seq as a strongly-typed and statically-compiled Python: all the bells and whistles of Python, boosted with strong type system, without any performance overhead.

Seq is able to outperform Python code by up to 160x. Seq can further beat equivalent C/C++ code by up to 2x without any manual interventions, and also natively supports parallelism out of the box. Implementation details and benchmarks are discussed in our paper.

Learn more by following the tutorial or from the cookbook.

Example

Seq is a Python-compatible language, and the vast majority of Python programs should work without any modifications:

def check_prime(n):
    if n > 1:
        for i in range(2, n):
            if n % i == 0:
                return False
        return True
    else:
        return False

n = 1009 print n, 'is', 'a' if check_prime(n) else 'not a', 'prime'

Here is an example that showcases Seq's bioinformatics features: a seeding application in Seq using a hypothetical genome index, like what is typically found in seed-and-extend alignment algorithms:

from sys import argv
from genomeindex import *
type K = Kmer[20]

index and process 20-mers

@prefetch def process(kmer: K, index: GenomeIndex[K]): hits_fwd = index[kmer] hits_rev = index[~kmer] ...

index over 20-mers

index = GenomeIndexK

stride for k-merization

stride = 10

sequence-processing pipeline

(FASTQ(argv[2]) |> seqs |> kmersK |> process(index))

A few notable aspects of this code:

  • Seq provides native k-mer types, e.g. a 20-mer is represented by
    Kmer[20]
    as above.
  • k-mers can be reverse-complemented with
    ~
    .
  • Seq provides easy iteration over common formats like FASTQ (
    FASTQ
    above).
  • Complex pipelines are easily expressible in Seq (via the
    |>
    syntax).
  • Seq can perform pipeline transformations to make genomic index lookups faster via
    @prefetch
    .

For a concrete example of

genomeindex
, check out our re-implementation of SNAP's index.

Install

Pre-built binaries

Pre-built binaries for Linux and macOS on x86_64 are available alongside each release. We also have a script for downloading and installing pre-built versions:

wget -O - https://raw.githubusercontent.com/seq-lang/seq/master/install.sh | bash

This will install Seq in a new

.seq
directory within your home directory. Be sure to update
~/.bash_profile
as the script indicates afterwards!

Seq binaries require a libomp to be present on your machine.

brew install libomp
or
apt install libomp5
should do the trick.

Build from source

See Building from Source.

Documentation

Please check docs.seq-lang.org for in-depth documentation.

Citing Seq

If you use Seq in your research, please cite:

Ariya Shajii, Ibrahim Numanagić, Riyadh Baghdadi, Bonnie Berger, and Saman Amarasinghe. 2019. Seq: a high-performance language for bioinformatics. Proc. ACM Program. Lang. 3, OOPSLA, Article 125 (October 2019), 29 pages. DOI: https://doi.org/10.1145/3360551

BibTeX:

@article{Shajii:2019:SHL:3366395.3360551,
 author = {Shajii, Ariya and Numanagi\'{c}, Ibrahim and Baghdadi, Riyadh and Berger, Bonnie and Amarasinghe, Saman},
 title = {Seq: A High-performance Language for Bioinformatics},
 journal = {Proc. ACM Program. Lang.},
 issue_date = {October 2019},
 volume = {3},
 number = {OOPSLA},
 month = oct,
 year = {2019},
 issn = {2475-1421},
 pages = {125:1--125:29},
 articleno = {125},
 numpages = {29},
 url = {http://doi.acm.org/10.1145/3360551},
 doi = {10.1145/3360551},
 acmid = {3360551},
 publisher = {ACM},
 address = {New York, NY, USA},
 keywords = {Python, bioinformatics, computational biology, domain-specific language, optimization, programming language},
}

We use cookies. If you continue to browse the site, you agree to the use of cookies. For more information on our use of cookies please see our Privacy Policy.