From 2ddab5819a7327ef09fb5533aece984d9dfe7f59 Mon Sep 17 00:00:00 2001 From: Ian Schenck Date: Fri, 9 Mar 2007 19:45:29 +0000 Subject: [PATCH] Script that will run like a tool for each dataset generated. Is this in the right place? P.S. this stuff isn't final. --- scripts/validate.py | 39 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) create mode 100644 scripts/validate.py diff --git a/scripts/validate.py b/scripts/validate.py new file mode 100644 index 00000000000..97f911d1030 --- /dev/null +++ b/scripts/validate.py @@ -0,0 +1,39 @@ +#!/usr/bin/env python + +""" +Validate a dataset based on extension a metadata passed in on the +command line. Outputs a binhex'd representation of the exceptions. + +usage: %prog input output + -c, --cols=N,N,N,N: column metadata, in the case of GFF, BED, or intervals + -x, --ext=N: extension as understood by galaxy +""" +from cookbook import doc_optparse +from galaxy import model +from fileinput import FileInput +from galaxy import util + +def main(): + options, args = doc_optparse.parse( __doc__ ) + + try: + extension = options.ext + except: + doc_optparse.exception() + + # create datatype + data = model.Dataset( extension=extension, id=int( args[0] ) ) + data.file_path = "/home/ian/trunk/database/files/" + + if options.cols: + cols = options.cols.split(",") + data.metadata.chromCol = cols[0] + data.metadata.startCol = cols[1] + data.metadata.endCol = cols[2] + data.metadata.strandCol = cols[3] + + errors = data.datatype.validate( data ) + print util.object_to_string(errors) + +if __name__ == "__main__": + main()