/* @source sigcleave application ** ** Displays protein signal cleavage sites ** @@ ** ** Original program "SIGCLEAVE" Peter Rice (EGCG 1988) ** ** This program uses the method of von Heijne (1986); Nuc. Acids Res. 14:4683 ** as modified by von Heijne (1987) in "Sequence Analysis in Molecular ** Biology, where the procedure for positions -1 and -3 is altered. ** ** This program is free software; you can redistribute it and/or ** modify it under the terms of the GNU General Public License ** as published by the Free Software Foundation; either version 2 ** of the License, or (at your option) any later version. ** ** This program is distributed in the hope that it will be useful, ** but WITHOUT ANY WARRANTY; without even the implied warranty of ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ** GNU General Public License for more details. ** ** You should have received a copy of the GNU General Public License ** along with this program; if not, write to the Free Software ** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. ******************************************************************************/ #include "emboss.h" #include #include #define EUKFILE "Esig.euk" #define PROFILE "Esig.pro" static ajint sigcleave_readSig(AjPFloat2d *matrix,AjBool prokaryote); /* @prog sigcleave ************************************************************ ** ** Reports protein signal cleavage sites ** ******************************************************************************/ int main(int argc, char **argv) { AjPSeqall seqall; AjPSeq seq = NULL; AjPFile outf = NULL; AjPReport report = NULL; AjPFeattable TabRpt = NULL; AjPFeature gf = NULL; AjPStr strand = NULL; AjPStr substr = NULL; AjPStr stmp = NULL; AjPStr sstr = NULL; AjPStr tmpStr = NULL; AjPStr headStr = NULL; AjPStr tailStr = NULL; AjBool prokaryote=ajFalse; AjPFloat2d matrix = NULL; ajint begin; ajint end; ajint len; ajint pval; ajint nval; ajint opval; /* save value from updating */ float minweight; float xweight; float weight; float maxweight; AjPUint hi = NULL; AjPUint hp = NULL; AjPFloat hwt = NULL; const char *p; char *q; ajint i; ajint j; ajint n; ajint maxsite; ajint istart; ajint iend; ajint ic; ajint isite; ajint se; AjPStr fthit = NULL; embInit("sigcleave",argc,argv); seqall = ajAcdGetSeqall("sequence"); opval = -13; /* was ajAcdGetInt */ nval = 2; /* was ajAcdGetInt */ prokaryote = ajAcdGetBoolean("prokaryote"); minweight = ajAcdGetFloat("minweight"); report = ajAcdGetReport("outfile"); /* obsolete. Can be uncommented in acd file and here to reuse */ /* outf = ajAcdGetOutfile("originalfile"); */ matrix = ajFloat2dNew(); hwt = ajFloatNew(); hi = ajUintNew(); hp = ajUintNew(); substr = ajStrNew(); stmp = ajStrNew(); sstr = ajStrNew(); ajStrAssignC(&fthit, "SO:0000418"); sigcleave_readSig(&matrix,prokaryote); while(ajSeqallNext(seqall, &seq)) { begin = ajSeqallGetseqBegin(seqall); end = ajSeqallGetseqEnd(seqall); pval = opval; TabRpt = ajFeattableNewSeq(seq); ajStrAssignS(&strand, ajSeqGetSeqS(seq)); ajStrFmtUpper(&strand); ajStrAssignSubC(&substr,ajStrGetPtr(strand),begin-1,end-1); ajStrAssignSubC(&sstr,ajStrGetPtr(strand),begin-1,end-1); len = ajStrGetLen(substr); q = ajStrGetuniquePtr(&substr); for(i=0;i i+pval) ? 0 : i+pval; iend = (i+nval-1 < len-1) ? i+nval-1 : len-1; ic = 13+pval; j = istart; ajDebug("i: %3d j: %3d istart: %3d iend: %3d ic: %3d\n", i, j, istart, iend, ic); while(j<=iend) { if(j>=0 && jmaxweight) { maxweight=weight; maxsite=i; } if(weight>minweight) { ajFloatPut(&hwt,n,weight);; ajUintPut(&hp,n,i); ajUintPut(&hi,n,n); ajDebug("hit[%d] at weight: %.3f i: %d\n", n, weight, i); ++n; } } ajStrAssignC(&headStr, ""); ajFmtPrintAppS(&headStr, "Reporting scores over %.2f", minweight); ajReportSetHeaderS(report, headStr); if(outf) ajFmtPrintF(outf,"\n\nSIGCLEAVE of %s from %d to %d\n\n", ajSeqGetNameC(seq),begin,end); if(outf) ajFmtPrintF(outf,"\nReporting scores over %.2f\n",minweight); if(!n) { if(outf) ajFmtPrintF(outf,"\nNo scores over %.2f\n",minweight); ajFmtPrintS(&tailStr,"\nNo scores over %.2f\n",minweight); ajReportSetSubtailS(report, tailStr); } else { if(outf) ajFmtPrintF(outf,"Maximum score %.1f at residue %d\n\n", maxweight, maxsite+begin); if(maxsite+pval<0) pval = -maxsite; /* end of signal peptide */ ajStrAssignSubC(&stmp,ajStrGetPtr(sstr),maxsite+pval,maxsite-1); if(outf) ajFmtPrintF(outf," Sequence: %s-",ajStrGetPtr(stmp)); if(maxsite+49'Z')) ++p; cols = ajStrParseCountC(line,ajStrGetPtr(delim)); if(pass) { pass = ajFalse; xcols = cols; } else if(xcols!=cols) ajFatal("Asymmetric table"); q = ajStrGetPtr(line); q = ajSysFuncStrtok(q,ajStrGetPtr(delim)); d1 = ajBasecodeToInt((char)toupper((ajint)*p)); c = 0; while((q=ajSysFuncStrtok(NULL,ajStrGetPtr(delim)))) { sscanf(q,"%f",&v); ajFloat2dPut(matrix,d1,c++,v); } } ajFloat2dLen(*matrix,&d1,&d2); mat = ajFloat2dFloat(*matrix); for(j=0;j 1) jmax = cols-2; else jmax=0; if(j==jmax) { if(fabs((double)(sample-rt)) > 0.9) ajFatal("Error in 'Expected' column"); } else if(fabs((double)(sample-rt)) > 0.05) ajFatal("Sample size doesn't match column"); } for(i=0;i 0.0) { for(j=0;j