/* @source plotorf application ** ** Plot potential open reading frames ** ** @author Copyright (C) Alan Bleasby (ableasby@hgmp.mrc.ac.uk) ** @@ ** ** 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 static void plotorf_norfs(const char *seq, const char *rev, ajint n, float **x, float **y, AjPInt *cnt, ajint beg, AjPStr const *starts, ajint nstarts, AjPStr const *stops, ajint nstops); static AjBool plotorf_isin(const char *p, AjPStr const *str, ajint n); /* @prog plotorf ************************************************************** ** ** Plot potential open reading frames ** ******************************************************************************/ int main(int argc, char **argv) { AjPSeq seq; AjPStr str; AjPStr rev; AjPStr *starts = NULL; AjPStr *stops = NULL; AjPStr start; AjPStr stop; ajint nstarts; ajint nstops; AjPGraph graph; AjPGraphdata data; float *x[6] = {NULL,NULL,NULL,NULL,NULL,NULL}; float *y[6] = {NULL,NULL,NULL,NULL,NULL,NULL}; AjPInt cnt; ajint beg; ajint end; ajint i; ajint j; const char *ftit[6]= { "F1","F2","F3","R1","R2","R3" }; embInit("plotorf", argc, argv); ajGraphicsSetPagesize(960, 960); seq = ajAcdGetSeq("sequence"); graph = ajAcdGetGraphxy("graph"); start = ajAcdGetString("start"); stop = ajAcdGetString("stop"); ajStrFmtUpper(&start); ajStrFmtUpper(&stop); nstarts = ajArrCommaList(start,&starts); nstops = ajArrCommaList(stop,&stops); beg = ajSeqGetBegin(seq); end = ajSeqGetEnd(seq); str = ajStrNew(); cnt = ajIntNew(); ajSeqFmtUpper(seq); ajStrAssignSubC(&str,ajSeqGetSeqC(seq),beg-1,end-1); rev = ajStrNewC(ajStrGetPtr(str)); ajSeqstrReverse(&rev); for(i=0;i<6;++i) { plotorf_norfs(ajStrGetPtr(str),ajStrGetPtr(rev),i,x,y,&cnt,beg,starts, nstarts,stops,nstops); data = ajGraphdataNewI(2); data->numofpoints = 0; ajGraphDataAdd(graph,data); ajGraphxySetflagOverlay(graph,ajFalse); ajGraphxyShowYtick(graph, ajFalse); ajGraphdataSetTruescale(data,(float)beg,(float)end,0.0,1.0); ajGraphdataSetTypeC(data,"Multi 2D Plot Small"); ajGraphdataSetYlabelC(data,"Orf"); ajGraphdataSetXlabelC(data,"Sequence"); ajGraphdataSetTitleC(data,ftit[i]); for(j=0;j