// Copyright 2009, 2010, 2011, 2012 Christopher Benner // // This file is part of HOMER // // HOMER 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 3 of the License, or // (at your option) any later version. // // HOMER 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. //just a bunch of routines to help graph if R is available on the system... #include "rwrappers.h" RWrapper::RWrapper() { rstatus = RSTATUS_UNKNOWN; colors = NULL; checkForR(); initColors(5); } RWrapper::~RWrapper() { deleteColors(); } void RWrapper::deleteColors() { if (colors != NULL) { for (int i=0;i 5) initColors(numCols); char* filename = new char[1000]; char* command = new char[1000]; sprintf(filename, "%s.script.R",outputFile); FILE* fp = fopen(filename, "w"); if (fp == NULL) { fprintf(stderr, "Can't open a temporary file %s\n", filename); return; } fprintf(fp, "png(%s)\n", outputFile); fprintf(fp, "x <- read.delim(\"%s\")\n", inputFile); fprintf(fp, "plot(x[,1],x[,2],type=\"n\")\n"); for (int i=0;i