Disembl and Jronn web services work. Modified to produce raw scores Globplot script...
authorpvtroshin <pvtroshin@e3abac25-378b-4346-85de-24260fe3988d>
Fri, 4 Feb 2011 17:15:33 +0000 (17:15 +0000)
committerpvtroshin <pvtroshin@e3abac25-378b-4346-85de-24260fe3988d>
Fri, 4 Feb 2011 17:15:33 +0000 (17:15 +0000)
git-svn-id: link to svn.lifesci.dundee.ac.uk/svn/barton/ptroshin/JABA2@3704 e3abac25-378b-4346-85de-24260fe3988d

18 files changed:
TODO.txt
binaries/src/globplot/GlobPipe.py [new file with mode: 0644]
binaries/src/globplot/GlobPipe.py.original [new file with mode: 0644]
binaries/src/globplot/LICENSE [new file with mode: 0644]
binaries/src/globplot/README [new file with mode: 0644]
runner/compbio/runner/disorder/Disembl.java
runner/compbio/runner/disorder/GlobProt.java [deleted file]
testsrc/compbio/ws/client/AAConWSClientExample.java
testsrc/compbio/ws/client/TestAAConWS.java
webservices/compbio/data/msa/SequenceAnnotation.java [moved from webservices/compbio/data/msa/Annotation.java with 86% similarity]
webservices/compbio/data/msa/jaxws/GetAnnotationResponse.java
webservices/compbio/ws/client/AAConClient.java
webservices/compbio/ws/client/IOHelper.java
webservices/compbio/ws/client/Jws2Client.java
webservices/compbio/ws/client/Services.java
webservices/compbio/ws/server/AAConWS.java
webservices/compbio/ws/server/DisemblWS.java [new file with mode: 0644]
webservices/compbio/ws/server/JronnWS.java

index f25cd0d..e3f5142 100644 (file)
--- a/TODO.txt
+++ b/TODO.txt
@@ -1,5 +1,18 @@
 TODO: \r
 \r
+Add registry service to query services status\r
+\r
+Refactor web services checker to enable a programmatic access to its methods.\r
+Rename it to avoid confusion with jabaws client\r
+\r
+Finish the client\r
+\r
+Add interface for Jalview annotation \r
+Add the method to return Jalview Annotation to SequenceAnnotation IF  \r
+\r
+Develop generic Interface to return Jalview annotation for easy to add new \r
+services (?) \r
+\r
 Replace conservation.Method with server.ws.Method \r
 and try building WS. If this does not work - get rid of Method\r
 \r
@@ -10,7 +23,7 @@ integrate the above to tweak the size of the local job
 \r
 Add AACon ws\r
 Add iupred ws http://iupred.enzim.hu/\r
-Add globprot ws \r
+Add globprot ws - does not report raw scores, just regions\r
 Add ronn ws\r
 \r
 Philogeny Mrbayes + Philip\r
