Beispiel #1
0
/* Set HTTP user header */
static void x_SetupUserHeader (
  SConnNetInfo*  net_info,
  const char*    appName,
  EMIME_Type     type,
  EMIME_SubType  subtype,
  EMIME_Encoding encoding
)
{
  const char* userAgentName = NULL;
  char        user_header [MAX_CONTENT_TYPE_LEN + 80];

  /* content-type if specified */
  if (type < eMIME_T_Unknown) {
    VERIFY( MIME_ComposeContentTypeEx (type, subtype, encoding,
                                       user_header, MAX_CONTENT_TYPE_LEN) );
    ConnNetInfo_OverrideUserHeader (net_info, user_header);
  }

  /* allow the user to specify a prog. name, otherwise get it from elsewhere */
  if (StringHasNoText (appName)) {
    const char* progName = GetProgramName();
    if (StringHasNoText (progName)) {
      char path [PATH_MAX];
      Nlm_ProgramPath (path, sizeof (path));
      userAgentName = StringRChr (path, DIRDELIMCHR);
      if (userAgentName)
        ++userAgentName;
    } else
      userAgentName = progName;
  } else
    userAgentName = appName;
  if (StringDoesHaveText (userAgentName)) {
    sprintf (user_header, "User-Agent: %.80s\r\n", userAgentName);
    ConnNetInfo_ExtendUserHeader (net_info, user_header);
  }
}
Beispiel #2
0
Int2 Main (void)

{
  AsnIoPtr      aop = NULL;
  AsnModulePtr  amp;
  AsnTypePtr    atp_bss, atp_ss, atp_se;
  BioseqSet     bss;
  FILE          *fp;
  ValNodePtr    head, vnp;
  Char          path [PATH_MAX];
  CharPtr       progname, str, subfile;

  ErrSetFatalLevel (SEV_MAX);
  ErrClearOptFlags (EO_SHOW_USERSTR);
  UseLocalAsnloadDataAndErrMsg ();
  ErrPathReset ();

  if (! AllObjLoad ()) {
    Message (MSG_FATAL, "AllObjLoad failed");
    return 1;
  }
  if (! SubmitAsnLoad ()) {
    Message (MSG_FATAL, "SubmitAsnLoad failed");
    return 1;
  }
  if (! SeqCodeSetLoad ()) {
    Message (MSG_FATAL, "SeqCodeSetLoad failed");
    return 1;
  }
  if (! GeneticCodeTableLoad ()) {
    Message (MSG_FATAL, "GeneticCodeTableLoad failed");
    return 1;
  }

  MemSet ((Pointer) &bss, 0, sizeof (BioseqSet));

  amp = AsnAllModPtr ();
  if (amp == NULL) {
    Message (MSG_FATAL, "Unable to load AsnAllModPtr");
    return 1;
  }

  atp_bss = AsnFind ("Bioseq-set");
  if (atp_bss == NULL) {
    Message (MSG_FATAL, "Unable to find ASN.1 type Bioseq-set");
    return 1;
  }

  atp_ss = AsnFind ("Bioseq-set.seq-set");
  if (atp_ss == NULL) {
    Message (MSG_FATAL, "Unable to find ASN.1 type Bioseq-set.seq-set");
    return 1;
  }


  atp_se = AsnFind ("Bioseq-set.seq-set.E");
  if (atp_se == NULL) {
    Message (MSG_FATAL, "Unable to find ASN.1 type Bioseq-set.seq-set.E");
    return 1;
  }

  ProgramPath (path, sizeof (path));
  progname = StringRChr (path, DIRDELIMCHR);
  if (progname != NULL) {
    progname++;
  } else {
    progname = "idcleanscan";
  }

  if (! GetArgs (progname, sizeof (myargs) / sizeof (Args), myargs)) {
    return 0;
  }

  fp = FileOpen (myargs [o_argOutputFile].strvalue, "a");
  if (fp == NULL) {
    Message (MSG_FATAL, "FileOpen failed");
    return 1;
  }

  if (StringHasNoText (myargs [p_argInputPath].strvalue)) {

    str = myargs [i_argInputFile].strvalue;
    if (! StringHasNoText (str)) {
      DoReleaseFile (str, myargs [b_argBinaryFile].intvalue, myargs [c_argCompressed].intvalue, fp, aop, NULL);
    }

  } else {

    head = DirCatalog (myargs [p_argInputPath].strvalue);

    if (! StringHasNoText (myargs [s_argSubset].strvalue)) {
      aop = AsnIoOpen (myargs [s_argSubset].strvalue, /* "wb" */ "w");
      AsnOpenStruct (aop, atp_bss, (Pointer) &bss);
      AsnOpenStruct (aop, atp_ss, (Pointer) bss.seq_set);
      /*
      av.intvalue = BioseqseqSet_class_genbank;
      AsnWrite (aop, atp_cls, &av);
      */
    }

    for (vnp = head; vnp != NULL; vnp = vnp->next) {
      if (vnp->choice == 0) {
        str = (CharPtr) vnp->data.ptrvalue;
        if (! StringHasNoText (str)) {
          subfile = myargs [x_argFileSelect].strvalue;
          if (StringHasNoText (subfile) || StringStr (str, subfile) != NULL) {
#ifdef OS_UNIX
            /* printf ("%s\n", str); */
#endif
            DoReleaseFile (str, myargs [b_argBinaryFile].intvalue, myargs [c_argCompressed].intvalue, fp, aop, atp_se);
          }
        }
      }
    }

    if (aop != NULL) {
      AsnCloseStruct (aop, atp_ss, (Pointer) bss.seq_set);
      AsnCloseStruct (aop, atp_bss, (Pointer) &bss);
      AsnIoClose (aop);
    }

    ValNodeFreeData (head);
  }

  FileClose (fp);

  return 0;
}
Beispiel #3
0
/** GET_MATRIX_PATH callback to find the path to a specified matrix.
 * Looks first in current directory, then one specified by
 * .ncbirc, then in local data directory, then env
 * variables.
 * @param matrix_name name of the matrix (e.g., BLOSUM50) [in]
 * @param is_prot protein matrix if TRUE [in]
 * @return path to matrix if found, or NULL.
 */
