This is the patch [Re: Lookup indices & native SRS]

Reinhard Doelz doelz at comp.bioz.unibas.ch
Thu Jun 27 14:15:33 EST 1996


Michael Schmitz wrote:
> 
> Christoph Gartmann (GARTMANN at IMMUNBIO.MPG.DE) wrote:
> : Hello,
> 
> : I think this question has been addressed before but I couldn't find it anymore.
> : So, is it possible to use the LookUp indices provided by GCG under SRS V4.08?
> : If so, how?
> 
> As far as I remember, the problem discussed before was the opposite: using
> existing SRS-build indices with Lookup. And that required changes to Lookup ...
> 
>         Michael Schmitz

Hello, 
I don't remember the precise patch either, and as I moved to another site I had to do it again; admittedly I restrict this posting to UNIX by now. There are three problems with srs4_08 in GCG 8.1: 

1) the GCG version is << 4.08
2) it can do only sequence libraries 
3) building in GCG is not too trivial as it uses a complex makefile

The strategy to make it work is as follows. I appreciate any feedback.

Regards
Reinhard 







1)         MAKE NORMAL NATIVE SRS
=================================
Get srs4.08 and treat it as usual. Make sure that getz -libs gets you at least a single "sequence" type. 

% getz -libs
                 Library   Group              Entries    Index Date
-------------------------------------------------------------------
               SWISSPROT   Sequence             52205       4/25/96
                SWISSNEW   Sequence              2819       4/25/96
                     PIR   Sequence             82066       4/25/96
                   NRL3D   Sequence              6063       4/26/96
 ...


2)         MAKE A NEW DIRECTORY AND GET THE GCG STUFF WORKING 
=============================================================
Make a new directory, move there, invoke GCG and GCGSUPPORT, and get gensource:lookup.c as usual: 

% fetch gensource:lookup.c

Fetch copies GCG sequences or data files from the GCG database 
into your directory or displays them on your terminal screen.

 lookup.c


Next, get the makefiles (fetch make*) and change the "name" c example 
in makefile.mm to "lookup". Make the makefile. The next is a crude 
hack and the GCG folks might correct me but this worked in my hands. 

