Skip to main content

NGLessPy: Python interface to NGLess

Project description

NGLessPy: NGLess as a Python Embedded Language

This is a variation of NGLess as an embedded language in Python, thus enabling processing of next generation data through a Python API. See the example below.

Build Status MIT licensed Join the chat at

This is very experimental and can change at any time. Please get in touch if you want to use it in your work. For questions, you can also use the ngless mailing list.


NGLesspy can auto-install ngless if it needs to.

NGLesspy is compatible with Python 2.7 and 3.4+.


Inside the bin/ directory, you will find several simple scripts exposing NGLess functionality as command line tools. These are also simple examples of how NGLessPy can be used.

See the tutorial for a more thorough explanation of what is going on in the example below.

    from ngless import NGLess

    sc = NGLess.NGLess('0.8')

    sc.import_('mocat', '0.0')
    e = sc.env

    e.sample = sc.load_mocat_sample_('testing')

    @sc.preprocess_(e.sample, using='r')
    def proc(bk):
        bk.r = sc.substrim_(bk.r, min_quality=25)

    e.mapped = sc.map_(e.sample, reference='hg19')
    e.mapped = sc.select_(e.mapped, keep_if=['{mapped}'])

    sc.write_(e.mapped, ofile='ofile.sam')

This is equivalent to the NGLess script

ngless '0.8'
import 'mocat' version '0.0'

sample = load_mocat_sample('testing')

preprocess_(sample) using='r':
    r = substrim(r, min_quality=25)

mapped = map(sample, reference='hg19')
mapped = select(mapped, keep_if=[{mapped}])

write(mapped, ofile='ofile.sam')

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Files for NGLessPy, version 0.2.2
Filename, size File type Python version Upload date Hashes
Filename, size NGLessPy-0.2.2.tar.gz (11.1 kB) File type Source Python version None Upload date Hashes View

Supported by

Pingdom Pingdom Monitoring Google Google Object Storage and Download Analytics Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN DigiCert DigiCert EV certificate StatusPage StatusPage Status page