static char*
s_BlastFindMatrixPath(const char* matrix_name, Boolean is_prot)
{
     char* matrix_path = NULL;  /* return value. */
     char buf_path[PATH_MAX];  /* Used for path without matrix filename. */
     char buf_full[PATH_MAX];  /* used for full path with filename. */
     char* ptr = NULL;

     if (matrix_name == NULL)
       return NULL;

     /* current directory */
     if (Nlm_FileLength((char*) matrix_name) > 0)
     {
         char buf_path_2[PATH_MAX];
         Nlm_ProgramPath(buf_path, PATH_MAX);
         ptr = StringRChr (buf_path, DIRDELIMCHR);
         if (ptr != NULL)
             *ptr = '\0';
         sprintf(buf_path_2, "%s%s", buf_path, DIRDELIMSTR);
         matrix_path = StringSave(buf_path_2);
         return matrix_path;
     }
     
     /* local data directory. */
     sprintf(buf_full, "data%s%s", DIRDELIMSTR, matrix_name);
     if (Nlm_FileLength(buf_full) > 0)
     {
         char buf_path_2[PATH_MAX];
         Nlm_ProgramPath(buf_path, PATH_MAX);
         ptr = StringRChr (buf_path, DIRDELIMCHR);
         if (ptr != NULL)
             *ptr = '\0';
         sprintf(buf_path_2, "%s%sdata%s", buf_path, DIRDELIMSTR, DIRDELIMSTR);
         matrix_path = StringSave(buf_path_2);
         return matrix_path;
     }

     if(FindPath("ncbi", "ncbi", "data", buf_path, PATH_MAX)) {
            sprintf(buf_full, "%s%s", buf_path, matrix_name);
            if(FileLength(buf_full) > 0) {
                matrix_path = StringSave(buf_path);
                return matrix_path;
            } else {
                 char alphabet_type[3];     /* aa or nt */
                 if (is_prot)
                      Nlm_StringNCpy(alphabet_type, "aa", 2);
                 else
                      Nlm_StringNCpy(alphabet_type, "nt", 2);
                 alphabet_type[2] = NULLB;

                 sprintf(buf_full, "%s%s%s%s", buf_path,
                          alphabet_type, DIRDELIMSTR, matrix_name);
                 if(FileLength(buf_full) > 0)
                 {
                    matrix_path = StringSave(buf_path);
                    return matrix_path;
                 }
            }
     }

     return NULL;
}
Beispiel #4
0
Int2 Main(void)
{
  Char             app [64];
  CharPtr          directory;
  CharPtr          ptr;
  Char             sfx [32];
  OutputStreamData osd;
  InputStreamData  isd;
  AsnStreamData    asd;
  Int4             gap_sizes[2];
  Int4             rval = 0;
  Int4             u_eq = 0, u_gteq = -1, k_eq = 0, k_gteq = -1;

  /* standard setup */

  ErrSetFatalLevel (SEV_MAX);
  ErrClearOptFlags (EO_SHOW_USERSTR);
  UseLocalAsnloadDataAndErrMsg ();
  ErrPathReset ();

  /* finish resolving internal connections in ASN.1 parse tables */

  if (! AllObjLoad ()) {
    Message (MSG_FATAL, "AllObjLoad failed");
    return 1;
  }
  if (! SubmitAsnLoad ()) {
    Message (MSG_FATAL, "SubmitAsnLoad failed");
    return 1;
  }
  if (! FeatDefSetLoad ()) {
    Message (MSG_FATAL, "FeatDefSetLoad failed");
    return 1;
  }
  if (! SeqCodeSetLoad ()) {
    Message (MSG_FATAL, "SeqCodeSetLoad failed");
    return 1;
  }
  if (! GeneticCodeTableLoad ()) {
    Message (MSG_FATAL, "GeneticCodeTableLoad failed");
    return 1;
  }

  SetUpAsnStreamData (&asd);

  /* initialize OuputStreamData */
  MemSet (&osd, 0, sizeof (osd));

  /* initialize InputStreamData */
  MemSet (&isd, 0, sizeof (isd));

  /* initialize gap_sizes */
  gap_sizes[0] = 0;
  gap_sizes[1] = 0;

  /* process command line arguments */

  sprintf (app, "raw2delt %s", RAW2DELT_APPLICATION);
  if (! GetArgs (app, sizeof (myargs) / sizeof (Args), myargs)) {
    return 0;
  }

  u_eq = (Int4) myargs [u_argEqUnknownGap].intvalue;
  u_gteq = (Int4) myargs [U_argGTEqUnknownGap].intvalue;
  k_eq = (Int4) myargs [k_argEqUnknownGap].intvalue;
  k_gteq = (Int4) myargs [K_argGtEqUnknownGap].intvalue;

  if (u_eq < 1 && u_gteq < 1 && k_eq < 1 && k_gteq < 1) {
    Message (MSG_FATAL, "Must specify values for at least one of -u, -U, -k, -K");
    return 1;
  } else if (u_eq > -1 && u_gteq > -1) {
    Message (MSG_FATAL, "May only specify value for -u or -U, not both");
    return 1;
  } else if (k_eq > -1 && k_gteq > -1) {
    Message (MSG_FATAL, "May only specify value for -k or -K, not both");
    return 1;
  }
    
  if (u_eq > 0) {
    gap_sizes[0] = u_eq;
  } else if (u_gteq > 0) {
    gap_sizes[0] = 0 - u_gteq;
  }

  if (k_eq > 0) {
    gap_sizes[1] = k_eq;
  } else if (k_gteq > 0) {
    gap_sizes[1] = 0 - k_gteq;
  }

  if (gap_sizes[0] == gap_sizes[1]) {
    Message (MSG_FATAL, "Cannot specify the same size for known and unknown length gaps");
    return 1;
  }

  directory = (CharPtr) myargs [p_argInputPath].strvalue;
  osd.results_dir = (CharPtr) myargs [r_argOutputPath].strvalue;
  if (StringHasNoText (osd.results_dir)) {
    osd.results_dir = NULL;
  }
  osd.suffix = (CharPtr) myargs [x_argSuffix].strvalue;
  osd.outsuffix = (CharPtr) myargs [s_argOutSuffix].strvalue;
  osd.base = (CharPtr) myargs [i_argInputFile].strvalue;
  osd.outfile = (CharPtr) myargs [o_argOutputFile].strvalue;
  if (StringHasNoText (osd.outfile)) {
    osd.outfile = NULL;
  }
  osd.is_binary = (Boolean) myargs [d_argOutputBinary].intvalue;

  if (osd.base == "stdin") {
    osd.base = NULL;
  }

  /* if we don't have an output directory or an output file, and the user hasn't provided an
   * output suffix, add a default.
   */
  if (osd.results_dir == NULL && osd.outfile == NULL && StringHasNoText (osd.outsuffix)) {
    osd.outsuffix = ".delta";
  } 

  isd.is_binary = (Boolean) myargs [b_argInputBinary].intvalue;
  isd.is_seqentry = (Boolean) myargs [e_argInputSeqEntry].intvalue;
  isd.directory = directory;
  isd.base = osd.base;
  isd.suffix = osd.suffix;

  if (StringDoesHaveText (osd.outfile)) {
    osd.aip = AsnIoOpen (osd.outfile, "w");
    if (osd.aip == NULL) {
      Message (MSG_FATAL, "Unable to open output file");
      return 1;
    }
  } else {
    if (StringHasNoText (osd.results_dir)) {
      osd.results_dir = directory;
    }
    /* if we're putting the results in a separate directory, strip the directory name from the output base */
    if (!StringHasNoText (osd.results_dir) && !StringHasNoText (osd.base)) {
#ifdef OS_MSWIN
      ptr = StringRChr (osd.base, '\\');
#else
      ptr = StringRChr (osd.base, '/');
#endif;
      if (ptr != NULL) {
        osd.base = ptr + 1;
      }
    }
  }


  if (StringHasNoText(directory) && StringHasNoText(osd.base)) {
    rval = ProcessStream (&isd, &osd, &asd, gap_sizes);
  } else if (StringDoesHaveText (osd.base)) {
    ptr = StringRChr (osd.base, '.');
    sfx[0] = '\0';
    if (ptr != NULL) {
      StringNCpy_0 (sfx, ptr, sizeof (sfx));
      *ptr = '\0';
    }
    osd.suffix = sfx;
    isd.suffix = sfx;
    if (isd.is_binary) {
      rval = ProcessStream (&isd, &osd, &asd, gap_sizes);
    } else {
      rval = ProcessOneRecord (directory, &osd, gap_sizes);
    }
  } else {

    rval = FileRecurse (directory, &isd, &osd, &asd, gap_sizes);
  }

  if (osd.aip != NULL) {
    AsnIoFlush (osd.aip);
    AsnIoClose (osd.aip);
  }
  return rval;
}
Beispiel #5
0
PCSAN LIBCALL LoadCSAN(CharPtr pcFile)
{

   FILE *f;
   Char fullpath [PATH_MAX];
   CharPtr ptr;
   PCSAN pcsanHead = NULL;
   PCSAN pcsanTemp = NULL;
   Char pcBuf[250];
   CharPtr ppcParse[125];
   CharPtr pcTemp = NULL;
   CharPtr pcTest = NULL;
   CharPtr pcSeqPart = NULL;
   ValNodePtr pvn = NULL;
   long int val = 0;
   Int4 i = 0;
   Int4 iString = 0;
   Int4 iLen =0;
   Int4 iWC =0;
   Int4 iWL = 0;
   Int4 iGi = 0;

   if (!pcFile) return(NULL);

   ProgramPath (fullpath, sizeof (fullpath) - 1);
   ptr = StringRChr (fullpath, DIRDELIMCHR);
   if (ptr != NULL) {
      *ptr = '\0';
   }

   /* printf("FULLPATH[%s]\n",IsNullStr(fullpath)); */

   FileBuildPath (fullpath, NULL, pcFile);
   /* printf("FULLPATH[%s]\n",IsNullStr(fullpath)); */

   if ((f = FileOpen (fullpath, "r")) == NULL)
     {
      if (FindPath ("NCBI", "NCBI", "DATA", fullpath, sizeof (fullpath) - 1))
        {
          FileBuildPath (fullpath, NULL, pcFile);
          f = FileOpen (fullpath, "r");
          if (f == NULL)
	    {
             ErrPost(CTX_NCBIOBJ, 1, "Couldn't open [%s] in LoadCSA", IsNullStr(fullpath));
             return (NULL);
            }
       }
     else
       {
         ErrPost(CTX_NCBIOBJ, 1, "FindPath failed in LoadNeighbors");
         return (NULL);
       }
    }

  do   /* get each line, tokenize into ppcParse */
     {
      pcBuf[0] = '\0';
      pcTest = fgets(pcBuf,  (size_t)250,  f);
      /* printf("[%s]\n",IsNullStr(pcTest)); */
      if (pcTest)
        {
		   iLen = StringLen(pcTest);
           /* Break into words delimited by whitespace or "|" */
           /* gi|123456| */
           /* printf("LineLength %d\n",(int) iLen); */
           for (i=0; i < 125; i++) ppcParse[i] = NULL;
           pcTemp = pcTest;
           ppcParse[0] = pcTest;
           iWC = 1;
           while ((*pcTemp != '\0') && (iWC < 125))
             {
                 if ((*pcTemp == '|') || (*pcTemp == ' ') || (*pcTemp == '\t') || (*pcTemp == '\n'))
                   {
                      *pcTemp = '\0';  /* terminate current word */
                       do {
                            pcTemp++;  /* skip whitespace to next word */
                          }  while ((*pcTemp == '|') || (*pcTemp == ' ') || (*pcTemp == '\t') || (*pcTemp == '\n'));
                       ppcParse[iWC] = pcTemp;  /* start next word */
                       iWC++;
                   }
                 else
                   pcTemp++;
             }

     /* DEBUG TEST */

/*           for (i=0; i<125; i++)
             if (ppcParse[i] != NULL)
               {
                 printf("%ld/%ld [%s]\n",i,iWC, IsNullStr(ppcParse[i]));
               } */

     /* If ppcParse[0] is "gi" then this is a VALID sequence line and the last
        word parsed is the sequence */
      if (ppcParse[0][0] != '\0')
        {
           iWL = StringLen(ppcParse[0]);
           if (iWL == 2)
             if (((ppcParse[0][0] == 'g') ||
                (ppcParse[0][0] == 'G')) &&
                ((ppcParse[0][1] == 'i') ||
                (ppcParse[0][1] == 'I')))
               {
                 /* next word should be GI */
                  iGi = 0;
                  if (StrToInt4 (ppcParse[1], &iGi))
                    {
                      /* printf("GI is (%ld)\n",iGi); */
                      if (iGi == 0) goto parserr;
                      /* find the 2nd last string = sequence */
                      /* last string is stripped off line terminator, by the way... */
                      iString=2; /* start after GI */
                      while (ppcParse[iString+1] != NULL)
                        {  /* iString is the LAST sting - line terminator */
                              iString++;
                         }
                      pcsanTemp = pcsanHead;
                      while (pcsanTemp)
                        {  /* look for existing pcsan */
                         if (iGi == pcsanTemp->iGi)
                          {
                            break;
                          }
                         pcsanTemp = pcsanTemp->next;
                        }
                      if (!pcsanTemp) /* otherwise add a new one */
                        {
                          pcsanTemp = NewCSAN();
                          pcsanTemp->next = pcsanHead;
                          pcsanHead = pcsanTemp; /* put at head of list */
                          pcsanTemp->iGi = iGi;
                        }
                      /* Initialize fields */
                      pcSeqPart = NULL;
                      pcSeqPart = StringSave(ppcParse[iString-1]);
                      /* printf("SEQ [%ld]= [%s]\n",(long) iString-1, IsNullStr(pcSeqPart)); */
                      ValNodeAddStr(&pcsanTemp->pvnSeqAlnPart, 0,  pcSeqPart);
                    }  /* if GI */
               }  /* if line starts with GI */
         }  /* if line starts with a word */
      } /* if pcTest */
    } while (pcTest);


  printf("REPORT\n");
  pcsanTemp = pcsanHead;
  while (pcsanTemp)
  {
     printf("GI = [%ld]\n", (long) pcsanTemp->iGi);
     pvn = pcsanTemp->pvnSeqAlnPart;
     while (pvn)
       {
         printf(">%s<\n",(char *) IsNullStr(pvn->data.ptrvalue));
         pvn = pvn->next;
       }
     pcsanTemp = pcsanTemp->next;
  }

   FileClose(f);
   return pcsanHead;


parserr:
   FileClose(f);
   ErrPostEx(SEV_FATAL,0,0, "Error in input format \n");
   FreeCSAN(pcsanHead);
   return NULL;

}
Beispiel #6
0
Int2 Main (void)

