boolean write_Blast_CompMat_alphabet(CompMat * cm,char * alphabet,FILE * ofp) { char * runner; char * run2; int minnumbers[26]; int len; int i; int min; if( bad_CompMat_alphabet(alphabet) == TRUE ) return FALSE; /* warning already issued */ fprintf(ofp,"# File made by *Wise CompMat library module\n"); fprintf(ofp,"# Comparison matrix in BLAST format\n"); fprintf(ofp,"# Usually matrices are given in half-bit units\n"); fprintf(ofp,"# First line is alphabet, the * column is the lowest score\n"); fprintf(ofp,"# File Created [%s]\n",now_string()); fprintf(ofp,"# Matrix name [%s]\n",cm->name == NULL ? "No Name" : cm->name); /*** print out alphabet wit correct spacing ***/ fprintf(ofp," %c",alphabet[0]); for(runner=alphabet+1;*runner;runner++) fprintf(ofp," %c",*runner); fprintf(ofp," *\n"); /*** print out each row: remember the minimum number for printing later **/ for(runner=alphabet,len=0;*runner;runner++) { min = cm->comp[*runner-'A'][0]; fprintf(ofp,"%- d",cm->comp[*runner-'A'][0]); for(run2=alphabet+1;*run2;run2++) { fprintf(ofp," %- d",cm->comp[*runner-'A'][*run2-'A']); if( cm->comp[*runner-'A'][*run2-'A'] < min ) min = cm->comp[*runner-'A'][*run2-'A']; } minnumbers[len++] = min; fprintf(ofp," % d\n",min); } /*** final row... * ***/ fprintf(ofp,"% d",minnumbers[0]); for(i=1;i<len;i++) fprintf(ofp," % d",minnumbers[i]); fprintf(ofp," 1\n"); /*** finished! ***/ return TRUE; }
void Base::set_updated_at() { _set_field("updated_at", fmt::format("{0}", now_string())); }