From 74a9f2ecbfdd57f188ec3d0817641decc1d8e12a Mon Sep 17 00:00:00 2001 From: Daniel Blankenberg Date: Wed, 17 Oct 2007 15:23:09 +0000 Subject: [PATCH] Modify metadata update script to update metadata of all tabular based files. Special case for interval files (interval, bed) to not override interval specific assignments. --- scripts/update_metadata.py | 42 +++++++++++++++++++------------------- 1 file changed, 21 insertions(+), 21 deletions(-) diff --git a/scripts/update_metadata.py b/scripts/update_metadata.py index 5d19e8dc9cb..71d70988f85 100644 --- a/scripts/update_metadata.py +++ b/scripts/update_metadata.py @@ -43,29 +43,29 @@ def main(): # data.flush() - #Search out tabular datatypes and make sure that number of columns is set. - #print "Seeking out tabular based files and setting number of columns." - #for row in app.model.Dataset.table.select().execute(): - # data = app.model.Dataset.get(row.id) - # if issubclass(type(data.datatype), type(app.datatypes_registry.get_datatype_by_extension('tabular'))): - # print row.id - # #The set_meta() function for tabular subclasses are responsible for determining - # #the number of 'problem' lines to skip in the file. Problem lines are comment lines - # #that do not begin with a '#' character, etc. When the number of lines to skip is determined, - # #Tabular().set_meta is called, passing the number of lines to skip. Nothing besides this is - # #currently done in set_meta() functions of subclasses of Tabular. - # data.set_meta() - # data.flush() + #Search out tabular datatypes (and subclasses) and initialize metadata + print "Seeking out tabular based files and initializing metadata" + for row in app.model.Dataset.table.select().execute(): + data = app.model.Dataset.get(row.id) + if issubclass(type(data.datatype), type(app.datatypes_registry.get_datatype_by_extension('tabular'))): + print row.id, data.extension + #Call meta_data for all tabular files + #special case interval type where we do not want to overwrite chr, start, end, etc assignments + if issubclass(type(data.datatype), type(app.datatypes_registry.get_datatype_by_extension('interval'))): + galaxy.datatypes.tabular.Tabular().set_meta(data) + else: + data.set_meta() + data.flush() #Search out maf datatypes and make sure that available species is set. - print "Seeking out maf files and setting available species." - for row in app.model.Dataset.table.select(app.model.Dataset.table.c.extension == 'maf').execute(): - print row.id - sys.stdout.flush() - data = app.model.Dataset.get(row.id) - if data.missing_meta: - data.set_meta() #Call maf set metadata method, setting available species - data.flush() + #print "Seeking out maf files and setting available species." + #for row in app.model.Dataset.table.select(app.model.Dataset.table.c.extension == 'maf').execute(): + # print row.id + # sys.stdout.flush() + # data = app.model.Dataset.get(row.id) + # if data.missing_meta: + # data.set_meta() #Call maf set metadata method, setting available species + # data.flush() app.shutdown() sys.exit(0)