changeset 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 85fd05d0d16c
files primsfilters.py query_metexp.py
diffstat 2 files changed, 13 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/primsfilters.py	Wed Mar 05 17:20:11 2014 +0100
+++ b/primsfilters.py	Thu Mar 06 14:29:55 2014 +0100
@@ -21,7 +21,9 @@
     """
     # for debugging: import pydevd;pydevd.settrace("L0136815.wurnet.nl")
     user = context.trans.user
-    metabolomics_tools = [ "msclust2", "combine_output", "create_poly_model", "lookup_library", "NDIStext2tabular", "rankfilterGCMS_tabular", "filter_on_rank" ]
+    metabolomics_tools = [ "msclust2", "combine_output", "create_poly_model", "lookup_library", 
+                          "NDIStext2tabular", "rankfilterGCMS_tabular", "filter_on_rank",
+                          "export_to_metexp_tabular", "query_metexp" ]
     found_match = False
     # iterate over the tool (partial)ids and look for a match (this is compatible with tool shed given ids):
     for partial_id in metabolomics_tools:
--- 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()