Skip to content
This repository has been archived by the owner on Aug 4, 2022. It is now read-only.

Allow to pass a python dictionary as schema #1

Open
jordeu opened this issue May 27, 2015 · 0 comments
Open

Allow to pass a python dictionary as schema #1

jordeu opened this issue May 27, 2015 · 0 comments

Comments

@jordeu
Copy link
Member

jordeu commented May 27, 2015

Let pass a dictionary following the same layout that we have in the schema file.

Simple example:

schema = { 'POSITION': { 'PARSER': 'int(x)', 'VALIDATOR': 'x > 0' }
data = itab.open('mutations.itab.tsv', schema=schema)

It will also be possible to pass a function instead of a string as parser and validator. This will allow to create more complex custom parsers and validators.

Advance example:

def example_parser(x, row):
    return int(x)

def example_validator(x, row):
    return x > 0

schema = { 'POSITION': { 'PARSER': example_parser, 'VALIDATOR':  example_validator }
data = itab.open('mutations.itab.tsv', schema=schema)
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

1 participant