コード例 #1
0
static void remap_read_equiv(AjPFile *equfile, AjPTable *table,
			     AjBool commercial)
{
    AjPStr line;
    AjPStr key;
    AjPStr value;

    const char *p;

    line = ajStrNew();

    while(ajReadlineTrim(*equfile,&line))
    {
        p = ajStrGetPtr(line);

        if(!*p || *p=='#' || *p=='!')
            continue;
        p = ajSysFuncStrtok(p," \t\n");
        key = ajStrNewC(p);
        p = ajSysFuncStrtok(NULL," \t\n");
        value = ajStrNewC(p);
	if(!commercial)
	    ajStrTrimEndC(&value,"*");
        ajTablePut(*table,(void *)key, (void *)value);
    }

    ajFileClose(equfile);
    ajStrDel(&line);

    return;
}
コード例 #2
0
ファイル: embprop.c プロジェクト: WenchaoLin/JAMg
AjBool embPropGetProperties(const EmbPPropAmino prop, AjPStr* Pstr)
{
    ajStrAssignC(Pstr, "");

    if(prop->tiny)
        ajStrAppendC(Pstr, "tiny,");

    if(prop->sm_all)
        ajStrAppendC(Pstr, "small,");

    if(prop->aliphatic)
        ajStrAppendC(Pstr, "aliphatic,");

    if(prop->aromatic)
        ajStrAppendC(Pstr, "aromatic,");

    if(prop->polar)
        ajStrAppendC(Pstr, "polar,");

    if(prop->nonpolar)
        ajStrAppendC(Pstr, "nonpolar,");

    ajStrTrimEndC(Pstr, ",");

    if(!ajStrGetLen(*Pstr))
        return ajFalse;

    return ajTrue;
}
コード例 #3
0
static AjBool dbxflat_ParseEmbl(EmbPBtreeEntry entry, AjPFile inf)
{
    AjPStr line = NULL;
    ajlong pos  = 0L;
    
    line = ajStrNewC("");
    
    while(!ajStrPrefixC(line,"//"))
    {
	pos = ajFileResetPos(inf);
	
	if(!ajReadlineTrim(inf,&line))
	{
	    ajStrDel(&line);
	    return ajFalse;
	}
	if(ajStrPrefixC(line,"ID"))
	{
	    entry->fpos = pos;
	    ajFmtScanS(line,"%*S%S",&entry->id);
	    ajStrTrimEndC(&entry->id, ";");
/*
	    ++global;
	    printf("%d. %s\n",global,ajStrGetPtr(entry->id));
*/
	    if(svfield)
		embBtreeEmblSV(line,svfield->data);
	}


	if(svfield)
	    if(ajStrPrefixC(line,"SV") ||
	       ajStrPrefixC(line,"IV"))	/* emblcds database format */
		embBtreeEmblAC(line,svfield->data);

	if(accfield)
	    if(ajStrPrefixC(line,"AC") ||
	       ajStrPrefixC(line,"PA"))	/* emblcds database format */
		embBtreeEmblAC(line,accfield->data);
	
	if(keyfield)
	    if(ajStrPrefixC(line,"KW"))
		embBtreeEmblKW(line,keyfield->data,keyfield->len);

	if(desfield)
	    if(ajStrPrefixC(line,"DE"))
		embBtreeEmblDE(line,desfield->data,desfield->len);

	if(orgfield)
	    if(ajStrPrefixC(line,"OC") || ajStrPrefixC(line,"OS"))
		embBtreeEmblTX(line,orgfield->data,orgfield->len);
    }
    

    ajStrDel(&line);
    
    return ajTrue;
}
コード例 #4
0
static AjBool dbxflat_ParseEmbl(EmbPBtreeEntry entry, AjPFile inf)
{
    AjPStr line = NULL;
    ajlong pos  = 0L;
    
    line = ajStrNewC("");
    
    while(!ajStrPrefixC(line,"//"))
    {
	pos = ajFileResetPos(inf);
	
	if(!ajReadlineTrim(inf,&line))
	{
	    ajStrDel(&line);
	    return ajFalse;
	}
	if(ajStrPrefixC(line,"ID"))
	{
	    entry->fpos = pos;
	    ajFmtScanS(line,"%*S%S",&entry->id);
	    ajStrTrimEndC(&entry->id, ";");
/*
	    ++global;
	    printf("%d. %s\n",global,ajStrGetPtr(entry->id));
*/
	    if(entry->do_sv)
		embBtreeEmblSV(line,entry->sv);
	}


	if(entry->do_sv)
	    if(ajStrPrefixC(line,"SV") ||
	       ajStrPrefixC(line,"IV"))	/* emblcds database format */
		embBtreeEmblAC(line,entry->sv);

	if(entry->do_accession)
	    if(ajStrPrefixC(line,"AC") ||
	       ajStrPrefixC(line,"PA"))	/* emblcds database format */
		embBtreeEmblAC(line,entry->ac);
	
	if(entry->do_keyword)
	    if(ajStrPrefixC(line,"KW"))
		embBtreeEmblKW(line,entry->kw,entry->kwlen);

	if(entry->do_description)
	    if(ajStrPrefixC(line,"DE"))
		embBtreeEmblDE(line,entry->de,entry->delen);

	if(entry->do_taxonomy)
	    if(ajStrPrefixC(line,"OC") || ajStrPrefixC(line,"OS"))
		embBtreeEmblTX(line,entry->tx,entry->txlen);
    }
    

    ajStrDel(&line);
    
    return ajTrue;
}