int Application::main(int argc,char *argv[]) { // Process command line BOOM::CommandLine cmd(argc,argv,""); if(cmd.numArgs()!=5) throw string( "\ncompute-signal-likelihoods <*.model> <pos-examples.fasta> \n\ <neg-examples.fasta> <consensuses> <#bins>\n\ \n\ example:\n\ compute-signal-likelihoods tag.model tag.fasta contigs.fasta TAG,TGA,TAA\n\ \n\ \n"); BOOM::String modelFilename=cmd.arg(0); BOOM::String posExamples=cmd.arg(1); BOOM::String negExamples=cmd.arg(2); BOOM::String consensusArg=cmd.arg(3); int numBins=cmd.arg(4).asInt(); if(!filestemRegex.search(modelFilename)) throw BOOM::String("Couldn't parse filestem from filename: ")+ modelFilename; BOOM::String filestem=filestemRegex[1]; // Load the model alphabet=DnaAlphabet::global(); GarbageIgnorer GC; SignalSensor *model=SignalSensor::load(modelFilename,GC); BOOM::Vector<BOOM::String> *consensuses=consensusArg.getFields(","); int numConsensuses=consensuses->size(); for(int i=0 ; i<numConsensuses ; ++i) model->addConsensus((*consensuses)[i]); // Load the examples BOOM::Vector<double> *posScores=loadPosExamples(posExamples,*model); BOOM::Vector<double> *negScores=loadPosExamples(negExamples,*model); // Report summary stats BOOM::SummaryStats posStats(*posScores); BOOM::SummaryStats backgroundStats(*negScores); cout<<"positives: "<<posStats.getMean()<<"+/-"<<posStats.getStdDev()<< " ("<<posStats.getMin()<<"-"<<posStats.getMax()<<")"<<endl; cout<<"background: "<<backgroundStats.getMean()<<"+/-" <<backgroundStats.getStdDev()<<" ("<<backgroundStats.getMin() <<"-"<<backgroundStats.getMax()<<")"<<endl; writeHistogramFile(*posScores,filestem+".pos-hist"); writeHistogramFile(*negScores,filestem+".neg-hist"); // Construct histograms double minScore=POSITIVE_INFINITY, maxScore=NEGATIVE_INFINITY; getExtrema(*posScores,minScore,maxScore); getExtrema(*negScores,minScore,maxScore); Histogram<double> posHist(minScore,maxScore,numBins,0.01); Histogram<double> backgroundHist(minScore,maxScore,numBins,1); posHist.addCounts(*posScores); backgroundHist.addCounts(*negScores); backgroundHist.addCounts(*posScores); // Compute log-likelihood ratios and write output file computeRatios(filestem,posHist,backgroundHist,minScore,maxScore, numBins); /* posHist.divideBy(backgroundHist); posHist.useLogs(); BOOM::String outfile=filestem+".isp"; posHist.save(outfile); */ return 0; }
bool ossimImageFileWriter::writeMetaDataFiles() { bool status = true; if(theWriteEnviHeaderFlag&&!needsAborting()) { if(writeEnviHeaderFile() == false) { status = false; ossimNotify(ossimNotifyLevel_WARN) << "Write of envi header file failed!" << endl; } } if(theWriteErsHeaderFlag&&!needsAborting()) { if(writeErsHeaderFile() == false) { status = false; ossimNotify(ossimNotifyLevel_WARN) << "Write of ers header file failed!" << endl; } } if (theWriteExternalGeometryFlag&&!needsAborting()) { if( writeExternalGeometryFile() == false) { status = false; if(traceDebug()) { ossimNotify(ossimNotifyLevel_WARN) << "Write of geometry file failed!" << endl; } } } if(theWriteFgdcFlag&&!needsAborting()) { if(writeFgdcFile() == false) { status = false; if(traceDebug()) { ossimNotify(ossimNotifyLevel_WARN) << "Write of fgdc file failed!" << endl; } } } if(theWriteJpegWorldFileFlag&&!needsAborting()) { if(writeJpegWorldFile() == false) { status = false; if(traceDebug()) { ossimNotify(ossimNotifyLevel_WARN) << "Write of jpeg world file failed!" << endl; } } } if(theWriteReadmeFlag&&!needsAborting()) { if(writeReadmeFile() == false) { status = false; if(traceDebug()) { ossimNotify(ossimNotifyLevel_WARN) << "Write of readme file failed!" << endl; } } } if(theWriteTiffWorldFileFlag&&!needsAborting()) { if(writeTiffWorldFile() == false) { status = false; if(traceDebug()) { ossimNotify(ossimNotifyLevel_WARN) << "Write of tiff world file failed!" << endl; } } } if(theWriteWorldFileFlag&&!needsAborting()) { if(writeWorldFile() == false) { status = false; if(traceDebug()) { ossimNotify(ossimNotifyLevel_WARN) << "Write of world file failed!" << endl; } } } if (theWriteHistogramFlag&&!needsAborting()) { if (!writeHistogramFile()) { status = false; if(traceDebug()) { ossimNotify(ossimNotifyLevel_WARN) << "Write of histogram file failed!" << endl; } } } return status; }