GlobPlot service, runner and result parser
[jabaws.git] / binaries / src / globplot / GlobPipe.py
index 71be8a7..b15a28d 100644 (file)
@@ -123,9 +123,9 @@ def SavitzkyGolay(window,derivative,datalist):
 
 def reportSlicesTXT(slices, sequence, maskFlag):
     if maskFlag == 'DOM':
-        coordstr = '|GlobDoms:'
+        coordstr = 'GlobDoms '
     elif maskFlag == 'DIS':
-        coordstr = '|Disorder:'
+        coordstr = 'Disorder '
     else:
         raise SystemExit
     if slices == []:
@@ -163,18 +163,16 @@ def reportSlicesTXT(slices, sequence, maskFlag):
 
 def runGlobPlot():
     try:
-        smoothFrame = int(sys.argv[1])
-        DOM_joinFrame = int(sys.argv[2])
-        DOM_peakFrame = int(sys.argv[3])
-        DIS_joinFrame = int(sys.argv[4])
-        DIS_peakFrame = int(sys.argv[5])
-        file = str(sys.argv[6])
+        smoothFrame = 10
+        DOM_joinFrame = 15
+        DOM_peakFrame = 74
+        DIS_joinFrame = 4
+        DIS_peakFrame = 5
+        file = str(sys.argv[1])
         db = open(file,'r')
     except:
         print 'Usage:'
-        print '         ./GlobPipe.py SmoothFrame DOMjoinFrame DOMpeakFrame DISjoinFrame DISpeakFrame FASTAfile'
-        print '         Optimised for ELM: ./GlobPlot.py 10 8 75 8 8 sequence_file'
-        print '         Webserver settings: ./GlobPlot.py 10 15 74 4 5 sequence_file'
+        print '         ./GlobPipe.py FASTAfile'
         raise SystemExit
     parser = Fasta.RecordParser()
     iterator = Fasta.Iterator(db,parser)
@@ -209,9 +207,12 @@ def runGlobPlot():
             globdoms, globdis = getSlices(dydx_vector, DOM_joinFrame, DOM_peakFrame, DIS_joinFrame, DIS_peakFrame)
             s_domMask, coordstrDOM = reportSlicesTXT(globdoms, seq, 'DOM')
             s_final, coordstrDIS = reportSlicesTXT(globdis, s_domMask, 'DIS')
-            sys.stdout.write('>'+cur_record.title+coordstrDOM+coordstrDIS+'\n')
+            sys.stdout.write('>'+cur_record.title+'\n')
+            sys.stdout.write('# '+coordstrDOM+'\n')
+            sys.stdout.write('# '+coordstrDIS+'\n')
 
 # UNCOMMENT THIS IF NEED TO PRODUCE PER RESEDUE VALUES 
+            sys.stdout.write('# RESIDUE' + '\t' + 'DYDX' + '\t' + 'RAW' + '\t' +'SMOOTHED\n')
             for i in range(len(dydx_vector)):
 # dydx (positive values seems to indicate disorder in rows more than ~6 chars)  raw    smoothed
                sys.stdout.write(seq[i]+'\t'+fpformat.fix(dydx_vector[i],4)+ '\t'+fpformat.fix(smooth[i],4)+'\t'+fpformat.fix(sum_vector[i],4)+ '\n')