diff --git a/binaries/src/globplot/GlobPipe.py b/binaries/src/globplot/GlobPipe.py
new file mode 100644 (file)
index 0000000..71be8a7
--- /dev/null
@@ -0,0 +1,225 @@
+#!/usr/bin/env python
+# Copyright (C) 2003 Rune Linding - EMBL
+# GlobPlot TM
+# GlobPlot is licensed under the Academic Free license
+
+from string import *
+from sys import argv
+import sys,re
+import os
+from os import system,popen3
+
+relpath = re.sub("/GlobPipe.py$","",argv[0])
+newpath =os.getcwd()+"/"+relpath+"/biopython-1.50"
+sys.path.append(newpath)
+
+import Bio
+from Bio import File
+from Bio import Fasta
+import fpformat
+import tempfile
+import math
+
+# Russell/Linding
+RL = {'N':0.229885057471264,'P':0.552316012226663,'Q':-0.187676577424997,'A':-0.261538461538462,'R':-0.176592654077609, \
+      'S':0.142883029808825,'C':-0.0151515151515152,'T':0.00887797506611258,'D':0.227629796839729,'E':-0.204684629516228, \
+      'V':-0.386174834235195,'F':-0.225572305974316,'W':-0.243375458622095,'G':0.433225711769886,'H':-0.00121743364986608, \
+      'Y':-0.20750516775322,'I':-0.422234699606962,'K':-0.100092289621613,'L':-0.337933495925287,'M':-0.225903614457831}
+
+def Sum(seq,par_dict):
+    sum = 0
+    results = []
+    raws = []
+    sums = []
+    p = 1
+    for residue in seq:
+        try:
+            parameter = par_dict[residue]
+        except:
+            parameter = 0
+        if p == 1:
+            sum = parameter
+        else:
+            sum = sum + parameter#*math.log10(p)
+        ssum = float(fpformat.fix(sum,10))
+        sums.append(ssum)
+        p +=1
+    return sums
+
+def getSlices(dydx_data, DOM_join_frame, DOM_peak_frame, DIS_join_frame, DIS_peak_frame):
+    DOMslices = []
+    DISslices = []
+    in_DOMslice = 0
+    in_DISslice = 0
+    beginDOMslice = 0
+    endDOMslice = 0
+    beginDISslice = 0
+    endDISslice = 0
+    for i in range( len(dydx_data) ):
+    #close dom slice
+        if in_DOMslice and dydx_data[i] > 0:
+            DOMslices.append([beginDOMslice, endDOMslice])
+            in_DOMslice = 0
+    #close dis slice
+        elif in_DISslice and dydx_data[i] < 0:
+            DISslices.append([beginDISslice, endDISslice])
+            in_DISslice = 0
+        # elseif inSlice expandslice
+        elif in_DOMslice:
+            endDOMslice += 1
+        elif in_DISslice:
+            endDISslice += 1
+    # if not in slice and dydx !== 0 start slice
+        if dydx_data[i] > 0 and not in_DISslice:
+            beginDISslice = i
+            endDISslice = i
+            in_DISslice = 1
+        elif dydx_data[i] < 0 and not in_DOMslice:
+            beginDOMslice = i
+            endDOMslice = i
+            in_DOMslice = 1
+    #last slice
+    if in_DOMslice:
+        DOMslices.append([beginDOMslice, endDOMslice])
+    if in_DISslice:
+        DISslices.append([beginDISslice,endDISslice])
+    k = 0
+    l = 0
+    while k < len(DOMslices):
+        if k+1 < len(DOMslices) and DOMslices[k+1][0]-DOMslices[k][1] < DOM_join_frame:
+            DOMslices[k] = [ DOMslices[k][0], DOMslices[k+1][1] ]
+            del DOMslices[k+1]
+        elif DOMslices[k][1]-DOMslices[k][0]+1 < DOM_peak_frame:
+            del DOMslices[k]
+        else:
+            k += 1
+    while l < len(DISslices):
+        if l+1 < len(DISslices) and DISslices[l+1][0]-DISslices[l][1] < DIS_join_frame:
+            DISslices[l] = [ DISslices[l][0], DISslices[l+1][1] ]
+            del DISslices[l+1]
+        elif DISslices[l][1]-DISslices[l][0]+1 < DIS_peak_frame:
+            del DISslices[l]
+        else:
+            l += 1
+    return DOMslices, DISslices
+
+
+def SavitzkyGolay(window,derivative,datalist):
+    SG_bin = relpath +'/'+ 'sav_gol -V0 '
+    stdin, stdout, stderr = popen3(SG_bin + '-D' + str(derivative) + ' -n' + str(window)+','+str(window))
+    for data in datalist:
+        stdin.write(`data`+'\n')
+    try:
+        stdin.close()
+    except:
+        print stderr.readlines()
+    results = stdout.readlines()
+    stdout.close()
+    SG_results = []
+    for result in results:
+        SG_results.append(float(fpformat.fix(result,6)))
+    return SG_results
+
+
+def reportSlicesTXT(slices, sequence, maskFlag):
+    if maskFlag == 'DOM':
+        coordstr = '|GlobDoms:'
+    elif maskFlag == 'DIS':
+        coordstr = '|Disorder:'
+    else:
+        raise SystemExit
+    if slices == []:
+        #by default the sequence is in uppercase which is our search space
+        s = sequence
+    else:
+        # insert seq before first slide
+        if slices[0][0] > 0:
+            s = sequence[0:slices[0][0]]
+        else:
+            s = ''
+        for i in range(len(slices)):
+            #skip first slice
+            if i > 0:
+                coordstr = coordstr + ', '
+            coordstr = coordstr + str(slices[i][0]+1) + '-' + str(slices[i][1]+1)
+            #insert the actual slice
+            if maskFlag == 'DOM':
+                s = s + lower(sequence[slices[i][0]:(slices[i][1]+1)])
+                if i < len(slices)-1:
+                    s = s + upper(sequence[(slices[i][1]+1):(slices[i+1][0])])
+                #last slice
+                elif slices[i][1] < len(sequence)-1:
+                    s = s + lower(sequence[(slices[i][1]+1):(len(sequence))])
+            elif maskFlag == 'DIS':
+                s = s + upper(sequence[slices[i][0]:(slices[i][1]+1)])
+                #insert untouched seq between disorder segments, 2-run labelling
+                if i < len(slices)-1:
+                    s = s + sequence[(slices[i][1]+1):(slices[i+1][0])]
+                #last slice
+                elif slices[i][1] < len(sequence)-1:
+                    s = s + sequence[(slices[i][1]+1):(len(sequence))]
+    return s,coordstr
+
+
+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])
+        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'
+        raise SystemExit
+    parser = Fasta.RecordParser()
+    iterator = Fasta.Iterator(db,parser)
+    while 1:
+        try:
+            cur_record = iterator.next()
+            #uppercase is searchspace
+            seq = upper(cur_record.sequence)
+            # sum function
+            sum_vector = Sum(seq,RL)
+            # Run Savitzky-Golay
+            smooth = SavitzkyGolay(`smoothFrame`,0, sum_vector)
+            dydx_vector = SavitzkyGolay(`smoothFrame`,1, sum_vector)
+            #test
+            sumHEAD = sum_vector[:smoothFrame]
+            sumTAIL = sum_vector[len(sum_vector)-smoothFrame:]
+            newHEAD = []
+            newTAIL = []
+            for i in range(len(sumHEAD)):
+                try:
+                    dHEAD = (sumHEAD[i+1]-sumHEAD[i])/2
+                except:
+                    dHEAD = (sumHEAD[i]-sumHEAD[i-1])/2
+                try:
+                    dTAIL = (sumTAIL[i+1]-sumTAIL[i])/2
+                except:
+                    dTAIL = (sumTAIL[i]-sumTAIL[i-1])/2
+                newHEAD.append(dHEAD)
+                newTAIL.append(dTAIL)
+            dydx_vector[:smoothFrame] = newHEAD
+            dydx_vector[len(dydx_vector)-smoothFrame:] = newTAIL
+            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')
+
+# UNCOMMENT THIS IF NEED TO PRODUCE PER RESEDUE VALUES 
+            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')
+    
+#            print s_final
+            print '\n'
+        except AttributeError:
+            break
+    return
+
+runGlobPlot()
diff --git a/binaries/src/globplot/GlobPipe.py.original b/binaries/src/globplot/GlobPipe.py.original
new file mode 100644 (file)
index 0000000..579945f
--- /dev/null
@@ -0,0 +1,222 @@
+#!/usr/bin/env python
+# Copyright (C) 2003 Rune Linding - EMBL
+# GlobPlot TM
+# GlobPlot is licensed under the Academic Free license
+
+from string import *
+from sys import argv
+import sys
+import os
+from os import system,popen3
+
+relpath = re.sub("/GlobPipe.py$","",argv[0])
+cwd = re.sub("/$","", os.getcwd())
+print '!'  +os.getcwd()
+print '!!' +cwd
+newpath =cwd+"/"+relpath+"/biopython-1.50"
+sys.path.append(newpath)
+
+import Bio
+from Bio import File
+from Bio import Fasta
+import fpformat
+import tempfile
+import math
+
+# Russell/Linding
+RL = {'N':0.229885057471264,'P':0.552316012226663,'Q':-0.187676577424997,'A':-0.261538461538462,'R':-0.176592654077609, \
+      'S':0.142883029808825,'C':-0.0151515151515152,'T':0.00887797506611258,'D':0.227629796839729,'E':-0.204684629516228, \
+      'V':-0.386174834235195,'F':-0.225572305974316,'W':-0.243375458622095,'G':0.433225711769886,'H':-0.00121743364986608, \
+      'Y':-0.20750516775322,'I':-0.422234699606962,'K':-0.100092289621613,'L':-0.337933495925287,'M':-0.225903614457831}
+
+def Sum(seq,par_dict):
+    sum = 0
+    results = []
+    raws = []
+    sums = []
+    p = 1
+    for residue in seq:
+        try:
+            parameter = par_dict[residue]
+        except:
+            parameter = 0
+        if p == 1:
+            sum = parameter
+        else:
+            sum = sum + parameter#*math.log10(p)
+        ssum = float(fpformat.fix(sum,10))
+        sums.append(ssum)
+        p +=1
+    return sums
+
+def getSlices(dydx_data, DOM_join_frame, DOM_peak_frame, DIS_join_frame, DIS_peak_frame):
+    DOMslices = []
+    DISslices = []
+    in_DOMslice = 0
+    in_DISslice = 0
+    beginDOMslice = 0
+    endDOMslice = 0
+    beginDISslice = 0
+    endDISslice = 0
+    for i in range( len(dydx_data) ):
+    #close dom slice
+        if in_DOMslice and dydx_data[i] > 0:
+            DOMslices.append([beginDOMslice, endDOMslice])
+            in_DOMslice = 0
+    #close dis slice
+        elif in_DISslice and dydx_data[i] < 0:
+            DISslices.append([beginDISslice, endDISslice])
+            in_DISslice = 0
+        # elseif inSlice expandslice
+        elif in_DOMslice:
+            endDOMslice += 1
+        elif in_DISslice:
+            endDISslice += 1
+    # if not in slice and dydx !== 0 start slice
+        if dydx_data[i] > 0 and not in_DISslice:
+            beginDISslice = i
+            endDISslice = i
+            in_DISslice = 1
+        elif dydx_data[i] < 0 and not in_DOMslice:
+            beginDOMslice = i
+            endDOMslice = i
+            in_DOMslice = 1
+    #last slice
+    if in_DOMslice:
+        DOMslices.append([beginDOMslice, endDOMslice])
+    if in_DISslice:
+        DISslices.append([beginDISslice,endDISslice])
+    k = 0
+    l = 0
+    while k < len(DOMslices):
+        if k+1 < len(DOMslices) and DOMslices[k+1][0]-DOMslices[k][1] < DOM_join_frame:
+            DOMslices[k] = [ DOMslices[k][0], DOMslices[k+1][1] ]
+            del DOMslices[k+1]
+        elif DOMslices[k][1]-DOMslices[k][0]+1 < DOM_peak_frame:
+            del DOMslices[k]
+        else:
+            k += 1
+    while l < len(DISslices):
+        if l+1 < len(DISslices) and DISslices[l+1][0]-DISslices[l][1] < DIS_join_frame:
+            DISslices[l] = [ DISslices[l][0], DISslices[l+1][1] ]
+            del DISslices[l+1]
+        elif DISslices[l][1]-DISslices[l][0]+1 < DIS_peak_frame:
+            del DISslices[l]
+        else:
+            l += 1
+    return DOMslices, DISslices
+
+
+def SavitzkyGolay(window,derivative,datalist):
+    SG_bin = '/homes/pvtroshin/soft/GlobPipe-2.3/sav_gol -V0 '
+    stdin, stdout, stderr = popen3(SG_bin + '-D' + str(derivative) + ' -n' + str(window)+','+str(window))
+    for data in datalist:
+        stdin.write(`data`+'\n')
+    try:
+        stdin.close()
+    except:
+        print stderr.readlines()
+    results = stdout.readlines()
+    stdout.close()
+    SG_results = []
+    for result in results:
+        SG_results.append(float(fpformat.fix(result,6)))
+    return SG_results
+
+
+def reportSlicesTXT(slices, sequence, maskFlag):
+    if maskFlag == 'DOM':
+        coordstr = '|GlobDoms:'
+    elif maskFlag == 'DIS':
+        coordstr = '|Disorder:'
+    else:
+        raise SystemExit
+    if slices == []:
+        #by default the sequence is in uppercase which is our search space
+        s = sequence
+    else:
+        # insert seq before first slide
+        if slices[0][0] > 0:
+            s = sequence[0:slices[0][0]]
+        else:
+            s = ''
+        for i in range(len(slices)):
+            #skip first slice
+            if i > 0:
+                coordstr = coordstr + ', '
+            coordstr = coordstr + str(slices[i][0]+1) + '-' + str(slices[i][1]+1)
+            #insert the actual slice
+            if maskFlag == 'DOM':
+                s = s + lower(sequence[slices[i][0]:(slices[i][1]+1)])
+                if i < len(slices)-1:
+                    s = s + upper(sequence[(slices[i][1]+1):(slices[i+1][0])])
+                #last slice
+                elif slices[i][1] < len(sequence)-1:
+                    s = s + lower(sequence[(slices[i][1]+1):(len(sequence))])
+            elif maskFlag == 'DIS':
+                s = s + upper(sequence[slices[i][0]:(slices[i][1]+1)])
+                #insert untouched seq between disorder segments, 2-run labelling
+                if i < len(slices)-1:
+                    s = s + sequence[(slices[i][1]+1):(slices[i+1][0])]
+                #last slice
+                elif slices[i][1] < len(sequence)-1:
+                    s = s + sequence[(slices[i][1]+1):(len(sequence))]
+    return s,coordstr
+
+
+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])
+        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'
+        raise SystemExit
+    parser = Fasta.RecordParser()
+    iterator = Fasta.Iterator(db,parser)
+    while 1:
+        try:
+            cur_record = iterator.next()
+            #uppercase is searchspace
+            seq = upper(cur_record.sequence)
+            # sum function
+            sum_vector = Sum(seq,RL)
+            # Run Savitzky-Golay
+            smooth = SavitzkyGolay(`smoothFrame`,0, sum_vector)
+            dydx_vector = SavitzkyGolay(`smoothFrame`,1, sum_vector)
+            #test
+            sumHEAD = sum_vector[:smoothFrame]
+            sumTAIL = sum_vector[len(sum_vector)-smoothFrame:]
+            newHEAD = []
+            newTAIL = []
+            for i in range(len(sumHEAD)):
+                try:
+                    dHEAD = (sumHEAD[i+1]-sumHEAD[i])/2
+                except:
+                    dHEAD = (sumHEAD[i]-sumHEAD[i-1])/2
+                try:
+                    dTAIL = (sumTAIL[i+1]-sumTAIL[i])/2
+                except:
+                    dTAIL = (sumTAIL[i]-sumTAIL[i-1])/2
+                newHEAD.append(dHEAD)
+                newTAIL.append(dTAIL)
+            dydx_vector[:smoothFrame] = newHEAD
+            dydx_vector[len(dydx_vector)-smoothFrame:] = newTAIL
+            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')
+            print s_final
+            print '\n'
+        except AttributeError:
+            break
+    return
+
+runGlobPlot()
diff --git a/binaries/src/globplot/LICENSE b/binaries/src/globplot/LICENSE
new file mode 100644 (file)
index 0000000..2da5f9c
--- /dev/null
@@ -0,0 +1,121 @@
+Academic Free License
+        Version 1.2
+
+This Academic Free License applies to any original work of authorship 
+(the "Original Work") whose owner (the "Licensor") has placed the 
+following notice immediately following the copyright notice for the 
+Original Work:
+
+Licensed under the Academic Free License version 1.2
+
+Grant of License. Licensor hereby grants to any person obtaining a 
+copy of the Original Work ("You") a world-wide, royalty-free, 
+non-exclusive, perpetual, non-sublicenseable license (1) to use, copy, 
+modify, merge, publish, perform, distribute and/or sell copies of the 
+Original Work and derivative works thereof, and (2) under patent claims 
+owned or controlled by the Licensor that are embodied in the Original 
+Work as furnished by the Licensor, to make, use, sell and offer for 
+sale the Original Work and derivative works thereof, subject to the 
+following conditions.
+
+Attribution Rights. You must retain, in the Source Code of any 
+Derivative Works that You create, all copyright, patent or trademark 
+notices from the Source Code of the Original Work, as well as any 
+notices of licensing and any descriptive text identified therein as an 
+"Attribution Notice." You must cause the Source Code for any Derivative 
+Works that You create to carry a prominent Attribution Notice reasonably 
+calculated to inform recipients that You have modified the Original Work.
+
+Exclusions from License Grant. Neither the names of Licensor, nor the 
+names of any contributors to the Original Work, nor any of their 
+trademarks or service marks, may be used to endorse or promote products 
+derived from this Original Work without express prior written permission 
+of the Licensor.
+
+Warranty and Disclaimer of Warranty. Licensor warrants that the copyright 
+in and to the Original Work is owned by the Licensor or that the Original 
+Work is distributed by Licensor under a valid current license from the 
+copyright owner. Except as expressly stated in the immediately proceeding 
+sentence, the Original Work is provided under this License on an "AS IS" 
+BASIS and WITHOUT WARRANTY, either express or implied, including, without 
+limitation, the warranties of NON-INFRINGEMENT, MERCHANTABILITY or FITNESS 
+FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY OF THE ORIGINAL 
+WORK IS WITH YOU. This DISCLAIMER OF WARRANTY constitutes an essential part 
+of this License. No license to Original Work is granted hereunder except 
+under this disclaimer.
+
+Limitation of Liability. Under no circumstances and under no legal theory, 
+whether in tort (including negligence), contract, or otherwise, shall the 
+Licensor be liable to any person for any direct, indirect, special, 
+incidental, or consequential damages of any character arising as a result 
+of this License or the use of the Original Work including, without 
+limitation, damages for loss of goodwill, work stoppage, computer failure 
+or malfunction, or any and all other commercial damages or losses. This 
+limitation of liability shall not apply to liability for death or personal 
+injury resulting from Licensor's negligence to the extent applicable law 
+prohibits such limitation. Some jurisdictions do not allow the exclusion or 
+limitation of incidental or consequential damages, so this exclusion and 
+limitation may not apply to You.
+
+License to Source Code. The term "Source Code" means the preferred form of 
+the Original Work for making modifications to it and all available 
+documentation describing how to modify the Original Work. Licensor hereby 
+agrees to provide a machine-readable copy of the Source Code of the Original 
+Work along with each copy of the Original Work that Licensor distributes. 
+Licensor reserves the right to satisfy this obligation by placing a 
+machine-readable copy of the Source Code in an information repository 
+reasonably calculated to permit inexpensive and convenient access by You for 
+as long as Licensor continues to distribute the Original Work, and by 
+publishing the address of that information repository in a notice immediately 
+following the copyright notice that applies to the Original Work.
+
+Mutual Termination for Patent Action. This License shall terminate 
+automatically and You may no longer exercise any of the rights granted to You 
+by this License if You file a lawsuit in any court alleging that any OSI 
+Certified open source software that is licensed under any license containing 
+this "Mutual Termination for Patent Action" clause infringes any patent 
+claims that are essential to use that software.
+
+Right to Use. You may use the Original Work in all ways not otherwise 
+restricted or conditioned by this License or by law, and Licensor promises 
+not to interfere with or be responsible for such uses by You.
+
+This license is Copyright (C) 2002 Lawrence E. Rosen. All rights reserved. 
+Permission is hereby granted to copy and distribute this license without 
+modification. This license may not be modified without the express written 
+permission of its copyright owner.
+
+-- 
+END OF LICENSE. The following is intended to describe the essential 
+differences between the Academic Free License (AFL) version 1.0 and other 
+open source licenses:
+
+The Academic Free License is similar to the BSD, MIT, UoI/NCSA and Apache 
+licenses in many respects but it is intended to solve a few problems with 
+those licenses.
+    
+* The AFL is written so as to make it clear what software is being 
+licensed (by the inclusion of a statement following the copyright notice 
+in the software). This way, the license functions better than a template 
+license. The BSD, MIT and UoI/NCSA licenses apply to unidentified software.
+    
+* The AFL contains a complete copyright grant to the software. The BSD 
+and Apache licenses are vague and incomplete in that respect.
+    
+* The AFL contains a complete patent grant to the software. The BSD, MIT, 
+UoI/NCSA and Apache licenses rely on an implied patent license and contain 
+no explicit patent grant.
+    
+* The AFL makes it clear that no trademark rights are granted to the 
+licensor's trademarks. The Apache license contains such a provision, but the 
+BSD, MIT and UoI/NCSA licenses do not.
+    
+* The AFL includes the warranty by the licensor that it either owns the 
+copyright or that it is distributing the software under a license. None of 
+the other licenses contain that warranty. All other warranties are disclaimed, 
+as is the case for the other licenses.
+
+* The AFL is itself copyrighted (with the right granted to copy and distribute 
+without modification). This ensures that the owner of the copyright to the 
+license will control changes. The Apache license contains a copyright notice, 
+but the BSD, MIT and UoI/NCSA licenses do not. 
diff --git a/binaries/src/globplot/README b/binaries/src/globplot/README
new file mode 100644 (file)
index 0000000..35a0e10
--- /dev/null
@@ -0,0 +1,32 @@
+Quick install:
+
+-install python2.2+
+-install Biopython from www.biopython.org
+
+-download TISEAN source: http://www.mpipks-dresden.mpg.de/~tisean/archive.html#source
+-compile the TISEAN package and get the sav_gol binary from the TISEAN_2.1/source_c directory,
+move it to the same directory as this archive was extracted to or change the path in
+the SavitzkyGolay routine.
+
+run globplot: ./GlobPlot.py
+
+
+note: only Russell/Linding propensities are currently in the script,
+you can replace them manually or mail and ask me to do it...but these
+parameters are the ones we had best results with!
+
+
+input: sequence_file is a fasta or file with multiple fasta sequences in!
+output: note that the masking is OPPOSITE the one the www servers is giving,
+CAPITAL letters means GlobDom or disorder!
+
+
+
+
+cheers
+r.
+
+GlobPlot & GlobPipe
+Rune Linding
+Copyright (C) 2003
+email: linding@embl.de
index 337395c..83ca5d3 100644 (file)
@@ -19,17 +19,14 @@ import java.io.FileInputStream;
 import java.io.FileNotFoundException;\r
 import java.io.IOException;\r
 import java.io.InputStream;\r
