diff options
author | Aaron M. Ucko <ucko@debian.org> | 2005-03-23 20:49:08 +0000 |
---|---|---|
committer | Aaron M. Ucko <ucko@debian.org> | 2005-03-23 20:49:08 +0000 |
commit | ee1ab2cbbf85d439732174f321efc1114f19f749 (patch) | |
tree | 4c803451e8507be875a478b39bdd31702f0ea281 /network | |
parent | c36b9906c3ef791147b3643f9e485cc02568819f (diff) |
Load ncbi (6.1.20020828) into ncbi-tools6/branches/upstream/current.
Diffstat (limited to 'network')
-rw-r--r-- | network/blast3/client/netblap3.c | 36 | ||||
-rw-r--r-- | network/blast3/client/netblap3.h | 15 | ||||
-rw-r--r-- | network/blast3/client/netblast.dsp | 109 | ||||
-rw-r--r-- | network/entrez/client/netentr.dsp | 122 | ||||
-rw-r--r-- | network/id1arch/idfetch.c | 6 | ||||
-rw-r--r-- | network/id1arch/ncbiid1.dsp | 118 | ||||
-rw-r--r-- | network/medarch/client/medarch.dsp | 119 | ||||
-rw-r--r-- | network/nsclilib/ni_disp.c | 7 | ||||
-rw-r--r-- | network/nsclilib/ni_net.h | 7 | ||||
-rw-r--r-- | network/nsclilib/ni_service.c | 143 | ||||
-rw-r--r-- | network/nsclilib/ni_types.h | 9 | ||||
-rw-r--r-- | network/taxon1/taxon2/ncbitxc2.dsp | 128 | ||||
-rw-r--r-- | network/taxon1/taxon2/tc2proc.c | 1836 | ||||
-rw-r--r-- | network/vibnet/vibnet.dsp | 114 |
14 files changed, 1150 insertions, 1619 deletions
diff --git a/network/blast3/client/netblap3.c b/network/blast3/client/netblap3.c index ed40b0bd..1a21b112 100644 --- a/network/blast3/client/netblap3.c +++ b/network/blast3/client/netblap3.c @@ -34,6 +34,18 @@ * * RCS Modification History: * $Log: netblap3.c,v $ +* Revision 1.99 2002/08/08 20:50:39 madden +* Remove SPLIT_BLAST macros +* +* Revision 1.98 2002/05/23 22:57:03 dondosha +* Made GetResponsePtr external +* +* Revision 1.97 2002/05/15 16:32:51 madden +* Make QueryIsProteinFromType extern +* +* Revision 1.96 2002/05/10 12:56:27 madden +* Allow network version of matrix as input +* * Revision 1.95 2002/04/24 17:59:03 dondosha * Added handling of parameters for database splitting and megablast with discontiguous words * @@ -698,7 +710,6 @@ BlastFini (BlastNet3Hptr bl3hptr) return retval; } -#ifndef SPLIT_BLAST NLM_EXTERN BlastParametersPtr LIBCALL BlastOptionsToParameters (BLAST_OptionsBlkPtr options) @@ -784,7 +795,6 @@ BlastOptionsToParameters (BLAST_OptionsBlkPtr options) return parameters; } -#endif /* Translates the BlastDbinfoPtr into TxDfDbInfoPtr. @@ -874,7 +884,7 @@ BlastNet3BlockNew(CharPtr program, CharPtr dbname) return retval; } -static Boolean +NLM_EXTERN Boolean LIBCALL QueryIsProteinFromType(Uint2 type) { switch (type) @@ -894,8 +904,7 @@ QueryIsProteinFromType(Uint2 type) } } -#ifndef SPLIT_BLAST -static BlastResponsePtr GetResponsePtr(BlastResponsePtr response, Nlm_Uint1 choice) +BlastResponsePtr GetResponsePtr(BlastResponsePtr response, Nlm_Uint1 choice) { while (response) @@ -909,7 +918,6 @@ static BlastResponsePtr GetResponsePtr(BlastResponsePtr response, Nlm_Uint1 choi return response; } -#endif NLM_EXTERN BlastDbinfoPtr LIBCALL BlastRequestDbInfo (BlastNet3Hptr bl3hp, CharPtr database, Boolean is_prot) @@ -1043,7 +1051,6 @@ BlastGetKaParams (BlastNet3BlockPtr blnet3blkptr, Boolean gapped) Converts 'standard' BLAST matrix to network matrix. */ -#ifndef SPLIT_BLAST NLM_EXTERN BlastMatrixPtr LIBCALL BlastMatrixToBlastNetMatrix(BLAST_MatrixPtr matrix) @@ -1158,7 +1165,6 @@ BlastNetMatrixToBlastMatrix (BlastMatrixPtr net_matrix) return blast_matrix; } -#endif NLM_EXTERN ValNodePtr LIBCALL BlastGetMaskedLoc (BlastNet3BlockPtr blnet3blkptr) @@ -1262,8 +1268,15 @@ BlastBioseq (BlastNet3BlockPtr blnet3blkptr, ValNodePtr *error_returns, Boolean search->database = blnet3blkptr->dbname; search->parameters = blnet3blkptr->parameters; search->mask = blnet3blkptr->mask; - search->matrix = - BlastMatrixToBlastNetMatrix(blnet3blkptr->blast_matrix); + if (blnet3blkptr->blast_matrix) + { + search->matrix = + BlastMatrixToBlastNetMatrix(blnet3blkptr->blast_matrix); + } + else + { + search->matrix = blnet3blkptr->net_matrix; + } search->query_set = blnet3blkptr->bsp_set; ValNodeAddPointer(&request, BlastRequest_search, search); @@ -1292,12 +1305,13 @@ BlastBioseq (BlastNet3BlockPtr blnet3blkptr, ValNodePtr *error_returns, Boolean ValNodeAddPointer(error_returns, BlastResponse_error, node->data.ptrvalue); } - /* These five are not allocated here. */ + /* These six are not allocated here. */ search->query = NULL; search->database = NULL; search->parameters = NULL; search->mask = NULL; search->query_set = NULL; + search->matrix = NULL; BlastRequestFree(request); #if 0 BlastDeleteUserErrorString(err_id); diff --git a/network/blast3/client/netblap3.h b/network/blast3/client/netblap3.h index d345f71d..d1c0124f 100644 --- a/network/blast3/client/netblap3.h +++ b/network/blast3/client/netblap3.h @@ -34,6 +34,15 @@ * * RCS Modification History: * $Log: netblap3.h,v $ +* Revision 1.30 2002/05/23 22:57:03 dondosha +* Made GetResponsePtr external +* +* Revision 1.29 2002/05/15 16:32:51 madden +* Make QueryIsProteinFromType extern +* +* Revision 1.28 2002/05/10 12:56:27 madden +* Allow network version of matrix as input +* * Revision 1.27 2001/05/02 19:42:48 egorov * Make the NetBlastGetMatrix() external * @@ -155,6 +164,7 @@ typedef struct _blastnet3_block { BlastNet3Hptr bl3hptr; /* BlastNet 3 handler returned from BlastInit. */ NetProgressCallback callback; BLAST_MatrixPtr blast_matrix; /* Matrix to be sent to server. */ + BlastMatrixPtr net_matrix; /* Network version of Matrix to be sent to server. */ BioseqSetPtr bsp_set; /* All queries if more than one */ } BlastNet3Block, PNTR BlastNet3BlockPtr; @@ -247,6 +257,11 @@ NLM_EXTERN Boolean SubmitRequest PROTO((BlastNet3Hptr bl3hptr, BlastRequestPtr b NLM_EXTERN BlastMatrixPtr LIBCALL NetBlastGetMatrix(BlastNet3BlockPtr blnet3blkptr); +BlastResponsePtr GetResponsePtr(BlastResponsePtr response, Nlm_Uint1 choice); + +/* Return TRUE if the query for this program is protein (e.g., blastp). */ +NLM_EXTERN Boolean LIBCALL QueryIsProteinFromType(Uint2 type); + #ifdef __cplusplus } #endif diff --git a/network/blast3/client/netblast.dsp b/network/blast3/client/netblast.dsp deleted file mode 100644 index 703d12f5..00000000 --- a/network/blast3/client/netblast.dsp +++ /dev/null @@ -1,109 +0,0 @@ -# Microsoft Developer Studio Project File - Name="netblast" - Package Owner=<4> -# Microsoft Developer Studio Generated Build File, Format Version 6.00 -# ** DO NOT EDIT ** - -# TARGTYPE "Win32 (x86) Static Library" 0x0104 - -CFG=netblast - Win32 Release -!MESSAGE This is not a valid makefile. To build this project using NMAKE, -!MESSAGE use the Export Makefile command and run -!MESSAGE -!MESSAGE NMAKE /f "netblast.mak". -!MESSAGE -!MESSAGE You can specify a configuration when running NMAKE -!MESSAGE by defining the macro CFG on the command line. For example: -!MESSAGE -!MESSAGE NMAKE /f "netblast.mak" CFG="netblast - Win32 Release" -!MESSAGE -!MESSAGE Possible choices for configuration are: -!MESSAGE -!MESSAGE "netblast - Win32 Debug" (based on "Win32 (x86) Static Library") -!MESSAGE "netblast - Win32 Release" (based on "Win32 (x86) Static Library") -!MESSAGE - -# Begin Project -# PROP AllowPerConfigDependencies 0 -# PROP Scc_ProjName "" -# PROP Scc_LocalPath "" -CPP=cl.exe -RSC=rc.exe - -!IF "$(CFG)" == "netblast - Win32 Debug" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 1 -# PROP BASE Output_Dir "Debug" -# PROP BASE Intermediate_Dir "Debug" -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 1 -# PROP Output_Dir "Debug" -# PROP Intermediate_Dir "Debug" -# PROP Target_Dir "" -# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_MBCS" /D "_LIB" /YX /FD /GZ /c -# ADD CPP /nologo /W2 /Gm /GX /ZI /Od /I "..\..\.." /I "..\..\..\ddv" /I "..\..\..\cn3d" /I "..\..\..\access" /I "..\..\..\asnstat" /I "..\..\..\connect\lbapi" /I "..\..\..\connect" /I "..\..\..\asnlib" /I "..\..\..\vibrant" /I "..\..\..\biostruc" /I "..\..\..\object" /I "..\..\..\api" /I "..\..\..\cdromlib" /I "..\..\..\desktop" /I "..\..\..\tools" /I "..\..\..\corelib" /I "..\..\taxon1\common" /I "..\..\vibnet" /I "..\..\entrez\client" /I "..\..\nsclilib" /I "..\..\medarch\client" /I "..\..\id1arch" /I "..\..\taxon1\taxon2" /I "..\..\blast3\client" /D "WIN32" /D "_DEBUG" /D "_MBCS" /D "_LIB" /YX /FD /GZ /c -# ADD BASE RSC /l 0x409 /d "_DEBUG" -# ADD RSC /l 0x409 /d "_DEBUG" -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LIB32=link.exe -lib -# ADD BASE LIB32 /nologo -# ADD LIB32 /nologo - -!ELSEIF "$(CFG)" == "netblast - Win32 Release" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 1 -# PROP BASE Output_Dir "netblast___Win32_Release" -# PROP BASE Intermediate_Dir "netblast___Win32_Release" -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 1 -# PROP Output_Dir "netblast___Win32_Release" -# PROP Intermediate_Dir "netblast___Win32_Release" -# PROP Target_Dir "" -# ADD BASE CPP /nologo /W2 /Gm /GX /ZI /Od /I "..\..\.." /I "..\..\..\ddv" /I "..\..\..\cn3d" /I "..\..\..\access" /I "..\..\..\asnstat" /I "..\..\..\connect\lbapi" /I "..\..\..\connect" /I "..\..\..\asnlib" /I "..\..\..\vibrant" /I "..\..\..\biostruc" /I "..\..\..\object" /I "..\..\..\api" /I "..\..\..\cdromlib" /I "..\..\..\desktop" /I "..\..\..\tools" /I "..\..\..\corelib" /I "..\..\taxon1\common" /I "..\..\vibnet" /I "..\..\entrez\client" /I "..\..\nsclilib" /I "..\..\medarch\client" /I "..\..\id1arch" /I "..\..\taxon1\taxon2" /I "..\..\blast3\client" /D "WIN32" /D "_DEBUG" /D "_MBCS" /D "_LIB" /YX /FD /I /GZ /c -# SUBTRACT BASE CPP /Fr -# ADD CPP /nologo /W2 /Gm /GX /Zi /I "..\..\.." /I "..\..\..\ddv" /I "..\..\..\cn3d" /I "..\..\..\access" /I "..\..\..\asnstat" /I "..\..\..\connect\lbapi" /I "..\..\..\connect" /I "..\..\..\asnlib" /I "..\..\..\vibrant" /I "..\..\..\biostruc" /I "..\..\..\object" /I "..\..\..\api" /I "..\..\..\cdromlib" /I "..\..\..\desktop" /I "..\..\..\tools" /I "..\..\..\corelib" /I "..\..\taxon1\common" /I "..\..\vibnet" /I "..\..\entrez\client" /I "..\..\nsclilib" /I "..\..\medarch\client" /I "..\..\id1arch" /I "..\..\taxon1\taxon2" /I "..\..\blast3\client" /D "_LIB" /D "WIN32" /D "_MBCS" /YX /FD /c -# ADD BASE RSC /l 0x409 /d "_DEBUG" -# ADD RSC /l 0x409 -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LIB32=link.exe -lib -# ADD BASE LIB32 /nologo -# ADD LIB32 /nologo - -!ENDIF - -# Begin Target - -# Name "netblast - Win32 Debug" -# Name "netblast - Win32 Release" -# Begin Group "Source Files" - -# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat" -# Begin Source File - -SOURCE=.\netblap3.c -# End Source File -# Begin Source File - -SOURCE=.\objblst3.c -# End Source File -# End Group -# Begin Group "Header Files" - -# PROP Default_Filter "h;hpp;hxx;hm;inl" -# Begin Source File - -SOURCE=.\netblap3.h -# End Source File -# Begin Source File - -SOURCE=.\objblst3.h -# End Source File -# End Group -# End Target -# End Project diff --git a/network/entrez/client/netentr.dsp b/network/entrez/client/netentr.dsp deleted file mode 100644 index 356d9786..00000000 --- a/network/entrez/client/netentr.dsp +++ /dev/null @@ -1,122 +0,0 @@ -# Microsoft Developer Studio Project File - Name="netentr" - Package Owner=<4> -# Microsoft Developer Studio Generated Build File, Format Version 6.00 -# ** DO NOT EDIT ** - -# TARGTYPE "Win32 (x86) Static Library" 0x0104 - -CFG=netentr - Win32 Release -!MESSAGE This is not a valid makefile. To build this project using NMAKE, -!MESSAGE use the Export Makefile command and run -!MESSAGE -!MESSAGE NMAKE /f "netentr.mak". -!MESSAGE -!MESSAGE You can specify a configuration when running NMAKE -!MESSAGE by defining the macro CFG on the command line. For example: -!MESSAGE -!MESSAGE NMAKE /f "netentr.mak" CFG="netentr - Win32 Release" -!MESSAGE -!MESSAGE Possible choices for configuration are: -!MESSAGE -!MESSAGE "netentr - Win32 Debug" (based on "Win32 (x86) Static Library") -!MESSAGE "netentr - Win32 Release" (based on "Win32 (x86) Static Library") -!MESSAGE - -# Begin Project -# PROP AllowPerConfigDependencies 0 -# PROP Scc_ProjName "" -# PROP Scc_LocalPath "" -CPP=cl.exe -RSC=rc.exe - -!IF "$(CFG)" == "netentr - Win32 Debug" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 1 -# PROP BASE Output_Dir "Debug" -# PROP BASE Intermediate_Dir "Debug" -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 1 -# PROP Output_Dir "Debug" -# PROP Intermediate_Dir "Debug" -# PROP Target_Dir "" -# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_MBCS" /D "_LIB" /YX /FD /GZ /c -# ADD CPP /nologo /W2 /Gm /GX /ZI /Od /I "..\..\.." /I "..\..\..\ddv" /I "..\..\..\cn3d" /I "..\..\..\access" /I "..\..\..\asnstat" /I "..\..\..\connect\lbapi" /I "..\..\..\connect" /I "..\..\..\asnlib" /I "..\..\..\vibrant" /I "..\..\..\biostruc" /I "..\..\..\object" /I "..\..\..\api" /I "..\..\..\cdromlib" /I "..\..\..\desktop" /I "..\..\..\tools" /I "..\..\..\corelib" /I "..\..\taxon1\common" /I "..\..\vibnet" /I "..\..\entrez\client" /I "..\..\nsclilib" /I "..\..\medarch\client" /I "..\..\id1arch" /I "..\..\taxon1\taxon2" /I "..\..\blast3\client" /D "WIN32" /D "_DEBUG" /D "_MBCS" /D "_LIB" /YX /FD /GZ /c -# SUBTRACT CPP /Fr -# ADD BASE RSC /l 0x409 /d "_DEBUG" -# ADD RSC /l 0x409 /d "_DEBUG" -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LIB32=link.exe -lib -# ADD BASE LIB32 /nologo -# ADD LIB32 /nologo - -!ELSEIF "$(CFG)" == "netentr - Win32 Release" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 1 -# PROP BASE Output_Dir "netentr___Win32_Release" -# PROP BASE Intermediate_Dir "netentr___Win32_Release" -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 1 -# PROP Output_Dir "netentr___Win32_Release" -# PROP Intermediate_Dir "netentr___Win32_Release" -# PROP Target_Dir "" -# ADD BASE CPP /nologo /W2 /Gm /GX /ZI /Od /I "..\..\.." /I "..\..\..\ddv" /I "..\..\..\cn3d" /I "..\..\..\access" /I "..\..\..\asnstat" /I "..\..\..\connect\lbapi" /I "..\..\..\connect" /I "..\..\..\asnlib" /I "..\..\..\vibrant" /I "..\..\..\biostruc" /I "..\..\..\object" /I "..\..\..\api" /I "..\..\..\cdromlib" /I "..\..\..\desktop" /I "..\..\..\tools" /I "..\..\..\corelib" /I "..\..\taxon1\common" /I "..\..\vibnet" /I "..\..\entrez\client" /I "..\..\nsclilib" /I "..\..\medarch\client" /I "..\..\id1arch" /I "..\..\taxon1\taxon2" /I "..\..\blast3\client" /D "WIN32" /D "_DEBUG" /D "_MBCS" /D "_LIB" /YX /FD /GZ /c -# SUBTRACT BASE CPP /Fr -# ADD CPP /nologo /W2 /Gm /GX /Zi /I "..\..\.." /I "..\..\..\ddv" /I "..\..\..\cn3d" /I "..\..\..\access" /I "..\..\..\asnstat" /I "..\..\..\connect\lbapi" /I "..\..\..\connect" /I "..\..\..\asnlib" /I "..\..\..\vibrant" /I "..\..\..\biostruc" /I "..\..\..\object" /I "..\..\..\api" /I "..\..\..\cdromlib" /I "..\..\..\desktop" /I "..\..\..\tools" /I "..\..\..\corelib" /I "..\..\taxon1\common" /I "..\..\vibnet" /I "..\..\entrez\client" /I "..\..\nsclilib" /I "..\..\medarch\client" /I "..\..\id1arch" /I "..\..\taxon1\taxon2" /I "..\..\blast3\client" /D "_LIB" /D "WIN32" /D "_MBCS" /YX /FD /c -# ADD BASE RSC /l 0x409 /d "_DEBUG" -# ADD RSC /l 0x409 -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LIB32=link.exe -lib -# ADD BASE LIB32 /nologo -# ADD LIB32 /nologo - -!ENDIF - -# Begin Target - -# Name "netentr - Win32 Debug" -# Name "netentr - Win32 Release" -# Begin Group "Source Files" - -# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat" -# Begin Source File - -SOURCE=.\netentr.c -# End Source File -# Begin Source File - -SOURCE=.\netlib.c -# End Source File -# Begin Source File - -SOURCE=.\objneten.c -# End Source File -# End Group -# Begin Group "Header Files" - -# PROP Default_Filter "h;hpp;hxx;hm;inl" -# Begin Source File - -SOURCE=.\netentr.h -# End Source File -# Begin Source File - -SOURCE=.\netlib.h -# End Source File -# Begin Source File - -SOURCE=.\netpriv.h -# End Source File -# Begin Source File - -SOURCE=.\objneten.h -# End Source File -# End Group -# End Target -# End Project diff --git a/network/id1arch/idfetch.c b/network/id1arch/idfetch.c index 2afc58e7..5db68289 100644 --- a/network/id1arch/idfetch.c +++ b/network/id1arch/idfetch.c @@ -25,6 +25,9 @@ * Author Karl Sirotkin * $Log: idfetch.c,v $ + Revision 1.22 2002/07/23 19:31:43 butanaev + Filtered out gi -1 + Revision 1.21 2001/11/02 14:24:44 kans made Fasta style SeqId args multi-line for Mac window @@ -627,6 +630,9 @@ void EntrezQuery(char *query) 0 == strcmp(myargs[dbarg].strvalue, "n"), FALSE); for(i = 0; i < count; ++i) { + if(ids[i] == -1) + continue; + if(myargs[onlylistarg].intvalue) printf("%d\n", ids[i]); else diff --git a/network/id1arch/ncbiid1.dsp b/network/id1arch/ncbiid1.dsp deleted file mode 100644 index 9989bd9c..00000000 --- a/network/id1arch/ncbiid1.dsp +++ /dev/null @@ -1,118 +0,0 @@ -# Microsoft Developer Studio Project File - Name="ncbiid1" - Package Owner=<4> -# Microsoft Developer Studio Generated Build File, Format Version 6.00 -# ** DO NOT EDIT ** - -# TARGTYPE "Win32 (x86) Static Library" 0x0104 - -CFG=ncbiid1 - Win32 Release -!MESSAGE This is not a valid makefile. To build this project using NMAKE, -!MESSAGE use the Export Makefile command and run -!MESSAGE -!MESSAGE NMAKE /f "ncbiid1.mak". -!MESSAGE -!MESSAGE You can specify a configuration when running NMAKE -!MESSAGE by defining the macro CFG on the command line. For example: -!MESSAGE -!MESSAGE NMAKE /f "ncbiid1.mak" CFG="ncbiid1 - Win32 Release" -!MESSAGE -!MESSAGE Possible choices for configuration are: -!MESSAGE -!MESSAGE "ncbiid1 - Win32 Debug" (based on "Win32 (x86) Static Library") -!MESSAGE "ncbiid1 - Win32 Release" (based on "Win32 (x86) Static Library") -!MESSAGE - -# Begin Project -# PROP AllowPerConfigDependencies 0 -# PROP Scc_ProjName "" -# PROP Scc_LocalPath "" -CPP=cl.exe -RSC=rc.exe - -!IF "$(CFG)" == "ncbiid1 - Win32 Debug" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 1 -# PROP BASE Output_Dir "Debug" -# PROP BASE Intermediate_Dir "Debug" -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 1 -# PROP Output_Dir "Debug" -# PROP Intermediate_Dir "Debug" -# PROP Target_Dir "" -# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_MBCS" /D "_LIB" /YX /FD /GZ /c -# ADD CPP /nologo /W2 /Gm /GX /ZI /Od /I "..\.." /I "..\..\ddv" /I "..\..\cn3d" /I "..\..\access" /I "..\..\asnstat" /I "..\..\connect\lbapi" /I "..\..\connect" /I "..\..\asnlib" /I "..\..\vibrant" /I "..\..\biostruc" /I "..\..\object" /I "..\..\api" /I "..\..\cdromlib" /I "..\..\desktop" /I "..\..\tools" /I "..\..\corelib" /I "..\taxon1\common" /I "..\vibnet" /I "..\entrez\client" /I "..\nsclilib" /I "..\medarch\client" /I "..\id1arch" /I "..\taxon1\taxon2" /I "..\blast3\client" /D "WIN32" /D "_DEBUG" /D "_MBCS" /D "_LIB" /YX /FD /GZ /c -# SUBTRACT CPP /Fr -# ADD BASE RSC /l 0x409 /d "_DEBUG" -# ADD RSC /l 0x409 /d "_DEBUG" -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LIB32=link.exe -lib -# ADD BASE LIB32 /nologo -# ADD LIB32 /nologo - -!ELSEIF "$(CFG)" == "ncbiid1 - Win32 Release" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 1 -# PROP BASE Output_Dir "ncbiid1___Win32_Release" -# PROP BASE Intermediate_Dir "ncbiid1___Win32_Release" -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 1 -# PROP Output_Dir "ncbiid1___Win32_Release" -# PROP Intermediate_Dir "ncbiid1___Win32_Release" -# PROP Target_Dir "" -# ADD BASE CPP /nologo /W2 /Gm /GX /ZI /Od /I "..\.." /I "..\..\ddv" /I "..\..\cn3d" /I "..\..\access" /I "..\..\asnstat" /I "..\..\connect\lbapi" /I "..\..\connect" /I "..\..\asnlib" /I "..\..\vibrant" /I "..\..\biostruc" /I "..\..\object" /I "..\..\api" /I "..\..\cdromlib" /I "..\..\desktop" /I "..\..\tools" /I "..\..\corelib" /I "..\taxon1\common" /I "..\vibnet" /I "..\entrez\client" /I "..\nsclilib" /I "..\medarch\client" /I "..\id1arch" /I "..\taxon1\taxon2" /I "..\blast3\client" /D "WIN32" /D "_DEBUG" /D "_MBCS" /D "_LIB" /YX /FD /GZ /c -# SUBTRACT BASE CPP /Fr -# ADD CPP /nologo /W2 /Gm /GX /Zi /I "..\.." /I "..\..\ddv" /I "..\..\cn3d" /I "..\..\access" /I "..\..\asnstat" /I "..\..\connect\lbapi" /I "..\..\connect" /I "..\..\asnlib" /I "..\..\vibrant" /I "..\..\biostruc" /I "..\..\object" /I "..\..\api" /I "..\..\cdromlib" /I "..\..\desktop" /I "..\..\tools" /I "..\..\corelib" /I "..\taxon1\common" /I "..\vibnet" /I "..\entrez\client" /I "..\nsclilib" /I "..\medarch\client" /I "..\id1arch" /I "..\taxon1\taxon2" /I "..\blast3\client" /D "_LIB" /D "WIN32" /D "_MBCS" /YX /FD /c -# ADD BASE RSC /l 0x409 /d "_DEBUG" -# ADD RSC /l 0x409 -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LIB32=link.exe -lib -# ADD BASE LIB32 /nologo -# ADD LIB32 /nologo - -!ENDIF - -# Begin Target - -# Name "ncbiid1 - Win32 Debug" -# Name "ncbiid1 - Win32 Release" -# Begin Group "Source Files" - -# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat" -# Begin Source File - -SOURCE=.\accid1.c -# End Source File -# Begin Source File - -SOURCE=.\id1arch.c -# End Source File -# Begin Source File - -SOURCE=.\id1gen.c -# End Source File -# End Group -# Begin Group "Header Files" - -# PROP Default_Filter "h;hpp;hxx;hm;inl" -# Begin Source File - -SOURCE=.\accid1.h -# End Source File -# Begin Source File - -SOURCE=.\id1arch.h -# End Source File -# Begin Source File - -SOURCE=.\id1gen.h -# End Source File -# End Group -# End Target -# End Project diff --git a/network/medarch/client/medarch.dsp b/network/medarch/client/medarch.dsp deleted file mode 100644 index 0010b338..00000000 --- a/network/medarch/client/medarch.dsp +++ /dev/null @@ -1,119 +0,0 @@ -# Microsoft Developer Studio Project File - Name="medarch" - Package Owner=<4> -# Microsoft Developer Studio Generated Build File, Format Version 6.00 -# ** DO NOT EDIT ** - -# TARGTYPE "Win32 (x86) Static Library" 0x0104 - -CFG=medarch - Win32 Release -!MESSAGE This is not a valid makefile. To build this project using NMAKE, -!MESSAGE use the Export Makefile command and run -!MESSAGE -!MESSAGE NMAKE /f "medarch.mak". -!MESSAGE -!MESSAGE You can specify a configuration when running NMAKE -!MESSAGE by defining the macro CFG on the command line. For example: -!MESSAGE -!MESSAGE NMAKE /f "medarch.mak" CFG="medarch - Win32 Release" -!MESSAGE -!MESSAGE Possible choices for configuration are: -!MESSAGE -!MESSAGE "medarch - Win32 Debug" (based on "Win32 (x86) Static Library") -!MESSAGE "medarch - Win32 Release" (based on "Win32 (x86) Static Library") -!MESSAGE - -# Begin Project -# PROP AllowPerConfigDependencies 0 -# PROP Scc_ProjName "" -# PROP Scc_LocalPath "" -CPP=cl.exe -RSC=rc.exe - -!IF "$(CFG)" == "medarch - Win32 Debug" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 1 -# PROP BASE Output_Dir "Debug" -# PROP BASE Intermediate_Dir "Debug" -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 1 -# PROP Output_Dir "Debug" -# PROP Intermediate_Dir "Debug" -# PROP Target_Dir "" -# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_MBCS" /D "_LIB" /YX /FD /GZ /c -# ADD CPP /nologo /W2 /Gm /GX /ZI /Od /I "..\..\.." /I "..\..\..\ddv" /I "..\..\..\cn3d" /I "..\..\..\access" /I "..\..\..\asnstat" /I "..\..\..\connect\lbapi" /I "..\..\..\connect" /I "..\..\..\asnlib" /I "..\..\..\vibrant" /I "..\..\..\biostruc" /I "..\..\..\object" /I "..\..\..\api" /I "..\..\..\cdromlib" /I "..\..\..\desktop" /I "..\..\..\tools" /I "..\..\..\corelib" /I "..\..\taxon1\common" /I "..\..\vibnet" /I "..\..\entrez\client" /I "..\..\nsclilib" /I "..\..\medarch\client" /I "..\..\id1arch" /I "..\..\taxon1\taxon2" /I "..\..\blast3\client" /D "WIN32" /D "_DEBUG" /D "_MBCS" /D "_LIB" /YX /FD /GZ /c -# SUBTRACT CPP /Fr -# ADD BASE RSC /l 0x409 /d "_DEBUG" -# ADD RSC /l 0x409 /d "_DEBUG" -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LIB32=link.exe -lib -# ADD BASE LIB32 /nologo -# ADD LIB32 /nologo - -!ELSEIF "$(CFG)" == "medarch - Win32 Release" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 1 -# PROP BASE Output_Dir "medarch___Win32_Release" -# PROP BASE Intermediate_Dir "medarch___Win32_Release" -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 1 -# PROP Output_Dir "medarch___Win32_Release" -# PROP Intermediate_Dir "medarch___Win32_Release" -# PROP Target_Dir "" -# ADD BASE CPP /nologo /W2 /Gm /GX /ZI /Od /I "..\..\.." /I "..\..\..\ddv" /I "..\..\..\cn3d" /I "..\..\..\access" /I "..\..\..\asnstat" /I "..\..\..\connect\lbapi" /I "..\..\..\connect" /I "..\..\..\asnlib" /I "..\..\..\vibrant" /I "..\..\..\biostruc" /I "..\..\..\object" /I "..\..\..\api" /I "..\..\..\cdromlib" /I "..\..\..\desktop" /I "..\..\..\tools" /I "..\..\..\corelib" /I "..\..\taxon1\common" /I "..\..\vibnet" /I "..\..\entrez\client" /I "..\..\nsclilib" /I "..\..\medarch\client" /I "..\..\id1arch" /I "..\..\taxon1\taxon2" /I "..\..\blast3\client" /D "WIN32" /D "_DEBUG" /D "_MBCS" /D "_LIB" /YX /FD /GZ /c -# SUBTRACT BASE CPP /Fr -# ADD CPP /nologo /W2 /Gm /GX /Zi /I "..\..\.." /I "..\..\..\ddv" /I "..\..\..\cn3d" /I "..\..\..\access" /I "..\..\..\asnstat" /I "..\..\..\connect\lbapi" /I "..\..\..\connect" /I "..\..\..\asnlib" /I "..\..\..\vibrant" /I "..\..\..\biostruc" /I "..\..\..\object" /I "..\..\..\api" /I "..\..\..\cdromlib" /I "..\..\..\desktop" /I "..\..\..\tools" /I "..\..\..\corelib" /I "..\..\taxon1\common" /I "..\..\vibnet" /I "..\..\entrez\client" /I "..\..\nsclilib" /I "..\..\medarch\client" /I "..\..\id1arch" /I "..\..\taxon1\taxon2" /I "..\..\blast3\client" /D "_LIB" /D "WIN32" /D "_MBCS" /YX /FD /c -# ADD BASE RSC /l 0x409 /d "_DEBUG" -# ADD RSC /l 0x409 -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LIB32=link.exe -lib -# ADD BASE LIB32 /nologo -# ADD LIB32 /nologo - -!ENDIF - -# Begin Target - -# Name "medarch - Win32 Debug" -# Name "medarch - Win32 Release" -# Begin Group "Source Files" - -# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat" -# Begin Source File - -SOURCE=.\medarch.c -# End Source File -# Begin Source File - -SOURCE=.\medutil.c -# End Source File -# Begin Source File - -SOURCE=.\objmla.c -# ADD CPP /D NLM_OBJ_INCL=mampla.h -# End Source File -# End Group -# Begin Group "Header Files" - -# PROP Default_Filter "h;hpp;hxx;hm;inl" -# Begin Source File - -SOURCE=.\medarch.h -# End Source File -# Begin Source File - -SOURCE=.\medutil.h -# End Source File -# Begin Source File - -SOURCE=.\objmla.h -# End Source File -# End Group -# End Target -# End Project diff --git a/network/nsclilib/ni_disp.c b/network/nsclilib/ni_disp.c index e012c477..5272af4d 100644 --- a/network/nsclilib/ni_disp.c +++ b/network/nsclilib/ni_disp.c @@ -29,7 +29,7 @@ * * Version Creation Date: 1/1/92 * -* $Revision: 4.10 $ +* $Revision: 4.11 $ * * File Description: * This file is a library of functions to be used by server application @@ -268,6 +268,9 @@ * * RCS Modification History: * $Log: ni_disp.c,v $ +* Revision 4.11 2002/06/17 15:14:32 ivanov +* Added fix for BeOS platform to sokselectw() +* * Revision 4.10 2001/09/17 20:09:38 lavr * Added conditional compilation for config parameter HAVE_SOCKLEN_T * @@ -3411,6 +3414,7 @@ int sokselectw(int fd, int seconds) if (FD_ISSET(fd, &wfds)) { #ifdef OS_UNIX +#ifndef OS_UNIX_BEOS int err; # ifdef HAVE_SOCKLEN_T socklen_t optlen; @@ -3422,6 +3426,7 @@ int sokselectw(int fd, int seconds) if (getsockopt(fd, SOL_SOCKET, SO_ERROR, (char *) &err, &optlen) >= 0 && err != 0) /* check for an error */ return -1; /* got some error */ +#endif #endif /* OS_UNIX */ return 0; } diff --git a/network/nsclilib/ni_net.h b/network/nsclilib/ni_net.h index 1597eecd..122ca6ec 100644 --- a/network/nsclilib/ni_net.h +++ b/network/nsclilib/ni_net.h @@ -29,7 +29,7 @@ * * Version Creation Date: 1/1/92 * -* $Revision: 6.2 $ +* $Revision: 6.3 $ * * File Description: * @@ -46,6 +46,9 @@ * * RCS Modification History: * $Log: ni_net.h,v $ +* Revision 6.3 2002/06/17 15:11:33 ivanov +* #include <arpa/inet.h> is absent on BeOS platform +* * Revision 6.2 2001/04/05 02:36:22 juran * Removed obsolete includes. * @@ -186,7 +189,9 @@ #include <sys/types.h> #include <sys/ioctl.h> #include <netinet/in.h> +#ifndef OS_UNIX_BEOS #include <arpa/inet.h> +#endif #include <sys/time.h> #define _NI_NET_ #endif /* _NI_NET_ */ diff --git a/network/nsclilib/ni_service.c b/network/nsclilib/ni_service.c index 8bd03210..30d0562e 100644 --- a/network/nsclilib/ni_service.c +++ b/network/nsclilib/ni_service.c @@ -1,4 +1,4 @@ -/* $RCSfile: ni_service.c,v $ $Revision: 6.6 $ $Date: 2002/04/23 17:57:54 $ +/* $RCSfile: ni_service.c,v $ $Revision: 6.11 $ $Date: 2002/08/16 20:36:19 $ * ========================================================================== * * PUBLIC DOMAIN NOTICE @@ -30,6 +30,21 @@ * * -------------------------------------------------------------------------- * $Log: ni_service.c,v $ + * Revision 6.11 2002/08/16 20:36:19 lavr + * Do not override net params which are not defined by old env.interface + * + * Revision 6.10 2002/08/08 02:45:28 lavr + * Minor change + * + * Revision 6.9 2002/08/07 18:45:21 lavr + * Change from deprecated to current EIO_ReadMethod enums + * + * Revision 6.8 2002/08/06 20:36:22 lavr + * Uppercase environment variable name to look for an alternate service name + * + * Revision 6.7 2002/05/06 19:24:38 lavr + * Translate service name AFTER creation of SConnNetInfo + * * Revision 6.6 2002/04/23 17:57:54 lavr * Recognize "INFINITE" as a timeout from registry/environment * @@ -69,34 +84,15 @@ #define SRV_SECTION "NET_SERV" #define ENV_ENGINE_HOST "SRV_ENGINE_HOST" -#define DEF_ENGINE_HOST DEF_CONN_HOST - #define ENV_ENGINE_PORT "SRV_ENGINE_PORT" -#define DEF_ENGINE_PORT DEF_CONN_PORT - #define ENV_ENGINE_URL "SRV_ENGINE_URL" -#define DEF_ENGINE_URL DEF_CONN_PATH - #define ENV_TIMEOUT "SRV_CONN_TIMEOUT" -#define DEF_TIMEOUT DEF_CONN_TIMEOUT - #define ENV_CONN_TRY "SRV_CONN_TRY" -#define DEF_CONN_TRY DEF_CONN_MAX_TRY - #define ENV_HTTP_PROXY_HOST "SRV_HTTP_PROXY_HOST" -#define DEF_HTTP_PROXY_HOST DEF_CONN_HTTP_PROXY_HOST - #define ENV_HTTP_PROXY_PORT "SRV_HTTP_PROXY_PORT" -#define DEF_HTTP_PROXY_PORT DEF_CONN_HTTP_PROXY_PORT - #define ENV_PROXY_HOST "SRV_PROXY_HOST" -#define DEF_PROXY_HOST DEF_CONN_PROXY_HOST - #define ENV_DEBUG_PRINTOUT "SRV_DEBUG_PRINTOUT" -#define DEF_DEBUG_PRINTOUT DEF_CONN_DEBUG_PRINTOUT - #define ENV_NO_LB_DIRECT "SRV_NO_LB_DIRECT" -#define DEF_NO_LB_DIRECT DEF_CONN_LB_DISABLE /* Static functions @@ -105,7 +101,7 @@ static Int2 LIBCALLBACK s_AsnRead(Pointer p, CharPtr buff, Uint2 len) { size_t n_read = 0; - CONN_Read((CONN) p, buff, len, &n_read, eIO_Plain); + CONN_Read((CONN) p, buff, len, &n_read, eIO_ReadPlain); return (Int2) n_read; } @@ -156,7 +152,7 @@ static NI_HandPtr s_GenericGetService (NI_DispatcherPtr disp, CharPtr configFile, CharPtr configSection, CharPtr defService, Boolean hasResource) { - SConnNetInfo* net_info; + SConnNetInfo *net_info, *def_info; Char str[64]; NI_HandPtr result; double valf; @@ -164,76 +160,74 @@ static NI_HandPtr s_GenericGetService int val; CONNECTOR c; - {{ /* alternate service name */ - static const Char ENV_PREFIX[] = "NI_SERVICE_NAME_"; - CharPtr envName = (CharPtr)MemNew(sizeof(ENV_PREFIX) + - StringLen(configSection)); - StringCpy(envName, ENV_PREFIX); - StringCat(envName, configSection); - NI_GetEnvParamEx(configFile, configSection, envName, "SERVICE_NAME", - str, sizeof(str), defService); - MemFree(envName); - }} - if (!(net_info = ConnNetInfo_Create(str))) { + if (!(net_info = ConnNetInfo_Create(defService))) { ErrPostEx(SEV_ERROR, 0, 1, "[Service NI Client] " - " Cannot set parameters for service \"%s\"", str); + " Cannot set parameters for service \"%s\"", defService); return 0; } - - /* Now override default parameters with proprietary parameters + if (!(def_info = ConnNetInfo_Clone(net_info))) { + ErrPostEx(SEV_ERROR, 0, 1, "[Service NI Client] " + " Cannot create reserve copy of network info"); + ConnNetInfo_Destroy(net_info); + return 0; + } + /* Now override default parameters with legacy parameters * of older WWW service dispatcher -- should go obsolete soon... */ /* alternate dispatcher's host name & port */ NI_GetEnvParam(configFile, SRV_SECTION, ENV_ENGINE_HOST, - net_info->host, sizeof(net_info->host), DEF_ENGINE_HOST); + net_info->host, sizeof(net_info->host), def_info->host); NI_GetEnvParam(configFile, SRV_SECTION, ENV_ENGINE_PORT, str, sizeof(str), ""); - val = atoi(str); - net_info->port = val > 0 ? val : DEF_ENGINE_PORT; + if ((val = atoi(str)) != 0) + net_info->port = val; /* alternate the dispatcher's CGI path */ NI_GetEnvParam(configFile, SRV_SECTION, ENV_ENGINE_URL, - net_info->path, sizeof(net_info->path), DEF_ENGINE_URL); + net_info->path, sizeof(net_info->path), def_info->path); /* alternate HTTP proxy host & port */ NI_GetEnvParam(configFile, SRV_SECTION, ENV_HTTP_PROXY_HOST, net_info->http_proxy_host, - sizeof(net_info->http_proxy_host), DEF_HTTP_PROXY_HOST); + sizeof(net_info->http_proxy_host), + def_info->http_proxy_host); NI_GetEnvParam(configFile, SRV_SECTION, ENV_HTTP_PROXY_PORT, str, sizeof(str), ""); - val = atoi(str); - net_info->http_proxy_port = val > 0 ? val : DEF_HTTP_PROXY_PORT; + if ((val = atoi(str)) != 0) + net_info->http_proxy_port = val; /* alternate non-transparent CERN-like firewall proxy server */ NI_GetEnvParam(configFile, SRV_SECTION, ENV_PROXY_HOST, net_info->proxy_host, sizeof(net_info->proxy_host), - DEF_PROXY_HOST); + def_info->proxy_host); /* alternate connection timeout */ NI_GetEnvParam(configFile, SRV_SECTION, ENV_TIMEOUT, str, sizeof(str), ""); - if (strlen(str) < 3 || StringNICmp(str, "infinite", strlen(str)) != 0) { - valf = atof(str); - if (valf <= 0) - valf = DEF_TIMEOUT; - if (!net_info->timeout) - net_info->timeout = &net_info->tmo; - net_info->timeout->sec = - (unsigned int) valf; - net_info->timeout->usec = - (unsigned int) ((valf - net_info->timeout->sec) * 1000000); - } else - net_info->timeout = 0; - - /* alternate max. number of attemts to establish connection */ + if (*str) { + if (strlen(str) > 2 && StringNICmp(str, "infinite", strlen(str)) == 0){ + net_info->timeout = 0; + } else { + if (!net_info->timeout) + net_info->timeout = &net_info->tmo; + valf = atof(str); + if (valf <= 0.0) + valf = DEF_CONN_TIMEOUT; + net_info->timeout->sec = (unsigned int) valf; + net_info->timeout->usec = (unsigned int) + ((valf - net_info->timeout->sec) * 1000000); + } + } + + /* alternate max. number of attempts to establish connection */ NI_GetEnvParam(configFile, SRV_SECTION, ENV_CONN_TRY, str, sizeof(str), ""); - val = atoi(str); - net_info->max_try = val > 0 ? val : DEF_CONN_TRY; + if ((val = atoi(str)) != 0) + net_info->max_try = val; NI_GetEnvParam(configFile, SRV_SECTION, ENV_DEBUG_PRINTOUT, - str, sizeof(str), DEF_DEBUG_PRINTOUT); + str, sizeof(str), ""); if (*str && (StringICmp(str, "1" ) == 0 || StringICmp(str, "true") == 0 || StringICmp(str, "yes" ) == 0)) @@ -241,23 +235,36 @@ static NI_HandPtr s_GenericGetService /* whether to prohibit the use of local LBSMD */ NI_GetEnvParam(configFile, SRV_SECTION, ENV_NO_LB_DIRECT, - str, sizeof(str), DEF_NO_LB_DIRECT); + str, sizeof(str), ""); if (*str && (StringICmp(str, "0" ) != 0 && StringICmp(str, "false") != 0 && StringICmp(str, "no" ) != 0)) net_info->lb_disable = 1/*true*/; + {{ /* alternate service name */ + static const Char ENV_PREFIX[] = "NI_SERVICE_NAME_"; + CharPtr envName = (CharPtr)MemNew(sizeof(ENV_PREFIX) + + StringLen(configSection)); + StringCpy(envName, ENV_PREFIX); + StringCat(envName, configSection); + StringUpper(envName); + NI_GetEnvParamEx(configFile, configSection, envName, "SERVICE_NAME", + str, sizeof(str), defService); + MemFree(envName); + }} + + ConnNetInfo_Destroy(def_info); /* establish connection to the server */ - if (!(c = SERVICE_CreateConnectorEx(defService, fSERV_Any, net_info, 0)) || + if (!(c = SERVICE_CreateConnectorEx(str, fSERV_Any, net_info, 0)) || CONN_Create(c, &conn) != eIO_Success) { ErrPostEx(SEV_ERROR, 0, 1, "[Service NI Client] " - " Service \"%s\" unusable", net_info->service); + " Service \"%s\" unusable", str); ConnNetInfo_Destroy(net_info); return 0; } - CONN_SetTimeout(conn, eIO_Open, net_info ? net_info->timeout : 0); - CONN_SetTimeout(conn, eIO_ReadWrite, net_info ? net_info->timeout : 0); - CONN_SetTimeout(conn, eIO_Close, net_info ? net_info->timeout : 0); + CONN_SetTimeout(conn, eIO_Open, net_info->timeout); + CONN_SetTimeout(conn, eIO_ReadWrite, net_info->timeout); + CONN_SetTimeout(conn, eIO_Close, net_info->timeout); /* open ASN i/o, etc. */ result = (NI_HandPtr) MemNew(sizeof(NI_Handle)); @@ -268,7 +275,7 @@ static NI_HandPtr s_GenericGetService (void*) conn, (IoFuncType) 0, s_AsnWrite); AsnIoSetErrorMsg(result->raip, s_AsnErrorFunc); AsnIoSetErrorMsg(result->waip, s_AsnErrorFunc); - result->hostname = StringSave(net_info ? net_info->client_host : ""); + result->hostname = StringSave(net_info->client_host); result->disp = disp; disp->referenceCount++; ConnNetInfo_Destroy(net_info); diff --git a/network/nsclilib/ni_types.h b/network/nsclilib/ni_types.h index 3449a156..75663c59 100644 --- a/network/nsclilib/ni_types.h +++ b/network/nsclilib/ni_types.h @@ -29,7 +29,7 @@ * * Version Creation Date: 1/1/92 * -* $Revision: 6.4 $ +* $Revision: 6.5 $ * * File Description: * @@ -37,6 +37,9 @@ * Modifications: * -------------------------------------------------------------------------- * $Log: ni_types.h,v $ +* Revision 6.5 2002/08/08 01:52:28 lavr +* Default dispatcher set to SERVICE +* * Revision 6.4 2001/02/21 22:09:27 lavr * SERVICE connector included * @@ -234,9 +237,9 @@ typedef enum { * so that eNII_Default be equal to the number of avail. interfaces */ eNII_Default /* let program try environment and config files */ -/* NII_DEFAULT will be used if user did not explicitely specify the interface +/* NII_DEFAULT will be used if user did not explicitly specify the interface * and if application failed to find it in environment and config files */ -#define NII_DEFAULT eNII_WWW +#define NII_DEFAULT eNII_Service } ENIInterface; diff --git a/network/taxon1/taxon2/ncbitxc2.dsp b/network/taxon1/taxon2/ncbitxc2.dsp deleted file mode 100644 index 3349ba6a..00000000 --- a/network/taxon1/taxon2/ncbitxc2.dsp +++ /dev/null @@ -1,128 +0,0 @@ -# Microsoft Developer Studio Project File - Name="ncbitxc2" - Package Owner=<4> -# Microsoft Developer Studio Generated Build File, Format Version 6.00 -# ** DO NOT EDIT ** - -# TARGTYPE "Win32 (x86) Static Library" 0x0104 - -CFG=ncbitxc2 - Win32 Release -!MESSAGE This is not a valid makefile. To build this project using NMAKE, -!MESSAGE use the Export Makefile command and run -!MESSAGE -!MESSAGE NMAKE /f "ncbitxc2.mak". -!MESSAGE -!MESSAGE You can specify a configuration when running NMAKE -!MESSAGE by defining the macro CFG on the command line. For example: -!MESSAGE -!MESSAGE NMAKE /f "ncbitxc2.mak" CFG="ncbitxc2 - Win32 Release" -!MESSAGE -!MESSAGE Possible choices for configuration are: -!MESSAGE -!MESSAGE "ncbitxc2 - Win32 Debug" (based on "Win32 (x86) Static Library") -!MESSAGE "ncbitxc2 - Win32 Release" (based on "Win32 (x86) Static Library") -!MESSAGE - -# Begin Project -# PROP AllowPerConfigDependencies 0 -# PROP Scc_ProjName "" -# PROP Scc_LocalPath "" -CPP=cl.exe -RSC=rc.exe - -!IF "$(CFG)" == "ncbitxc2 - Win32 Debug" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 1 -# PROP BASE Output_Dir "Debug" -# PROP BASE Intermediate_Dir "Debug" -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 1 -# PROP Output_Dir "Debug" -# PROP Intermediate_Dir "Debug" -# PROP Target_Dir "" -# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_MBCS" /D "_LIB" /YX /FD /GZ /c -# ADD CPP /nologo /W2 /Gm /GX /ZI /Od /I "..\..\.." /I "..\..\..\ddv" /I "..\..\..\cn3d" /I "..\..\..\access" /I "..\..\..\asnstat" /I "..\..\..\connect\lbapi" /I "..\..\..\connect" /I "..\..\..\asnlib" /I "..\..\..\vibrant" /I "..\..\..\biostruc" /I "..\..\..\object" /I "..\..\..\api" /I "..\..\..\cdromlib" /I "..\..\..\desktop" /I "..\..\..\tools" /I "..\..\..\corelib" /I "..\..\taxon1\common" /I "..\..\vibnet" /I "..\..\entrez\client" /I "..\..\nsclilib" /I "..\..\medarch\client" /I "..\..\id1arch" /I "..\..\taxon1\taxon2" /I "..\..\blast3\client" /D "WIN32" /D "_DEBUG" /D "_MBCS" /D "_LIB" /YX /FD /GZ /c -# SUBTRACT CPP /Fr -# ADD BASE RSC /l 0x409 /d "_DEBUG" -# ADD RSC /l 0x409 /d "_DEBUG" -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LIB32=link.exe -lib -# ADD BASE LIB32 /nologo -# ADD LIB32 /nologo - -!ELSEIF "$(CFG)" == "ncbitxc2 - Win32 Release" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 1 -# PROP BASE Output_Dir "ncbitxc2___Win32_Release" -# PROP BASE Intermediate_Dir "ncbitxc2___Win32_Release" -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 1 -# PROP Output_Dir "ncbitxc2___Win32_Release" -# PROP Intermediate_Dir "ncbitxc2___Win32_Release" -# PROP Target_Dir "" -# ADD BASE CPP /nologo /W2 /Gm /GX /ZI /Od /I "..\..\.." /I "..\..\..\ddv" /I "..\..\..\cn3d" /I "..\..\..\access" /I "..\..\..\asnstat" /I "..\..\..\connect\lbapi" /I "..\..\..\connect" /I "..\..\..\asnlib" /I "..\..\..\vibrant" /I "..\..\..\biostruc" /I "..\..\..\object" /I "..\..\..\api" /I "..\..\..\cdromlib" /I "..\..\..\desktop" /I "..\..\..\tools" /I "..\..\..\corelib" /I "..\..\taxon1\common" /I "..\..\vibnet" /I "..\..\entrez\client" /I "..\..\nsclilib" /I "..\..\medarch\client" /I "..\..\id1arch" /I "..\..\taxon1\taxon2" /I "..\..\blast3\client" /D "WIN32" /D "_DEBUG" /D "_MBCS" /D "_LIB" /YX /FD /GZ /c -# SUBTRACT BASE CPP /Fr -# ADD CPP /nologo /W2 /Gm /GX /Zi /I "..\..\.." /I "..\..\..\ddv" /I "..\..\..\cn3d" /I "..\..\..\access" /I "..\..\..\asnstat" /I "..\..\..\connect\lbapi" /I "..\..\..\connect" /I "..\..\..\asnlib" /I "..\..\..\vibrant" /I "..\..\..\biostruc" /I "..\..\..\object" /I "..\..\..\api" /I "..\..\..\cdromlib" /I "..\..\..\desktop" /I "..\..\..\tools" /I "..\..\..\corelib" /I "..\..\taxon1\common" /I "..\..\vibnet" /I "..\..\entrez\client" /I "..\..\nsclilib" /I "..\..\medarch\client" /I "..\..\id1arch" /I "..\..\taxon1\taxon2" /I "..\..\blast3\client" /D "_LIB" /D "WIN32" /D "_MBCS" /YX /FD /c -# ADD BASE RSC /l 0x409 /d "_DEBUG" -# ADD RSC /l 0x409 -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LIB32=link.exe -lib -# ADD BASE LIB32 /nologo -# ADD LIB32 /nologo - -!ENDIF - -# Begin Target - -# Name "ncbitxc2 - Win32 Debug" -# Name "ncbitxc2 - Win32 Release" -# Begin Group "Source Files" - -# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat" -# Begin Source File - -SOURCE=..\common\objtax1.c -# End Source File -# Begin Source File - -SOURCE=.\parttree.c -# End Source File -# Begin Source File - -SOURCE=.\taxcs.c -# End Source File -# Begin Source File - -SOURCE=..\common\taxutil.c -# End Source File -# Begin Source File - -SOURCE=.\tc2proc.c -# ADD CPP /D "TAXSERVICE" -# End Source File -# Begin Source File - -SOURCE=.\txcdproc.c -# ADD CPP /D "TAXSERVICE" -# End Source File -# End Group -# Begin Group "Header Files" - -# PROP Default_Filter "h;hpp;hxx;hm;inl" -# Begin Source File - -SOURCE=..\common\objtax1.h -# End Source File -# Begin Source File - -SOURCE=..\common\taxutil.h -# End Source File -# End Group -# End Target -# End Project diff --git a/network/taxon1/taxon2/tc2proc.c b/network/taxon1/taxon2/tc2proc.c index ceb6bf00..c11b1b01 100644 --- a/network/taxon1/taxon2/tc2proc.c +++ b/network/taxon1/taxon2/tc2proc.c @@ -12,6 +12,10 @@ #define TAX_READ 0 #define TAX_WRITE 1 +#define ORGMOD_gb_acronym 32 +#define ORGMOD_gb_anamorph 33 +#define ORGMOD_gb_synonym 34 + static TreePtr tax_tree= NULL; @@ -26,7 +30,10 @@ static Int2 OrderRank= 0; static Int2 ClassRank= 0; static Int2 SYNONYM= 0; static Int2 COMMON_NAME= 0; -static Int2 PREF_COMMON= 0; +static Int2 GB_COMMON= 0; +static Int2 GB_ACRONYM= 0; +static Int2 GB_SYNONYM= 0; +static Int2 GB_ANAMORPH= 0; static int my_timer= 0; @@ -56,7 +63,7 @@ static void bldOrgRefOut(OrgRefPtr dst, OrgRefPtr src, Int4 tax_id); Boolean tax1_setSynonyms(Boolean on_off) { Boolean ret; - + ret= we_want_synonyms; we_want_synonyms= on_off; return ret; @@ -66,9 +73,9 @@ Boolean tax1_setSynonyms(Boolean on_off) static Boolean tc2_toNode(TreeCursorPtr cursor, Int4 tax_id) { if(!tax_ptree_toTaxId(cursor, tax_id, FALSE)) { - /* this node is not in our tree */ - return (tax_ptree_addNode(tax_tree, tax_id)) ? - tax_ptree_toTaxId(cursor, tax_id, FALSE) : FALSE; + /* this node is not in our tree */ + return (tax_ptree_addNode(tax_tree, tax_id)) ? + tax_ptree_toTaxId(cursor, tax_id, FALSE) : FALSE; } return TRUE; } @@ -89,9 +96,9 @@ static void initBuff(void) my_timer= 0; for(i= 0; i < BUFF_SIZE; i++) { - or_buff[i].tax_id= 0; - or_buff[i].p_org_ref= NULL; - or_buff[i].blast_name= NULL; + or_buff[i].tax_id= 0; + or_buff[i].p_org_ref= NULL; + or_buff[i].blast_name= NULL; } } @@ -122,16 +129,16 @@ int InitTaxDB(void) if((tmp=getenv("TAXDBPATH")) != NULL) DB_PATH= tmp; if(!txc_connect2Server(DB_PATH, "soussov", "vladimir", "tax2cl")) { - - return 0; + + return 0; } - + if((!txc_loadNameClasses()) || (!txc_loadRanks()) || (!txc_loadDivisions()) || (!txc_loadGCs())) { - - return 0; + + return 0; } - + SpeciesRank= tax_getRankId("species"); SubspeciesRank= tax_getRankId("subspecies"); @@ -146,7 +153,10 @@ int InitTaxDB(void) SYNONYM= tax_getClass_cde("synonym"); COMMON_NAME= tax_getClass_cde("common name"); - PREF_COMMON= tax_getClass_cde("preferred common name"); + GB_COMMON= tax_getClass_cde("genbank common name"); + GB_ACRONYM= tax_getClass_cde("genbank acronym"); + GB_SYNONYM= tax_getClass_cde("genbank synonym"); + GB_ANAMORPH= tax_getClass_cde("genbank anamorph"); initBuff(); tax_tree= tax_ptree_new(); @@ -163,14 +173,14 @@ int InitTaxDB(void) static void free_blast_name(NameListPtr blast_name) { if(blast_name != NULL) { - NameListPtr t; - - do { - t= blast_name->next; - MemFree(blast_name); - blast_name= t; - } - while(blast_name); + NameListPtr t; + + do { + t= blast_name->next; + MemFree(blast_name); + blast_name= t; + } + while(blast_name); } } @@ -179,18 +189,18 @@ int CloseTaxDB(void) int i; if(tax_tree != NULL) { - tree_delete(tax_tree); - - txc_close(); - - for(i= 0; i < BUFF_SIZE; i++) { - if(or_buff[i].p_org_ref != NULL) { - OrgRefFree(or_buff[i].p_org_ref); - if(or_buff[i].blast_name != NULL) { - free_blast_name(or_buff[i].blast_name); - } - } - } + tree_delete(tax_tree); + + txc_close(); + + for(i= 0; i < BUFF_SIZE; i++) { + if(or_buff[i].p_org_ref != NULL) { + OrgRefFree(or_buff[i].p_org_ref); + if(or_buff[i].blast_name != NULL) { + free_blast_name(or_buff[i].blast_name); + } + } + } } return 1; } @@ -199,21 +209,21 @@ Int4 tax1_getParent(Int4 id_tax) { TreeCursorPtr cursor; Int4 ret_id= -1; - + if(tax_tree == NULL) return -1; - + if(id_tax == 1) return 0; - + cursor= tree_openCursor(tax_tree, NULL, NULL); if(cursor == NULL) return -1; - + if(tc2_toNode(cursor, id_tax)) { - TXC_TreeNodePtr tnp; - Uint2 s; - - tree_parent(cursor); - tnp= tree_getNodeData(cursor, &s); - if(tnp != NULL) ret_id= tnp->tax_id; + TXC_TreeNodePtr tnp; + Uint2 s; + + tree_parent(cursor); + tnp= tree_getNodeData(cursor, &s); + if(tnp != NULL) ret_id= tnp->tax_id; } tree_closeCursor(cursor); @@ -224,33 +234,33 @@ Int4 tax1_getGenus(Int4 id_tax) { TreeCursorPtr cursor; Int4 ret_id= -1; - + if(tax_tree == NULL) return -1; - + if(id_tax == 1) return 0; - + cursor= tree_openCursor(tax_tree, NULL, NULL); if(cursor == NULL) return -1; - + if(tc2_toNode(cursor, id_tax)) { - TXC_TreeNodePtr tnp; - Uint2 s; - Int2 rank; - - do { - tree_parent(cursor); - tnp= tree_getNodeData(cursor, &s); - if(tnp == NULL) { - ret_id= -1; - break; - } - ret_id= tnp->tax_id; - rank= tnp->flags & 0xFF; - --rank; - if(rank == GenusRank) break; - if((rank > 0) && (rank < GenusRank)) ret_id= -1; - } - while(ret_id > 1); + TXC_TreeNodePtr tnp; + Uint2 s; + Int2 rank; + + do { + tree_parent(cursor); + tnp= tree_getNodeData(cursor, &s); + if(tnp == NULL) { + ret_id= -1; + break; + } + ret_id= tnp->tax_id; + rank= tnp->flags & 0xFF; + --rank; + if(rank == GenusRank) break; + if((rank > 0) && (rank < GenusRank)) ret_id= -1; + } + while(ret_id > 1); } tree_closeCursor(cursor); @@ -268,32 +278,32 @@ int tax1_getChildren(Int4 id_tax, Int4** ids_out) if(cursor == NULL) return 0; if(tc2_toNode(cursor, id_tax)) { - if(tax_ptree_addChildren(cursor) && tree_child(cursor)) { - TXC_TreeNodePtr tnp; - Uint2 s; - - do { - n++; - } - while(tree_sibling(cursor)); - - *ids_out= ids= MemNew(n*sizeof(Int4)); - - tree_parent(cursor); - tree_child(cursor); - n= 0; - do { - tnp= tree_getNodeData(cursor, &s); - if(tnp != NULL) ids[n++]= tnp->tax_id; - } - while(tree_sibling(cursor)); - } + if(tax_ptree_addChildren(cursor) && tree_child(cursor)) { + TXC_TreeNodePtr tnp; + Uint2 s; + + do { + n++; + } + while(tree_sibling(cursor)); + + *ids_out= ids= MemNew(n*sizeof(Int4)); + + tree_parent(cursor); + tree_child(cursor); + n= 0; + do { + tnp= tree_getNodeData(cursor, &s); + if(tnp != NULL) ids[n++]= tnp->tax_id; + } + while(tree_sibling(cursor)); + } } - + tree_closeCursor(cursor); return n; } - + /* find last common ancestor for two nodes */ Int4 tax1_join(Int4 taxid1, Int4 taxid2) @@ -302,24 +312,24 @@ Int4 tax1_join(Int4 taxid1, Int4 taxid2) Int4 aid= 0; TreeCursorPtr cursor1= tree_openCursor(tax_tree, NULL, NULL); TreeCursorPtr cursor2= tree_openCursor(tax_tree, NULL, NULL); - + if((cursor1 == NULL) || (cursor2 == NULL) || (!tc2_toNode(cursor1, taxid1)) || (!tc2_toNode(cursor2, taxid2))) { - if(cursor1 != NULL) tree_closeCursor(cursor1); - if(cursor2 != NULL) tree_closeCursor(cursor2); - return -1; + if(cursor1 != NULL) tree_closeCursor(cursor1); + if(cursor2 != NULL) tree_closeCursor(cursor2); + return -1; } - + nid= tree_getAncestor(cursor1, cursor2); - + if(tree_toNode(cursor1, nid)) { - TXC_TreeNodePtr tnp; - Uint2 s; - - tnp= tree_getNodeData(cursor1, &s); - if(tnp != NULL) aid= tnp->tax_id; + TXC_TreeNodePtr tnp; + Uint2 s; + + tnp= tree_getNodeData(cursor1, &s); + if(tnp != NULL) aid= tnp->tax_id; } - + tree_closeCursor(cursor1); tree_closeCursor(cursor2); return aid; @@ -354,18 +364,18 @@ Int4 tax1_getAllTaxIdByName(CharPtr orgname, Int4 **Ids_out) *Ids_out= Ids= MemNew(n*sizeof(Int4)); if(Ids != NULL) { - for(i= 0; i < n; i++) { - Ids[i]= nameList[i].tax_id; - if(nameList[i].name_txt != NULL) MemFree(nameList[i].name_txt); - if(nameList[i].unique_name != NULL) MemFree(nameList[i].unique_name); - } + for(i= 0; i < n; i++) { + Ids[i]= nameList[i].tax_id; + if(nameList[i].name_txt != NULL) MemFree(nameList[i].name_txt); + if(nameList[i].unique_name != NULL) MemFree(nameList[i].unique_name); + } } else { - for(i= 0; i < n; i++) { - if(nameList[i].name_txt != NULL) MemFree(nameList[i].name_txt); - if(nameList[i].unique_name != NULL) MemFree(nameList[i].unique_name); - } - n= 0; + for(i= 0; i < n; i++) { + if(nameList[i].name_txt != NULL) MemFree(nameList[i].name_txt); + if(nameList[i].unique_name != NULL) MemFree(nameList[i].unique_name); + } + n= 0; } MemFree(nameList); return n; @@ -379,126 +389,126 @@ static Boolean goodOrgMode(Uint1 t) static Int4 getIdByOrgRef(CharPtr sname, OrgNamePtr orNm) { if(orNm != NULL) { - OrgModPtr o_mod= orNm->mod; - Boolean om_flag= FALSE; - Int4 tax_id, id; - CharPtr altname= NULL; - int nof_mods= 0; - _subspecPtr ss; - _subspec src; - - /* first try to search using search name */ - for(;o_mod != NULL; o_mod= o_mod->next) { - if(o_mod->subtype == 254) { - /* search name */ - altname= o_mod->subname; - } - else if(o_mod->subtype != 20) nof_mods++; - } - - if(nof_mods == 0) { - /* we have no modifiers */ - if(altname != NULL) { - if((tax_id= tax_getIdByName(altname, NULL, 0)) > 0) return tax_id; - return tax_getIdByName(sname, altname, 254); - } - return tax_getIdByName(sname, NULL, 0); - } - - if(nof_mods == 1) { - /* we have one valuable modifier */ - for(o_mod= orNm->mod; o_mod != NULL; o_mod= o_mod->next) { - if(goodOrgMode(o_mod->subtype)) { - if(altname != NULL) { - if((tax_id= tax_getIdByName(altname, o_mod->subname, o_mod->subtype)) > 0) - return tax_id; /* find by old name and modifier */ - if((tax_id= tax_getIdByName(sname, o_mod->subname, o_mod->subtype)) > 0) - return tax_id; /* find by new name and modifier */ - return tax_getIdByName(sname, altname, 254); /* find by new name and old name */ - } - return tax_getIdByName(sname, o_mod->subname, o_mod->subtype); - } - } - return 0; - } - - /* we have more than one modifier */ - /* first try to find organism using just names */ - if(altname != NULL) { - if((tax_id= tax_getIdByName(altname, NULL, 0)) == 0) { - tax_id= tax_getIdByName(sname, altname, 254); - } - } - else { - tax_id= tax_getIdByName(sname, NULL, 0); - } - - if(tax_id == 0) return 0; /* we have no such names */ - if(tax_id > 0) { - /* we have found just one node, check it against modifiers */ - id= 0; - for(o_mod= orNm->mod; o_mod != NULL; o_mod= o_mod->next) { - if(o_mod->subtype != 20) { - src.stype= o_mod->subtype; - src.sname= o_mod->subname; - src.rname= NULL; - if((ss= tax_SSget(tax_id, &src)) != NULL) { - if(ss->rname != NULL) MemFree(ss->rname); - if((ss->r_id != 0) && (ss->r_id != tax_id)) { - if(id == 0) id= ss->r_id; - else if(id != ss->r_id) { - id= -id; /* conflict in mapping */ - break; - } - } - } - } - } - if(id == 0) return tax_id; - if(id < 0) return -tax_id; /* we have a mapping conflict */ - - /* we have a mapping without conflict, we try to make the best assumption */ - return id; - } - - if(tax_id < 0) { - /* more than one tax_id was found */ - Int4Ptr ids; - Int4 n; - - if(altname != NULL) { - n= tax1_getAllTaxIdByName(altname, &ids); - if(n < 1) n= tax1_getAllTaxIdByName(sname, &ids); - } - else n= tax1_getAllTaxIdByName(sname, &ids); - - id= 0; - while(n-- > 0) { - for(o_mod= orNm->mod; o_mod != NULL; o_mod= o_mod->next) { - if(goodOrgMode(o_mod->subtype)) { - src.stype= o_mod->subtype; - src.sname= o_mod->subname; - src.rname= NULL; - if((ss= tax_SSget(ids[n], &src)) != NULL) { - if(ss->rname != NULL) MemFree(ss->rname); - if(ss->r_id != 0) { - if(id == 0) id= ss->r_id; - else if(id != ss->r_id) id= -id; - } - } - } - } - } - if(ids != NULL) MemFree(ids); - if(id > 0) return id; - } - return tax_id; + OrgModPtr o_mod= orNm->mod; + Boolean om_flag= FALSE; + Int4 tax_id, id; + CharPtr altname= NULL; + int nof_mods= 0; + _subspecPtr ss; + _subspec src; + + /* first try to search using search name */ + for(;o_mod != NULL; o_mod= o_mod->next) { + if(o_mod->subtype == 254) { + /* search name */ + altname= o_mod->subname; + } + else if(o_mod->subtype != 20) nof_mods++; + } + + if(nof_mods == 0) { + /* we have no modifiers */ + if(altname != NULL) { + if((tax_id= tax_getIdByName(altname, NULL, 0)) > 0) return tax_id; + return tax_getIdByName(sname, altname, 254); + } + return tax_getIdByName(sname, NULL, 0); + } + + if(nof_mods == 1) { + /* we have one valuable modifier */ + for(o_mod= orNm->mod; o_mod != NULL; o_mod= o_mod->next) { + if(goodOrgMode(o_mod->subtype)) { + if(altname != NULL) { + if((tax_id= tax_getIdByName(altname, o_mod->subname, o_mod->subtype)) > 0) + return tax_id; /* find by old name and modifier */ + if((tax_id= tax_getIdByName(sname, o_mod->subname, o_mod->subtype)) > 0) + return tax_id; /* find by new name and modifier */ + return tax_getIdByName(sname, altname, 254); /* find by new name and old name */ + } + return tax_getIdByName(sname, o_mod->subname, o_mod->subtype); + } + } + return 0; + } + + /* we have more than one modifier */ + /* first try to find organism using just names */ + if(altname != NULL) { + if((tax_id= tax_getIdByName(altname, NULL, 0)) == 0) { + tax_id= tax_getIdByName(sname, altname, 254); + } + } + else { + tax_id= tax_getIdByName(sname, NULL, 0); + } + + if(tax_id == 0) return 0; /* we have no such names */ + if(tax_id > 0) { + /* we have found just one node, check it against modifiers */ + id= 0; + for(o_mod= orNm->mod; o_mod != NULL; o_mod= o_mod->next) { + if(o_mod->subtype != 20) { + src.stype= o_mod->subtype; + src.sname= o_mod->subname; + src.rname= NULL; + if((ss= tax_SSget(tax_id, &src)) != NULL) { + if(ss->rname != NULL) MemFree(ss->rname); + if((ss->r_id != 0) && (ss->r_id != tax_id)) { + if(id == 0) id= ss->r_id; + else if(id != ss->r_id) { + id= -id; /* conflict in mapping */ + break; + } + } + } + } + } + if(id == 0) return tax_id; + if(id < 0) return -tax_id; /* we have a mapping conflict */ + + /* we have a mapping without conflict, we try to make the best assumption */ + return id; + } + + if(tax_id < 0) { + /* more than one tax_id was found */ + Int4Ptr ids; + Int4 n; + + if(altname != NULL) { + n= tax1_getAllTaxIdByName(altname, &ids); + if(n < 1) n= tax1_getAllTaxIdByName(sname, &ids); + } + else n= tax1_getAllTaxIdByName(sname, &ids); + + id= 0; + while(n-- > 0) { + for(o_mod= orNm->mod; o_mod != NULL; o_mod= o_mod->next) { + if(goodOrgMode(o_mod->subtype)) { + src.stype= o_mod->subtype; + src.sname= o_mod->subname; + src.rname= NULL; + if((ss= tax_SSget(ids[n], &src)) != NULL) { + if(ss->rname != NULL) MemFree(ss->rname); + if(ss->r_id != 0) { + if(id == 0) id= ss->r_id; + else if(id != ss->r_id) id= -id; + } + } + } + } + } + if(ids != NULL) MemFree(ids); + if(id > 0) return id; + } + return tax_id; } else { - /* we have no modifiers */ - return tax_getIdByName(sname, NULL, 0); + /* we have no modifiers */ + return tax_getIdByName(sname, NULL, 0); } - + } Int4 tax1_getTaxIdByOrgRef(OrgRefPtr orgRef) @@ -507,27 +517,27 @@ Int4 tax1_getTaxIdByOrgRef(OrgRefPtr orgRef) return txc_getTaxIdByOrgRef(orgRef); #else Int4 tax_id, id; - + if(orgRef == NULL) return 0; - + tax_id= 0; - + if((orgRef->taxname != NULL) && ((tax_id= getIdByOrgRef(orgRef->taxname, orgRef->orgname)) > 0)) return tax_id; - + if((orgRef->common != NULL) && ((tax_id= getIdByOrgRef(orgRef->common, orgRef->orgname)) > 0)) return tax_id; - + if(orgRef->syn != NULL) { - ValNodePtr synonym; - - id= 0; - - for(synonym= orgRef->syn; (synonym != NULL) && (id < 1); synonym= synonym->next) { - id= getIdByOrgRef(synonym->data.ptrvalue, orgRef->orgname); - } + ValNodePtr synonym; + + id= 0; + + for(synonym= orgRef->syn; (synonym != NULL) && (id < 1); synonym= synonym->next) { + id= getIdByOrgRef(synonym->data.ptrvalue, orgRef->orgname); + } } - + return (id > 0)? id : tax_id; #endif } @@ -544,9 +554,9 @@ Int4 tax1_findTaxIdByName(CharPtr orgname) Int4 id= tax_getIdByName(orgname, NULL, 0); if(id < 1) { - Int4 idu= tax_uniqueName(orgname, 0); - - if(idu > 0) id= idu; + Int4 idu= tax_uniqueName(orgname, 0); + + if(idu > 0) id= idu; } return id; } @@ -562,18 +572,18 @@ Int4 tax1_findAllTaxIdByName(CharPtr orgname, Int4 **Ids_out) Int4 id= tax1_findTaxIdByName(orgname); if(id > 0) { - *Ids_out= MemNew(sizeof(Int4)); - if(*Ids_out != NULL) { - **Ids_out= id; - return 1; - } - else return 0; + *Ids_out= MemNew(sizeof(Int4)); + if(*Ids_out != NULL) { + **Ids_out= id; + return 1; + } + else return 0; } if(id < 0) { - return tax1_getAllTaxIdByName(orgname, Ids_out); + return tax1_getAllTaxIdByName(orgname, Ids_out); } - + return 0; } @@ -589,20 +599,20 @@ Int2 tax1_getAllNames(Int4 tax_id, CharPtr **out_names, Boolean unique) *out_names= names= MemNew(n*sizeof(CharPtr)); if(names != NULL) { for(i= 0; i < n; i++) { - if(unique && (nameList[i].unique_name != NULL) && (nameList[i].unique_name[0] != '\0')) { - names[i]= nameList[i].unique_name; - nameList[i].unique_name= NULL; - } - else { - names[i]= nameList[i].name_txt; - nameList[i].name_txt= NULL; - } - } + if(unique && (nameList[i].unique_name != NULL) && (nameList[i].unique_name[0] != '\0')) { + names[i]= nameList[i].unique_name; + nameList[i].unique_name= NULL; + } + else { + names[i]= nameList[i].name_txt; + nameList[i].name_txt= NULL; + } + } } - + for(i= 0; i < n; i++) { - if(nameList[i].name_txt != NULL) MemFree(nameList[i].name_txt); - if(nameList[i].unique_name != NULL) MemFree(nameList[i].unique_name); + if(nameList[i].name_txt != NULL) MemFree(nameList[i].name_txt); + if(nameList[i].unique_name != NULL) MemFree(nameList[i].unique_name); } MemFree(nameList); @@ -621,16 +631,16 @@ static OrgRefPtr s_tax1_getOrgRef(Int4 tax_id, int* is_species, int* is_uncultur tax_id= getLiveId(tax_id); if(tax_id == 0) return NULL; - + if((orp= getFromBuff(tax_id, is_species, is_uncultured, blast_name)) != NULL) { - /* OrgRef is already in buffer */ - return orp; + /* OrgRef is already in buffer */ + return orp; } - + lockBuff(TAX_WRITE); loadInBuff(tax_id); unlockBuff(); - + return getFromBuff(tax_id, is_species, is_uncultured, blast_name); } @@ -639,7 +649,7 @@ OrgRefPtr tax1m_getOrgRef(Int4 tax_id, int* is_species, int* is_uncultured, Char NameListPtr blast_name_list= NULL; OrgRefPtr orp= s_tax1_getOrgRef(tax_id, is_species, is_uncultured, &blast_name_list); if((blast_name_list != NULL) && (blast_name != NULL)) { - *blast_name= StringSave(blast_name_list->name); + *blast_name= StringSave(blast_name_list->name); } return orp; } @@ -649,7 +659,7 @@ OrgRefPtr tax1_getOrgRef(Int4 tax_id, int* is_species, CharPtr div, CharPtr embl OrgRefPtr orp= s_tax1_getOrgRef(tax_id, is_species, NULL, NULL); if(embl_cde != NULL) *embl_cde= '\0'; if((div != NULL) && (orp != NULL) && (orp->orgname != NULL) && (orp->orgname->div != NULL)) { - StringCpy(div, orp->orgname->div); + StringCpy(div, orp->orgname->div); } return orp; @@ -659,12 +669,12 @@ static ValNodePtr make_blast_name(NameListPtr bl) { ValNodePtr list= NULL; ValNodePtr header= NULL; - + while(bl != NULL) { - list= ValNodeNew(list); - list->data.ptrvalue= StringSave(bl->name); - if(header == NULL) header= list; - bl= bl->next; + list= ValNodeNew(list); + list->data.ptrvalue= StringSave(bl->name); + if(header == NULL) header= list; + bl= bl->next; } return header; } @@ -737,7 +747,96 @@ static CharPtr strTail(CharPtr str1, CharPtr str2) return c; } +static void rmWord(CharPtr str, CharPtr wrd, int wlen) +{ + if((str == wrd) || isspace(*(wrd-1))) { + while((*(wrd+wlen) != '\0') && isspace(*(wrd+wlen))) wlen++; + } + + for(;;) { + *wrd= *(wrd + wlen); + if(*wrd == '\0') break; + ++wrd; + } +} +static Int2 getSubtypeFromName(CharPtr name) +{ + CharPtr c; + if(strchr(name, '.') == NULL) return 0; + /* check for subsp */ + c= StringStr(name, "subsp."); + if(c) { + rmWord(name, c, 6); + return 22; + } + c= StringStr(name, "ssp."); + if(c) { + rmWord(name, c, 4); + return 22; + } + c= StringStr(name, "f. sp."); + if(c) { + rmWord(name, c, 6); + return 26; + } + c= StringStr(name, "f.sp."); + if(c) { + rmWord(name, c, 5); + return 26; + } + c= StringStr(name, "str."); + if(c) { + rmWord(name, c, 4); + return 2; + } + c= StringStr(name, "substr."); + if(c) { + rmWord(name, c, 7); + return 3; + } + c= StringStr(name, "var."); + if(c) { + rmWord(name, c, 4); + return 6; + } + c= StringStr(name, "sv."); + if(c) { + rmWord(name, c, 3); + return 9; + } + c= StringStr(name, "cv."); + if(c) { + rmWord(name, c, 3); + return 10; + } + c= StringStr(name, "pv."); + if(c) { + rmWord(name, c, 3); + return 11; + } + c= StringStr(name, "bv."); + if(c) { + rmWord(name, c, 3); + return 13; + } + c= StringStr(name, "f."); + if(c) { + rmWord(name, c, 2); + return 25; + } + c= StringStr(name, "fo."); + if(c) { + rmWord(name, c, 3); + return 25; + } + c= StringStr(name, "grp."); + if(c) { + rmWord(name, c, 4); + return 15; + } + return 0; +} static OrgModPtr bldOrgMod(TreeCursorPtr cursor) { @@ -750,45 +849,48 @@ static OrgModPtr bldOrgMod(TreeCursorPtr cursor) OrgModPtr orgMdf= OrgModNew(); while(tree_parent(cursor)) { - if((tnp= tree_getNodeData(cursor, &s)) == NULL) continue; - prank= tnp->flags & 0xFF; - --prank; - if((prank == SubspeciesRank) || - (prank == SpeciesRank) || - (prank == GenusRank)) { - parent= tnp; - break; - } + if((tnp= tree_getNodeData(cursor, &s)) == NULL) continue; + prank= tnp->flags & 0xFF; + --prank; + if((prank == SubspeciesRank) || + (prank == SpeciesRank) || + (prank == GenusRank)) { + parent= tnp; + break; + } } tree_toNode(cursor, nid); - + if(parent != NULL) { - orgMdf->subname= StringSave(strTail(me->node_label, parent->node_label)); + orgMdf->subname= StringSave(strTail(me->node_label, parent->node_label)); } else { - orgMdf->subname= StringSave(me->node_label); + orgMdf->subname= StringSave(me->node_label); } - + rank= me->flags & 0xFF; - if(--rank == SubspeciesRank) { - orgMdf->subtype= 22; /* subspecies */ - } - else if(rank == tax_getRankId("varietas")) { - orgMdf->subtype= 6; /* variety */ - } - else if(rank == tax_getRankId("forma")) { - orgMdf->subtype= 2; /* strain */ - } - else if((parent != NULL) && (prank == SubspeciesRank)) { - orgMdf->subtype= 2; /* strain */ + orgMdf->subtype= getSubtypeFromName(orgMdf->subname); + + if(orgMdf->subtype <= 0) { + if(--rank == SubspeciesRank) { + orgMdf->subtype= 22; /* subspecies */ + } + else if(rank == tax_getRankId("varietas")) { + orgMdf->subtype= 6; /* variety */ + } + else if(rank == tax_getRankId("forma")) { + orgMdf->subtype= 25; /* forma */ + } + else if((parent != NULL) && (prank == SubspeciesRank)) { + orgMdf->subtype= 2; /* strain */ + } + else { + orgMdf->subtype= 255; /* other */ + } } - else { - orgMdf->subtype= 255; /* other */ - } - orgMdf->attrib= NULL; - + return orgMdf; } @@ -809,73 +911,73 @@ static int binomialName(TreeCursorPtr cursor, OrgNamePtr onp) BinomialOrgNamePtr bName; do { - tnp= tree_getNodeData(cursor, &s); - if(tnp == NULL) continue; - rank= tnp->flags & 0xFF; - if(--rank == SubspeciesRank) subspec= tnp; - else if(rank == SpeciesRank) spec= tnp; - else if(rank == GenusRank) { - genus= tnp; - break; - } + tnp= tree_getNodeData(cursor, &s); + if(tnp == NULL) continue; + rank= tnp->flags & 0xFF; + if(--rank == SubspeciesRank) subspec= tnp; + else if(rank == SpeciesRank) spec= tnp; + else if(rank == GenusRank) { + genus= tnp; + break; + } } while(tree_parent(cursor)); - + tree_toNode(cursor, nid); - + if(genus == NULL) { - /* try to find subgenus */ - do { - tnp= tree_getNodeData(cursor, &s); - if(tnp == NULL) continue; - rank= tnp->flags & 0xFF; - if(--rank == (GenusRank + 1)) { - genus= tnp; - break; - } - } - while(tree_parent(cursor)); - tree_toNode(cursor, nid); + /* try to find subgenus */ + do { + tnp= tree_getNodeData(cursor, &s); + if(tnp == NULL) continue; + rank= tnp->flags & 0xFF; + if(--rank == (GenusRank + 1)) { + genus= tnp; + break; + } + } + while(tree_parent(cursor)); + tree_toNode(cursor, nid); } - + if(genus == NULL) return 0; /* no genus - no binomial */ - + onp->choice= 1; /*binomial*/ - + onp->data= bName= BinomialOrgNameNew(); - + bName->genus= StringSave(genus->node_label); - + if(spec != NULL) { - /* we have a species in lineage */ - bName->species= StringSave(strTail(spec->node_label, genus->node_label)); - - if(subspec != NULL) { - /* we also have a subspecies in lineage */ - bName->subspecies= StringSave(strTail(subspec->node_label, spec->node_label)); - } - else { - bName->subspecies= NULL; - } - tnp= tree_getNodeData(cursor, &s); - - onp->mod= (tnp == spec)? NULL : bldOrgMod(cursor); - return 1; + /* we have a species in lineage */ + bName->species= StringSave(strTail(spec->node_label, genus->node_label)); + + if(subspec != NULL) { + /* we also have a subspecies in lineage */ + bName->subspecies= StringSave(strTail(subspec->node_label, spec->node_label)); + } + else { + bName->subspecies= NULL; + } + tnp= tree_getNodeData(cursor, &s); + + onp->mod= (tnp == spec)? NULL : bldOrgMod(cursor); + return 1; } - + /* no species in lineage */ - + if(subspec != NULL) { - /* we have no species but we have subspecies */ - bName->species= NULL; - bName->subspecies= StringSave(strTail(subspec->node_label, genus->node_label)); - onp->mod= bldOrgMod(cursor); - return 1; + /* we have no species but we have subspecies */ + bName->species= NULL; + bName->subspecies= StringSave(strTail(subspec->node_label, genus->node_label)); + onp->mod= bldOrgMod(cursor); + return 1; } - + /* we have no species, no subspecies but we are under species level (varietas or forma) */ - + bName->species= NULL; bName->subspecies= NULL; onp->mod= bldOrgMod(cursor); @@ -889,32 +991,32 @@ static void partialName(TreeCursorPtr cursor, OrgNamePtr onp) Uint2 s; TXC_TreeNodePtr tnp= tree_getNodeData(cursor, &s); Int2 rank_id= tnp->flags & 0xFF; - + onp->choice= 5; /* partial */ onp->data= taxElem= TaxElementNew(); - + if(--rank_id == FamilyRank) { - taxElem->fixed_level= 1; /* family */ - taxElem->level= NULL; + taxElem->fixed_level= 1; /* family */ + taxElem->level= NULL; } else if(rank_id == OrderRank) { - taxElem->fixed_level= 2; - taxElem->level= NULL; + taxElem->fixed_level= 2; + taxElem->level= NULL; } else if(rank_id == ClassRank) { - taxElem->fixed_level= 3; - taxElem->level= NULL; + taxElem->fixed_level= 3; + taxElem->level= NULL; } else { - taxElem->fixed_level= 0; - taxElem->level= StringSave(tax_getRank(rank_id)); + taxElem->fixed_level= 0; + taxElem->level= StringSave(tax_getRank(rank_id)); } - + taxElem->name= StringSave(tnp->node_label); taxElem->next= NULL; } - + /***************************************************************** * build synonyms valnodes * this routine include in valnodes synonyms and common synonyms @@ -924,15 +1026,15 @@ static ValNodePtr bldSynValNodes(TaxNamePtr syn, Int2 n) ValNodePtr list= NULL; ValNodePtr header= NULL; Int2 i; - + for(i= 1; i < n; i++) { - if((syn[i].class_cde == SYNONYM) || (syn[i].class_cde == COMMON_NAME)) { - list= ValNodeNew(list); - list->choice= (syn[i].class_cde == SYNONYM)? 1 : 0; - list->data.ptrvalue= syn[i].name_txt; - syn[i].name_txt= NULL; - if(header == NULL) header= list; - } + if((syn[i].class_cde == SYNONYM) || (syn[i].class_cde == COMMON_NAME)) { + list= ValNodeNew(list); + list->choice= (syn[i].class_cde == SYNONYM)? 1 : 0; + list->data.ptrvalue= syn[i].name_txt; + syn[i].name_txt= NULL; + if(header == NULL) header= list; + } } return header; } @@ -953,45 +1055,45 @@ static CharPtr bldLineage(TreeCursorPtr cursor, int* is_uncultured, NameListPtr* CharPtr tmp, t; Int2 rank= 0; - + while(tree_parent(cursor)) { - if((tnp= tree_getNodeData(cursor, &s)) != NULL) { - if(tnp->tax_id < 2) break; - if(tnp->flags & TXC_UNCULTURED) *is_uncultured= 1; - if((tnp->flags & TXC_STHIDE) == 0) { /* we do have a blast name here */ - NameListPtr node= MemNew(sizeof(NameList)); - node->name= tnp->node_label + (StringLen(tnp->node_label) + 1); - node->next= NULL; - *blast_name= node; - blast_name= &(node->next); - } - rank= tnp->flags & 0xFF; - if(rank > SpeciesRank) { - if(lineage != NULL) { - lineage = MemFree(lineage); - } - continue; - } - - if((tnp->flags & TXC_GBHIDE) == 0) { - s= StringLen(tnp->node_label); - if(lineage != NULL) { - s+= StringLen(lineage) + 2; - } - - tmp= MemNew(s+2); - if(tmp == NULL) continue; - t= StringMove(tmp, tnp->node_label); - if(lineage != NULL) { - t= StringMove(t, "; "); - t= StringMove(t, lineage); - MemFree(lineage); - } - lineage= tmp; - } - } + if((tnp= tree_getNodeData(cursor, &s)) != NULL) { + if(tnp->tax_id < 2) break; + if(tnp->flags & TXC_UNCULTURED) *is_uncultured= 1; + if((tnp->flags & TXC_STHIDE) == 0) { /* we do have a blast name here */ + NameListPtr node= MemNew(sizeof(NameList)); + node->name= tnp->node_label + (StringLen(tnp->node_label) + 1); + node->next= NULL; + *blast_name= node; + blast_name= &(node->next); + } + rank= tnp->flags & 0xFF; + if(rank > SpeciesRank) { + if(lineage != NULL) { + lineage = MemFree(lineage); + } + continue; + } + + if((tnp->flags & TXC_GBHIDE) == 0) { + s= StringLen(tnp->node_label); + if(lineage != NULL) { + s+= StringLen(lineage) + 2; + } + + tmp= MemNew(s+2); + if(tmp == NULL) continue; + t= StringMove(tmp, tnp->node_label); + if(lineage != NULL) { + t= StringMove(t, "; "); + t= StringMove(t, lineage); + MemFree(lineage); + } + lineage= tmp; + } + } } - + tree_toNode(cursor, nid); return lineage; @@ -1014,7 +1116,7 @@ static ValNodePtr bldDBId(Int4 id) } static OrgNamePtr bldOrgName(TreeCursorPtr cursor, int* is_species_out, - int* is_uncultured, NameListPtr* blast_name) + int* is_uncultured, NameListPtr* blast_name) { OrgNamePtr onp; Uint2 s; @@ -1032,11 +1134,11 @@ static OrgNamePtr bldOrgName(TreeCursorPtr cursor, int* is_species_out, *is_uncultured= ((tnp->flags & TXC_UNCULTURED) != 0)? 1 : 0; if((tnp->flags & TXC_STHIDE) == 0) { /* we do have a blast name here */ - NameListPtr node= MemNew(sizeof(NameList)); - node->name= tnp->node_label + (StringLen(tnp->node_label) + 1); - node->next= NULL; - *blast_name= node; - blast_name= &(node->next); + NameListPtr node= MemNew(sizeof(NameList)); + node->name= tnp->node_label + (StringLen(tnp->node_label) + 1); + node->next= NULL; + *blast_name= node; + blast_name= &(node->next); } onp= OrgNameNew(); @@ -1053,84 +1155,84 @@ static OrgNamePtr bldOrgName(TreeCursorPtr cursor, int* is_species_out, /* correct level by lineage if node has no rank */ if(rank_id < 0) { - while(tree_parent(cursor)) { - tnp= tree_getNodeData(cursor, &s); - if(tnp != NULL) { - rank= tnp->flags & 0xFF; - if(rank != 0) { - is_species= (rank >= SpeciesRank) ? 1 : 0; - break; - } - } - } - tree_toNode(cursor, nid); - tnp= tree_getNodeData(cursor, &s); + while(tree_parent(cursor)) { + tnp= tree_getNodeData(cursor, &s); + if(tnp != NULL) { + rank= tnp->flags & 0xFF; + if(rank != 0) { + is_species= (rank >= SpeciesRank) ? 1 : 0; + break; + } + } + } + tree_toNode(cursor, nid); + tnp= tree_getNodeData(cursor, &s); } if(tax_getDivision(div_id, &div_abbr, NULL)) { - onp->div= StringSave(div_abbr); - /* StringCpy(div, div_abbr);*/ + onp->div= StringSave(div_abbr); + /* StringCpy(div, div_abbr);*/ } *is_species_out= is_species; if(is_species) { - /* we are on species level or below */ + /* we are on species level or below */ - /* check for viruses */ - if((div_id == VRL_div) || (div_id == PHG_div)) { - /* this is a virus */ - onp->choice= 2; /* virus */ - if(rank_id == SpeciesRank) { - /* we are on species level */ - onp->data= StringSave(tnp->node_label); - onp->mod= NULL; - } - else { - /* we are below species */ - /* first try to find species or min rank which below species but above us */ - TreeNodeId s_id; + /* check for viruses */ + if((div_id == VRL_div) || (div_id == PHG_div)) { + /* this is a virus */ + onp->choice= 2; /* virus */ + if(rank_id == SpeciesRank) { + /* we are on species level */ + onp->data= StringSave(tnp->node_label); + onp->mod= NULL; + } + else { + /* we are below species */ + /* first try to find species or min rank which below species but above us */ + TreeNodeId s_id; - s_id.idi= 0; - while(tree_parent(cursor)) { - tnp= tree_getNodeData(cursor, &s); - if(tnp != NULL) { - rank= tnp->flags & 0xFF; - if(--rank >= SpeciesRank) { - s_id= tree_getId(cursor); - if(rank == SpeciesRank) break; - } - else if(rank >= 0) break; - } - } - if(s_id.idi != 0) { - /* we have species or something above us */ - tree_toNode(cursor, s_id); - } - else { - /* no species above */ - tree_toNode(cursor, nid); - } + s_id.idi= 0; + while(tree_parent(cursor)) { + tnp= tree_getNodeData(cursor, &s); + if(tnp != NULL) { + rank= tnp->flags & 0xFF; + if(--rank >= SpeciesRank) { + s_id= tree_getId(cursor); + if(rank == SpeciesRank) break; + } + else if(rank >= 0) break; + } + } + if(s_id.idi != 0) { + /* we have species or something above us */ + tree_toNode(cursor, s_id); + } + else { + /* no species above */ + tree_toNode(cursor, nid); + } - tnp= tree_getNodeData(cursor, &s); - onp->data= StringSave(tnp->node_label); - if(s_id.idi != 0) { - tree_toNode(cursor, nid); - } - - onp->mod= bldOrgMod(cursor); - } - } - else if(!binomialName(cursor, onp)) { - /* name is not binomial: set partial */ - partialName(cursor, onp); - } + tnp= tree_getNodeData(cursor, &s); + onp->data= StringSave(tnp->node_label); + if(s_id.idi != 0) { + tree_toNode(cursor, nid); + } + + onp->mod= bldOrgMod(cursor); + } + } + else if(!binomialName(cursor, onp)) { + /* name is not binomial: set partial */ + partialName(cursor, onp); + } } else { - /* above species */ - partialName(cursor, onp); + /* above species */ + partialName(cursor, onp); } - return onp; + return onp; } @@ -1149,8 +1251,8 @@ static Boolean bldOrgRef(Int4 id, OrgRefPtr orp, int* is_species, int* is_uncult n= tax_getOrgNames(id, &nameList); if(n < 1) { - tree_closeCursor(cursor); - return FALSE; + tree_closeCursor(cursor); + return FALSE; } orp->taxname= nameList[0].name_txt; @@ -1160,26 +1262,60 @@ static Boolean bldOrgRef(Int4 id, OrgRefPtr orp, int* is_species, int* is_uncult /* fill-up preferred common name */ orp->common= NULL; for(i= 1; i < n; i++) { - if(nameList[i].class_cde == PREF_COMMON) { - orp->common= nameList[i].name_txt; - nameList[i].name_txt= NULL; - break; - } + if(nameList[i].class_cde == GB_COMMON) { + orp->common= nameList[i].name_txt; + nameList[i].name_txt= NULL; + break; + } } /* fill-up synonyms */ orp->syn= bldSynValNodes(nameList, n); - for(i= 0; i < n; i++) { - if(nameList[i].name_txt != NULL) MemFree(nameList[i].name_txt); - if(nameList[i].unique_name != NULL) MemFree(nameList[i].unique_name); - } - - MemFree(nameList); orp->mod= NULL; orp->db= bldDBId(id); orp->orgname= bldOrgName(cursor, is_species, is_uncult, bnl); + /* + ORGMOD_gb_acronym 32 + ORGMOD_gb_anamorph 33 + ORGMOD_gb_synonym 34 + */ + /* add some of the nametypes as OrgMods */ + if(orp->orgname) { // OrgName is not empty + for(i= 1; i < n; i++) { + if(nameList[i].class_cde == GB_ACRONYM) { + OrgModPtr acr= OrgModNew(); + acr->subtype= ORGMOD_gb_acronym; + acr->subname= nameList[i].name_txt; + nameList[i].name_txt= NULL; + acr->next= orp->orgname->mod; + orp->orgname->mod= acr; + } + else if(nameList[i].class_cde == GB_ANAMORPH) { + OrgModPtr anm= OrgModNew(); + anm->subtype= ORGMOD_gb_anamorph; + anm->subname= nameList[i].name_txt; + nameList[i].name_txt= NULL; + anm->next= orp->orgname->mod; + orp->orgname->mod= anm; + } + else if(nameList[i].class_cde == GB_SYNONYM) { + OrgModPtr snm= OrgModNew(); + snm->subtype= ORGMOD_gb_synonym; + snm->subname= nameList[i].name_txt; + nameList[i].name_txt= NULL; + snm->next= orp->orgname->mod; + orp->orgname->mod= snm; + } + } + } + + for(i= 0; i < n; i++) { + if(nameList[i].name_txt != NULL) MemFree(nameList[i].name_txt); + if(nameList[i].unique_name != NULL) MemFree(nameList[i].unique_name); + } + MemFree(nameList); tree_closeCursor(cursor); return TRUE; @@ -1193,31 +1329,31 @@ static void loadInBuff(Int4 id) /*Int4 bt;*/ for(i= 0; i < BUFF_SIZE; i++) { - if(or_buff[i].tax_id == 0) { - k= i; - break; - } - if(or_buff[i].timer < t) { - t= or_buff[i].timer; - k= i; - } + if(or_buff[i].tax_id == 0) { + k= i; + break; + } + if(or_buff[i].timer < t) { + t= or_buff[i].timer; + k= i; + } } if(k >= 0) { - if(or_buff[k].p_org_ref != NULL) { - OrgRefFree(or_buff[k].p_org_ref); - free_blast_name(or_buff[k].blast_name); - } + if(or_buff[k].p_org_ref != NULL) { + OrgRefFree(or_buff[k].p_org_ref); + free_blast_name(or_buff[k].blast_name); + } - or_buff[k].tax_id= id; - or_buff[k].p_org_ref= OrgRefNew(); - or_buff[k].timer= ++my_timer; - or_buff[k].blast_name= NULL; - if(!bldOrgRef(id, or_buff[k].p_org_ref, &or_buff[k].is_species, - &or_buff[k].is_uncultured, &(or_buff[k].blast_name))) { - OrgRefFree(or_buff[k].p_org_ref); - or_buff[k].tax_id= 0; - } + or_buff[k].tax_id= id; + or_buff[k].p_org_ref= OrgRefNew(); + or_buff[k].timer= ++my_timer; + or_buff[k].blast_name= NULL; + if(!bldOrgRef(id, or_buff[k].p_org_ref, &or_buff[k].is_species, + &or_buff[k].is_uncultured, &(or_buff[k].blast_name))) { + OrgRefFree(or_buff[k].p_org_ref); + or_buff[k].tax_id= 0; + } } } @@ -1229,14 +1365,14 @@ static OrgRefPtr getFromBuff(Int4 id, int* is_sp, int* is_uncult, NameListPtr* b lockBuff(TAX_READ); for(i= 0; i < BUFF_SIZE; i++) { - if(or_buff[i].tax_id == id) { - or_buff[i].timer= ++my_timer; - orp= or_buff[i].p_org_ref; - if(is_sp != NULL) *is_sp= or_buff[i].is_species; - if(is_uncult != NULL) *is_uncult= or_buff[i].is_uncultured; - if(bnl != NULL) *bnl= or_buff[i].blast_name; - break; - } + if(or_buff[i].tax_id == id) { + or_buff[i].timer= ++my_timer; + orp= or_buff[i].p_org_ref; + if(is_sp != NULL) *is_sp= or_buff[i].is_species; + if(is_uncult != NULL) *is_uncult= or_buff[i].is_uncultured; + if(bnl != NULL) *bnl= or_buff[i].blast_name; + break; + } } unlockBuff(); return orp; @@ -1249,34 +1385,37 @@ static OrgModPtr fixModifier(Int4 tax_id, OrgModPtr omp) memset(&src_ss, 0, sizeof(_subspec)); - if(omp->subtype < 2) { - omp->next= NULL; - OrgModFree(omp); - return NULL; + if((omp->subtype < 2) || + (omp->subtype == ORGMOD_gb_acronym) || + (omp->subtype == ORGMOD_gb_anamorph) || + (omp->subtype == ORGMOD_gb_synonym)) { + omp->next= NULL; + OrgModFree(omp); + return NULL; } if((omp->subname != NULL) && (omp->subtype != 0)) { - src_ss.stype= omp->subtype; - src_ss.sname= omp->subname; - src_ss.rname= NULL; + src_ss.stype= omp->subtype; + src_ss.sname= omp->subname; + src_ss.rname= NULL; - ss= tax_SSget(tax_id, &src_ss); + ss= tax_SSget(tax_id, &src_ss); } if((ss != NULL) && (ss->r_id == tax_id) && (ss->stype == 0)) { - /* remove it */ - if(ss->rname != NULL) MemFree(ss->rname); - omp->next= NULL; - OrgModFree(omp); - return NULL; + /* remove it */ + if(ss->rname != NULL) MemFree(ss->rname); + omp->next= NULL; + OrgModFree(omp); + return NULL; } if((ss != NULL) && (ss->r_id == tax_id) && (ss->stype != 0)) { - MemFree(omp->subname); - omp->subname= src_ss.rname; - omp->subtype= src_ss.rtype; - return omp; + MemFree(omp->subname); + omp->subname= src_ss.rname; + omp->subtype= src_ss.rtype; + return omp; } if(src_ss.rname != NULL) MemFree(src_ss.rname); @@ -1288,15 +1427,15 @@ static void CleanOrgMod(Int4 tax_id, OrgNamePtr onp) OrgModPtr omp, omp_p, omp_n; for(omp_p= NULL, omp= onp->mod; omp != NULL; omp= omp_n) { - omp_n= omp->next; - if((omp= fixModifier(tax_id, omp)) == NULL) { - /* exclude this modifier */ - if(omp_p == NULL) { - onp->mod= omp_n; - } - else omp_p->next= omp_n; - } - else omp_p= omp; + omp_n= omp->next; + if((omp= fixModifier(tax_id, omp)) == NULL) { + /* exclude this modifier */ + if(omp_p == NULL) { + onp->mod= omp_n; + } + else omp_p->next= omp_n; + } + else omp_p= omp; } } @@ -1310,17 +1449,17 @@ static void cleanOrgName(Int4 tax_id, OrgNamePtr onp) #endif if(onp->next != NULL) OrgNameSetFree(onp->next); if(onp->data != NULL) { - switch(onp->choice) { - case 1 : /* binomial name */ - BinomialOrgNameFree(onp->data); - break; - case 2 : /* virus name */ - MemFree(onp->data); - break; - case 5 : /* partial name */ - TaxElementSetFree(onp->data); - break; - } + switch(onp->choice) { + case 1 : /* binomial name */ + BinomialOrgNameFree(onp->data); + break; + case 2 : /* virus name */ + MemFree(onp->data); + break; + case 5 : /* partial name */ + TaxElementSetFree(onp->data); + break; + } } } @@ -1355,10 +1494,12 @@ static TaxElementPtr copyPartial(TaxElementPtr src) static OrgModPtr copyOrgMod(OrgModPtr src) { -#if 0 +#if 1 OrgModPtr dst; if(src == NULL) return NULL; + if(src->subtype == 255) + return (src->next != NULL)? copyOrgMod(src->next) : NULL; dst= OrgModNew(); dst->subtype= src->subtype; @@ -1367,8 +1508,50 @@ static OrgModPtr copyOrgMod(OrgModPtr src) dst->next= (src->next != NULL)? copyOrgMod(src->next) : NULL; return dst; -#endif +#else return NULL; +#endif +} + +static int subtypeConflict(Int2 t1, Int2 t2) +{ + if(t1 == t2) return 1; + switch(t2) { + case 2: + case 6: + case 22: + if((t1 >= 2 && t1 <= 17) || (t1 == 22)) return 1; + break; + case 255: + return 1; + default: + break; + } + return 0; +} + +static void mergeOrgMod(OrgModPtr omp, OrgModPtr src) +{ + if(src == NULL) return; + else { + OrgModPtr dst, lst; + for(dst= omp; dst != NULL; dst= dst->next) { + lst= dst; + if(subtypeConflict((Int2)dst->subtype, (Int2)src->subtype)) { + mergeOrgMod(omp, src->next); + return; + } + } + + lst->next= dst= OrgModNew(); + dst->subtype= src->subtype; + dst->subname= (src->subname != NULL)? StringSave(src->subname) : NULL; + dst->attrib= (src->attrib != NULL)? StringSave(src->attrib) : NULL; + dst->next= NULL; + + mergeOrgMod(omp, src->next); + } + } static ValNodePtr removeDbtag(ValNodePtr vnp) @@ -1377,23 +1560,23 @@ static ValNodePtr removeDbtag(ValNodePtr vnp) DbtagPtr dbtag; for(vnf= vnp; vnp != NULL; vnp= vnn) { - dbtag= vnp->data.ptrvalue; - vnn= vnp->next; - if(dbtag == NULL) return NULL; - if(StringCmp(dbtag->db, "taxon") == 0) { - /* taxon tag, remove it */ - if(vnl == NULL) { - vnf= vnn; - } - else { - vnl->next= vnn; - } - DbtagFree(dbtag); - MemFree(vnp); - } - else { - vnl= vnp; - } + dbtag= vnp->data.ptrvalue; + vnn= vnp->next; + if(dbtag == NULL) return NULL; + if(StringCmp(dbtag->db, "taxon") == 0) { + /* taxon tag, remove it */ + if(vnl == NULL) { + vnf= vnn; + } + else { + vnl->next= vnn; + } + DbtagFree(dbtag); + MemFree(vnp); + } + else { + vnl= vnp; + } } return vnf; } @@ -1412,7 +1595,7 @@ static void bldOrgRefOut(OrgRefPtr dst, OrgRefPtr src, Int4 tax_id) /* populate tax_id */ vnp= ValNodeNew(NULL); if (dst->db != NULL) { - dst->db= removeDbtag(dst->db); + dst->db= removeDbtag(dst->db); } vnp->next= dst->db; dst->db= vnp; @@ -1425,12 +1608,12 @@ static void bldOrgRefOut(OrgRefPtr dst, OrgRefPtr src, Int4 tax_id) /* copy the synonym list */ dst->syn= NULL; vnl= NULL; if(we_want_synonyms) { - for(vnp= src->syn; vnp != NULL; vnp= vnp->next) { - vnl= ValNodeNew(vnl); - vnl->choice= vnp->choice; - vnl->data.ptrvalue= StringSave(vnp->data.ptrvalue); - if(dst->syn == NULL) dst->syn= vnl; - } + for(vnp= src->syn; vnp != NULL; vnp= vnp->next) { + vnl= ValNodeNew(vnl); + vnl->choice= vnp->choice; + vnl->data.ptrvalue= StringSave(vnp->data.ptrvalue); + if(dst->syn == NULL) dst->syn= vnl; + } } /* copy orgname */ @@ -1441,19 +1624,22 @@ static void bldOrgRefOut(OrgRefPtr dst, OrgRefPtr src, Int4 tax_id) switch(src->orgname->choice) { case 1 : /*binomial*/ - onp->data= copyBinomial(src->orgname->data); - break; + onp->data= copyBinomial(src->orgname->data); + break; case 2 : /* virus */ - onp->data= (src->orgname->data != NULL)? StringSave(src->orgname->data) : NULL; - break; + onp->data= (src->orgname->data != NULL)? StringSave(src->orgname->data) : NULL; + break; case 5 : /* partial */ - onp->data= copyPartial(src->orgname->data); - break; + onp->data= copyPartial(src->orgname->data); + break; default : /* can't handle */ - onp->data= NULL; + onp->data= NULL; } if(onp->mod == NULL) onp->mod= copyOrgMod(src->orgname->mod); + else { + mergeOrgMod(onp->mod, src->orgname->mod); + } onp->lineage= (src->orgname->lineage != NULL)? StringSave(src->orgname->lineage) : NULL; onp->gcode= src->orgname->gcode; onp->mgcode= src->orgname->mgcode; @@ -1466,26 +1652,26 @@ static void populateReplaced(OrgRefPtr orp, CharPtr oldName) OrgModPtr omp; if((orp->taxname != NULL) && (StringICmp(orp->taxname, oldName) == 0)) { - MemFree(oldName); - return; + MemFree(oldName); + return; } if((orp->common != NULL) && (StringICmp(orp->common, oldName) == 0)) { - MemFree(oldName); - return; + MemFree(oldName); + return; } /* organism name was changed */ onp= orp->orgname; if(onp != NULL) { - omp= OrgModNew(); - omp->next= onp->mod; - omp->subtype= 254; - omp->subname= oldName; - onp->mod= omp; + omp= OrgModNew(); + omp->next= onp->mod; + omp->subtype= 254; + omp->subname= oldName; + onp->mod= omp; } else { - MemFree(oldName); + MemFree(oldName); } } @@ -1512,59 +1698,59 @@ Taxon2DataPtr tax1m_lookup(OrgRefPtr inp_orgRef, int merge) /* populate search name if necessary */ if(inp_orgRef->taxname != NULL) { - if((db_orgRef->taxname != NULL) && (StringICmp(inp_orgRef->taxname, db_orgRef->taxname) == 0)) { - need_search_name= FALSE; - } - else if((db_orgRef->common != NULL) && (StringICmp(inp_orgRef->taxname, db_orgRef->common) == 0)) { - need_search_name= FALSE; - } + if((db_orgRef->taxname != NULL) && (StringICmp(inp_orgRef->taxname, db_orgRef->taxname) == 0)) { + need_search_name= FALSE; + } + else if((db_orgRef->common != NULL) && (StringICmp(inp_orgRef->taxname, db_orgRef->common) == 0)) { + need_search_name= FALSE; + } } if(need_search_name && (inp_orgRef->common != NULL)) { - if((db_orgRef->taxname != NULL) && (StringICmp(inp_orgRef->common, db_orgRef->taxname) == 0)) { - need_search_name= FALSE; - } - else if((db_orgRef->common != NULL) && (StringICmp(inp_orgRef->common, db_orgRef->common) == 0)) { - need_search_name= FALSE; - } + if((db_orgRef->taxname != NULL) && (StringICmp(inp_orgRef->common, db_orgRef->taxname) == 0)) { + need_search_name= FALSE; + } + else if((db_orgRef->common != NULL) && (StringICmp(inp_orgRef->common, db_orgRef->common) == 0)) { + need_search_name= FALSE; + } } if(need_search_name && (inp_orgRef->orgname != NULL)) { - /* check if search name already exists */ - OrgModPtr omp; + /* check if search name already exists */ + OrgModPtr omp; - for(omp= inp_orgRef->orgname->mod; omp != NULL; omp= omp->next) { - if(omp->subtype == 254) { - need_search_name= FALSE; - break; - } - } + for(omp= inp_orgRef->orgname->mod; omp != NULL; omp= omp->next) { + if(omp->subtype == 254) { + need_search_name= FALSE; + break; + } + } } hit_name= NULL; if(need_search_name) { - if((inp_orgRef->taxname != NULL) && (inp_orgRef->taxname[0] != '\0')) { - hit_name= StringSave(inp_orgRef->taxname); - } - else if((inp_orgRef->common != NULL) && (inp_orgRef->common[0] != '\0')) { - hit_name= StringSave(inp_orgRef->common); - } + if((inp_orgRef->taxname != NULL) && (inp_orgRef->taxname[0] != '\0')) { + hit_name= StringSave(inp_orgRef->taxname); + } + else if((inp_orgRef->common != NULL) && (inp_orgRef->common[0] != '\0')) { + hit_name= StringSave(inp_orgRef->common); + } } if(merge) { - /* we have to merge old orgref with the new one */ - res->org= inp_orgRef; - /* clean-up old information */ - if(inp_orgRef->taxname != NULL) MemFree(inp_orgRef->taxname); - if(inp_orgRef->common != NULL) MemFree(inp_orgRef->common); - if(inp_orgRef->syn != NULL) ValNodeFreeData(inp_orgRef->syn); - if(inp_orgRef->orgname != NULL) cleanOrgName(tax_id, inp_orgRef->orgname); + /* we have to merge old orgref with the new one */ + res->org= inp_orgRef; + /* clean-up old information */ + if(inp_orgRef->taxname != NULL) MemFree(inp_orgRef->taxname); + if(inp_orgRef->common != NULL) MemFree(inp_orgRef->common); + if(inp_orgRef->syn != NULL) ValNodeFreeData(inp_orgRef->syn); + if(inp_orgRef->orgname != NULL) cleanOrgName(tax_id, inp_orgRef->orgname); } else { - /* make new orgref */ - res->org= OrgRefNew(); - res->org->db= NULL; - res->org->orgname= NULL; + /* make new orgref */ + res->org= OrgRefNew(); + res->org->db= NULL; + res->org->orgname= NULL; } /* fill-up orgref based on db_orgRef */ bldOrgRefOut(res->org, db_orgRef, tax_id); @@ -1593,59 +1779,59 @@ Taxon1DataPtr tax1_lookup(OrgRefPtr inp_orgRef, int merge) /* populate search name if necessary */ if(inp_orgRef->taxname != NULL) { - if((db_orgRef->taxname != NULL) && (StringICmp(inp_orgRef->taxname, db_orgRef->taxname) == 0)) { - need_search_name= FALSE; - } - else if((db_orgRef->common != NULL) && (StringICmp(inp_orgRef->taxname, db_orgRef->common) == 0)) { - need_search_name= FALSE; - } + if((db_orgRef->taxname != NULL) && (StringICmp(inp_orgRef->taxname, db_orgRef->taxname) == 0)) { + need_search_name= FALSE; + } + else if((db_orgRef->common != NULL) && (StringICmp(inp_orgRef->taxname, db_orgRef->common) == 0)) { + need_search_name= FALSE; + } } if(need_search_name && (inp_orgRef->common != NULL)) { - if((db_orgRef->taxname != NULL) && (StringICmp(inp_orgRef->common, db_orgRef->taxname) == 0)) { - need_search_name= FALSE; - } - else if((db_orgRef->common != NULL) && (StringICmp(inp_orgRef->common, db_orgRef->common) == 0)) { - need_search_name= FALSE; - } + if((db_orgRef->taxname != NULL) && (StringICmp(inp_orgRef->common, db_orgRef->taxname) == 0)) { + need_search_name= FALSE; + } + else if((db_orgRef->common != NULL) && (StringICmp(inp_orgRef->common, db_orgRef->common) == 0)) { + need_search_name= FALSE; + } } if(need_search_name && (inp_orgRef->orgname != NULL)) { - /* check if search name already exists */ - OrgModPtr omp; + /* check if search name already exists */ + OrgModPtr omp; - for(omp= inp_orgRef->orgname->mod; omp != NULL; omp= omp->next) { - if(omp->subtype == 254) { - need_search_name= FALSE; - break; - } - } + for(omp= inp_orgRef->orgname->mod; omp != NULL; omp= omp->next) { + if(omp->subtype == 254) { + need_search_name= FALSE; + break; + } + } } hit_name= NULL; if(need_search_name) { - if((inp_orgRef->taxname != NULL) && (inp_orgRef->taxname[0] != '\0')) { - hit_name= StringSave(inp_orgRef->taxname); - } - else if((inp_orgRef->common != NULL) && (inp_orgRef->common[0] != '\0')) { - hit_name= StringSave(inp_orgRef->common); - } + if((inp_orgRef->taxname != NULL) && (inp_orgRef->taxname[0] != '\0')) { + hit_name= StringSave(inp_orgRef->taxname); + } + else if((inp_orgRef->common != NULL) && (inp_orgRef->common[0] != '\0')) { + hit_name= StringSave(inp_orgRef->common); + } } if(merge) { - /* we have to merge old orgref with the new one */ - res->org= inp_orgRef; - /* clean-up old information */ - if(inp_orgRef->taxname != NULL) MemFree(inp_orgRef->taxname); - if(inp_orgRef->common != NULL) MemFree(inp_orgRef->common); - if(inp_orgRef->syn != NULL) ValNodeFreeData(inp_orgRef->syn); - if(inp_orgRef->orgname != NULL) cleanOrgName(tax_id, inp_orgRef->orgname); + /* we have to merge old orgref with the new one */ + res->org= inp_orgRef; + /* clean-up old information */ + if(inp_orgRef->taxname != NULL) MemFree(inp_orgRef->taxname); + if(inp_orgRef->common != NULL) MemFree(inp_orgRef->common); + if(inp_orgRef->syn != NULL) ValNodeFreeData(inp_orgRef->syn); + if(inp_orgRef->orgname != NULL) cleanOrgName(tax_id, inp_orgRef->orgname); } else { - /* make new orgref */ - res->org= OrgRefNew(); - res->org->db= NULL; - res->org->orgname= NULL; + /* make new orgref */ + res->org= OrgRefNew(); + res->org->db= NULL; + res->org->orgname= NULL; } /* fill-up orgref based on db_orgRef */ bldOrgRefOut(res->org, db_orgRef, tax_id); @@ -1680,8 +1866,8 @@ Boolean tax1e_invokeChildren(Int4 tax_id) TreeCursorPtr cursor= tree_openCursor(tax_tree, NULL, NULL); if(tax_id < 0) { - res= TRUE; - tax_id= -tax_id; + res= TRUE; + tax_id= -tax_id; } if((cursor == NULL) || (!tc2_toNode(cursor, tax_id))) return FALSE; @@ -1729,100 +1915,100 @@ Int4 tax1_getTaxId4Str(CharPtr str, CharPtr* substring, Int4Ptr *Ids_out) tax_id= tax1_getTaxIdByName(str); if(tax_id > 1) { - *Ids_out= MemNew(sizeof(Int4)); - **Ids_out= tax_id; - *substring= StringSave(str); - return 1; + *Ids_out= MemNew(sizeof(Int4)); + **Ids_out= tax_id; + *substring= StringSave(str); + return 1; } else if(tax_id < 0) { - *substring= StringSave(str); - return tax1_getAllTaxIdByName(str, Ids_out); + *substring= StringSave(str); + return tax1_getAllTaxIdByName(str, Ids_out); } /* whole string matches nothing */ /* try the whole string inside first set of parenthesis */ for(b= str; *b != '\0'; b++) { - if(*b == '(') { - k= 0; - for(e= b+1; *e != '\0'; e++) { - if(*e == '(') { - k++; - continue; - } - if(*e == ')') { - if(k > 0) { - k--; - continue; - } - - *e= '\0'; - tax_id= tax1_getTaxIdByName(b+1); - - if(tax_id > 1) { - *substring= StringSave(b+1); - *e= ')'; - *Ids_out= MemNew(sizeof(Int4)); - **Ids_out= tax_id; - return 1; - } - else if(tax_id < 0) { - *substring= StringSave(b+1); - *e= ')'; - return tax1_getAllTaxIdByName(*substring, Ids_out); - } - - /* whole string won't help lets try truncate it at first comma*/ - *e= ')'; - for(e= b+1; *e != '\0'; e++) { - if(*e == ',') { - *e= '\0'; - tax_id= tax1_getTaxIdByName(b+1); - - if(tax_id > 1) { - *substring= StringSave(b+1); - *e= ','; - *Ids_out= MemNew(sizeof(Int4)); - **Ids_out= tax_id; - return 1; - } - else if(tax_id < 0) { - *substring= StringSave(b+1); - *e= ','; - return tax1_getAllTaxIdByName(*substring, Ids_out); - } - *e= ','; - break; - } - } - break; - } - } - break; - } + if(*b == '(') { + k= 0; + for(e= b+1; *e != '\0'; e++) { + if(*e == '(') { + k++; + continue; + } + if(*e == ')') { + if(k > 0) { + k--; + continue; + } + + *e= '\0'; + tax_id= tax1_getTaxIdByName(b+1); + + if(tax_id > 1) { + *substring= StringSave(b+1); + *e= ')'; + *Ids_out= MemNew(sizeof(Int4)); + **Ids_out= tax_id; + return 1; + } + else if(tax_id < 0) { + *substring= StringSave(b+1); + *e= ')'; + return tax1_getAllTaxIdByName(*substring, Ids_out); + } + + /* whole string won't help lets try truncate it at first comma*/ + *e= ')'; + for(e= b+1; *e != '\0'; e++) { + if(*e == ',') { + *e= '\0'; + tax_id= tax1_getTaxIdByName(b+1); + + if(tax_id > 1) { + *substring= StringSave(b+1); + *e= ','; + *Ids_out= MemNew(sizeof(Int4)); + **Ids_out= tax_id; + return 1; + } + else if(tax_id < 0) { + *substring= StringSave(b+1); + *e= ','; + return tax1_getAllTaxIdByName(*substring, Ids_out); + } + *e= ','; + break; + } + } + break; + } + } + break; + } } /* we still have got nothing */ /* try the substring before first '(' */ if(*b == '(') { - /* we are staying on the first '(' */ - *b= '\0'; + /* we are staying on the first '(' */ + *b= '\0'; - tax_id= tax1_getTaxIdByName(str); - - if(tax_id > 1) { - *Ids_out= MemNew(sizeof(Int4)); - **Ids_out= tax_id; - *substring= StringSave(str); - *b= '('; - return 1; - } - else if(tax_id < 0) { - *substring= StringSave(str); - *b= '('; - return tax1_getAllTaxIdByName(*substring, Ids_out); - } - *b= '('; + tax_id= tax1_getTaxIdByName(str); + + if(tax_id > 1) { + *Ids_out= MemNew(sizeof(Int4)); + **Ids_out= tax_id; + *substring= StringSave(str); + *b= '('; + return 1; + } + else if(tax_id < 0) { + *substring= StringSave(str); + *b= '('; + return tax1_getAllTaxIdByName(*substring, Ids_out); + } + *b= '('; } b= StringStr(str, "Organism"); @@ -1830,46 +2016,46 @@ Int4 tax1_getTaxId4Str(CharPtr str, CharPtr* substring, Int4Ptr *Ids_out) if(b == NULL) b= StringStr(str, "ORGANISM"); if(b != NULL) { - e= StringChr(b, ':'); - if(e != NULL) { - b= e+1; - tax_id= tax1_getTaxIdByName(b); - - if(tax_id > 1) { - *Ids_out= MemNew(sizeof(Int4)); - **Ids_out= tax_id; - *substring= StringSave(b); - return 1; - } - else if(tax_id < 0) { - *substring= StringSave(b); - return tax1_getAllTaxIdByName(*substring, Ids_out); - } + e= StringChr(b, ':'); + if(e != NULL) { + b= e+1; + tax_id= tax1_getTaxIdByName(b); + + if(tax_id > 1) { + *Ids_out= MemNew(sizeof(Int4)); + **Ids_out= tax_id; + *substring= StringSave(b); + return 1; + } + else if(tax_id < 0) { + *substring= StringSave(b); + return tax1_getAllTaxIdByName(*substring, Ids_out); + } - /* if multiple lines or ; , ( */ - for(++e; *e != '\0'; e++) { - if((*e == '\n') || (*e == ';') || (*e == ',') || (*e == '(')) { - c= *e; - *e= '\0'; - tax_id= tax1_getTaxIdByName(b); - - if(tax_id > 1) { - *substring= StringSave(b); - *e= c; - *Ids_out= MemNew(sizeof(Int4)); - **Ids_out= tax_id; - return 1; - } - else if(tax_id < 0) { - *substring= StringSave(b); - *e= c; - return tax1_getAllTaxIdByName(*substring, Ids_out); - } - *e= c; - break; - } - } - } + /* if multiple lines or ; , ( */ + for(++e; *e != '\0'; e++) { + if((*e == '\n') || (*e == ';') || (*e == ',') || (*e == '(')) { + c= *e; + *e= '\0'; + tax_id= tax1_getTaxIdByName(b); + + if(tax_id > 1) { + *substring= StringSave(b); + *e= c; + *Ids_out= MemNew(sizeof(Int4)); + **Ids_out= tax_id; + return 1; + } + else if(tax_id < 0) { + *substring= StringSave(b); + *e= c; + return tax1_getAllTaxIdByName(*substring, Ids_out); + } + *e= c; + break; + } + } + } } return 0; } @@ -1889,11 +2075,11 @@ static Int4 storedTaxId(OrgRefPtr orp) ObjectIdPtr object_id; for(vnp= orp->db; vnp != NULL; vnp= vnp->next) { - dbtag= vnp->data.ptrvalue; - if((dbtag != NULL) && (StringCmp(dbtag->db, "taxon") == 0)) { - ObjectIdPtr object_id= dbtag->tag; - return object_id->id; - } + dbtag= vnp->data.ptrvalue; + if((dbtag != NULL) && (StringCmp(dbtag->db, "taxon") == 0)) { + ObjectIdPtr object_id= dbtag->tag; + return object_id->id; + } } return 0; @@ -1908,15 +2094,15 @@ static Int4 OrgModCmp(OrgModPtr omp1, OrgModPtr omp2) if(omp1 == NULL) return 100; for(;omp2 != NULL; omp2= omp2->next) { - found= 0; - for(omp= omp1; omp != NULL; omp= omp->next) { - if((omp2->subtype == omp->subtype) && - (nameCmp(omp2->subname, omp->subname) == 0)) { - found= 1; - break; - } - } - if(!found) return 100; + found= 0; + for(omp= omp1; omp != NULL; omp= omp->next) { + if((omp2->subtype == omp->subtype) && + (nameCmp(omp2->subname, omp->subname) == 0)) { + found= 1; + break; + } + } + if(!found) return 100; } return 0; } @@ -1962,7 +2148,7 @@ Int4 tax1e_needUpdate(OrgRefPtr inp_orgRef) db_orgRef= s_tax1_getOrgRef(tax_id, NULL, NULL, NULL /*res->embl_code*/); if(db_orgRef == NULL) { - return -2; + return -2; } return OrgRefCmp(inp_orgRef, db_orgRef); @@ -1997,16 +2183,16 @@ CharPtr tax1m_getBlastName(Int4 tax_id) TreeCursorPtr cursor= tree_openCursor(tax_tree, NULL, NULL); if(tc2_toNode(cursor, tax_id)) { - TXC_TreeNodePtr tnp; - Uint2 s; - do{ - tnp= tree_getNodeData(cursor, &s); - if((tnp != NULL) && ((tnp->flags & TXC_STHIDE) == 0)) { /* we do have a blast name here */ - res= tnp->node_label + (StringLen(tnp->node_label) + 1); - break; - } - } - while(tree_parent(cursor)); + TXC_TreeNodePtr tnp; + Uint2 s; + do{ + tnp= tree_getNodeData(cursor, &s); + if((tnp != NULL) && ((tnp->flags & TXC_STHIDE) == 0)) { /* we do have a blast name here */ + res= tnp->node_label + (StringLen(tnp->node_label) + 1); + break; + } + } + while(tree_parent(cursor)); } tree_closeCursor(cursor); diff --git a/network/vibnet/vibnet.dsp b/network/vibnet/vibnet.dsp deleted file mode 100644 index 0027c028..00000000 --- a/network/vibnet/vibnet.dsp +++ /dev/null @@ -1,114 +0,0 @@ -# Microsoft Developer Studio Project File - Name="vibnet" - Package Owner=<4> -# Microsoft Developer Studio Generated Build File, Format Version 6.00 -# ** DO NOT EDIT ** - -# TARGTYPE "Win32 (x86) Static Library" 0x0104 - -CFG=vibnet - Win32 Release -!MESSAGE This is not a valid makefile. To build this project using NMAKE, -!MESSAGE use the Export Makefile command and run -!MESSAGE -!MESSAGE NMAKE /f "vibnet.mak". -!MESSAGE -!MESSAGE You can specify a configuration when running NMAKE -!MESSAGE by defining the macro CFG on the command line. For example: -!MESSAGE -!MESSAGE NMAKE /f "vibnet.mak" CFG="vibnet - Win32 Release" -!MESSAGE -!MESSAGE Possible choices for configuration are: -!MESSAGE -!MESSAGE "vibnet - Win32 Debug" (based on "Win32 (x86) Static Library") -!MESSAGE "vibnet - Win32 Release" (based on "Win32 (x86) Static Library") -!MESSAGE - -# Begin Project -# PROP AllowPerConfigDependencies 0 -# PROP Scc_ProjName "" -# PROP Scc_LocalPath "" -CPP=cl.exe -RSC=rc.exe - -!IF "$(CFG)" == "vibnet - Win32 Debug" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 1 -# PROP BASE Output_Dir "Debug" -# PROP BASE Intermediate_Dir "Debug" -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 1 -# PROP Output_Dir "Debug" -# PROP Intermediate_Dir "Debug" -# PROP Target_Dir "" -# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_MBCS" /D "_LIB" /YX /FD /GZ /c -# ADD CPP /nologo /W2 /Gm /GX /ZI /Od /I "..\.." /I "..\..\ddv" /I "..\..\cn3d" /I "..\..\access" /I "..\..\asnstat" /I "..\..\connect\lbapi" /I "..\..\connect" /I "..\..\asnlib" /I "..\..\vibrant" /I "..\..\biostruc" /I "..\..\object" /I "..\..\api" /I "..\..\cdromlib" /I "..\..\desktop" /I "..\..\tools" /I "..\..\corelib" /I "..\taxon1\common" /I "..\vibnet" /I "..\entrez\client" /I "..\nsclilib" /I "..\medarch\client" /I "..\id1arch" /I "..\taxon1\taxon2" /I "..\blast3\client" /D "WIN32" /D "_DEBUG" /D "_MBCS" /D "_LIB" /YX /FD /GZ /c -# SUBTRACT CPP /Fr -# ADD BASE RSC /l 0x409 /d "_DEBUG" -# ADD RSC /l 0x409 /d "_DEBUG" -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LIB32=link.exe -lib -# ADD BASE LIB32 /nologo -# ADD LIB32 /nologo - -!ELSEIF "$(CFG)" == "vibnet - Win32 Release" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 1 -# PROP BASE Output_Dir "vibnet___Win32_Release" -# PROP BASE Intermediate_Dir "vibnet___Win32_Release" -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 1 -# PROP Output_Dir "vibnet___Win32_Release" -# PROP Intermediate_Dir "" -# PROP Target_Dir "" -# ADD BASE CPP /nologo /W2 /Gm /GX /ZI /Od /I "..\.." /I "..\..\ddv" /I "..\..\cn3d" /I "..\..\access" /I "..\..\asnstat" /I "..\..\connect\lbapi" /I "..\..\connect" /I "..\..\asnlib" /I "..\..\vibrant" /I "..\..\biostruc" /I "..\..\object" /I "..\..\api" /I "..\..\cdromlib" /I "..\..\desktop" /I "..\..\tools" /I "..\..\corelib" /I "..\taxon1\common" /I "..\vibnet" /I "..\entrez\client" /I "..\nsclilib" /I "..\medarch\client" /I "..\id1arch" /I "..\taxon1\taxon2" /I "..\blast3\client" /D "WIN32" /D "_DEBUG" /D "_MBCS" /D "_LIB" /YX /FD /GZ /c -# SUBTRACT BASE CPP /Fr -# ADD CPP /nologo /W2 /Gm /GX /Zi /I "..\.." /I "..\..\ddv" /I "..\..\cn3d" /I "..\..\access" /I "..\..\asnstat" /I "..\..\connect\lbapi" /I "..\..\connect" /I "..\..\asnlib" /I "..\..\vibrant" /I "..\..\biostruc" /I "..\..\object" /I "..\..\api" /I "..\..\cdromlib" /I "..\..\desktop" /I "..\..\tools" /I "..\..\corelib" /I "..\taxon1\common" /I "..\vibnet" /I "..\entrez\client" /I "..\nsclilib" /I "..\medarch\client" /I "..\id1arch" /I "..\taxon1\taxon2" /I "..\blast3\client" /D "_LIB" /D "WIN32" /D "_MBCS" /YX /FD /c -# ADD BASE RSC /l 0x409 /d "_DEBUG" -# ADD RSC /l 0x409 -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LIB32=link.exe -lib -# ADD BASE LIB32 /nologo -# ADD LIB32 /nologo - -!ENDIF - -# Begin Target - -# Name "vibnet - Win32 Debug" -# Name "vibnet - Win32 Release" -# Begin Group "Source Files" - -# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat" -# Begin Source File - -SOURCE=.\docsum.c -# End Source File -# Begin Source File - -SOURCE=.\netcnfg.c -# End Source File -# Begin Source File - -SOURCE=.\trmlst.c -# End Source File -# End Group -# Begin Group "Header Files" - -# PROP Default_Filter "h;hpp;hxx;hm;inl" -# Begin Source File - -SOURCE=.\entrez.h -# End Source File -# Begin Source File - -SOURCE=.\netcnfg.h -# End Source File -# End Group -# End Target -# End Project |