Esempio n. 1
0
static void DoTitle (SeqDescrPtr vnp, Pointer userdata)

{
  Char         ch;
  CharPtr      ptr, str, tmp;
  ScanDataPtr  sdp;

  if (vnp->choice != Seq_descr_title) return;
  str = (CharPtr) vnp->data.ptrvalue;
  if (StringHasNoText (str)) return;

  sdp = (ScanDataPtr) userdata;

  tmp = str;
  ptr = StringStr (tmp, "complete ");
  while (ptr != NULL) {
    tmp = ptr + 9;
    ch = *tmp;
    while (ch != '\0' && (! (IS_WHITESP (ch)))) {
      tmp++;
      ch = *tmp;
    }
    if (ch == '\0') return;
    if (StringNICmp (tmp, " genome", 7) == 0) {
      tmp [7] = '\0';
      RecordTitle (sdp, ptr);
      return;
    } else if (StringNICmp (tmp, " DNA", 4) == 0) {
      tmp [4] = '\0';
      RecordTitle (sdp, ptr);
      return;
    } else if (StringNICmp (tmp, " sequence", 9) == 0) {
      tmp [9] = '\0';
      RecordTitle (sdp, ptr);
      return;
    }
    ptr = StringStr (tmp, "complete ");
  }

  if (StringStr (str, "genome DNA") != NULL) {
    RecordTitle (sdp, "genome DNA");
    return;
  }

  if (sdp->bulk) return;

  if (StringStr (str, "genomic DNA") != NULL) {
    RecordTitle (sdp, "genomic DNA");
    return;
  }
}
Esempio n. 2
0
/***************************************************************************
*  CkQualSeqaa:
*  -- format       (seq:"codon-sequence", aa:amino_acid)
*  -- example      /codon=(seq:"ttt",aa:Leu)
*                  /codon=(seq: "ttt", aa: Leu )
*                                                                  6-29-93
***************************************************************************/
NLM_EXTERN int CkQualSeqaa (GBQualPtr PNTR head_gbqp, GBQualPtr gbqp, 
   GBQualPtr preq,
   Boolean error_msgs, Boolean perform_corrections)
{
   CharPtr  eptr, str, aa;
   int retval = GB_FEAT_ERR_NONE;

   str = gbqp->val;

   if (StringNICmp(str, "(seq:", 5) == 0) {
      str += 5;

      while (*str == ' ')
          ++str;

      if ((eptr = StringChr(str, ',')) != NULL) { 
         while (str != eptr)
             str++;

         while (*str != '\0' && (*str == ',' || *str == ' '))
             str++;

         if (StringNICmp(str, "aa:", 3) == 0) {
            str += 3;

            while (*str == ' ')
                ++str;

            if ((eptr = StringChr(str, ')')) != NULL) {
               aa = TextSave(str, eptr-str);
               
                 retval = CkQualPosSeqaa(head_gbqp,  gbqp, preq,
                    error_msgs, perform_corrections,  aa, eptr);

             }
           } /* if, aa: */ else{
            if (error_msgs){ 
               ErrPostEx(SEV_ERROR, ERR_QUALIFIER_AA,
                 "Missing aa: /%s=%s",gbqp->qual,gbqp->val); 
             }
             retval = GB_FEAT_ERR_DROP;
             if (perform_corrections){
                DeleteGBQualFromList(head_gbqp, gbqp, preq);
             }
            
         }
      }else{
         if (error_msgs){ 
            ErrPostEx(SEV_ERROR, ERR_QUALIFIER_SeqPosComma,
               "Missing \',\' /%s=%s",gbqp->qual,gbqp->val); 
   /* ) match */             
         }
         retval = GB_FEAT_ERR_DROP;
        if (perform_corrections){
             DeleteGBQualFromList(head_gbqp, gbqp, preq);
         }
      }
   } /* if, (seq: */ else {


        if (error_msgs){ 
           ErrPostEx(SEV_ERROR, ERR_QUALIFIER_Seq,
              "Missing (seq: /%s=%s",gbqp->qual,gbqp->val); 
/* ) match */             
        }
        retval = GB_FEAT_ERR_DROP;
       if (perform_corrections){
            DeleteGBQualFromList(head_gbqp, gbqp, preq);
        }
      }
  
      return retval;

} /* CkQualSeqaa */
Esempio n. 3
0
/***************************************************************************
*  CkQualPosaa:
*  
*  -- format       (pos:base_range, aa:amino_acid)
*  -- example      /anticodon=(pos:34..36,aa:Phe)
*                  /anticodon=(pos: 34..36, aa: Phe)
*                                                                 10-12-93
****************************************************************************/
NLM_EXTERN int CkQualPosaa(GBQualPtr PNTR head_gbqp, GBQualPtr gbqp, 
   GBQualPtr preq,
   Boolean error_msgs, Boolean perform_corrections)
{
   CharPtr  eptr, str, aa = NULL;
   int retval = GB_FEAT_ERR_NONE;

   str = gbqp->val;

   if (StringNICmp(str, "(pos:", 5) == 0) {
      str += 5;

      while (*str == ' ')
          ++str;

/*---I expect that we maight need to allow blanks here, 
            but not now... -Karl 1/28/94 */
      if ((eptr = StringChr(str, ',')) != NULL) { 
         while (str != eptr  && (IS_DIGIT(*str) || *str == '.'))
             str++;

         if (str == eptr) {
            while (*str != '\0' && (*str == ',' || *str == ' '))
                str++;

            if (StringNICmp(str, "aa:", 3) == 0) {
               str += 3;

               while (*str == ' ')
                   ++str;

               if ((eptr = StringChr(str, ')')) != NULL) {
                  aa = TextSave(str, eptr-str);
                  
                  
                 retval = CkQualPosSeqaa(head_gbqp,  gbqp, preq,
                    error_msgs, perform_corrections,  aa, eptr);
               }
            } /* if, aa: */ else{
               if (error_msgs){ 
                ErrPostEx(SEV_ERROR, ERR_QUALIFIER_AA,
                   "Missing aa: /%s=%s",gbqp->qual,gbqp->val); 
               }
               retval = GB_FEAT_ERR_DROP;
               if (perform_corrections){
                  DeleteGBQualFromList(head_gbqp, gbqp, preq);
               }
            }
         }
      }else{
         if (error_msgs){ 
            ErrPostEx(SEV_ERROR, ERR_QUALIFIER_SeqPosComma,
               "Missing \',\' /%s=%s",gbqp->qual,gbqp->val); 
   /* ) match */             
         }
         retval = GB_FEAT_ERR_DROP;
        if (perform_corrections){
             DeleteGBQualFromList(head_gbqp, gbqp, preq);
         }
      }
   } /* if, (pos: */  else{
      if (error_msgs){ 
         ErrPostEx(SEV_ERROR, ERR_QUALIFIER_Pos,
            "Missing (pos: /%s=%s",gbqp->qual,gbqp->val); 
/* ) match */             
      }
      retval = GB_FEAT_ERR_DROP;
     if (perform_corrections){
          DeleteGBQualFromList(head_gbqp, gbqp, preq);
      }
   }
                        
      return retval;

} /* CkQualPosaa */
Esempio n. 4
0
/***************************************************************************
*  CkQualSite:
*  -- format       (5'site:boolean, 3'site:boolean)
*  -- example      /cons_splice=(5'site:YES, 3'site:NO)
*                                                                  6-29-93
***************************************************************************/
NLM_EXTERN int CkQualSite ( GBQualPtr PNTR head_gbqp, GBQualPtr gbqp, 
   GBQualPtr preq,
   Boolean error_msgs, Boolean perform_corrections )
{
   int retval = GB_FEAT_ERR_NONE;
   CharPtr  bptr, str;
   Boolean ok=FALSE;
   CharPtr yes_or_no = "not \'YES\', \'NO\' or \'ABSENT\'";

   str = gbqp->val;
   if (StringNICmp(str, "(5'site:", 8) == 0) {
      bptr = str;
      str += 8;

      if (StringNICmp(str, "YES", 3) == 0 || StringNICmp(str, "NO", 2) == 0 ||
          StringNICmp(str, "ABSENT", 6) == 0) {

         if (StringNICmp(str, "YES", 3) == 0)
            str += 3;
         else if (StringNICmp(str, "NO", 2) == 0)
            str += 2;
         else
            str += 6;

         for (; *str == ' '; str++);
         for (; *str == ','; str++);
         for (; *str == ' '; str++);
         

         if (StringNICmp(str, "3'site:", 7) == 0) {
            str += 7;

            if (StringNICmp(str, "YES", 3) == 0 ||
                StringNICmp(str, "NO", 2) == 0 ||
                StringNICmp(str, "ABSENT", 6) == 0) {
               if (StringNICmp(str, "YES", 3) == 0)
                  str += 3;
               else if (StringNICmp(str, "NO", 2) == 0)
                  str += 2;
               else
                  str += 6;

               if (*str == ')') {
   
                  while (*str != '\0' && (*str == ' ' || *str == ')'))
                      str++;

                  if (*str == '\0')
                    ok=TRUE;
                  else {
                     bptr = "extra characters";
                  }

               } /* if, ")" */ else{
               }
            } /* if, yes or no */ else{
               bptr = yes_or_no;
            }
         } /* if, 3'site */ else{
            bptr="3\' site";
         }
      } /* if, yes or no */else {
         bptr = yes_or_no;
      }
   } /* if, 5'site */else {
     bptr="5\' site";
   }

  if (! ok){
      if (error_msgs){ 
         ErrPostEx(SEV_ERROR, ERR_QUALIFIER_Cons_splice,
           "%s /%s=%s", bptr, gbqp->qual,gbqp->val); 
       }
       retval = GB_FEAT_ERR_DROP;
       if (perform_corrections){
          DeleteGBQualFromList(head_gbqp, gbqp, preq);
       }
  }
  return retval;

} /* CkQualSite */
Esempio n. 5
0
static Boolean LIBCALLBACK FirstVecScreenCallback (
  CONN conn,
  Nlm_VoidPtr userdata,
  EIO_Status  status
)

