Giter Club home page Giter Club logo

nglesspy's Introduction

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

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.

Dependencies

NGLesspy can auto-install ngless if it needs to.

NGLesspy is compatible with Python 2.7 and 3.4+.

Example

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')

    sc.run()

This is equivalent to the NGLess script

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

sample = load_mocat_sample('testing')

sample = 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')

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.