-\r
 import java.util.Map;\r
 import java.util.Set;\r
 \r
 import org.apache.log4j.Logger;\r
 \r
-\r
 import compbio.data.sequence.Score;\r
 import compbio.data.sequence.SequenceUtil;\r
 import compbio.data.sequence.UnknownFileFormatException;\r
-\r
 import compbio.engine.client.Executable;\r
 import compbio.engine.client.PipedExecutable;\r
 import compbio.engine.client.SkeletalExecutable;\r
@@ -39,26 +36,26 @@ import compbio.metadata.ResultNotAvailableException;
 import compbio.runner.Util;\r
 \r
 /**\r
- *      DisEMBL.py smooth_frame peak_frame join_frame fold_coils fold_hotloops\r
- *      fold_rem465 sequence_file print \r
- *      \r
- *      'A default run would be: ./DisEMBL.py 8 8 4 1.2 1.4 1.2 fasta_file > out' \r
- *             \r
- *             This version of DisEMBL is 1.4 (latest available for download in Feb 2011)\r
- *             capable of outputting raw values      \r
- *      \r
- *      The values of the parameters are hard coded in DisEMBL.py script. \r
- *      smooth_frame=8 peak_frame=8 join_frame=4 fold_coils=1.2 fold_hotloops=1.4\r
- *      fold_rem465=1.2 \r
- *      \r
- *       Changing these values are not recommended by developers, apart from smoothing window. \r
- *       However, 5 orders of magnitude changes in this parameter does not change the output\r
- *       so allowing this change also seems pointless. Finally, the binary, DisEMBL depends on\r
- *       - Tisean is not happy with arbitruary changes to these values, so changing them can \r
- *       lead to problems.\r
- *        \r
+ * DisEMBL.py smooth_frame peak_frame join_frame fold_coils fold_hotloops\r
+ * fold_rem465 sequence_file print\r
+ * \r
+ * 'A default run would be: ./DisEMBL.py 8 8 4 1.2 1.4 1.2 fasta_file > out'\r
+ * \r
+ * This version of DisEMBL is 1.4 (latest available for download in Feb 2011)\r
+ * capable of outputting raw values\r
+ * \r
+ * The values of the parameters are hard coded in DisEMBL.py script.\r
+ * smooth_frame=8 peak_frame=8 join_frame=4 fold_coils=1.2 fold_hotloops=1.4\r
+ * fold_rem465=1.2\r
  * \r
- *      This is not a standard DisEMBL! The script has been modified! \r
+ * Changing these values are not recommended by developers, apart from smoothing\r
+ * window. However, 5 orders of magnitude changes in this parameter does not\r
+ * change the output so allowing this change also seems pointless. Finally, the\r
+ * binary, DisEMBL depends on - Tisean is not happy with arbitruary changes to\r
+ * these values, so changing them can lead to problems.\r
+ * \r
+ * \r
+ * This is not a standard DisEMBL! The script has been modified!\r
  * \r
  */\r
 public class Disembl extends SkeletalExecutable<Disembl>\r