{
  VQueuePtr  cqp;
  FILE       *fp;
  Char       line [256];
  Char       path [PATH_MAX];
  CharPtr    rid;
  CharPtr    rtoe;
  CharPtr    str;
  long int   val;

  /* read rID or failure message */

  cqp = (VQueuePtr) userdata;

  TmpNam (path);
  fp = FileOpen (path, "w");
  QUERY_CopyResultsToFile (conn, fp);
  FileClose (fp);

  fp = FileOpen (path, "r");
  str = ReadALine (line, sizeof (line), fp);
  while (str != NULL) {
    if (! StringHasNoText (line)) {
      if (line [0] == '>') {
        if (StringNICmp (line, ">Vector", 7) == 0) {
          rid = StringStr (line, "RID: ");
          if (rid != NULL) {
            rid += 5;
            rtoe = StringStr (rid, " RTOE: ");
            if (rtoe != NULL) {
              *rtoe = '\0';
              rtoe += 7;
              StringNCpy_0 (cqp->rid, rid, sizeof (cqp->rid));
              if (sscanf (rtoe, "%ld", &val) == 1) {
                cqp->estTime = (time_t) val;
                cqp->secondsToWait = (Int2) val + 2;
              } else {
                cqp->secondsToWait = 15;
              }
              if (cqp->secondsToWait > 15) {
                cqp->secondsToWait = 15;
              }
              if (cqp->announceproc != NULL) {
                cqp->announceproc (rid, cqp->seqid, (Int2) val);
              }
            }
          } else if (StringStr (line, "FAILED") != NULL) {
            cqp->done = TRUE;
            if (cqp->resultproc != NULL) {
              cqp->resultproc (NULL, cqp->userdata, cqp->rid, cqp->seqid, FALSE);
            }
          }
        } else if (StringNICmp (line, ">Message", 8) == 0) {
          str = ReadALine (line, sizeof (line), fp);
          while (str != NULL && StringNCmp (line, "//", 2) != 0) {
            Message (MSG_POST, "%s\n", str);
            if (StringStr (line, "FAILURE") != NULL) {
              cqp->done = TRUE;
            }
            str = ReadALine (line, sizeof (line), fp);
          }
        }
      }
    }
    str = ReadALine (line, sizeof (line), fp);
  }
  FileClose (fp);

  FileRemove (path);

  return TRUE;
}
Esempio n. 6
0
static Boolean LIBCALLBACK SecondVecScreenCallback (
  CONN conn,
  Nlm_VoidPtr userdata,
  EIO_Status  status
)

