diff query_metexp.py @ 22:cd4f13119afa

Small fix in filters part and improvement in query_metexp time logging
author pieter.lukasse@wur.nl
date Thu, 06 Mar 2014 14:29:55 +0100
parents 19d8fd10248e
children
line wrap: on
line diff
--- a/query_metexp.py	Wed Mar 05 17:20:11 2014 +0100
+++ b/query_metexp.py	Thu Mar 06 14:29:55 2014 +0100
@@ -14,6 +14,7 @@
 import sys
 import fileinput
 import urllib2
+import time
 from collections import OrderedDict
 
 __author__ = "Pieter Lukasse"
@@ -44,6 +45,8 @@
     This method will iterate over the record in the input_data and
     will enrich them with the related information found (if any) in the 
     MetExp Database.
+    
+    # TODO : could optimize this with multi-threading, see also nice example at http://stackoverflow.com/questions/2846653/python-multithreading-for-dummies
     '''
     merged = []
     
@@ -247,6 +250,8 @@
     and one for the formula of the respective identification. These two columns are then
     used to query against MetExp Database.   
     '''
+    seconds_start = int(round(time.time()))
+    
     input_file = sys.argv[1]
     casid_col = sys.argv[2]
     formula_col = sys.argv[3]
@@ -267,7 +272,11 @@
                                    'METEXP hits: experiments','METEXP hits: user names','METEXP hits: column types', 'METEXP hits: CAS nrs', 'Link to METEXP hits']
     
     _save_data(enriched_data, headers, output_result)
-
+    
+    seconds_end = int(round(time.time()))
+    print "Took " + str(seconds_end - seconds_start) + " seconds"
+                      
+                      
 
 if __name__ == '__main__':
     main()