root/galaxy-central/tools/validation/validate.py

リビジョン 2, 1.0 KB (コミッタ: hatakeyama, 14 年 前)

import galaxy-central

行番号 
1#!/usr/bin/env python
2
3"""
4Validate a dataset based on extension a metadata passed in on the
5command line.  Outputs a binhex'd representation of the exceptions.
6
7usage: %prog input output
8    -m, --metadata=N: base64 pickeled metadata
9    -x, --ext=N: extension as understood by galaxy
10"""
11
12import pkg_resources; pkg_resources.require( "bx-python" )
13from bx.cookbook import doc_optparse
14
15from galaxy import model
16from fileinput import FileInput
17from galaxy import util
18
19def main():
20    options, args = doc_optparse.parse( __doc__ )
21
22    try:
23        extension = options.ext
24    except:
25        doc_optparse.exception()
26
27    # create datatype
28    data = model.Dataset( extension=extension, id=int( args[0] ) )
29    data.file_path = "/home/ian/trunk/database/files/"
30   
31    if options.metadata:
32        data.metadata = util.string_to_object( options.metadata )
33
34    errors = data.datatype.validate( data )
35    print util.object_to_string(errors)
36
37if __name__ == "__main__":
38    main()
Note: リポジトリブラウザについてのヘルプは TracBrowser を参照してください。