{
  VQueuePtr  cqp;
  FILE       *fp;
  Char       line [256];
  Char       path [PATH_MAX];
  CharPtr    rid;
  CharPtr    sttus;
  CharPtr    str;
  Boolean    success = FALSE;
  Boolean    waiting = FALSE;

  /* look for waiting, failure, or success */

  cqp = (VQueuePtr) userdata;

  TmpNam (path);
  fp = FileOpen (path, "w");
  QUERY_CopyResultsToFile (conn, fp);
  FileClose (fp);

  fp = FileOpen (path, "r");
  str = ReadALine (line, sizeof (line), fp);
  while (str != NULL) {
    if (! StringHasNoText (line)) {
      if (line [0] == '>') {
        if (StringNICmp (line, ">Vector", 7) == 0) {
          rid = StringStr (line, "RID: ");
          if (rid != NULL) {
            rid += 5;
            sttus = StringStr (rid, " Status: ");
            if (sttus != NULL) {
              *sttus = '\0';
              sttus += 9;
              if (StringCmp (cqp->rid, rid) != 0) {
                ErrPostEx (SEV_ERROR, 0, 0, "RID mismatch '%s' vs '%s'", cqp->rid, rid);
                cqp->done = TRUE;
              } else if (StringStr (sttus, "FAILED") != NULL) {
                cqp->done = TRUE;
              } else if (StringStr (sttus, "unknown") != NULL) {
                ErrPostEx (SEV_ERROR, 0, 0, "RID unknown '%s'", rid);
                cqp->done = TRUE;
              } else if (StringStr (sttus, "SUCCESS") != NULL) {
                success = TRUE;
              } else if (StringStr (sttus, "WAITING") != NULL) {
                waiting = TRUE;
                /*
                Message (MSG_POST, "WAITING");
                */
              }
            }
          }
        } else if (StringNICmp (line, ">Message", 8) == 0) {
          str = ReadALine (line, sizeof (line), fp);
          while (str != NULL && StringNCmp (line, "//", 2) != 0) {
            Message (MSG_POST, "%s\n", str);
            if (StringStr (line, "FAILURE") != NULL) {
              if (! waiting) {
                cqp->done = TRUE;
              }
            }
            str = ReadALine (line, sizeof (line), fp);
          }
        }
      }
    }
    str = ReadALine (line, sizeof (line), fp);
  }
  FileClose (fp);

  if (success) {
    cqp->resultproc (path, cqp->userdata, cqp->rid, cqp->seqid, success);
    cqp->done = TRUE;
  } else if (cqp->done) {
    cqp->resultproc (NULL, cqp->userdata, cqp->rid, cqp->seqid, success);
  }

  FileRemove (path);

  return TRUE;
}