Migrated exp_track_comm into htswdataprod.exp_track_comm python module.
authorBrandon King <kingb@caltech.edu>
Wed, 6 Aug 2008 21:33:30 +0000 (21:33 +0000)
committerBrandon King <kingb@caltech.edu>
Wed, 6 Aug 2008 21:33:30 +0000 (21:33 +0000)
htswdataprod/htswdataprod/exp_track_comm.py [new file with mode: 0755]
htswdataprod/scripts/exp_track_comm.py [deleted file]
htswdataprod/scripts/exp_track_main.py

diff --git a/htswdataprod/htswdataprod/exp_track_comm.py b/htswdataprod/htswdataprod/exp_track_comm.py
new file mode 100755 (executable)
index 0000000..843a3e0
--- /dev/null
@@ -0,0 +1,77 @@
+import urllib
+import urllib2
+import re
+import os
+
+def getWebPage(url,params):
+  pdata = urllib.urlencode(params)
+  req = urllib2.Request(url,pdata)
+  wpage = urllib2.urlopen(req)
+  restext = wpage.read()
+  wpage.close()
+  return restext
+
+def getConfigFile(fcid,runfolder):
+  #This function serves as well as a sync check between the datarun server and exp track web server
+  #By retrieving a valid config params set with valid input: fcid and runfolder we ensure that both servers are synch-ed  
+
+  varStatus = 'getting conf file from exp trac server'
+  url = 'http://myerslab.stanford.edu/exp_track/getConfile'
+  
+  params = {'user':'rami','fcid':fcid,'runf':runfolder}
+  readw = getWebPage(url,params)
+  #Check web response 
+  tempstr = re.sub(pattern="\n",repl=", ",string=readw)
+  #match_str = re.compile(r"READ_LENGTH.+$")
+  match_str = re.compile('^READ_LENGTH.+')
+  if match_str.search(tempstr):
+    # create file in curret folder
+    folder = './'  
+    file_path = os.path.join(folder,'config.txt')
+    f = open(file_path, 'w')
+    f.write(readw.replace(',','\n'))
+    f.close()
+    varStatus = 'OK. "config.txt" created. You can check it now.'
+  else:
+    varStatus = 'Failed reading valid Config Params in server reply:\n'+readw
+  
+  return varStatus
+
+
+def getLanesNames(fcid):
+  varStatus = 'getting Lane Names'
+  url = 'http://myerslab.stanford.edu/exp_track/getLanesNames'                                                                        
+  
+  params = {'user':'rami','fcid':fcid}
+  readw = getWebPage(url,params)
+  #Check web response                                                                                                               
+  tempstr = re.sub(pattern="\n",repl="",string=readw)
+  #match_str = re.compile(r"^<\?xml.+$")
+  match_str = re.compile('^<\?xml.+$')
+  if match_str.search(tempstr):
+    # create file in curret folder                                                                                                 
+    folder = './'
+    file_path = os.path.join(folder,'LaneNames.xml')
+    f = open(file_path, 'w')
+    f.write(readw)
+    f.close()
+    varStatus = 'OK. LaneNames.xml created. CollectReads can use it now.'
+  else:
+    varStatus = 'Failed retrieving valid LaneNames.xml data. Server returned:\n'+readw
+
+  return varStatus
+
+def updExpTrack(fcid,runfolder,updStatus,updMsg):  
+  url = 'http://myerslab.stanford.edu/exp_track/updStatus'
+
+  if len(updMsg) > 0:
+    params = {'user':'rami','fcid':fcid,'runf':runfolder,'updst':updStatus,'m\
+sg':updMsg}
+    print "Msg: "+updMsg
+  else:
+    params = {'user':'rami','fcid':fcid,'runf':runfolder,'updst':updStatus}
+    print "No Msg: "+len(updMsg).__str__()
+  readw = getWebPage(url,params)
+  return readw 
diff --git a/htswdataprod/scripts/exp_track_comm.py b/htswdataprod/scripts/exp_track_comm.py
deleted file mode 100755 (executable)
index 843a3e0..0000000
+++ /dev/null
@@ -1,77 +0,0 @@
-import urllib
-import urllib2
-import re
-import os
-
-def getWebPage(url,params):
-  pdata = urllib.urlencode(params)
-  req = urllib2.Request(url,pdata)
-  wpage = urllib2.urlopen(req)
-  restext = wpage.read()
-  wpage.close()
-  return restext
-
-def getConfigFile(fcid,runfolder):
-  #This function serves as well as a sync check between the datarun server and exp track web server
-  #By retrieving a valid config params set with valid input: fcid and runfolder we ensure that both servers are synch-ed  
-
-  varStatus = 'getting conf file from exp trac server'
-  url = 'http://myerslab.stanford.edu/exp_track/getConfile'
-  
-  params = {'user':'rami','fcid':fcid,'runf':runfolder}
-  readw = getWebPage(url,params)
-  #Check web response 
-  tempstr = re.sub(pattern="\n",repl=", ",string=readw)
-  #match_str = re.compile(r"READ_LENGTH.+$")
-  match_str = re.compile('^READ_LENGTH.+')
-  if match_str.search(tempstr):
-    # create file in curret folder
-    folder = './'  
-    file_path = os.path.join(folder,'config.txt')
-    f = open(file_path, 'w')
-    f.write(readw.replace(',','\n'))
-    f.close()
-    varStatus = 'OK. "config.txt" created. You can check it now.'
-  else:
-    varStatus = 'Failed reading valid Config Params in server reply:\n'+readw
-  
-  return varStatus
-
-
-def getLanesNames(fcid):
-  varStatus = 'getting Lane Names'
-  url = 'http://myerslab.stanford.edu/exp_track/getLanesNames'                                                                        
-  
-  params = {'user':'rami','fcid':fcid}
-  readw = getWebPage(url,params)
-  #Check web response                                                                                                               
-  tempstr = re.sub(pattern="\n",repl="",string=readw)
-  #match_str = re.compile(r"^<\?xml.+$")
-  match_str = re.compile('^<\?xml.+$')
-  if match_str.search(tempstr):
-    # create file in curret folder                                                                                                 
-    folder = './'
-    file_path = os.path.join(folder,'LaneNames.xml')
-    f = open(file_path, 'w')
-    f.write(readw)
-    f.close()
-    varStatus = 'OK. LaneNames.xml created. CollectReads can use it now.'
-  else:
-    varStatus = 'Failed retrieving valid LaneNames.xml data. Server returned:\n'+readw
-
-  return varStatus
-
-def updExpTrack(fcid,runfolder,updStatus,updMsg):  
-  url = 'http://myerslab.stanford.edu/exp_track/updStatus'
-
-  if len(updMsg) > 0:
-    params = {'user':'rami','fcid':fcid,'runf':runfolder,'updst':updStatus,'m\
-sg':updMsg}
-    print "Msg: "+updMsg
-  else:
-    params = {'user':'rami','fcid':fcid,'runf':runfolder,'updst':updStatus}
-    print "No Msg: "+len(updMsg).__str__()
-  readw = getWebPage(url,params)
-  return readw 
index 166711e47ddb3a9218ce644ece19bf13ae1cf7ef..c8586e17265342b4adcba2460e2358cae6e9d133 100755 (executable)
@@ -3,7 +3,7 @@
 import sys 
 
 try:
-    from exp_track_comm import * 
+    from htswdataprod.exp_track_comm import * 
 except ImportError:
     sys.stderr.write("\nError: Can't find the file 'exp_track_comm.py' in the directory containing %r.")
     sys.exit(1);