Next, printenv the variable for the executable 
% printenv SRSEXE
Edit the makefile and add the variable you got there (e.g. /sw/srs4_08/bin/irix) and add this to the 'include' section 
_before_ the other includes (this is extremely important as you will 
use GCVG's include otherwise). In my system this might look like 

CFLAGS = -Dirix -Dunix -D__LONGLONG -ansiposix -cckr -common $(DEBUGFLAGS) -I/sw/srs4_08/bin/irix -I$(IDIR)

Do the same with the link library statement and add the need to add libsrs.a from your native SRS installation. 

CEXLIBS = -L/sw/srs4_08/bin/irix/ -lsrs -L$(LDIR) -lgenshare -l$(CURSES) -lm -lmalloc

(remember that this must look different on your system as you will have the srs installation in a different path! Also, do not allow any space between -I and -L and the leading slash of the filename). 

Try it - don't get frustrated as it won't work but you should get something like 

% make lookup
        cc -Dirix -Dunix -D__LONGLONG -ansiposix -cckr -common -DNDEBUG -I/sw/srs4_08/bin/irix/ -I/bio1/gcg/gcg81/gcgsource/include -c lookup.c
        cc  -DNDEBUG lookup.o /bio1/gcg/gcg81/gcgbin/oblib/libapp.a  -L/sw/srs4_08/bin/irix/ -lsrs -L/bio1/gcg/gcg81/gcgbin/oblib -lgenshare -lcurses -lm -lmalloc  -o lookup
ld:
Unresolved:
MsgGetFnct
*** Error code 1 

3.     MODIFY LOOKUP TO RUN ONLY SEQUENCE LIBRARIES 
===================================================

There are only three locations which you need to change. 
% diff lookup.c.patch lookup.c.orig
 
568a571
>     if (!strcmp(g->com, "Sequence")) { 
582c585
< 
---
>     } 
1702a1706,1712
> 
> static int  (*PrintMessage)(MSGo *) = NULL; /* pointer to print function */
> 
> INT4 (*MsgGetFnct (void))()
> {
>   return PrintMessage;
> }

The first is that in line 568 there is a loop which embraces all 
libraries. That's not what we need, as we got the group in the 
previous line the statement 
 for(lcontext = 0; l = LibNextLib(g, &lcontext);
needs only be executed if g->com is "sequence":

  571         for(lcontext = 0; l = LibNextLib(g, &lcontext); ) {
(gdb) p g 
$3 = (struct SRSoGROUP_ *) 0x10266404
(gdb) p *g
$4 = {key = 0x1028033c "S", com = 0x10280330 "Sequence", short_nm = 0x10280340 "SQ", 
  cmnt = 0x10280344 "Search sequence libraries", help = 0x10280360 "srs_me query lib", 
  single_f = 0 '\000', library = {0x10264228, 0x102642c4, 0x102645d0, 0x10264360, 0x102643fc, 0x10264498, 
    0x10264708, 0x10265c5c, 0x10265cf8, 0x0 <repeats 16 times>}, libraryN = 9, df_t = {0x102784ac, 
    0x10278484, 0x102784d4, 0x10278524, 0x1027854c, 0x10278574, 0x1027859c, 0x102785c4, 0x102785ec, 
    0x1027868c, 0x10278664, 0x10278614, 0x1027863c, 0x102784fc, 0x102786dc, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 
    0x0, 0x0, 0x0, 0x0}, upd_f = 0 '\000'}

All what we do, therefore, is add the line 

if (!strcmp(g->com, "Sequence")) {

before this line (after the line stating SLBo *l;) and end this 
condition just before the end of the main loop (stating 
  } /* end loop */) with a single }. 

This passage should now look like 

  for(count = 0, gcontext = 0; g = LibNextLibGroup(&gcontext);) {
    int lcontext;
    SLBo *l;

    if (!strcmp(g->com, "Sequence")) {
    for(lcontext = 0; l = LibNextLib(g, &lcontext); ) {

[... some lines deleted deleted for clarity ...]

      if(!access(buf, R_OK))
        activeLib[count++] = l;
    }
   }    

  } /* end loop */

If you want to be really perfect and have more than 24 sequence libraries :-) you need to add a counter that tells the LibNextLib
to stop after 23 readings but you'll miss all beyond this point. 

4.     ADD THE MISSING FUNCTION 
===============================

Last, we need to add the function MsgGetFnct and define PrintMessage 
as this got dropped at least in my 4.08 SRS native version. 
Append the lines 

static int  (*PrintMessage)(MSGo *) = NULL; /* pointer to print function */

INT4 (*MsgGetFnct (void))()
{
  return PrintMessage;
}

to lookup.c, exit the editor, and recompile with "make lookup". 
Try it out: 

% ./lookup

LookUp identifies sequences by name, accession number, author, organism,
keyword, title, reference, feature, definition, length, or date.  The output
is a list of sequences. 

The LookUp program is experimental in this release--please look carefully at
your results. 

 LOOKUP in what sequence libraries:

   a) swissprot
   b) swissnew

...

   m) All libraries
 
   n) quit

 Please choose one or more (* m *): 


5.    RETURN THE BINARY  TO THE USUAL PLACE 
============================================

Last, you need to copy the binary to the usual place 

% mv $GCGUTILDIR/lookup $GCGUTILDIR/lookup.orig
% cp lookup $GCGUTILDIR/lookup

and rescue the source code. 



DISCLAIMER
==========

No warranty for this patch. This is an inofficial fix and
neither myself nor GCG or my employer are responsible for 
this posting or any consequence arising thereof.



[PS: Please don't use this message to reply:to as I don't read my mailbox 
at this address frequently. I've posted from my new address once earlier
and you can get the mail address from there if you need]
-- 
Reinhard Doelz, Basel, Switzerland
 




More information about the Bio-srs mailing list