/* @source chaos application ** @author Ian Longden ** @@ ** Chaos produces a chaos plot. ** ** 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" /* @prog chaos **************************************************************** ** ** Create a chaos game representation plot for a sequence ** ******************************************************************************/ int main(int argc, char **argv) { AjPSeq sequence = NULL; AjPGraph graph = NULL; float x = 0.5; float y = 0.5; float x2; const char *ptr; ajint i; ajint a = 0; ajint c = 0; ajint t = 0; ajint g = 0; ajint n = 0; char line[40]; AjPStr str=NULL; ajint begin; ajint end; ajint len; embInit("chaos", argc, argv); sequence = ajAcdGetSeq("sequence"); graph = ajAcdGetGraph("graph"); ajGraphAppendTitleS(graph, ajSeqGetUsaS(sequence)); ajGraphOpenWin(graph,(float)-0.1,(float)1.4,(float)-0.1,(float)1.1); str = ajStrNew(); begin = ajSeqGetBegin(sequence) - 1; end = ajSeqGetEnd(sequence) - 1; ajStrAssignSubS(&str,ajSeqGetSeqS(sequence),begin,end); ajStrFmtLower(&str); ptr = ajStrGetPtr(str); len = end-begin+1; for(i=0;i