@@ -72,6 +69,13 @@ public class Disembl extends SkeletalExecutable<Disembl>
 \r
        public static final String KEY_VALUE_SEPARATOR = Util.SPACE;\r
 \r
+       /**\r
+        * For the region to be considered disordered the values must exceed these\r
+        */\r
+       public final double COILS_EXPECTATION_THRESHOLD = 0.43;\r
+       public final double REM_EXPECTATION_THRESHOLD = 0.5;\r
+       public final double LOOPS_EXPECTATION_THRESHOLD = 0.086;\r
+\r
        /* The parameter list there must not contain same values! */\r
        public Disembl() {\r
                // remove default input to prevent it to appear in the parameters list\r
@@ -84,26 +88,27 @@ public class Disembl extends SkeletalExecutable<Disembl>
                        throws ResultNotAvailableException {\r
 \r
                InputStream inStream = null;\r
-               Map<String, Set<Score>> results= null; \r
-                       try {\r
-                               inStream = new FileInputStream(new File(workDirectory,\r
-                                               getOutput()));\r
-                               results = SequenceUtil.removeSequences(SequenceUtil.readDisembl(inStream));\r
-                               inStream.close();\r
-                       } catch (FileNotFoundException e) {\r
-                               log.error(e.getMessage(), e.getCause());\r
-                               throw new ResultNotAvailableException(e);\r
-                       } catch (IOException e) {\r
-                               log.error(e.getMessage(), e.getCause());\r
-                               throw new ResultNotAvailableException(e);\r
-                       } catch (UnknownFileFormatException e) {\r
-                               log.error(e.getMessage(), e.getCause());\r
-                               throw new ResultNotAvailableException(e);\r
-                       } catch (NullPointerException e) {\r
-                               log.error(e.getMessage(), e.getCause());\r
-                               throw new ResultNotAvailableException(e);\r
-                       }\r
-               \r
+               Map<String, Set<Score>> results = null;\r
+               // How about getting ranges?\r
+               try {\r
+                       inStream = new FileInputStream(new File(workDirectory, getOutput()));\r
+                       results = SequenceUtil.removeSequences(SequenceUtil\r
+                                       .readDisembl(inStream));\r
+                       inStream.close();\r
+               } catch (FileNotFoundException e) {\r
+                       log.error(e.getMessage(), e.getCause());\r
+                       throw new ResultNotAvailableException(e);\r
+               } catch (IOException e) {\r
+                       log.error(e.getMessage(), e.getCause());\r
+                       throw new ResultNotAvailableException(e);\r
+               } catch (UnknownFileFormatException e) {\r
+                       log.error(e.getMessage(), e.getCause());\r
+                       throw new ResultNotAvailableException(e);\r
+               } catch (NullPointerException e) {\r
+                       log.error(e.getMessage(), e.getCause());\r
+                       throw new ResultNotAvailableException(e);\r
+               }\r
+\r
                return results;\r
        }\r
 \r
diff --git a/runner/compbio/runner/disorder/GlobProt.java b/runner/compbio/runner/disorder/GlobProt.java
deleted file mode 100644 (file)
index 4ef7a3f..0000000
+++ /dev/null
@@ -1,17 +0,0 @@
-package compbio.runner.disorder;\r
-\r
-/**\r
- * \r
- * ./GlobPipe.py SmoothFrame DOMjoinFrame DOMpeakFrame DISjoinFrame DISpeakFrame\r
- * FASTAfile\r
- * \r
- * Optimised for ELM: ./GlobPlot.py 10 8 75 8 8 sequence_file\r
- * \r
- * Webserver settings: ./GlobPlot.py 10 15 74 4 5 sequence_file\r
- * \r
- * @author pvtroshin\r
- * \r
- */\r
-public class GlobProt {\r
-\r
-}\r
index 98c2dfc..4178ada 100644 (file)
@@ -3,10 +3,11 @@ package compbio.ws.client;
 import java.io.ByteArrayInputStream;\r
 import java.io.FileNotFoundException;\r
 import java.io.IOException;\r
+import java.util.HashSet;\r
 import java.util.List;\r
-import java.util.Set;\r
+import java.util.Map;\r
 \r
-import compbio.data.msa.Annotation;\r
+import compbio.data.msa.SequenceAnnotation;\r
 import compbio.data.sequence.FastaSequence;\r
 import compbio.data.sequence.Score;\r
 import compbio.data.sequence.SequenceUtil;\r
@@ -70,8 +71,9 @@ public class AAConWSClientExample {
                /*\r
                 * Annotation interface for AAConWS web service instance\r
                 */\r
-               Annotation<AACon> client = (Annotation<AACon>) Jws2Client.connect(\r
-                               "http://www.compbio.dundee.ac.uk/aacon", Services.AAConWS);\r
+               SequenceAnnotation<AACon> client = (SequenceAnnotation<AACon>) Jws2Client\r
+                               .connect("http://www.compbio.dundee.ac.uk/aacon",\r
+                                               Services.AAConWS);\r
 \r
                /* Get the list of available presets */\r
                PresetManager presetman = client.getPresets();\r
@@ -94,7 +96,7 @@ public class AAConWSClientExample {
                String jobId = client.presetAnalize(fastalist, preset);\r
 \r
                /* This method will block for the duration of the calculation */\r
-               Set<Score> result = client.getAnnotation(jobId);\r
+               Map<String, HashSet<Score>> result = client.getAnnotation(jobId);\r
 \r
                /*\r
                 * This is a better way of obtaining results, it does not involve\r
@@ -108,7 +110,8 @@ public class AAConWSClientExample {
                // }\r
 \r
                /* Output the alignment to standard out */\r
-               Score.write(result, System.out);\r
+               IOHelper.writeOut(System.out, result);\r
+               // Score.write(result, System.out);\r
 \r
                /* Alternatively, you can record retrieved alignment into the file */\r
                // FileOutputStream out = new FileOutputStream("result.txt");\r
index acaf57f..4fa90ac 100644 (file)
@@ -11,12 +11,13 @@ import java.io.IOException;
 import java.util.ArrayList;\r
 import java.util.HashSet;\r
 import java.util.List;\r
+import java.util.Map;\r
 \r
 import org.testng.annotations.BeforeTest;\r
 import org.testng.annotations.Test;\r
 \r
-import compbio.data.msa.Annotation;\r
 import compbio.data.msa.JABAService;\r
+import compbio.data.msa.SequenceAnnotation;\r
 import compbio.data.sequence.ConservationMethod;\r
 import compbio.data.sequence.FastaSequence;\r
 import compbio.data.sequence.Score;\r
@@ -33,7 +34,7 @@ import compbio.util.SysPrefs;
 \r
 public class TestAAConWS {\r
 \r
-       Annotation<AACon> msaws;\r
+       SequenceAnnotation<AACon> msaws;\r
 \r
        @BeforeTest\r
        void initConnection() {\r
@@ -49,7 +50,7 @@ public class TestAAConWS {
                 */\r
                JABAService client = Jws2Client.connect("http://localhost:8080/jabaws",\r
                                Services.AAConWS);\r
-               msaws = (Annotation<AACon>) client;\r
+               msaws = (SequenceAnnotation<AACon>) client;\r
        }\r
 \r
        @Test\r
@@ -77,12 +78,13 @@ public class TestAAConWS {
                        System.out.println("Pres: " + msaws.getPresets().getPresets());\r
                        String jobId = msaws.analize(fsl);\r
                        System.out.println("J: " + jobId);\r
-                       HashSet<Score> result = msaws.getAnnotation(jobId);\r
+                       Map<String, HashSet<Score>> result = msaws.getAnnotation(jobId);\r
                        assertNotNull(result);\r
                        assertEquals(result.size(), 1);\r
-                       assertEquals(result.iterator().next().getMethod(),\r
-                                       ConservationMethod.SHENKIN);\r
-                       List<Float> scores = result.iterator().next().getScores();\r
+                       assertEquals(result.values().iterator().next().iterator().next()\r
+                                       .getMethod(), ConservationMethod.SHENKIN);\r
+                       List<Float> scores = result.values().iterator().next().iterator()\r
+                                       .next().getScores();\r
                        assertNotNull(scores);\r
                        assertEquals(scores.size(), 568);\r
 \r
@@ -142,7 +144,7 @@ public class TestAAConWS {
                        PresetManager<AACon> presets = msaws.getPresets();\r
                        String jobId = msaws.presetAnalize(fsl,\r
                                        presets.getPresetByName("Quick conservation"));\r
-                       HashSet<Score> result = msaws.getAnnotation(jobId);\r
+                       Map<String, HashSet<Score>> result = msaws.getAnnotation(jobId);\r
                        assertNotNull(result);\r
                        assertEquals(result.size(), 13);\r
 \r
@@ -197,12 +199,12 @@ public class TestAAConWS {
                        // .setDefaultValue("MAX_SCORE");\r
                        // options.getArgument("SMERFS Gap Threshhold").setDefaultValue("1");\r
                        String jobId = msaws.customAnalize(fsl, options.getArguments());\r
-                       HashSet<Score> result = msaws.getAnnotation(jobId);\r
+                       Map<String, HashSet<Score>> result = msaws.getAnnotation(jobId);\r
                        assertNotNull(result);\r
                        assertEquals(result.size(), 1);\r
                        assertEquals(\r
-                                       new ArrayList<Score>(result).get(0).getScores().get(0),\r
-                                       0.698f);\r
+                                       new ArrayList<Score>(result.values().iterator().next())\r
+                                                       .get(0).getScores().get(0), 0.698f);\r
 \r
                        options.getArgument("Calculation method").setDefaultValue("SMERFS");\r
                        options.removeArgument("Normalize");\r
@@ -212,8 +214,8 @@ public class TestAAConWS {
                        assertNotNull(result);\r
                        assertEquals(result.size(), 1);\r
                        assertEquals(\r
-                                       new ArrayList<Score>(result).get(0).getScores().get(0),\r
-                                       0.401f);\r
+                                       new ArrayList<Score>(result.values().iterator().next())\r
+                                                       .get(0).getScores().get(0), 0.401f);\r
 \r
                } catch (WrongParameterException e) {\r
                        e.printStackTrace();\r
@@ -1,6 +1,7 @@
 package compbio.data.msa;\r
 \r
 import java.security.InvalidParameterException;\r
+import java.util.HashMap;\r
 import java.util.HashSet;\r
 import java.util.List;\r
 \r
@@ -21,6 +22,8 @@ import compbio.metadata.WrongParameterException;
 /**\r
  * Interface for tools that results to one or more annotation to sequence(s)\r
  * \r
+ * Single, multiple sequences their groups or alignments can be annotated\r
+ * \r
  * @author Peter Troshin\r
  * \r
  * @param <T>\r
@@ -29,7 +32,11 @@ import compbio.metadata.WrongParameterException;
  * @version 1.0 November 2010\r
  */\r
 @WebService(targetNamespace = "http://msa.data.compbio/01/12/2010/")\r
-public interface Annotation<T> extends JABAService, JManagement, Metadata<T> {\r
+public interface SequenceAnnotation<T>\r
+               extends\r
+                       JABAService,\r
+                       JManagement,\r
+                       Metadata<T> {\r
 \r
        /**\r
         * \r
@@ -167,7 +174,13 @@ public interface Annotation<T> extends JABAService, JManagement, Metadata<T> {
         * \r
         * @param jobId\r
         *            a unique job identifier\r
-        * @return the HashSet of Score objects\r
+        * @return the Map with the sequence names, sequence group names or the word\r
+        *         'Alignment' in case of alignments and values the represented by a\r
+        *         Set of Score objects. The alignment can be represented in as\r
+        *         little as one key->value pair in this map, the list of sequences\r
+        *         will be represented by multiple key->value mappings. If multiple\r
+        *         annotations were calculated, then they are represented as a Set\r
+        *         of Scores.\r
         * @throws ResultNotAvailableException\r
         *             this exception is throw if the job execution was not\r
         *             successful or the result of the execution could not be found.\r
@@ -178,9 +191,16 @@ public interface Annotation<T> extends JABAService, JManagement, Metadata<T> {
         * @throws InvalidParameterException\r
         *             thrown if jobId is empty or cannot be recognised e.g. in\r
         *             invalid format\r
+        * \r
         */\r
        @WebMethod\r
-       HashSet<Score> getAnnotation(@WebParam(name = "jobId") String jobId)\r
+       HashMap<String, HashSet<Score>> getAnnotation(\r
+                       @WebParam(name = "jobId") String jobId)\r
                        throws ResultNotAvailableException;\r
-\r
+       /*\r
+        * The method should really return Map and Set, but unfortunately JAXB\r
+        * cannot serialize interfaces, has a concrete implementation is used Could\r
+        * also specify the generic Set e.g. ? extends Set. But this would require\r
+        * the client cast or operate with generic Set. Keep it simple for now.\r
+        */\r
 }\r
index c9d0d5b..d7adf3c 100644 (file)
@@ -1,6 +1,7 @@
 \r
 package compbio.data.msa.jaxws;\r
 \r
+import java.util.HashMap;\r
 import java.util.HashSet;\r
 import javax.xml.bind.annotation.XmlAccessType;\r
 import javax.xml.bind.annotation.XmlAccessorType;\r
@@ -14,14 +15,14 @@ import javax.xml.bind.annotation.XmlType;
 public class GetAnnotationResponse {\r
 \r
     @XmlElement(name = "return", namespace = "")\r
-    private HashSet<compbio.data.sequence.Score> _return;\r
+    private HashMap<String, HashSet<compbio.data.sequence.Score>> _return;\r
 \r
     /**\r
      * \r
      * @return\r
-     *     returns HashSet<Score>\r
+     *     returns HashMap<String,HashSet<Score>>\r
      */\r
-    public HashSet<compbio.data.sequence.Score> getReturn() {\r
+    public HashMap<String, HashSet<compbio.data.sequence.Score>> getReturn() {\r
         return this._return;\r
     }\r
 \r
@@ -30,7 +31,7 @@ public class GetAnnotationResponse {
      * @param _return\r
      *     the value for the _return property\r
      */\r
-    public void setReturn(HashSet<compbio.data.sequence.Score> _return) {\r
+    public void setReturn(HashMap<String, HashSet<compbio.data.sequence.Score>> _return) {\r
         this._return = _return;\r
     }\r
 \r
index 34fc751..57cf59f 100644 (file)
@@ -33,7 +33,9 @@ import java.io.IOException;
 import java.io.OutputStream;\r
 import java.net.MalformedURLException;\r
 import java.net.URL;\r
+import java.util.HashSet;\r
 import java.util.List;\r
+import java.util.Map;\r
 import java.util.Set;\r
 import java.util.logging.Level;\r
 import java.util.logging.Logger;\r
@@ -42,7 +44,7 @@ import javax.xml.namespace.QName;
 import javax.xml.ws.Service;\r
 import javax.xml.ws.WebServiceException;\r
 \r
-import compbio.data.msa.Annotation;\r
+import compbio.data.msa.SequenceAnnotation;\r
 import compbio.data.sequence.FastaSequence;\r
 import compbio.data.sequence.Score;\r
 import compbio.data.sequence.SequenceUtil;\r
@@ -102,7 +104,7 @@ public class AAConClient {
                File parametersFile = IOHelper.getFile(cmd, paramFile, true);\r
                String presetName = CmdHelper.getPresetName(cmd);\r
 \r
-               Annotation<AAConWS> msaws = connect();\r
+               SequenceAnnotation<AAConWS> msaws = connect();\r
                Preset<AAConWS> preset = null;\r
                if (presetName != null) {\r
                        preset = MetadataHelper.getPreset(msaws, presetName);\r
@@ -113,7 +115,7 @@ public class AAConClient {
                        customOptions = MetadataHelper.processParameters(prms,\r
                                        msaws.getRunnerOptions());\r
                }\r
-               Set<Score> result = null;\r
+               Map<String, HashSet<Score>> result = null;\r
                if (inputFile != null) {\r
                        System.out.println("Calculating conservation...");\r
                        result = analize(inputFile, msaws, preset, customOptions);\r
@@ -153,9 +155,14 @@ public class AAConClient {
         * @param result\r
         *            the AACon scores to output\r
         */\r
-       static void writeOut(OutputStream outStream, Set<Score> result) {\r
+       static void writeOut(OutputStream outStream,\r
+                       Map<String, HashSet<Score>> result) {\r
                try {\r
-                       Score.write(result, outStream);\r
+                       for (Map.Entry<String, ? extends Set<Score>> entry : result\r
+                                       .entrySet()) {\r
+                               System.out.println(">" + entry.getKey());\r
+                               Score.write(entry.getValue(), outStream);\r
+                       }\r
                } catch (IOException e) {\r
                        System.err\r
                                        .println("Problems writing output file! Stack trace is below: ");\r
@@ -175,11 +182,12 @@ public class AAConClient {
         * Connects to a AACon web service by the host and the service name\r
         * \r
         * \r
-        * @return {@link Annotation}\r
+        * @return {@link AlignmentAnnotation}\r
         * @throws WebServiceException\r
         *             if cannot connect to a web service\r
         */\r
-       public static Annotation<AAConWS> connect() throws WebServiceException {\r
+       public static SequenceAnnotation<AAConWS> connect()\r
+                       throws WebServiceException {\r
                URL url = null;\r
                log.log(Level.FINE, "Attempting to connect...");\r
                try {\r
@@ -193,8 +201,8 @@ public class AAConClient {
                QName portName = new QName(QUALIFIED_SERVICE_NAME, "AAConWS" + "Port");\r
 \r
                @SuppressWarnings("unchecked")\r
-               Annotation<AAConWS> serviceIF = serv\r
-                               .getPort(portName, Annotation.class);\r
+               SequenceAnnotation<AAConWS> serviceIF = serv.getPort(portName,\r
+                               SequenceAnnotation.class);\r
 \r
                log.log(Level.FINE, "Connected successfully!");\r
                return serviceIF;\r
@@ -214,11 +222,12 @@ public class AAConClient {
         * @return Set<Score> the conservation scores\r
         * @throws UnknownFileFormatException\r
         */\r
-       static Set<Score> analize(File file, Annotation<AAConWS> wsproxy,\r
-                       Preset<AAConWS> preset, List<Option<AAConWS>> customOptions) {\r
+       static Map<String, HashSet<Score>> analize(File file,\r
+                       SequenceAnnotation<AAConWS> wsproxy, Preset<AAConWS> preset,\r
+                       List<Option<AAConWS>> customOptions) {\r
 \r
                List<FastaSequence> fastalist = null;\r
-               Set<Score> scores = null;\r
+               Map<String, HashSet<Score>> scores = null;\r
                try {\r
                        fastalist = SequenceUtil.openInputStream(file.getAbsolutePath());\r
 \r
index 79357e5..414af9c 100644 (file)
@@ -10,8 +10,9 @@ import java.io.FileReader;
 import java.io.IOException;\r
 import java.io.OutputStream;\r
 import java.util.ArrayList;\r
+import java.util.HashSet;\r
 import java.util.List;\r
-import java.util.Set;\r
+import java.util.Map;\r
 \r
 import compbio.data.sequence.Alignment;\r
 import compbio.data.sequence.ClustalAlignmentUtil;\r
@@ -118,9 +119,13 @@ public class IOHelper {
         * @param result\r
         *            the AACon scores to output\r
         */\r
-       static void writeOut(OutputStream outStream, Set<Score> result) {\r
+       static void writeOut(OutputStream outStream,\r
+                       Map<String, HashSet<Score>> result) {\r
                try {\r
-                       Score.write(result, outStream);\r
+                       for (Map.Entry<String, HashSet<Score>> entry : result.entrySet()) {\r
+                               System.out.println(">" + entry.getKey());\r
+                               Score.write(entry.getValue(), outStream);\r
+                       }\r
                } catch (IOException e) {\r
                        System.err\r
                                        .println("Problems writing output file! Stack trace is below: ");\r
index 1673e18..62aa383 100644 (file)
@@ -37,18 +37,19 @@ import java.io.OutputStream;
 import java.net.MalformedURLException;\r
 import java.net.URL;\r
 import java.util.Arrays;\r
+import java.util.HashSet;\r
 import java.util.List;\r
-import java.util.Set;\r
+import java.util.Map;\r
 import java.util.logging.Level;\r
 import java.util.logging.Logger;\r
 \r
 import javax.xml.ws.Service;\r
 import javax.xml.ws.WebServiceException;\r
 \r
-import compbio.data.msa.Annotation;\r
 import compbio.data.msa.JABAService;\r
 import compbio.data.msa.Metadata;\r
 import compbio.data.msa.MsaWS;\r
+import compbio.data.msa.SequenceAnnotation;\r
 import compbio.data.sequence.Alignment;\r
 import compbio.data.sequence.FastaSequence;\r
 import compbio.data.sequence.Score;\r
@@ -160,8 +161,8 @@ public class Jws2Client {
                                outStream = System.out;\r
                        }\r
                        if (service == Services.AAConWS) {\r
-                               Set<Score> result = analize(inputFile, ((Annotation<T>) msaws),\r
-                                               preset, customOptions);\r
+                               Map<String, HashSet<Score>> result = analize(inputFile,\r
+                                               ((SequenceAnnotation<T>) msaws), preset, customOptions);\r
                                IOHelper.writeOut(outStream, result);\r
                        } else {\r
                                alignment = align(inputFile, (MsaWS<T>) msaws, preset,\r
@@ -202,11 +203,12 @@ public class Jws2Client {
         * @return Set<Score> the conservation scores\r
         * @throws UnknownFileFormatException\r
         */\r
-       <T> Set<Score> analize(File file, Annotation<T> wsproxy, Preset<T> preset,\r
+       <T> Map<String, HashSet<Score>> analize(File file,\r
+                       SequenceAnnotation<T> wsproxy, Preset<T> preset,\r
                        List<Option<T>> customOptions) {\r
 \r
                List<FastaSequence> fastalist = null;\r
-               Set<Score> scores = null;\r
+               Map<String, HashSet<Score>> scores = null;\r
                try {\r
                        fastalist = SequenceUtil.openInputStream(file.getAbsolutePath());\r
 \r
index 6734a36..f18eadf 100644 (file)
@@ -23,9 +23,9 @@ import java.net.URL;
 import javax.xml.namespace.QName;\r
 import javax.xml.ws.Service;\r
 \r
-import compbio.data.msa.Annotation;\r
 import compbio.data.msa.JABAService;\r
 import compbio.data.msa.MsaWS;\r
+import compbio.data.msa.SequenceAnnotation;\r
 \r
 /**\r
  * List of web services currently supported by JABAWS version 2\r
@@ -70,7 +70,7 @@ public enum Services {
 \r
                switch (this) {\r
                        case AAConWS :\r
-                               return service.getPort(portName, Annotation.class);\r
+                               return service.getPort(portName, SequenceAnnotation.class);\r
 \r
                                // deliberate leaking\r
                        case ClustalWS :\r
index a32533f..433728b 100644 (file)
@@ -2,6 +2,7 @@ package compbio.ws.server;
 \r
 import java.io.File;\r
 import java.util.Arrays;\r
+import java.util.HashMap;\r
 import java.util.HashSet;\r
 import java.util.List;\r
 \r
@@ -11,7 +12,7 @@ import javax.xml.ws.WebServiceContext;
 \r
 import org.apache.log4j.Logger;\r
 \r
-import compbio.data.msa.Annotation;\r
+import compbio.data.msa.SequenceAnnotation;\r
 import compbio.data.sequence.FastaSequence;\r
 import compbio.data.sequence.Score;\r
 import compbio.engine.AsyncExecutor;\r
@@ -33,8 +34,8 @@ import compbio.metadata.WrongParameterException;
 import compbio.runner.Util;\r
 import compbio.runner.conservation.AACon;\r
 \r
-@WebService(endpointInterface = "compbio.data.msa.Annotation", targetNamespace = "http://msa.data.compbio/01/12/2010/", serviceName = "AAConWS")\r
-public class AAConWS implements Annotation<AACon> {\r
+@WebService(endpointInterface = "compbio.data.msa.SequenceAnnotation", targetNamespace = "http://msa.data.compbio/01/12/2010/", serviceName = "AAConWS")\r
+public class AAConWS implements SequenceAnnotation<AACon> {\r
 \r
        // Ask for resource injection\r
        @Resource\r
@@ -58,15 +59,17 @@ public class AAConWS implements Annotation<AACon> {
        }\r
 \r
        @Override\r
-       public HashSet<Score> getAnnotation(String jobId)\r
+       public HashMap<String, HashSet<Score>> getAnnotation(String jobId)\r
                        throws ResultNotAvailableException {\r
                WSUtil.validateJobId(jobId);\r
                AsyncExecutor asyncEngine = Configurator.getAsyncEngine(jobId);\r
                ConfiguredExecutable<AACon> aacon = (ConfiguredExecutable<AACon>) asyncEngine\r
                                .getResults(jobId);\r
                HashSet<Score> mas = aacon.getResults();\r
+               HashMap<String, HashSet<Score>> result = new HashMap<String, HashSet<Score>>();\r
+               result.put("Alignment", mas);\r
                log.trace(jobId + " getConservation : " + mas);\r
-               return mas;\r
+               return result;\r
        }\r
        /*\r
         * @SuppressWarnings("unchecked") public JalviewAnnotation\r
diff --git a/webservices/compbio/ws/server/DisemblWS.java b/webservices/compbio/ws/server/DisemblWS.java
new file mode 100644 (file)
index 0000000..00f3f69
--- /dev/null
@@ -0,0 +1,157 @@
+package compbio.ws.server;\r
+\r
+import java.util.HashMap;\r
+import java.util.HashSet;\r
+import java.util.List;\r
+\r
+import javax.annotation.Resource;\r
+import javax.jws.WebService;\r
+import javax.xml.ws.WebServiceContext;\r
+\r
+import org.apache.log4j.Logger;\r
+\r
+import compbio.data.msa.SequenceAnnotation;\r
+import compbio.data.sequence.FastaSequence;\r
+import compbio.data.sequence.Score;\r
+import compbio.engine.AsyncExecutor;\r
+import compbio.engine.Configurator;\r
+import compbio.engine.client.ConfiguredExecutable;\r
+import compbio.metadata.ChunkHolder;\r
+import compbio.metadata.JobStatus;\r
+import compbio.metadata.JobSubmissionException;\r
+import compbio.metadata.Limit;\r
+import compbio.metadata.LimitExceededException;\r
+import compbio.metadata.LimitsManager;\r
+import compbio.metadata.Option;\r
+import compbio.metadata.Preset;\r
+import compbio.metadata.PresetManager;\r
+import compbio.metadata.ResultNotAvailableException;\r
+import compbio.metadata.RunnerConfig;\r
+import compbio.metadata.UnsupportedRuntimeException;\r
+import compbio.metadata.WrongParameterException;\r
+import compbio.runner.Util;\r
+import compbio.runner.disorder.Disembl;\r
+\r
+@WebService(endpointInterface = "compbio.data.msa.SequenceAnnotation", targetNamespace = "http://msa.data.compbio/01/12/2010/", serviceName = "DisemblWS")\r
+public class DisemblWS implements SequenceAnnotation<Disembl> {\r
+\r
+       // Ask for resource injection\r
+       @Resource\r
+       WebServiceContext wsContext;\r
+\r
+       private static Logger statLog = Logger.getLogger("DisemblWS-stats");\r
+\r
+       private static Logger log = Logger.getLogger(DisemblWS.class);\r
+\r
+       private static final RunnerConfig<Disembl> disemblOptions = Util\r
+                       .getSupportedOptions(Disembl.class);\r
+\r
+       private static final PresetManager<Disembl> disemblPresets = Util\r
+                       .getPresets(Disembl.class);\r
+\r
+       ConfiguredExecutable<Disembl> init(List<FastaSequence> sequences)\r
+                       throws JobSubmissionException {\r
+               Disembl disembl = new Disembl();\r
+               disembl.setInput("fasta.in").setOutput("disembl.out");\r
+               return Configurator.configureExecutable(disembl, sequences);\r
+       }\r
+\r
+       @Override\r
+       public HashMap<String, HashSet<Score>> getAnnotation(String jobId)\r
+                       throws ResultNotAvailableException {\r
+               WSUtil.validateJobId(jobId);\r
+               AsyncExecutor asyncEngine = Configurator.getAsyncEngine(jobId);\r
+               ConfiguredExecutable<Disembl> aacon = (ConfiguredExecutable<Disembl>) asyncEngine\r
+                               .getResults(jobId);\r
+               HashMap<String, HashSet<Score>> mas = aacon.getResults();\r
+               log.trace(jobId + " getConservation : " + mas);\r
+               return mas;\r
+       }\r
+\r
+       @Override\r
+       public Limit<Disembl> getLimit(String presetName) {\r
+               return new Disembl().getLimit(presetName);\r
+       }\r
+\r
+       @Override\r
+       public LimitsManager<Disembl> getLimits() {\r
+               return new Disembl().getLimits();\r
+       }\r
+\r
+       @Override\r
+       public ChunkHolder pullExecStatistics(String jobId, long position) {\r
+               // Execution stat is not supported\r
+               return new ChunkHolder("", -1);\r
+       }\r
+\r
+       @Override\r
+       public boolean cancelJob(String jobId) {\r
+               WSUtil.validateJobId(jobId);\r
+               return WSUtil.cancelJob(jobId);\r
+       }\r
+\r
+       @Override\r
+       public JobStatus getJobStatus(String jobId) {\r
+               WSUtil.validateJobId(jobId);\r
+               return WSUtil.getJobStatus(jobId);\r
+       }\r
+\r
+       @Override\r
+       public PresetManager<Disembl> getPresets() {\r
+               return disemblPresets;\r
+       }\r
+\r
+       @Override\r
+       public RunnerConfig<Disembl> getRunnerOptions() {\r
+               return disemblOptions;\r
+       }\r
+\r
+       String analize(List<FastaSequence> sequences,\r
+                       ConfiguredExecutable<Disembl> confExec, Logger log, String method,\r
+                       Limit<Disembl> limit) throws JobSubmissionException {\r
+               if (limit != null && limit.isExceeded(sequences)) {\r
+                       throw LimitExceededException.newLimitExceeded(limit, sequences);\r
+               }\r
+\r
+               compbio.runner.Util.writeInput(sequences, confExec);\r
+               AsyncExecutor engine = Configurator.getAsyncEngine(confExec);\r
+               String jobId = engine.submitJob(confExec);\r
+               return jobId;\r
+       }\r
+\r
+       @Override\r
+       public String analize(List<FastaSequence> sequences)\r
+                       throws UnsupportedRuntimeException, LimitExceededException,\r
+                       JobSubmissionException {\r
+               WSUtil.validateFastaInput(sequences);\r
+               ConfiguredExecutable<Disembl> confDisembl = init(sequences);\r
+\r
+               return analize(sequences, confDisembl, null, "analize", getLimit(""));\r
+       }\r
+\r
+       /*\r
+        * No options are supported, thus the result of this call will be as simple\r
+        * call to analize without parameters\r
+        */\r
+       @Override\r
+       public String customAnalize(List<FastaSequence> sequences,\r
+                       List<Option<Disembl>> options) throws UnsupportedRuntimeException,\r
+                       LimitExceededException, JobSubmissionException,\r
+                       WrongParameterException {\r
+               return analize(sequences);\r
+       }\r
+\r
+       /*\r
+        * No presets are supported, thus the result of this call will be as simple\r
+        * call to analize without parameters\r
+        */\r
+       @Override\r
+       public String presetAnalize(List<FastaSequence> sequences,\r
+                       Preset<Disembl> preset) throws UnsupportedRuntimeException,\r
+                       LimitExceededException, JobSubmissionException,\r
+                       WrongParameterException {\r
+\r
+               return analize(sequences);\r
+       }\r
+\r
+}\r
index 9f5be63..13fe708 100644 (file)
@@ -1,6 +1,7 @@
 package compbio.ws.server;\r
 \r
 import java.io.File;\r
+import java.util.HashMap;\r
 import java.util.HashSet;\r
 import java.util.List;\r
 \r
@@ -10,7 +11,7 @@ import javax.xml.ws.WebServiceContext;
 \r
 import org.apache.log4j.Logger;\r
 \r
-import compbio.data.msa.Annotation;\r
+import compbio.data.msa.SequenceAnnotation;\r
 import compbio.data.sequence.FastaSequence;\r
 import compbio.data.sequence.Score;\r
 import compbio.engine.AsyncExecutor;\r
@@ -33,8 +34,8 @@ import compbio.runner.Util;
 import compbio.runner.conservation.AACon;\r
 import compbio.runner.disorder.Jronn;\r
 \r
-@WebService(endpointInterface = "compbio.data.msa.Annotation", targetNamespace = "http://msa.data.compbio/01/12/2010/", serviceName = "JronnWS")\r
-public class JronnWS implements Annotation<Jronn> {\r
+@WebService(endpointInterface = "compbio.data.msa.SequenceAnnotation", targetNamespace = "http://msa.data.compbio/01/12/2010/", serviceName = "JronnWS")\r
+public class JronnWS implements SequenceAnnotation<Jronn> {\r
 \r
        // Ask for resource injection\r
        @Resource\r
@@ -44,27 +45,27 @@ public class JronnWS implements Annotation<Jronn> {
 \r
        private static Logger log = Logger.getLogger(JronnWS.class);\r
 \r
-       private static final RunnerConfig<Jronn> aaconOptions = Util\r
+       private static final RunnerConfig<Jronn> jronnOptions = Util\r
                        .getSupportedOptions(Jronn.class);\r
 \r
-       private static final PresetManager<Jronn> aaconPresets = Util\r
+       private static final PresetManager<Jronn> jronnPresets = Util\r
                        .getPresets(Jronn.class);\r
 \r
        ConfiguredExecutable<Jronn> init(List<FastaSequence> sequences)\r
                        throws JobSubmissionException {\r
                Jronn jronn = new Jronn();\r
-               jronn.setInput("fasta.in").setOutput("aacon.out");\r
+               jronn.setInput("fasta.in").setOutput("jronn.out");\r
                return Configurator.configureExecutable(jronn, sequences);\r
        }\r
 \r
        @Override\r
-       public HashSet<Score> getAnnotation(String jobId)\r
+       public HashMap<String, HashSet<Score>> getAnnotation(String jobId)\r
                        throws ResultNotAvailableException {\r
                WSUtil.validateJobId(jobId);\r
                AsyncExecutor asyncEngine = Configurator.getAsyncEngine(jobId);\r
-               ConfiguredExecutable<AACon> aacon = (ConfiguredExecutable<AACon>) asyncEngine\r
+               ConfiguredExecutable<Jronn> jronn = (ConfiguredExecutable<Jronn>) asyncEngine\r
                                .getResults(jobId);\r
-               HashSet<Score> mas = aacon.getResults();\r
+               HashMap<String, HashSet<Score>> mas = jronn.getResults();\r
                log.trace(jobId + " getConservation : " + mas);\r
                return mas;\r
        }\r
@@ -101,12 +102,12 @@ public class JronnWS implements Annotation<Jronn> {
 \r
        @Override\r
        public PresetManager<Jronn> getPresets() {\r
-               return aaconPresets;\r
+               return jronnPresets;\r
        }\r
 \r
        @Override\r
        public RunnerConfig<Jronn> getRunnerOptions() {\r
-               return aaconOptions;\r
+               return jronnOptions;\r
        }\r
 \r
        String analize(List<FastaSequence> sequences,\r
@@ -127,10 +128,9 @@ public class JronnWS implements Annotation<Jronn> {
                        throws UnsupportedRuntimeException, LimitExceededException,\r
                        JobSubmissionException {\r
                WSUtil.validateFastaInput(sequences);\r
-               ConfiguredExecutable<Jronn> confAAcon = init(sequences);\r
+               ConfiguredExecutable<Jronn> confJronn = init(sequences);\r
 \r
-               // set default conservation method to fastest - SHENKIN\r
-               return analize(sequences, confAAcon, null, "analize", getLimit(""));\r
+               return analize(sequences, confJronn, null, "analize", getLimit(""));\r
        }\r
 \r
        @Override\r
@@ -140,9 +140,7 @@ public class JronnWS implements Annotation<Jronn> {
                        WrongParameterException {\r
                WSUtil.validateFastaInput(sequences);\r
                ConfiguredExecutable<Jronn> confJronn = init(sequences);\r
-               // Could not do that! Space separated values\r
-               // will all be treated as keys! thus duplicates removed\r
-               // String params = cbuilder.getCommand();\r
+\r
                List<String> params = WSUtil.getCommands(options,\r
                                AACon.KEY_VALUE_SEPARATOR);\r
                confJronn.addParameters(params);\r