{
  Int2     db = -1;
  Int2     i;
  Boolean  makeCDS;
  Char     path [PATH_MAX];
  CharPtr  progname;
  FILE     *fp;
  Int2     rsult;

  ErrSetFatalLevel (SEV_MAX);
  ErrClearOptFlags (EO_SHOW_USERSTR);
  UseLocalAsnloadDataAndErrMsg ();
  ErrPathReset ();

  if (! AllObjLoad ()) {
    Message (MSG_FATAL, "AllObjLoad failed");
    return 1;
  }
  if (! SeqCodeSetLoad ()) {
    Message (MSG_FATAL, "SeqCodeSetLoad failed");
    return 1;
  }
  if (! GeneticCodeTableLoad ()) {
    Message (MSG_FATAL, "GeneticCodeTableLoad failed");
    return 1;
  }

  ProgramPath (path, sizeof (path));
  progname = StringRChr (path, DIRDELIMCHR);
  if (progname != NULL) {
    progname++;
  } else {
    progname = "fetchent";
  }

  /* GetArgs is a portable way of obtaining arguments */
  if (! GetArgs (progname, NUMARG, myargs)) {
    Message (MSG_FATAL, "GetArgs failed");
    return 1;
  }

  /* Map database argument to TYP_XX value */
  for (i = 0; databases [i] != NULL; i++) {
    if (StringICmp (myargs [0].strvalue, databases [i]) == 0) {
      db = i;
    }
  }
  /* Convert M, P, or N alternative database symbols to proper code */
  if (db >= 3 && db <= 5) {
    db -= 3;
  }
  if (db < 0 || db > 2) {
    Message (MSG_FATAL, "Database must be ML, AA, or NT");
    return 1;
  }

  if (! EntrezInit (progname, FALSE, NULL)) {
    Message (MSG_FATAL, "EntrezInit failed");
    return 1;
  }

  fp = FileOpen (myargs [2].strvalue, "w");
  if (fp == NULL) {
    Message (MSG_FATAL, "FileOpen failed");
    return 1;
  }

  makeCDS = (Boolean) myargs [3].intvalue;
  if (makeCDS && db != TYP_NT) {
    Message (MSG_ERROR, "Coding region extraction inappropriate");
    makeCDS = FALSE;
  }

  rsult = ProcessQuery (db, myargs [1].strvalue, makeCDS, fp);

  FileClose (fp);
  EntrezFini ();
  return rsult;
}
Beispiel #7
0
/*****************************************************************************
*
*   PrintTemplateSetPtr PrintTemplateSetLoad()
*       loads PrintTemplates
*       If path== NULL, looks for "prt.prt" in the "data" directory
*
*****************************************************************************/
static Boolean PrintTemplateSetLoadInt ( CharPtr path, Boolean verbose )
{
	AsnIoPtr aip;
	FILE *f;
	Boolean retval;
	Char filename [80];
	Char fullpath [PATH_MAX];
	CharPtr ptr;
	ErrSev lastLevel;

	aip = NULL;
	if (path != NULL && *path != '\0' && StringRChr (path, DIRDELIMCHR) != NULL) {
		StringNCpy (fullpath, path, sizeof (fullpath) - 1);
		if ((aip = AsnIoOpen (fullpath, "r")) == NULL) {
		    if (verbose) {
	    		ErrPost(CTX_NCBIOBJ, 1, "Couldn't open [%s]", fullpath);
		    }
			return FALSE;
		}
	} else {
		if (path != NULL && *path != '\0') {
			StringNCpy (filename, path, sizeof (filename) - 1);
		} else {
			StringCpy (filename, "prt.prt");
		}
		ProgramPath (fullpath, sizeof (fullpath) - 1);
		ptr = StringRChr (fullpath, DIRDELIMCHR);
		if (ptr != NULL) {
			*ptr = '\0';
		}
		FileBuildPath (fullpath, NULL, filename);
		/* silence SEV_INFO errors from FileOpen() */
		if ((lastLevel = ErrGetMessageLevel()) < SEV_WARNING)
			ErrSetMessageLevel (SEV_WARNING);
		if ((f = FileOpen (fullpath, "r")) == NULL) {
			ErrSetMessageLevel (lastLevel);
			if (FindPath ("NCBI", "NCBI", "DATA", fullpath, sizeof (fullpath) - 1)) {
				FileBuildPath (fullpath, NULL, filename);
				if ((aip = AsnIoOpen (fullpath, "r")) == NULL) {
				    if (verbose) {
					    ErrPost(CTX_NCBIOBJ, 1, "Couldn't open [%s]", fullpath);
				    }
					return FALSE;
				}
			} else {
			    if (verbose) {
			    	ErrPost(CTX_NCBIOBJ, 1, "FindPath failed in PrintTemplateSetLoad - ncbi configuration file missing or incorrect");
			    }
				return FALSE;
			}
		} else {
			ErrSetMessageLevel (lastLevel);
			FileClose (f);
			if ((aip = AsnIoOpen(fullpath, "r")) == NULL) {
			    if (verbose) {
				    ErrPost(CTX_NCBIOBJ, 1, "Couldn't open [%s]", fullpath);
			    }
				return FALSE;
			}
		}
	}

    retval = PrintTemplateSetAsnRead(aip);

    AsnIoClose(aip);
    return retval;
}