示例#1
0
文件: Read.c 项目: mxpule/pMol0174
/*
 * Read a sequence from a file "fnin" of format "format". If "format" is 0
 * (ANY_FORMAT), we automatically determine the correct format.
 * Returns:
 *   Read *   for success
 *   NULLRead for failure
 */
Read *read_reading(char *fn, int format) {
    Read *read;
    mFILE *fp;

#ifdef USE_BIOLIMS
    if( !strncmp(fn,BIOLIMS_TAG,strlen(BIOLIMS_TAG))){
	return spReadBiolimsReading(fn);
   }
#endif

    if (NULL == (fp = open_trace_mfile(fn, NULL))) {
	errout("'%s': couldn't open\n", fn);
	return NULL;
    }

    read = mfread_reading(fp, fn, format);
    mfclose(fp);

    return read;
}
示例#2
0
文件: Read.c 项目: diavy/biolib
/*!
 * Read a sequence from a file "fnin" of format "format". If "format" is 0
 * (ANY_FORMAT), we automatically determine the correct format.
 * Returns:
 *   Read *   for success
 *   NULLRead for failure
 */
Read *read_reading(char *fn, int format) {
    Read *read;
    mFILE *fp;

#ifdef USE_BIOLIMS
    if( !strncmp(fn,BIOLIMS_TAG,strlen(BIOLIMS_TAG))){
	return spReadBiolimsReading(fn);
   }
#endif

    /*
     * If we're asking for an Experiment file, read it.
     * If the format is ANY then attempt EXP first following by trace.
     * Otherwise use the trace search mechanism.
     *
     * Note this is purely for locating files and not for forcing the file
     * format. It's here so that experiment files and trace files may be
     * given identical names but accessed through different search paths
     * (as is the case with the trace server).
     */
    if (format == TT_EXP) {
	if (NULL == (fp = open_exp_mfile(fn, NULL))) {
	    errout("'%s': couldn't open\n", fn);
	    return NULL;
	}
    } else {
	fp = NULL;
	if (format == TT_ANY)
	    fp = open_exp_mfile(fn, NULL);

	if (!fp && NULL == (fp = open_trace_mfile(fn, NULL))) {
	    errout("'%s': couldn't open\n", fn);
	    return NULL;
	}
    }

    read = mfread_reading(fp, fn, format);
    mfclose(fp);

    return read;
}