summaryrefslogtreecommitdiff
path: root/network
diff options
context:
space:
mode:
authorAaron M. Ucko <ucko@debian.org>2005-03-23 21:49:46 +0000
committerAaron M. Ucko <ucko@debian.org>2005-03-23 21:49:46 +0000
commit7c9ae4b4aa930a13144b20e19b3baf050c45fa6f (patch)
treec056b27ee047e404364fddaa582415a54b5348b4 /network
parentc75ff6a6ca0d1c0a0b90ac5cf9a14a73a913cb16 (diff)
Load ncbi (6.1.20030421) into ncbi-tools6/branches/upstream/current.
Diffstat (limited to 'network')
-rw-r--r--network/blast3/client/netblap3.c87
-rw-r--r--network/blast3/client/netblap3.h10
-rw-r--r--network/id1arch/id1.asn33
-rw-r--r--network/id1arch/id1.h122
-rw-r--r--network/id1arch/id1arch.c6
-rw-r--r--network/id1arch/id1gen.c458
-rw-r--r--network/id1arch/id1gen.h50
-rw-r--r--network/id1arch/idfetch.c111
-rw-r--r--network/medarch/client/medutil.c30
-rw-r--r--network/medarch/client/medutil.h6
-rw-r--r--network/nsclilib/ni_msg.c7
-rw-r--r--network/nsclilib/readme17
-rw-r--r--network/taxon1/common/taxinc.h8
-rw-r--r--network/taxon1/taxon2/tc2proc.c284
-rw-r--r--network/taxon1/taxon2/txcdproc.c86
-rw-r--r--network/taxon1/taxon2/txclient.h5
-rw-r--r--network/taxon1/taxon2/txcproc.c9
17 files changed, 1097 insertions, 232 deletions
diff --git a/network/blast3/client/netblap3.c b/network/blast3/client/netblap3.c
index 3b561e5b..191d5b13 100644
--- a/network/blast3/client/netblap3.c
+++ b/network/blast3/client/netblap3.c
@@ -34,6 +34,12 @@
*
* RCS Modification History:
* $Log: netblap3.c,v $
+* Revision 1.104 2003/01/13 18:08:26 bealer
+* - Replace nonstandard snprintf() function with strcpy/strcat/strlen.
+*
+* Revision 1.103 2003/01/10 21:45:06 bealer
+* - Modify to return errors from BLASTGetUidsFromQuery instead of logging them.
+*
* Revision 1.102 2002/10/30 18:54:58 madden
* NULL out SeqLoc for lower-case masking
*
@@ -2787,8 +2793,11 @@ parametersToOptions (BlastParametersPtr parameters, CharPtr program, ValNodePtr
to get list of gis corresponding to the Entrez Boolean string or
just number of such hits in the Entrez database */
-NLM_EXTERN Int4 BLASTGetUidsFromQuery(CharPtr query, Int4Ptr PNTR uids,
- Boolean is_na, Boolean count_only)
+NLM_EXTERN Int4 BLASTGetUidsFromQuery(CharPtr query,
+ Int4Ptr PNTR uids,
+ Boolean is_na,
+ Boolean count_only,
+ BlastError ** blast_err)
{
Entrez2ReplyPtr e2ry;
Entrez2RequestPtr e2rq;
@@ -2811,20 +2820,55 @@ NLM_EXTERN Int4 BLASTGetUidsFromQuery(CharPtr query, Int4Ptr PNTR uids,
e2ry = EntrezSynchronousQuery (e2rq);
if (e2ry == NULL) {
- ErrPostEx(SEV_ERROR, 0, 0,
- "NULL returned from EntrezSynchronousQuery()");
+ if ( blast_err ) {
+ *blast_err = BlastErrorNew();
+
+ (*blast_err)->level = Blast_error_level_error;
+ (*blast_err)->msg = StrSave("NULL returned from EntrezSynchronousQuery()");
+ } else {
+ ErrPostEx(SEV_ERROR, 0, 0,
+ "NULL returned from EntrezSynchronousQuery()");
+ }
+
return -1;
}
-
+
if((e2rp = e2ry->reply) == NULL) {
- ErrPostEx(SEV_ERROR, 0, 0, "Invalid ASN.1: E2ReplyPtr==NULL");
+ if ( blast_err ) {
+ *blast_err = BlastErrorNew();
+
+ (*blast_err)->level = Blast_error_level_error;
+ (*blast_err)->msg = StrSave("Invalid ASN.1: E2ReplyPtr==NULL");
+ } else {
+ ErrPostEx(SEV_ERROR, 0, 0, "Invalid ASN.1: E2ReplyPtr==NULL");
+ }
return -1;
}
switch(e2rp->choice) {
-
case E2Reply_error:
- ErrPostEx(SEV_ERROR, 0, 0, (CharPtr) e2rp->data.ptrvalue);
+ if ( blast_err ) {
+ const char * msg1 = "Error in request: ";
+ const char * msg2 = (CharPtr) e2rp->data.ptrvalue;
+ char * msg3 = 0;
+
+ int msglen1 = strlen(msg1);
+ int msglen2 = strlen(msg2);
+
+ msg3 = MemNew(msglen1 + msglen2 + 1);
+
+ if ( msg3 ) {
+ strcpy(msg3, msg1);
+ strcat(msg3, msg2);
+
+ *blast_err = BlastErrorNew();
+
+ (*blast_err)->level = Blast_error_level_error;
+ (*blast_err)->msg = msg3;
+ }
+ } else {
+ ErrPostEx(SEV_ERROR, 0, 0, "Error in request: %s", (CharPtr) e2rp->data.ptrvalue);
+ }
count = -1;
break;
case E2Reply_eval_boolean:
@@ -2840,15 +2884,36 @@ NLM_EXTERN Int4 BLASTGetUidsFromQuery(CharPtr query, Int4Ptr PNTR uids,
}
break;
default:
- ErrPostEx(SEV_ERROR, 0, 0, "Invalid reply type from the server: %d", e2rp->choice);
+ if ( blast_err ) {
+ const char * msg1 = "Invalid reply type from the server: ";
+ const char * msg2 = (CharPtr) e2rp->data.ptrvalue;
+ char * msg3 = 0;
+
+ int msglen1 = strlen(msg1);
+ int msglen2 = strlen(msg2);
+
+ msg3 = MemNew(msglen1 + msglen2 + 1);
+
+ if ( msg3 ) {
+ strcpy(msg3, msg1);
+ strcat(msg3, msg2);
+
+ *blast_err = BlastErrorNew();
+
+ (*blast_err)->level = Blast_error_level_error;
+ (*blast_err)->msg = msg3;
+ }
+ } else {
+ ErrPostEx(SEV_ERROR, 0, 0, "Invalid reply type from the server: %d", e2rp->choice);
+ }
count = -1;
break;
-
}
Entrez2ReplyFree(e2ry);
Entrez2RequestFree(e2rq);
-
+
return count;
}
#endif
+
diff --git a/network/blast3/client/netblap3.h b/network/blast3/client/netblap3.h
index d1c0124f..239e34cc 100644
--- a/network/blast3/client/netblap3.h
+++ b/network/blast3/client/netblap3.h
@@ -34,6 +34,9 @@
*
* RCS Modification History:
* $Log: netblap3.h,v $
+* Revision 1.31 2003/01/10 21:45:06 bealer
+* - Modify to return errors from BLASTGetUidsFromQuery instead of logging them.
+*
* Revision 1.30 2002/05/23 22:57:03 dondosha
* Made GetResponsePtr external
*
@@ -249,8 +252,11 @@ NLM_EXTERN BLAST_OptionsBlkPtr parametersToOptions (BlastParametersPtr parameter
NLM_EXTERN BlastDbinfoPtr LIBCALL Blast3GetDbinfo(BlastNet3Hptr bl3hptr);
-NLM_EXTERN Int4 BLASTGetUidsFromQuery(CharPtr query, Int4Ptr PNTR uids,
- Boolean is_na, Boolean count_only);
+NLM_EXTERN Int4 BLASTGetUidsFromQuery(CharPtr query,
+ Int4Ptr PNTR uids,
+ Boolean is_na,
+ Boolean count_only,
+ BlastError ** err_ret);
NLM_EXTERN Boolean SubmitRequest PROTO((BlastNet3Hptr bl3hptr, BlastRequestPtr blreqp, BlastResponsePtr PNTR response, NetProgressCallback callback, Boolean reestablish));
diff --git a/network/id1arch/id1.asn b/network/id1arch/id1.asn
index 7b8f9c5c..7f8d3cc1 100644
--- a/network/id1arch/id1.asn
+++ b/network/id1arch/id1.asn
@@ -1,4 +1,4 @@
---$Revision: 1.4 $
+--$Revision: 1.9 $
--********************************************************************
--
-- Network Id server network access
@@ -32,8 +32,10 @@ ID1server-request ::= CHOICE {
getseqidsfromgi INTEGER, --get all Seq-ids of given gi
getgihist INTEGER, --get an historical list of gis
getgirev INTEGER, --get a revision history of gi
- getgistate INTEGER --get a state of gi
- }
+ getgistate INTEGER, --get a state of gi
+ getsewithinfo ID1server-maxcomplex,
+ getblobinfo ID1server-maxcomplex
+}
-- Complexity stuff will be for ID1
@@ -68,8 +70,29 @@ ID1server-back ::= CHOICE {
ids SET OF Seq-id,
gihist SET OF ID1Seq-hist, -- because hand crafted Seq-hist does not follow
-- same conventions
- girevhist SET OF ID1Seq-hist
- }
+ girevhist SET OF ID1Seq-hist,
+ gotsewithinfo ID1SeqEntry-info,
+ gotblobinfo ID1blob-info
+}
ID1server-debug ::= SET OF ID1server-back
+
+
+ID1blob-info ::= SEQUENCE {
+ gi INTEGER ,
+ sat INTEGER,
+ sat-key INTEGER,
+ satname VisibleString,
+ suppress INTEGER,
+ withdrawn INTEGER,
+ confidential INTEGER,
+ blob-state INTEGER,
+ comment VisibleString OPTIONAL, -- public comment for withdrawn record
+ extfeatmask INTEGER OPTIONAL -- mask for external features (SNP,...)
+}
+
+ID1SeqEntry-info ::= SEQUENCE {
+ blob-info ID1blob-info,
+ blob Seq-entry OPTIONAL
+}
END
diff --git a/network/id1arch/id1.h b/network/id1arch/id1.h
index b7a5977b..a9596d75 100644
--- a/network/id1arch/id1.h
+++ b/network/id1arch/id1.h
@@ -9,7 +9,7 @@
#include <asn.h>
#endif
-static char * asnfilename = "id1.h13";
+static char * asnfilename = "id1.h18";
static AsnValxNode avnx[5] = {
{20,"entry" ,0,0.0,&avnx[1] } ,
{20,"bioseq" ,1,0.0,&avnx[2] } ,
@@ -17,18 +17,18 @@ static AsnValxNode avnx[5] = {
{20,"nuc-prot" ,3,0.0,&avnx[4] } ,
{20,"pub-set" ,4,0.0,NULL } };
-static AsnType atx[42] = {
+static AsnType atx[60] = {
{401, "Seq-id" ,1,0,0,0,0,0,1,0,NULL,NULL,NULL,0,&atx[1]} ,
{402, "Seq-entry" ,1,0,0,0,0,0,1,0,NULL,NULL,NULL,0,&atx[2]} ,
{403, "Seq-hist" ,1,0,0,0,0,0,1,0,NULL,NULL,NULL,0,&atx[3]} ,
- {404, "ID1server-request" ,1,0,0,0,0,0,0,0,NULL,&atx[22],&atx[4],0,&atx[8]} ,
+ {404, "ID1server-request" ,1,0,0,0,0,0,0,0,NULL,&atx[24],&atx[4],0,&atx[8]} ,
{0, "init" ,128,0,0,0,0,0,0,0,NULL,&atx[5],NULL,0,&atx[6]} ,
{305, "NULL" ,0,5,0,0,0,0,0,0,NULL,NULL,NULL,0,NULL} ,
{0, "getgi" ,128,1,0,0,0,0,0,0,NULL,&atx[0],NULL,0,&atx[7]} ,
{0, "getsefromgi" ,128,2,0,0,0,0,0,0,NULL,&atx[8],NULL,0,&atx[17]} ,
{405, "ID1server-maxcomplex" ,1,0,0,0,0,0,0,0,NULL,&atx[16],&atx[9],0,&atx[10]} ,
{0, "maxplex" ,128,0,0,0,0,0,0,0,NULL,&atx[10],NULL,0,&atx[12]} ,
- {406, "Entry-complexities" ,1,0,0,0,0,0,0,0,NULL,&atx[11],&avnx[0],0,&atx[23]} ,
+ {406, "Entry-complexities" ,1,0,0,0,0,0,0,0,NULL,&atx[11],&avnx[0],0,&atx[25]} ,
{302, "INTEGER" ,0,2,0,0,0,0,0,0,NULL,NULL,NULL,0,NULL} ,
{0, "gi" ,128,1,0,0,0,0,0,0,NULL,&atx[11],NULL,0,&atx[13]} ,
{0, "ent" ,128,2,0,1,0,0,0,0,NULL,&atx[11],NULL,0,&atx[14]} ,
@@ -39,30 +39,48 @@ static AsnType atx[42] = {
{0, "getseqidsfromgi" ,128,4,0,0,0,0,0,0,NULL,&atx[11],NULL,0,&atx[19]} ,
{0, "getgihist" ,128,5,0,0,0,0,0,0,NULL,&atx[11],NULL,0,&atx[20]} ,
{0, "getgirev" ,128,6,0,0,0,0,0,0,NULL,&atx[11],NULL,0,&atx[21]} ,
- {0, "getgistate" ,128,7,0,0,0,0,0,0,NULL,&atx[11],NULL,0,NULL} ,
+ {0, "getgistate" ,128,7,0,0,0,0,0,0,NULL,&atx[11],NULL,0,&atx[22]} ,
+ {0, "getsewithinfo" ,128,8,0,0,0,0,0,0,NULL,&atx[8],NULL,0,&atx[23]} ,
+ {0, "getblobinfo" ,128,9,0,0,0,0,0,0,NULL,&atx[8],NULL,0,NULL} ,
{315, "CHOICE" ,0,-1,0,0,0,0,0,0,NULL,NULL,NULL,0,NULL} ,
- {407, "ID1Seq-hist" ,1,0,0,0,0,0,0,0,NULL,&atx[16],&atx[24],0,&atx[25]} ,
+ {407, "ID1Seq-hist" ,1,0,0,0,0,0,0,0,NULL,&atx[16],&atx[26],0,&atx[27]} ,
{0, "hist" ,128,0,0,0,0,0,0,0,NULL,&atx[2],NULL,0,NULL} ,
- {408, "ID1server-back" ,1,0,0,0,0,0,0,0,NULL,&atx[22],&atx[26],0,&atx[40]} ,
- {0, "init" ,128,0,0,0,0,0,0,0,NULL,&atx[5],NULL,0,&atx[27]} ,
- {0, "error" ,128,1,0,0,0,0,0,0,NULL,&atx[11],NULL,0,&atx[28]} ,
- {0, "gotgi" ,128,2,0,0,0,0,0,0,NULL,&atx[11],NULL,0,&atx[29]} ,
- {0, "gotseqentry" ,128,3,0,0,0,0,0,0,NULL,&atx[1],NULL,0,&atx[30]} ,
- {0, "gotdeadseqentry" ,128,4,0,0,0,0,0,0,NULL,&atx[1],NULL,0,&atx[31]} ,
- {0, "fini" ,128,5,0,0,0,0,0,0,NULL,&atx[5],NULL,0,&atx[32]} ,
- {0, "gistate" ,128,6,0,0,0,0,0,0,NULL,&atx[11],NULL,0,&atx[33]} ,
- {0, "ids" ,128,7,0,0,0,0,0,0,NULL,&atx[35],&atx[34],0,&atx[36]} ,
+ {408, "ID1server-back" ,1,0,0,0,0,0,0,0,NULL,&atx[24],&atx[28],0,&atx[43]} ,
+ {0, "init" ,128,0,0,0,0,0,0,0,NULL,&atx[5],NULL,0,&atx[29]} ,
+ {0, "error" ,128,1,0,0,0,0,0,0,NULL,&atx[11],NULL,0,&atx[30]} ,
+ {0, "gotgi" ,128,2,0,0,0,0,0,0,NULL,&atx[11],NULL,0,&atx[31]} ,
+ {0, "gotseqentry" ,128,3,0,0,0,0,0,0,NULL,&atx[1],NULL,0,&atx[32]} ,
+ {0, "gotdeadseqentry" ,128,4,0,0,0,0,0,0,NULL,&atx[1],NULL,0,&atx[33]} ,
+ {0, "fini" ,128,5,0,0,0,0,0,0,NULL,&atx[5],NULL,0,&atx[34]} ,
+ {0, "gistate" ,128,6,0,0,0,0,0,0,NULL,&atx[11],NULL,0,&atx[35]} ,
+ {0, "ids" ,128,7,0,0,0,0,0,0,NULL,&atx[37],&atx[36],0,&atx[38]} ,
{0, NULL,1,-1,0,0,0,0,0,0,NULL,&atx[0],NULL,0,NULL} ,
{314, "SET OF" ,0,17,0,0,0,0,0,0,NULL,NULL,NULL,0,NULL} ,
- {0, "gihist" ,128,8,0,0,0,0,0,0,NULL,&atx[35],&atx[37],0,&atx[38]} ,
- {0, NULL,1,-1,0,0,0,0,0,0,NULL,&atx[23],NULL,0,NULL} ,
- {0, "girevhist" ,128,9,0,0,0,0,0,0,NULL,&atx[35],&atx[39],0,NULL} ,
- {0, NULL,1,-1,0,0,0,0,0,0,NULL,&atx[23],NULL,0,NULL} ,
- {409, "ID1server-debug" ,1,0,0,0,0,0,0,0,NULL,&atx[35],&atx[41],0,NULL} ,
- {0, NULL,1,-1,0,0,0,0,0,0,NULL,&atx[25],NULL,0,NULL} };
+ {0, "gihist" ,128,8,0,0,0,0,0,0,NULL,&atx[37],&atx[39],0,&atx[40]} ,
+ {0, NULL,1,-1,0,0,0,0,0,0,NULL,&atx[25],NULL,0,NULL} ,
+ {0, "girevhist" ,128,9,0,0,0,0,0,0,NULL,&atx[37],&atx[41],0,&atx[42]} ,
+ {0, NULL,1,-1,0,0,0,0,0,0,NULL,&atx[25],NULL,0,NULL} ,
+ {0, "gotsewithinfo" ,128,10,0,0,0,0,0,0,NULL,&atx[43],NULL,0,&atx[57]} ,
+ {409, "ID1SeqEntry-info" ,1,0,0,0,0,0,0,0,NULL,&atx[16],&atx[44],0,&atx[45]} ,
+ {0, "blob-info" ,128,0,0,0,0,0,0,0,NULL,&atx[45],NULL,0,&atx[56]} ,
+ {410, "ID1blob-info" ,1,0,0,0,0,0,0,0,NULL,&atx[16],&atx[46],0,&atx[58]} ,
+ {0, "gi" ,128,0,0,0,0,0,0,0,NULL,&atx[11],NULL,0,&atx[47]} ,
+ {0, "sat" ,128,1,0,0,0,0,0,0,NULL,&atx[11],NULL,0,&atx[48]} ,
+ {0, "sat-key" ,128,2,0,0,0,0,0,0,NULL,&atx[11],NULL,0,&atx[49]} ,
+ {0, "satname" ,128,3,0,0,0,0,0,0,NULL,&atx[15],NULL,0,&atx[50]} ,
+ {0, "suppress" ,128,4,0,0,0,0,0,0,NULL,&atx[11],NULL,0,&atx[51]} ,
+ {0, "withdrawn" ,128,5,0,0,0,0,0,0,NULL,&atx[11],NULL,0,&atx[52]} ,
+ {0, "confidential" ,128,6,0,0,0,0,0,0,NULL,&atx[11],NULL,0,&atx[53]} ,
+ {0, "blob-state" ,128,7,0,0,0,0,0,0,NULL,&atx[11],NULL,0,&atx[54]} ,
+ {0, "comment" ,128,8,0,1,0,0,0,0,NULL,&atx[15],NULL,0,&atx[55]} ,
+ {0, "extfeatmask" ,128,9,0,1,0,0,0,0,NULL,&atx[11],NULL,0,NULL} ,
+ {0, "blob" ,128,1,0,1,0,0,0,0,NULL,&atx[1],NULL,0,NULL} ,
+ {0, "gotblobinfo" ,128,11,0,0,0,0,0,0,NULL,&atx[45],NULL,0,NULL} ,
+ {411, "ID1server-debug" ,1,0,0,0,0,0,0,0,NULL,&atx[37],&atx[59],0,NULL} ,
+ {0, NULL,1,-1,0,0,0,0,0,0,NULL,&atx[27],NULL,0,NULL} };
static AsnModule ampx[1] = {
- { "NCBI-ID1Access" , "id1.h13",&atx[0],NULL,NULL,0,0} };
+ { "NCBI-ID1Access" , "id1.h18",&atx[0],NULL,NULL,0,0} };
static AsnValxNodePtr avn = avnx;
static AsnTypePtr at = atx;
@@ -85,6 +103,8 @@ static AsnModulePtr amp = ampx;
#define ID1SERVER_REQUEST_getgihist &at[19]
#define ID1SERVER_REQUEST_getgirev &at[20]
#define ID1SERVER_REQUEST_getgistate &at[21]
+#define ID1SERVER_REQUEST_getsewithinfo &at[22]
+#define ID1SERVER_REQUEST_getblobinfo &at[23]
#define ID1SERVER_MAXCOMPLEX &at[8]
#define ID1SERVER_MAXCOMPLEX_maxplex &at[9]
@@ -94,23 +114,41 @@ static AsnModulePtr amp = ampx;
#define ENTRY_COMPLEXITIES &at[10]
-#define ID1SEQ_HIST &at[23]
-#define ID1SEQ_HIST_hist &at[24]
-
-#define ID1SERVER_BACK &at[25]
-#define ID1SERVER_BACK_init &at[26]
-#define ID1SERVER_BACK_error &at[27]
-#define ID1SERVER_BACK_gotgi &at[28]
-#define ID1SERVER_BACK_gotseqentry &at[29]
-#define ID1SERVER_BACK_gotdeadseqentry &at[30]
-#define ID1SERVER_BACK_fini &at[31]
-#define ID1SERVER_BACK_gistate &at[32]
-#define ID1SERVER_BACK_ids &at[33]
-#define ID1SERVER_BACK_ids_E &at[34]
-#define ID1SERVER_BACK_gihist &at[36]
-#define ID1SERVER_BACK_gihist_E &at[37]
-#define ID1SERVER_BACK_girevhist &at[38]
-#define ID1SERVER_BACK_girevhist_E &at[39]
-
-#define ID1SERVER_DEBUG &at[40]
-#define ID1SERVER_DEBUG_E &at[41]
+#define ID1SEQ_HIST &at[25]
+#define ID1SEQ_HIST_hist &at[26]
+
+#define ID1SERVER_BACK &at[27]
+#define ID1SERVER_BACK_init &at[28]
+#define ID1SERVER_BACK_error &at[29]
+#define ID1SERVER_BACK_gotgi &at[30]
+#define ID1SERVER_BACK_gotseqentry &at[31]
+#define ID1SERVER_BACK_gotdeadseqentry &at[32]
+#define ID1SERVER_BACK_fini &at[33]
+#define ID1SERVER_BACK_gistate &at[34]
+#define ID1SERVER_BACK_ids &at[35]
+#define ID1SERVER_BACK_ids_E &at[36]
+#define ID1SERVER_BACK_gihist &at[38]
+#define ID1SERVER_BACK_gihist_E &at[39]
+#define ID1SERVER_BACK_girevhist &at[40]
+#define ID1SERVER_BACK_girevhist_E &at[41]
+#define ID1SERVER_BACK_gotsewithinfo &at[42]
+#define ID1SERVER_BACK_gotblobinfo &at[57]
+
+#define ID1SEQENTRY_INFO &at[43]
+#define ID1SEQENTRY_INFO_blob_info &at[44]
+#define ID1SEQENTRY_INFO_blob &at[56]
+
+#define ID1BLOB_INFO &at[45]
+#define ID1BLOB_INFO_gi &at[46]
+#define ID1BLOB_INFO_sat &at[47]
+#define ID1BLOB_INFO_sat_key &at[48]
+#define ID1BLOB_INFO_satname &at[49]
+#define ID1BLOB_INFO_suppress &at[50]
+#define ID1BLOB_INFO_withdrawn &at[51]
+#define ID1BLOB_INFO_confidential &at[52]
+#define ID1BLOB_INFO_blob_state &at[53]
+#define ID1BLOB_INFO_comment &at[54]
+#define ID1BLOB_INFO_extfeatmask &at[55]
+
+#define ID1SERVER_DEBUG &at[58]
+#define ID1SERVER_DEBUG_E &at[59]
diff --git a/network/id1arch/id1arch.c b/network/id1arch/id1arch.c
index 0b9ffab0..39c58afd 100644
--- a/network/id1arch/id1arch.c
+++ b/network/id1arch/id1arch.c
@@ -134,7 +134,11 @@ s_ID1ArchSeqEntryGet (Int4 uid, CharPtr db, Int4 ent,Int4Ptr status, Int2 maxple
AsnIoReset(asnout);
ID1serverRequestFree (id1reqp);
- if ((id1bp = NetID1servReadAsn()) == NULL)
+ SeqMgrHoldIndexing(TRUE);
+ id1bp = NetID1servReadAsn();
+ SeqMgrHoldIndexing(FALSE);
+
+ if (id1bp == NULL)
return NULL;
if (id1bp->choice != ID1serverBack_gotseqentry &&
diff --git a/network/id1arch/id1gen.c b/network/id1arch/id1gen.c
index cecce98d..a5a2fa4f 100644
--- a/network/id1arch/id1gen.c
+++ b/network/id1arch/id1gen.c
@@ -32,7 +32,7 @@ id1genAsnLoad(void)
/**************************************************
* Generated object loaders for Module NCBI-ID1Access
-* Generated using ASNCODE Revision: 6.0 at Jul 30, 1998 4:04 PM
+* Generated using ASNCODE Revision: 6.0 at Mar 18, 2003 12:08 PM
*
**************************************************/
@@ -63,6 +63,12 @@ ID1serverRequestFree(ValNodePtr anp)
case ID1serverRequest_getsefromgi:
ID1serverMaxcomplexFree(anp -> data.ptrvalue);
break;
+ case ID1serverRequest_getsewithinfo:
+ ID1serverMaxcomplexFree(anp -> data.ptrvalue);
+ break;
+ case ID1serverRequest_getblobinfo:
+ ID1serverMaxcomplexFree(anp -> data.ptrvalue);
+ break;
}
return MemFree(anp);
}
@@ -169,6 +175,14 @@ ID1serverRequestAsnRead(AsnIoPtr aip, AsnTypePtr orig)
}
anp->data.intvalue = av.intvalue;
}
+ else if (atp == ID1SERVER_REQUEST_getsewithinfo) {
+ choice = ID1serverRequest_getsewithinfo;
+ func = (AsnReadFunc) ID1serverMaxcomplexAsnRead;
+ }
+ else if (atp == ID1SERVER_REQUEST_getblobinfo) {
+ choice = ID1serverRequest_getblobinfo;
+ func = (AsnReadFunc) ID1serverMaxcomplexAsnRead;
+ }
anp->choice = choice;
if (func != NULL)
{
@@ -262,6 +276,14 @@ ID1serverRequestAsnWrite(ID1serverRequestPtr anp, AsnIoPtr aip, AsnTypePtr orig)
av.intvalue = anp->data.intvalue;
retval = AsnWrite(aip, ID1SERVER_REQUEST_getgistate, &av);
break;
+ case ID1serverRequest_getsewithinfo:
+ writetype = ID1SERVER_REQUEST_getsewithinfo;
+ func = (AsnWriteFunc) ID1serverMaxcomplexAsnWrite;
+ break;
+ case ID1serverRequest_getblobinfo:
+ writetype = ID1SERVER_REQUEST_getblobinfo;
+ func = (AsnWriteFunc) ID1serverMaxcomplexAsnWrite;
+ break;
}
if (writetype != NULL) {
retval = (* func)(pnt, aip, writetype); /* write it out */
@@ -650,6 +672,12 @@ ID1serverBackFree(ValNodePtr anp)
case ID1serverBack_girevhist:
AsnGenericUserSeqOfFree((Pointer) pnt, (AsnOptFreeFunc) ID1SeqHistFree);
break;
+ case ID1serverBack_gotsewithinfo:
+ ID1SeqEntryInfoFree(anp -> data.ptrvalue);
+ break;
+ case ID1serverBack_gotblobinfo:
+ ID1blobInfoFree(anp -> data.ptrvalue);
+ break;
}
return MemFree(anp);
}
@@ -773,6 +801,14 @@ ID1serverBackAsnRead(AsnIoPtr aip, AsnTypePtr orig)
goto erret;
}
}
+ else if (atp == ID1SERVER_BACK_gotsewithinfo) {
+ choice = ID1serverBack_gotsewithinfo;
+ func = (AsnReadFunc) ID1SeqEntryInfoAsnRead;
+ }
+ else if (atp == ID1SERVER_BACK_gotblobinfo) {
+ choice = ID1serverBack_gotblobinfo;
+ func = (AsnReadFunc) ID1blobInfoAsnRead;
+ }
anp->choice = choice;
if (func != NULL)
{
@@ -871,6 +907,14 @@ ID1serverBackAsnWrite(ID1serverBackPtr anp, AsnIoPtr aip, AsnTypePtr orig)
case ID1serverBack_girevhist:
retval = AsnGenericUserSeqOfAsnWrite((Pointer) pnt, (AsnWriteFunc) ID1SeqHistAsnWrite, aip, ID1SERVER_BACK_girevhist, ID1SERVER_BACK_girevhist_E);
break;
+ case ID1serverBack_gotsewithinfo:
+ writetype = ID1SERVER_BACK_gotsewithinfo;
+ func = (AsnWriteFunc) ID1SeqEntryInfoAsnWrite;
+ break;
+ case ID1serverBack_gotblobinfo:
+ writetype = ID1SERVER_BACK_gotblobinfo;
+ func = (AsnWriteFunc) ID1blobInfoAsnWrite;
+ break;
}
if (writetype != NULL) {
retval = (* func)(pnt, aip, writetype); /* write it out */
@@ -888,6 +932,414 @@ erret:
/**************************************************
*
+* ID1SeqEntryInfoNew()
+*
+**************************************************/
+NLM_EXTERN
+ID1SeqEntryInfoPtr LIBCALL
+ID1SeqEntryInfoNew(void)
+{
+ ID1SeqEntryInfoPtr ptr = MemNew((size_t) sizeof(ID1SeqEntryInfo));
+
+ return ptr;
+
+}
+
+
+/**************************************************
+*
+* ID1SeqEntryInfoFree()
+*
+**************************************************/
+NLM_EXTERN
+ID1SeqEntryInfoPtr LIBCALL
+ID1SeqEntryInfoFree(ID1SeqEntryInfoPtr ptr)
+{
+
+ if(ptr == NULL) {
+ return NULL;
+ }
+ ID1blobInfoFree(ptr -> blob_info);
+ SeqEntryFree(ptr -> blob);
+ return MemFree(ptr);
+}
+
+
+/**************************************************
+*
+* ID1SeqEntryInfoAsnRead()
+*
+**************************************************/
+NLM_EXTERN
+ID1SeqEntryInfoPtr LIBCALL
+ID1SeqEntryInfoAsnRead(AsnIoPtr aip, AsnTypePtr orig)
+{
+ DataVal av;
+ AsnTypePtr atp;
+ Boolean isError = FALSE;
+ AsnReadFunc func;
+ ID1SeqEntryInfoPtr ptr;
+
+ if (! loaded)
+ {
+ if (! id1genAsnLoad()) {
+ return NULL;
+ }
+ }
+
+ if (aip == NULL) {
+ return NULL;
+ }
+
+ if (orig == NULL) { /* ID1SeqEntryInfo ::= (self contained) */
+ atp = AsnReadId(aip, amp, ID1SEQENTRY_INFO);
+ } else {
+ atp = AsnLinkType(orig, ID1SEQENTRY_INFO);
+ }
+ /* link in local tree */
+ if (atp == NULL) {
+ return NULL;
+ }
+
+ ptr = ID1SeqEntryInfoNew();
+ if (ptr == NULL) {
+ goto erret;
+ }
+ if (AsnReadVal(aip, atp, &av) <= 0) { /* read the start struct */
+ goto erret;
+ }
+
+ atp = AsnReadId(aip,amp, atp);
+ func = NULL;
+
+ if (atp == ID1SEQENTRY_INFO_blob_info) {
+ ptr -> blob_info = ID1blobInfoAsnRead(aip, atp);
+ if (aip -> io_failure) {
+ goto erret;
+ }
+ atp = AsnReadId(aip,amp, atp);
+ }
+ if (atp == ID1SEQENTRY_INFO_blob) {
+ ptr -> blob = SeqEntryAsnRead(aip, atp);
+ if (aip -> io_failure) {
+ goto erret;
+ }
+ atp = AsnReadId(aip,amp, atp);
+ }
+
+ if (AsnReadVal(aip, atp, &av) <= 0) {
+ goto erret;
+ }
+ /* end struct */
+
+ret:
+ AsnUnlinkType(orig); /* unlink local tree */
+ return ptr;
+
+erret:
+ aip -> io_failure = TRUE;
+ ptr = ID1SeqEntryInfoFree(ptr);
+ goto ret;
+}
+
+
+
+/**************************************************
+*
+* ID1SeqEntryInfoAsnWrite()
+*
+**************************************************/
+NLM_EXTERN Boolean LIBCALL
+ID1SeqEntryInfoAsnWrite(ID1SeqEntryInfoPtr ptr, AsnIoPtr aip, AsnTypePtr orig)
+{
+ DataVal av;
+ AsnTypePtr atp;
+ Boolean retval = FALSE;
+
+ if (! loaded)
+ {
+ if (! id1genAsnLoad()) {
+ return FALSE;
+ }
+ }
+
+ if (aip == NULL) {
+ return FALSE;
+ }
+
+ atp = AsnLinkType(orig, ID1SEQENTRY_INFO); /* link local tree */
+ if (atp == NULL) {
+ return FALSE;
+ }
+
+ if (ptr == NULL) { AsnNullValueMsg(aip, atp); goto erret; }
+ if (! AsnOpenStruct(aip, atp, (Pointer) ptr)) {
+ goto erret;
+ }
+
+ if (ptr -> blob_info != NULL) {
+ if ( ! ID1blobInfoAsnWrite(ptr -> blob_info, aip, ID1SEQENTRY_INFO_blob_info)) {
+ goto erret;
+ }
+ }
+ if (ptr -> blob != NULL) {
+ if ( ! SeqEntryAsnWrite(ptr -> blob, aip, ID1SEQENTRY_INFO_blob)) {
+ goto erret;
+ }
+ }
+ if (! AsnCloseStruct(aip, atp, (Pointer)ptr)) {
+ goto erret;
+ }
+ retval = TRUE;
+
+erret:
+ AsnUnlinkType(orig); /* unlink local tree */
+ return retval;
+}
+
+
+
+/**************************************************
+*
+* ID1blobInfoNew()
+*
+**************************************************/
+NLM_EXTERN
+ID1blobInfoPtr LIBCALL
+ID1blobInfoNew(void)
+{
+ ID1blobInfoPtr ptr = MemNew((size_t) sizeof(ID1blobInfo));
+
+ return ptr;
+
+}
+
+
+/**************************************************
+*
+* ID1blobInfoFree()
+*
+**************************************************/
+NLM_EXTERN
+ID1blobInfoPtr LIBCALL
+ID1blobInfoFree(ID1blobInfoPtr ptr)
+{
+
+ if(ptr == NULL) {
+ return NULL;
+ }
+ MemFree(ptr -> satname);
+ MemFree(ptr -> comment);
+ return MemFree(ptr);
+}
+
+
+/**************************************************
+*
+* ID1blobInfoAsnRead()
+*
+**************************************************/
+NLM_EXTERN
+ID1blobInfoPtr LIBCALL
+ID1blobInfoAsnRead(AsnIoPtr aip, AsnTypePtr orig)
+{
+ DataVal av;
+ AsnTypePtr atp;
+ Boolean isError = FALSE;
+ AsnReadFunc func;
+ ID1blobInfoPtr ptr;
+
+ if (! loaded)
+ {
+ if (! id1genAsnLoad()) {
+ return NULL;
+ }
+ }
+
+ if (aip == NULL) {
+ return NULL;
+ }
+
+ if (orig == NULL) { /* ID1blobInfo ::= (self contained) */
+ atp = AsnReadId(aip, amp, ID1BLOB_INFO);
+ } else {
+ atp = AsnLinkType(orig, ID1BLOB_INFO);
+ }
+ /* link in local tree */
+ if (atp == NULL) {
+ return NULL;
+ }
+
+ ptr = ID1blobInfoNew();
+ if (ptr == NULL) {
+ goto erret;
+ }
+ if (AsnReadVal(aip, atp, &av) <= 0) { /* read the start struct */
+ goto erret;
+ }
+
+ atp = AsnReadId(aip,amp, atp);
+ func = NULL;
+
+ if (atp == ID1BLOB_INFO_gi) {
+ if ( AsnReadVal(aip, atp, &av) <= 0) {
+ goto erret;
+ }
+ ptr -> gi = av.intvalue;
+ atp = AsnReadId(aip,amp, atp);
+ }
+ if (atp == ID1BLOB_INFO_sat) {
+ if ( AsnReadVal(aip, atp, &av) <= 0) {
+ goto erret;
+ }
+ ptr -> sat = av.intvalue;
+ atp = AsnReadId(aip,amp, atp);
+ }
+ if (atp == ID1BLOB_INFO_sat_key) {
+ if ( AsnReadVal(aip, atp, &av) <= 0) {
+ goto erret;
+ }
+ ptr -> sat_key = av.intvalue;
+ atp = AsnReadId(aip,amp, atp);
+ }
+ if (atp == ID1BLOB_INFO_satname) {
+ if ( AsnReadVal(aip, atp, &av) <= 0) {
+ goto erret;
+ }
+ ptr -> satname = av.ptrvalue;
+ atp = AsnReadId(aip,amp, atp);
+ }
+ if (atp == ID1BLOB_INFO_suppress) {
+ if ( AsnReadVal(aip, atp, &av) <= 0) {
+ goto erret;
+ }
+ ptr -> suppress = av.intvalue;
+ atp = AsnReadId(aip,amp, atp);
+ }
+ if (atp == ID1BLOB_INFO_withdrawn) {
+ if ( AsnReadVal(aip, atp, &av) <= 0) {
+ goto erret;
+ }
+ ptr -> withdrawn = av.intvalue;
+ atp = AsnReadId(aip,amp, atp);
+ }
+ if (atp == ID1BLOB_INFO_confidential) {
+ if ( AsnReadVal(aip, atp, &av) <= 0) {
+ goto erret;
+ }
+ ptr -> confidential = av.intvalue;
+ atp = AsnReadId(aip,amp, atp);
+ }
+ if (atp == ID1BLOB_INFO_blob_state) {
+ if ( AsnReadVal(aip, atp, &av) <= 0) {
+ goto erret;
+ }
+ ptr -> blob_state = av.intvalue;
+ atp = AsnReadId(aip,amp, atp);
+ }
+ if (atp == ID1BLOB_INFO_comment) {
+ if ( AsnReadVal(aip, atp, &av) <= 0) {
+ goto erret;
+ }
+ ptr -> comment = av.ptrvalue;
+ atp = AsnReadId(aip,amp, atp);
+ }
+ if (atp == ID1BLOB_INFO_extfeatmask) {
+ if ( AsnReadVal(aip, atp, &av) <= 0) {
+ goto erret;
+ }
+ ptr -> extfeatmask = av.intvalue;
+ atp = AsnReadId(aip,amp, atp);
+ }
+
+ if (AsnReadVal(aip, atp, &av) <= 0) {
+ goto erret;
+ }
+ /* end struct */
+
+ret:
+ AsnUnlinkType(orig); /* unlink local tree */
+ return ptr;
+
+erret:
+ aip -> io_failure = TRUE;
+ ptr = ID1blobInfoFree(ptr);
+ goto ret;
+}
+
+
+
+/**************************************************
+*
+* ID1blobInfoAsnWrite()
+*
+**************************************************/
+NLM_EXTERN Boolean LIBCALL
+ID1blobInfoAsnWrite(ID1blobInfoPtr ptr, AsnIoPtr aip, AsnTypePtr orig)
+{
+ DataVal av;
+ AsnTypePtr atp;
+ Boolean retval = FALSE;
+
+ if (! loaded)
+ {
+ if (! id1genAsnLoad()) {
+ return FALSE;
+ }
+ }
+
+ if (aip == NULL) {
+ return FALSE;
+ }
+
+ atp = AsnLinkType(orig, ID1BLOB_INFO); /* link local tree */
+ if (atp == NULL) {
+ return FALSE;
+ }
+
+ if (ptr == NULL) { AsnNullValueMsg(aip, atp); goto erret; }
+ if (! AsnOpenStruct(aip, atp, (Pointer) ptr)) {
+ goto erret;
+ }
+
+ av.intvalue = ptr -> gi;
+ retval = AsnWrite(aip, ID1BLOB_INFO_gi, &av);
+ av.intvalue = ptr -> sat;
+ retval = AsnWrite(aip, ID1BLOB_INFO_sat, &av);
+ av.intvalue = ptr -> sat_key;
+ retval = AsnWrite(aip, ID1BLOB_INFO_sat_key, &av);
+ if (ptr -> satname != NULL) {
+ av.ptrvalue = ptr -> satname;
+ retval = AsnWrite(aip, ID1BLOB_INFO_satname, &av);
+ }
+ av.intvalue = ptr -> suppress;
+ retval = AsnWrite(aip, ID1BLOB_INFO_suppress, &av);
+ av.intvalue = ptr -> withdrawn;
+ retval = AsnWrite(aip, ID1BLOB_INFO_withdrawn, &av);
+ av.intvalue = ptr -> confidential;
+ retval = AsnWrite(aip, ID1BLOB_INFO_confidential, &av);
+ av.intvalue = ptr -> blob_state;
+ retval = AsnWrite(aip, ID1BLOB_INFO_blob_state, &av);
+ if (ptr -> comment != NULL) {
+ av.ptrvalue = ptr -> comment;
+ retval = AsnWrite(aip, ID1BLOB_INFO_comment, &av);
+ }
+ av.intvalue = ptr -> extfeatmask;
+ retval = AsnWrite(aip, ID1BLOB_INFO_extfeatmask, &av);
+ if (! AsnCloseStruct(aip, atp, (Pointer)ptr)) {
+ goto erret;
+ }
+ retval = TRUE;
+
+erret:
+ AsnUnlinkType(orig); /* unlink local tree */
+ return retval;
+}
+
+
+
+/**************************************************
+*
* ID1serverDebugFree()
*
**************************************************/
@@ -913,7 +1365,7 @@ NLM_EXTERN
ID1serverDebugPtr LIBCALL
ID1serverDebugAsnRead(AsnIoPtr aip, AsnTypePtr orig)
{
-
+ DataVal av;
AsnTypePtr atp;
Boolean isError = FALSE;
AsnReadFunc func;
@@ -969,7 +1421,7 @@ erret:
NLM_EXTERN Boolean LIBCALL
ID1serverDebugAsnWrite(ID1serverDebugPtr ptr, AsnIoPtr aip, AsnTypePtr orig)
{
-
+ DataVal av;
AsnTypePtr atp;
Boolean retval = FALSE;
diff --git a/network/id1arch/id1gen.h b/network/id1arch/id1gen.h
index cb0988d2..f7cc4209 100644
--- a/network/id1arch/id1gen.h
+++ b/network/id1arch/id1gen.h
@@ -17,7 +17,7 @@ extern "C" { /* } */
/**************************************************
*
* Generated objects for Module NCBI-ID1Access
-* Generated using ASNCODE Revision: 6.0 at Jul 30, 1998 4:04 PM
+* Generated using ASNCODE Revision: 6.0 at Mar 18, 2003 12:08 PM
*
**************************************************/
@@ -33,6 +33,8 @@ typedef ValNode ID1serverRequest;
#define ID1serverRequest_getgihist 6
#define ID1serverRequest_getgirev 7
#define ID1serverRequest_getgistate 8
+#define ID1serverRequest_getsewithinfo 9
+#define ID1serverRequest_getblobinfo 10
NLM_EXTERN ID1serverRequestPtr LIBCALL ID1serverRequestFree PROTO ((ID1serverRequestPtr ));
@@ -89,6 +91,8 @@ typedef ValNode ID1serverBack;
#define ID1serverBack_ids 8
#define ID1serverBack_gihist 9
#define ID1serverBack_girevhist 10
+#define ID1serverBack_gotsewithinfo 11
+#define ID1serverBack_gotblobinfo 12
NLM_EXTERN ID1serverBackPtr LIBCALL ID1serverBackFree PROTO ((ID1serverBackPtr ));
@@ -99,6 +103,50 @@ NLM_EXTERN Boolean LIBCALL ID1serverBackAsnWrite PROTO (( ID1serverBackPtr , Asn
/**************************************************
*
+* ID1SeqEntryInfo
+*
+**************************************************/
+typedef struct struct_ID1SeqEntry_info {
+ struct struct_ID1blob_info PNTR blob_info;
+ ValNodePtr blob;
+} ID1SeqEntryInfo, PNTR ID1SeqEntryInfoPtr;
+
+
+NLM_EXTERN ID1SeqEntryInfoPtr LIBCALL ID1SeqEntryInfoFree PROTO ((ID1SeqEntryInfoPtr ));
+NLM_EXTERN ID1SeqEntryInfoPtr LIBCALL ID1SeqEntryInfoNew PROTO (( void ));
+NLM_EXTERN ID1SeqEntryInfoPtr LIBCALL ID1SeqEntryInfoAsnRead PROTO (( AsnIoPtr, AsnTypePtr));
+NLM_EXTERN Boolean LIBCALL ID1SeqEntryInfoAsnWrite PROTO (( ID1SeqEntryInfoPtr , AsnIoPtr, AsnTypePtr));
+
+
+
+/**************************************************
+*
+* ID1blobInfo
+*
+**************************************************/
+typedef struct struct_ID1blob_info {
+ Int4 gi;
+ Int4 sat;
+ Int4 sat_key;
+ CharPtr satname;
+ Int4 suppress;
+ Int4 withdrawn;
+ Int4 confidential;
+ Int4 blob_state;
+ CharPtr comment;
+ Int4 extfeatmask;
+} ID1blobInfo, PNTR ID1blobInfoPtr;
+
+
+NLM_EXTERN ID1blobInfoPtr LIBCALL ID1blobInfoFree PROTO ((ID1blobInfoPtr ));
+NLM_EXTERN ID1blobInfoPtr LIBCALL ID1blobInfoNew PROTO (( void ));
+NLM_EXTERN ID1blobInfoPtr LIBCALL ID1blobInfoAsnRead PROTO (( AsnIoPtr, AsnTypePtr));
+NLM_EXTERN Boolean LIBCALL ID1blobInfoAsnWrite PROTO (( ID1blobInfoPtr , AsnIoPtr, AsnTypePtr));
+
+
+
+/**************************************************
+*
* ID1serverDebug
*
**************************************************/
diff --git a/network/id1arch/idfetch.c b/network/id1arch/idfetch.c
index 3cd1d240..ce439e7a 100644
--- a/network/id1arch/idfetch.c
+++ b/network/id1arch/idfetch.c
@@ -25,6 +25,18 @@
* Author Karl Sirotkin
*
$Log: idfetch.c,v $
+ Revision 1.27 2003/03/28 18:48:39 yaschenk
+ tuning ObjMgr, adding STREAM_SEQ_PORT_FIRST to SeqEntryToGnbk
+
+ Revision 1.26 2003/01/29 23:08:19 yaschenk
+ fixing FASTA on far pointers
+
+ Revision 1.25 2003/01/21 22:27:23 kans
+ new CstType parameter for flatfile generator
+
+ Revision 1.24 2002/12/30 22:36:53 yaschenk
+ optimizing..
+
Revision 1.23 2002/11/07 17:21:55 yaschenk
switching ID1 to new displatcher
@@ -137,7 +149,13 @@
#include <ncbi.h>
#include <objsset.h>
#include <accid1.h>
+
+#if 0
#include <asn2ff.h>
+#else
+#include <asn2gnbk.h>
+#endif
+
#include <tofasta.h>
#include <ni_types.h>
#include <ni_lib.h>
@@ -206,6 +224,7 @@ int Numarg = sizeof(myargs)/sizeof(myargs[0]);
}
static Nlm_Int2 Nlm_WhichArg PROTO(( Nlm_Char which, Nlm_Int2 numargs, Nlm_ArgPtr ap));
+static void MyBioseqToFasta(BioseqPtr bsp, Pointer userdata);
Int4 giBuffer[1000];
int giBufferPos = 0;
@@ -338,6 +357,16 @@ Int2 Main()
has_trouble=TRUE;
goto FATAL;
}
+
+ { /** tuning ObjMgr **/
+ ObjMgrPtr omp;
+ omp=ObjMgrGet();
+ omp->maxtemp=500;
+ /*omp->maxobj=64000;*/
+ omp->autoclean = TRUE;
+
+ }
+
if(myargs[infotypearg].intvalue != 1)
{
outmode = "w";
@@ -375,14 +404,19 @@ Int2 Main()
if( has_trouble )
exit (1);
- if(fp_in || myargs[entrezqueryarg].strvalue || myargs[entrezqueryfilearg].strvalue)
- { /*** Statefull mode ***/
- putenv("CONN_STATELESS=FALSE"); /***NI_SetInterface(eNII_WWW);***/
- }
- else
- { /*** Stateless mode ***/
- putenv("CONN_STATELESS=TRUE"); /***NI_SetInterface(eNII_WWWDirect);***/
- }
+
+ if( fp_in
+ || myargs[entrezqueryarg].strvalue
+ || myargs[entrezqueryfilearg].strvalue
+ || myargs[outtypearg].intvalue == 3
+ || myargs[outtypearg].intvalue == 4
+ || myargs[outtypearg].intvalue == 5
+ ) { /*** Statefull mode ***/
+ putenv("CONN_STATELESS=FALSE");
+ }
+ else { /*** Stateless mode ***/
+ putenv("CONN_STATELESS=TRUE");
+ }
if(!ID1BioseqFetchEnable("idfetch",TRUE))
{
@@ -939,6 +973,7 @@ static Boolean IdFetch_func(Int4 gi,CharPtr db, Int4 ent,Int2 maxplex)
}
else
{
+ putenv("CONN_STATELESS=FALSE"); /*** some formats may ask a lot of information ***/
switch(myargs[outtypearg].intvalue)
{
case 1:
@@ -952,7 +987,12 @@ static Boolean IdFetch_func(Int4 gi,CharPtr db, Int4 ent,Int2 maxplex)
}
break;
case 3:
+#if 0
if(!SeqEntryToFlat(sep, fp, GENBANK_FMT, RELEASE_MODE)){
+#else
+ AssignIDsInEntity(0,OBJ_SEQENTRY,sep);
+ if(!SeqEntryToGnbk(sep,NULL,GENBANK_FMT,ENTREZ_MODE,0,SHOW_CONTIG_FEATURES|ONLY_NEAR_FEATURES,STREAM_SEQ_PORT_FIRST,0,NULL,fp)){
+#endif
ErrPostEx(SEV_WARNING,0,0,
"GenBank Format does not exist for this sequence ");
retval=FALSE;
@@ -960,7 +1000,12 @@ static Boolean IdFetch_func(Int4 gi,CharPtr db, Int4 ent,Int2 maxplex)
}
break;
case 4:
+#if 0
if(!SeqEntryToFlat(sep, fp, GENPEPT_FMT, RELEASE_MODE))
+#else
+ AssignIDsInEntity(0,OBJ_SEQENTRY,sep);
+ if(!SeqEntryToGnbk(sep,NULL,GENPEPT_FMT,ENTREZ_MODE,0,SHOW_CONTIG_FEATURES|ONLY_NEAR_FEATURES,STREAM_SEQ_PORT_FIRST,0,NULL,fp))
+#endif
{
ErrPostEx(SEV_WARNING,0,0,
"GenPept Format does not exist for this sequence");
@@ -975,12 +1020,21 @@ static Boolean IdFetch_func(Int4 gi,CharPtr db, Int4 ent,Int2 maxplex)
switch(myargs[infotypearg].intvalue){
case 0:
if(bsp){
+#if 0
SeqEntrysToFasta (sep, fp, ISA_na (bsp->mol), group_segs);
+#else
+ MyBioseqToFasta(bsp,(Pointer)fp);
+#endif
}
else
{
+#if 0
SeqEntryToFasta(sep, fp, TRUE); /* nuc acids */
SeqEntryToFasta(sep, fp, FALSE); /* proteins */
+#else
+ VisitBioseqsInSep(sep,(Pointer)fp, MyBioseqToFasta);
+
+#endif
}
break;
case 2:
@@ -1001,11 +1055,13 @@ DONE:
{
static Uint2 reap_cnt;
BioseqUnlock(bsp);
+#if 0
reap_cnt++;
if(reap_cnt > 128){
ObjMgrFreeCache(0);
reap_cnt=0;
}
+#endif
}
else if(sep)
{
@@ -1108,3 +1164,42 @@ static Int4 BEGetUidsFromQuery(CharPtr query, Uint4Ptr PNTR uids,
return count;
}
+#define FASTA_LINE_SIZE 70
+#define FASTA_LINES_IN_CHUNK 5000
+
+static void
+MyBioseqToFasta(BioseqPtr bsp, Pointer userdata)
+{
+ SeqPortPtr spp=NULL;
+ Char buf[2048];
+ Char str[200];
+ ValNodePtr vnp;
+ MolInfoPtr mip=NULL;
+ FILE PNTR fp=(FILE PNTR)userdata;
+ Int4 start=0,step=FASTA_LINE_SIZE*FASTA_LINES_IN_CHUNK,stop;
+
+ for(vnp=bsp->descr;vnp;vnp=vnp->next){
+ if(vnp->choice==Seq_descr_molinfo){
+ mip = (MolInfoPtr)(vnp->data.ptrvalue);
+ }
+ }
+ SeqIdWrite(bsp->id,str,PRINTID_FASTA_LONG,199);
+ if(!CreateDefLine(NULL, bsp, buf, sizeof(buf), mip?mip->tech:0, NULL, NULL)) return;
+ fprintf(fp, ">%s %s\n", str,buf);
+ while(start < bsp->length){
+ stop=start+step-1;
+ if(stop >= bsp->length) stop=bsp->length-1;
+ spp = SeqPortNew(bsp,start,stop,0, (ISA_na(bsp->mol))?Seq_code_iupacna:Seq_code_ncbieaa);
+ if(spp==NULL) return;
+ SeqPortSet_do_virtual(spp, TRUE);
+ while (FastaSeqLineEx(spp, buf, FASTA_LINE_SIZE, ISA_na(bsp->mol),TRUE)) {
+ fprintf(fp,"%s\n", buf);
+ buf[0] = '\0';
+ }
+ if(spp) {
+ SeqPortFree(spp);
+ spp=NULL;
+ }
+ start=stop+1;
+ }
+}
diff --git a/network/medarch/client/medutil.c b/network/medarch/client/medutil.c
index 4cb50b0a..7914ea5e 100644
--- a/network/medarch/client/medutil.c
+++ b/network/medarch/client/medutil.c
@@ -28,7 +28,7 @@
*
* Version Creation Date: 8/31/93
*
-* $Revision: 6.6 $
+* $Revision: 6.8 $
*
* File Description: Medline Utilities for MedArch
* Assumes user calls MedArchInit and Fini
@@ -44,6 +44,12 @@
*
* RCS Modification History:
* $Log: medutil.c,v $
+* Revision 6.8 2003/03/25 19:14:59 bazhin
+* Function "ten_authors()" became public (from static).
+*
+* Revision 6.7 2003/03/12 20:35:02 bazhin
+* "ten_authors()" function now can handle consortiums.
+*
* Revision 6.6 2001/03/08 12:47:44 ostell
* made FixPub work if no medline uid returned, but pmid is returned.
*
@@ -248,7 +254,7 @@ void print_pub(ValNodePtr pub, Boolean found, Boolean auth, Int4 muid)
* ten_authors
*
****************************************************************************/
-static Boolean ten_authors(CitArtPtr art, CitArtPtr art_tmp)
+Boolean ten_authors(CitArtPtr art, CitArtPtr art_tmp)
{
Int2 num, numnew, i, match, n;
ValNodePtr v;
@@ -273,8 +279,13 @@ static Boolean ten_authors(CitArtPtr art, CitArtPtr art_tmp)
for (v = art_tmp->authors->names; v != NULL && numnew < 10;
v = v->next, numnew++) {
aup = v->data.ptrvalue;
- namestd = aup->name->data;
- mu[numnew] = namestd->names[0];
+ if(aup->name->choice == 2)
+ {
+ namestd = aup->name->data;
+ mu[numnew] = namestd->names[0];
+ }
+ else if(aup->name->choice == 5)
+ mu[numnew] = aup->name->data;
}
}
@@ -283,8 +294,15 @@ static Boolean ten_authors(CitArtPtr art, CitArtPtr art_tmp)
no_compare = FALSE;
for (v = art->authors->names; v != NULL; v = v->next) {
aup = v->data.ptrvalue;
- namestd = aup->name->data;
- ptr = namestd->names[0];
+ if(aup->name->choice == 2)
+ {
+ namestd = aup->name->data;
+ ptr = namestd->names[0];
+ }
+ else if(aup->name->choice == 5)
+ ptr = aup->name->data;
+ else
+ continue;
for (i = 0; i < numnew; i++) {
if (StringICmp(ptr, mu[i]) == 0) {
match++;
diff --git a/network/medarch/client/medutil.h b/network/medarch/client/medutil.h
index da27786a..daf20b22 100644
--- a/network/medarch/client/medutil.h
+++ b/network/medarch/client/medutil.h
@@ -29,7 +29,7 @@
*
* Version Creation Date: 8/31/93
*
-* $Revision: 6.1 $
+* $Revision: 6.2 $
*
* File Description: * File Description: Medline Utilities for MedArch
* Assumes user calls MedArchInit and Fini
@@ -45,6 +45,9 @@
*
* RCS Modification History:
* $Log: medutil.h,v $
+* Revision 6.2 2003/03/25 19:14:50 bazhin
+* Function "ten_authors()" became public (from static).
+*
* Revision 6.1 2000/08/18 17:01:02 kans
* added FetchPubPmId, enhanced FixPubEquiv to handle records with pmid but no muid
*
@@ -127,6 +130,7 @@ ValNodePtr MedlineToISO PROTO((ValNodePtr tmp));
ValNodePtr get_std_auth PROTO((CharPtr token, Uint1 format));
Boolean in_press PROTO ((CitArtPtr cit));
+Boolean ten_authors PROTO((CitArtPtr art, CitArtPtr art_tmp));
#ifdef __cplusplus
}
diff --git a/network/nsclilib/ni_msg.c b/network/nsclilib/ni_msg.c
index 5f43dba5..326392e7 100644
--- a/network/nsclilib/ni_msg.c
+++ b/network/nsclilib/ni_msg.c
@@ -29,7 +29,7 @@
*
* Version Creation Date: 1/1/92
*
-* $Revision: 6.2 $
+* $Revision: 6.3 $
*
* File Description:
* This file consists mostly of functions for creating, destroying, reading,
@@ -138,6 +138,9 @@
*
* RCS Modification History:
* $Log: ni_msg.c,v $
+* Revision 6.3 2002/12/17 23:01:36 kans
+* support for OS_UNIX_DARWIN for Mach-O executables (RGS)
+*
* Revision 6.2 2001/08/29 18:00:01 juran
* Under Carbon, define missing POSIX macros in terms of Mac counterparts.
*
@@ -191,7 +194,7 @@ static char * _this_file = __FILE__;
#include "ni_msg.h"
#include "ni_asn.h" /* produced by ASNTOOL */
-#if TARGET_API_MAC_CARBON
+#if TARGET_API_MAC_CARBON && !defined(O_NDELAY)
#define O_NDELAY kO_NDELAY
#endif
diff --git a/network/nsclilib/readme b/network/nsclilib/readme
index 8b3894d8..15a8a0b0 100644
--- a/network/nsclilib/readme
+++ b/network/nsclilib/readme
@@ -81,14 +81,15 @@ Value:
| on your proxy firewall server to those of NCBI
| (see in http://www.ncbi.nlm.nih.gov/cpp/network/firewall.html).
| Thus the mapping on your non-transparent firewall server
-| shoul look like this:
+| should look like this:
|
-| SRV_PROXY_HOST:5853 --> 130.14.22.1:5853 RETIRED -- DO NOT USE!
-| SRV_PROXY_HOST:5859 --> 130.14.22.2:5859 RETIRED -- DO NOT USE!
-| SRV_PROXY_HOST:5840 --> 130.14.22.8:5840 RETIRED -- DO NOT USE!
-| SRV_PROXY_HOST:5810 --> 130.14.22.30:5810 RETIRED -- DO NOT USE!
-| SRV_PROXY_HOST:5812 --> 130.14.22.31:5812
-| SRV_PROXY_HOST:5811 --> 130.14.22.32:5811
+| SRV_PROXY_HOST:5853 --> 130.14.22.1:5853 RETIRED -- DO NOT USE!
+| SRV_PROXY_HOST:5859 --> 130.14.22.2:5859 RETIRED -- DO NOT USE!
+| SRV_PROXY_HOST:5840 --> 130.14.22.8:5840 RETIRED -- DO NOT USE!
+| SRV_PROXY_HOST:5810 --> 130.14.22.30:5810 RETIRED -- DO NOT USE!
+| SRV_PROXY_HOST:5812 --> 130.14.22.31:5812
+| SRV_PROXY_HOST:5811 --> 130.14.22.32:5811
+| SRV_PROXY_HOST:5850..5860 --> 130.14.29.112:5850..5860(for future extensions)
|
| NOTE: It's pretty rare (if ever) when you have to use
| "SRV_PROXY_HOST" as most of firewalls are "transparent"
@@ -187,4 +188,4 @@ Solaris or IRIX. Then, the client must run on the host that:
a) belongs to one of NCBI subnets and
b) has "lbdaemon"(load-balance daemon) application running on it.
-$Date: 2002/09/07 02:00:28 $
+$Date: 2003/02/08 17:51:14 $
diff --git a/network/taxon1/common/taxinc.h b/network/taxon1/common/taxinc.h
index ae2017bf..f96ecbae 100644
--- a/network/taxon1/common/taxinc.h
+++ b/network/taxon1/common/taxinc.h
@@ -187,6 +187,14 @@ Int4 tax1_getTaxId4GI(Int4 gi);
*/
CharPtr tax1m_getBlastName(Int4 tax_id);
+/*---------------------------------------------
+ * Find out is taxonomy lookup system inited or not
+ * Returns: TRUE - alive
+ * FALSE - dead
+ */
+
+Boolean tax1_inited(void);
+
#ifdef __cplusplus
/* { */ }
diff --git a/network/taxon1/taxon2/tc2proc.c b/network/taxon1/taxon2/tc2proc.c
index f7b24cbc..7861336f 100644
--- a/network/taxon1/taxon2/tc2proc.c
+++ b/network/taxon1/taxon2/tc2proc.c
@@ -1,5 +1,5 @@
/*----------------*/
-/* $Id: tc2proc.c,v 1.23 2002/10/18 19:48:51 soussov Exp $ */
+/* $Id: tc2proc.c,v 1.28 2003/03/05 21:32:00 soussov Exp $ */
/*----------------*/
#include <stdlib.h>
@@ -17,6 +17,8 @@
#define ORGMOD_gb_acronym 32
#define ORGMOD_gb_anamorph 33
#define ORGMOD_gb_synonym 34
+#define ORGMOD_anamorph 29
+#define ORGMOD_synonym 28
static TreePtr tax_tree= NULL;
@@ -204,6 +206,7 @@ int CloseTaxDB(void)
}
}
}
+ tax_tree= NULL;
return 1;
}
@@ -766,74 +769,79 @@ static Int2 getSubtypeFromName(CharPtr name)
{
CharPtr c;
if(strchr(name, '.') == NULL) return 0;
+
+ /* ignore subsp. cf. and subsp. aff. */
+ if (StringStr (name, "subsp. cf.") != NULL) return 0;
+ if (StringStr (name, "subsp. aff.") != NULL) return 0;
+
/* check for subsp */
c= StringStr(name, "subsp.");
- if(c) {
+ if(c == name) {
rmWord(name, c, 6);
return 22;
}
c= StringStr(name, "ssp.");
- if(c) {
+ if(c == name) {
rmWord(name, c, 4);
return 22;
}
c= StringStr(name, "f. sp.");
- if(c) {
+ if(c == name) {
rmWord(name, c, 6);
return 26;
}
c= StringStr(name, "f.sp.");
- if(c) {
+ if(c == name) {
rmWord(name, c, 5);
return 26;
}
c= StringStr(name, "str.");
- if(c) {
+ if(c == name) {
rmWord(name, c, 4);
return 2;
}
c= StringStr(name, "substr.");
- if(c) {
+ if(c == name) {
rmWord(name, c, 7);
return 3;
}
c= StringStr(name, "var.");
- if(c) {
+ if(c == name) {
rmWord(name, c, 4);
return 6;
}
c= StringStr(name, "sv.");
- if(c) {
+ if(c == name) {
rmWord(name, c, 3);
return 9;
}
c= StringStr(name, "cv.");
- if(c) {
+ if(c == name) {
rmWord(name, c, 3);
return 10;
}
c= StringStr(name, "pv.");
- if(c) {
+ if(c == name) {
rmWord(name, c, 3);
return 11;
}
c= StringStr(name, "bv.");
- if(c) {
+ if(c == name) {
rmWord(name, c, 3);
return 13;
}
c= StringStr(name, "f.");
- if(c) {
+ if(c == name) {
rmWord(name, c, 2);
return 25;
}
c= StringStr(name, "fo.");
- if(c) {
+ if(c == name) {
rmWord(name, c, 3);
return 25;
}
c= StringStr(name, "grp.");
- if(c) {
+ if(c == name) {
rmWord(name, c, 4);
return 15;
}
@@ -1380,7 +1388,7 @@ static OrgRefPtr getFromBuff(Int4 id, int* is_sp, int* is_uncult, NameListPtr* b
return orp;
}
-static OrgModPtr fixModifier(Int4 tax_id, OrgModPtr omp)
+static OrgModPtr fixModifier(Int4 tax_id, OrgModPtr omp, CharPtr taxname)
{
_subspec src_ss;
_subspecPtr ss= NULL;
@@ -1395,7 +1403,15 @@ static OrgModPtr fixModifier(Int4 tax_id, OrgModPtr omp)
OrgModFree(omp);
return NULL;
}
-
+
+ if((omp->subtype == ORGMOD_anamorph ||
+ omp->subtype == ORGMOD_synonym) &&
+ StringICmp(omp->subname, taxname) == 0) {
+ omp->next= NULL;
+ OrgModFree(omp);
+ return NULL;
+ }
+
if((omp->subname != NULL) && (omp->subtype != 0)) {
src_ss.stype= omp->subtype;
@@ -1426,13 +1442,13 @@ static OrgModPtr fixModifier(Int4 tax_id, OrgModPtr omp)
return omp;
}
-static void CleanOrgMod(Int4 tax_id, OrgNamePtr onp)
+static void CleanOrgMod(Int4 tax_id, OrgNamePtr onp, CharPtr taxname)
{
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) {
+ if((omp= fixModifier(tax_id, omp, taxname)) == NULL) {
/* exclude this modifier */
if(omp_p == NULL) {
onp->mod= omp_n;
@@ -1443,13 +1459,13 @@ static void CleanOrgMod(Int4 tax_id, OrgNamePtr onp)
}
}
-static void cleanOrgName(Int4 tax_id, OrgNamePtr onp)
+static void cleanOrgName(Int4 tax_id, OrgNamePtr onp, CharPtr taxname)
{
if(onp->lineage != NULL) onp->lineage= MemFree(onp->lineage);
if(onp->div != NULL) onp->div= MemFree(onp->div);
#if 1
/* #if 0 means that we will trust to initial modifier */
- if(onp->mod != NULL) CleanOrgMod(tax_id, onp);
+ if(onp->mod != NULL) CleanOrgMod(tax_id, onp, taxname);
#endif
if(onp->next != NULL) OrgNameSetFree(onp->next);
if(onp->data != NULL) {
@@ -1536,7 +1552,7 @@ static int subtypeConflict(Int2 t1, Int2 t2)
return 0;
}
-static void mergeOrgMod(OrgModPtr omp, OrgModPtr src)
+static void mergeOrgMod(OrgModPtr omp, OrgModPtr src, int need_copy)
{
if(src == NULL) return;
else {
@@ -1544,18 +1560,31 @@ static void mergeOrgMod(OrgModPtr omp, OrgModPtr src)
for(dst= omp; dst != NULL; dst= dst->next) {
lst= dst;
if(subtypeConflict((Int2)dst->subtype, (Int2)src->subtype)) {
- mergeOrgMod(omp, src->next);
+ lst= src->next;
+ if(!need_copy) {
+ src->next= NULL;
+ OrgModFree(src);
+ }
+ mergeOrgMod(omp, lst, need_copy);
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;
+ if(need_copy) {
+ 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;
+ lst= src->next;
+ }
+ else {
+ lst->next= src;
+ lst= src->next;
+ src->next= NULL;
+ }
- mergeOrgMod(omp, src->next);
+ mergeOrgMod(omp, lst, need_copy);
}
}
@@ -1644,7 +1673,7 @@ static void bldOrgRefOut(OrgRefPtr dst, OrgRefPtr src, Int4 tax_id)
if(onp->mod == NULL) onp->mod= copyOrgMod(src->orgname->mod);
else {
- mergeOrgMod(onp->mod, src->orgname->mod);
+ mergeOrgMod(onp->mod, src->orgname->mod, 1);
}
onp->lineage= (src->orgname->lineage != NULL)? StringSave(src->orgname->lineage) : NULL;
onp->gcode= src->orgname->gcode;
@@ -1652,33 +1681,80 @@ static void bldOrgRefOut(OrgRefPtr dst, OrgRefPtr src, Int4 tax_id)
onp->div= StringSave(src->orgname->div);
}
-static void populateReplaced(OrgRefPtr orp, CharPtr oldName)
+static void populateReplaced(OrgRefPtr orp, OrgModPtr hitName)
{
- OrgNamePtr onp;
- OrgModPtr omp;
+ OrgModPtr omp, srv_mod;
- if((orp->taxname != NULL) && (StringICmp(orp->taxname, oldName) == 0)) {
- MemFree(oldName);
- return;
- }
+ if(hitName == NULL) return;
- if((orp->common != NULL) && (StringICmp(orp->common, oldName) == 0)) {
- MemFree(oldName);
- return;
+ /* find the real hitName */
+ if (hitName->subtype == 254) {
+ srv_mod= hitName->next;
+ hitName->next= NULL;
}
+ else {
+ srv_mod= hitName;
+ for(omp= hitName, hitName= hitName->next; hitName; hitName= hitName->next) {
+ if(hitName->subtype == 254) {
+ omp->next= hitName->next;
+ hitName->next= NULL;
+ break;
+ }
+ else {
+ omp= hitName;
+ }
+ }
+ }
+
- /* 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;
+ if(orp->orgname->mod) {
+ mergeOrgMod(orp->orgname->mod, srv_mod, 0);
}
else {
- MemFree(oldName);
+ orp->orgname->mod= srv_mod;
}
+
+
+ if(hitName == NULL) return;
+
+ for(omp= orp->orgname->mod; omp != NULL; omp= omp->next) {
+ if(omp->subtype == 254) { /* search name is populated already */
+ if((omp->attrib == NULL) && (hitName->attrib != NULL) &&
+ (StringICmp(omp->subname, hitName->subname) == 0)) {
+ omp->attrib= hitName->attrib;
+ hitName->attrib= NULL;
+ }
+ OrgModFree(hitName);
+ return;
+ }
+ }
+
+ if((orp->taxname != NULL) && (StringICmp(orp->taxname, hitName->subname) == 0)) {
+ /* we probably don't need to populate search name */
+ if(hitName->attrib == NULL) {
+ OrgModFree(hitName);
+ return;
+ }
+ else {
+ Uint1 st= atoi(hitName->attrib+1);
+ char* sn= strchr(hitName->attrib, '=');
+ if(sn == NULL) {
+ OrgModFree(hitName);
+ return;
+ }
+ ++sn;
+ for(omp= orp->orgname->mod; omp != NULL; omp= omp->next) {
+ if((omp->subtype == st) && (StringICmp(omp->subname, sn) == 0)) {
+ OrgModFree(hitName);
+ return;
+ }
+ }
+ }
+ }
+
+ /* adding this modifier */
+ hitName->next= orp->orgname->mod;
+ orp->orgname->mod= hitName;
}
Taxon2DataPtr tax1m_lookup(OrgRefPtr inp_orgRef, int merge)
@@ -1689,10 +1765,9 @@ Taxon2DataPtr tax1m_lookup(OrgRefPtr inp_orgRef, int merge)
int is_species;
int is_uncultured;
NameListPtr bl;
- Boolean need_search_name= TRUE;
- CharPtr hit_name;
+ OrgModPtr hitName;
- tax_id= tax1_getTaxIdByOrgRef(inp_orgRef);
+ tax_id= txc_findByOrg(inp_orgRef, &hitName);
if(tax_id <= 0) return NULL;
db_orgRef= s_tax1_getOrgRef(tax_id, &is_species, &is_uncultured, &bl);
if(db_orgRef == NULL) return NULL;
@@ -1702,47 +1777,6 @@ Taxon2DataPtr tax1m_lookup(OrgRefPtr inp_orgRef, int merge)
res->is_uncultured= is_uncultured;
res->blast_name= make_blast_name(bl);
- /* 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(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(need_search_name && (inp_orgRef->orgname != NULL)) {
- /* 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;
- }
- }
- }
-
- 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(merge) {
/* we have to merge old orgref with the new one */
res->org= inp_orgRef;
@@ -1750,7 +1784,8 @@ Taxon2DataPtr tax1m_lookup(OrgRefPtr inp_orgRef, int merge)
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);
+ if(inp_orgRef->orgname != NULL) cleanOrgName(tax_id, inp_orgRef->orgname,
+ db_orgRef->taxname);
}
else {
/* make new orgref */
@@ -1760,7 +1795,7 @@ Taxon2DataPtr tax1m_lookup(OrgRefPtr inp_orgRef, int merge)
}
/* fill-up orgref based on db_orgRef */
bldOrgRefOut(res->org, db_orgRef, tax_id);
- if(need_search_name && (hit_name != NULL)) populateReplaced(res->org, hit_name);
+ populateReplaced(res->org, hitName);
return res;
}
@@ -1770,10 +1805,11 @@ Taxon1DataPtr tax1_lookup(OrgRefPtr inp_orgRef, int merge)
Int4 tax_id;
OrgRefPtr db_orgRef;
int is_species;
- Boolean need_search_name= TRUE;
- CharPtr hit_name;
+ OrgModPtr hitName;
- tax_id= tax1_getTaxIdByOrgRef(inp_orgRef);
+ tax_id= txc_findByOrg(inp_orgRef, &hitName);
+
+ //tax_id= tax1_getTaxIdByOrgRef(inp_orgRef);
if(tax_id <= 0) return NULL;
db_orgRef= s_tax1_getOrgRef(tax_id, &is_species, NULL, NULL);
if(db_orgRef == NULL) return NULL;
@@ -1783,47 +1819,6 @@ Taxon1DataPtr tax1_lookup(OrgRefPtr inp_orgRef, int merge)
res->embl_code= NULL;
res->div= (db_orgRef->orgname != NULL)? StringSave(db_orgRef->orgname->div) : NULL;
- /* 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(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(need_search_name && (inp_orgRef->orgname != NULL)) {
- /* 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;
- }
- }
- }
-
- 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(merge) {
/* we have to merge old orgref with the new one */
res->org= inp_orgRef;
@@ -1831,7 +1826,8 @@ Taxon1DataPtr tax1_lookup(OrgRefPtr inp_orgRef, int merge)
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);
+ if(inp_orgRef->orgname != NULL) cleanOrgName(tax_id, inp_orgRef->orgname,
+ db_orgRef->taxname);
}
else {
/* make new orgref */
@@ -1841,7 +1837,7 @@ Taxon1DataPtr tax1_lookup(OrgRefPtr inp_orgRef, int merge)
}
/* fill-up orgref based on db_orgRef */
bldOrgRefOut(res->org, db_orgRef, tax_id);
- if(need_search_name && (hit_name != NULL)) populateReplaced(res->org, hit_name);
+ populateReplaced(res->org, hitName);
return res;
}
@@ -2162,6 +2158,7 @@ Int4 tax1e_needUpdate(OrgRefPtr inp_orgRef)
Boolean tax1_isAlive(void)
{
+ if(!tax1_inited()) return FALSE;
return (tax1_getTaxIdByName("dog") > 1)? TRUE : FALSE;
}
@@ -2204,3 +2201,8 @@ CharPtr tax1m_getBlastName(Int4 tax_id)
tree_closeCursor(cursor);
return res;
}
+
+Boolean tax1_inited()
+{
+ return (tax_tree != NULL)? TRUE : FALSE;
+}
diff --git a/network/taxon1/taxon2/txcdproc.c b/network/taxon1/taxon2/txcdproc.c
index 760ff7d1..ca27b0bb 100644
--- a/network/taxon1/taxon2/txcdproc.c
+++ b/network/taxon1/taxon2/txcdproc.c
@@ -29,7 +29,7 @@
*
* Version Creation Date: 07/15/97
*
-* $Revision: 1.12 $
+* $Revision: 1.14 $
*
* File Description:
* API for Taxonomy service
@@ -44,6 +44,12 @@
*
* RCS Modification History:
* $Log: txcdproc.c,v $
+* Revision 1.14 2003/03/06 16:30:32 kans
+* tdp->org needed a cast to (OrgRefPtr) due to Mac compiler complaint
+*
+* Revision 1.13 2003/03/05 21:32:00 soussov
+* new lookup procedure
+*
* Revision 1.12 2001/09/28 15:53:15 soussov
* tax1e_maxTaxId() added
*
@@ -1453,3 +1459,81 @@ Int4 tax1e_maxTaxId()
return tax_id;
}
+
+static OrgRefPtr s_findbyorg(OrgRefPtr orgRef)
+{
+ Taxon1ReqPtr taxrp;
+ Taxon1RespPtr taxbp;
+ Taxon1DataPtr tdp;
+
+ if((taxrp= ValNodeNew(NULL)) == NULL) return 0;
+ taxrp->choice= Taxon1Req_lookup;
+ taxrp->data.ptrvalue= orgRef;
+ Taxon1ReqAsnWrite(taxrp, asnout, NULL);
+ AsnIoReset(asnout);
+ taxrp->data.ptrvalue= NULL;
+ Taxon1ReqFree(taxrp);
+
+ if((taxbp= NetTaxArchReadAsn()) == NULL) return 0;
+
+ if(taxbp->choice != Taxon1Resp_lookup) {
+ report_service_error("txc_getTaxIdByOrgRef", taxbp);
+ Taxon1RespFree(taxbp);
+ return NULL;
+ }
+
+ tdp= taxbp->data.ptrvalue;
+ orgRef= (OrgRefPtr) tdp->org;
+ tdp->org= NULL;
+ Taxon1RespFree(taxbp);
+
+ return orgRef;
+}
+
+Int4 txc_findByOrg(OrgRefPtr inp_orgRef, OrgModPtr* hitName)
+{
+ Int4 i;
+ short erract;
+ ErrDesc err;
+ OrgRefPtr orp= NULL;
+ Int4 tax_id= 0;
+
+ if(tax_track) tax_time1= clock();
+ for (i= TAXARCH_SERV_RETRIES; i >= 0; --i) {
+ ErrGetOpts(&erract, NULL);
+ ErrSetOpts(ERR_IGNORE, 0);
+ ErrFetch(&err);
+
+ orp = s_findbyorg(inp_orgRef);
+
+ ErrSetOpts(erract, 0);
+ if (!ErrFetch(&err)) break; /* success */
+
+ if(!ReestablishNetTaxArch()) break;
+ }
+
+ if(tax_track) {
+ double diff= (double)(clock() - tax_time1)/CLOCKS_PER_SEC;
+ printf("tax1_getTaxIdByOrgRef() %f\n", diff);
+ }
+
+ if(orp && orp->db) {
+ ValNodePtr vnp= orp->db;
+ DbtagPtr dbtag= vnp->data.ptrvalue;
+ ObjectIdPtr object_id= dbtag->tag;
+ tax_id= object_id->id;
+
+ if(hitName) {
+ if(orp->orgname) {
+ *hitName= orp->orgname->mod;
+ orp->orgname->mod= NULL;
+ }
+ else *hitName= NULL;
+ }
+ }
+
+ if(orp) OrgRefFree(orp);
+
+ return tax_id;
+}
+
diff --git a/network/taxon1/taxon2/txclient.h b/network/taxon1/taxon2/txclient.h
index 711614c9..8060d02f 100644
--- a/network/taxon1/taxon2/txclient.h
+++ b/network/taxon1/taxon2/txclient.h
@@ -31,6 +31,9 @@
*
*
* $Log: txclient.h,v $
+* Revision 1.7 2003/03/05 21:32:00 soussov
+* new lookup procedure
+*
* Revision 1.6 1998/07/23 18:27:01 soussov
* one prototype added
*
@@ -168,6 +171,7 @@ Boolean te_saveEditWindows(void);
#ifdef TAXSERVICE
Int4 txc_getTaxIdByOrgRef(OrgRefPtr orgRef);
+Int4 txc_findByOrg(OrgRefPtr inp_orgRef, OrgModPtr* hitName);
#endif
_subspecPtr tax_SSgetAll(Int4 tax_id);
@@ -175,4 +179,5 @@ _subspecPtr tax_SSget(Int4 tax_id, _subspecPtr ssrec);
tax_OrgModPtr tax_SSgetLegal(Int4 tax_id);
Int4 tax_SSgetNodes(Uint1 stype, CharPtr sname, Uint1 mode, Int4Ptr* ids);
+
#endif
diff --git a/network/taxon1/taxon2/txcproc.c b/network/taxon1/taxon2/txcproc.c
index 122ea296..e9fc9481 100644
--- a/network/taxon1/taxon2/txcproc.c
+++ b/network/taxon1/taxon2/txcproc.c
@@ -31,6 +31,9 @@
*
*
* $Log: txcproc.c,v $
+* Revision 1.7 2003/03/05 21:32:00 soussov
+* new lookup procedure
+*
* Revision 1.6 1999/12/20 17:05:17 soussov
* taxid4gi added
*
@@ -2592,3 +2595,9 @@ Int4 tax_getTaxId4GI(Int4 gi)
ct_cmd_drop(cmd);
return tax_id;
}
+
+Int4 txc_findByOrg(OrgRefPtr inp_orgRef, OrgModPtr* hitName)
+{
+ if(hitName) *hitName= NULL;
+ return tax1_getTaxIdByOrgRef(inp_orgRef);
+}