示例#1
0
int main(){
	char fileName[20];
	char errorLogFileName[20];
	createBotDirectory(errorLogFileName);
	createFileName(fileName, 1);
	genFile(fileName);
	if(buildFile(fileName, errorLogFileName)!=-1){
		runFile(fileName, errorLogFileName);
	}else{
		printf("Build error\n");
	}
}
示例#2
0
void NewGenomeFile::loadGenomeFileIntoMap() {


	ifstream genFile(_genomeFileName.c_str());
	if (!genFile.good()) {
		cerr << "Error: Can't open genome file" << _genomeFileName << "Exiting..." << endl;
		exit(1);
	}
	string sLine;
	Tokenizer fieldTokens;
	CHRPOS chrSize = 0;
	string chrName;
	while (!genFile.eof()) {
		sLine.clear();
		chrSize = 0;
		chrName.clear();
		getline(genFile, sLine);
		int numFields = fieldTokens.tokenize(sLine.c_str());
		// allow use of .fai files.
		 if (numFields < 2) {
		 	continue;
		 }
		chrName = fieldTokens.getElem(0);
		chrSize = str2chrPos(fieldTokens.getElem(1));
		_maxId++;
		_chromSizeIds[chrName] = pair<CHRPOS, int>(chrSize, _maxId);
		_startOffsets.push_back(_genomeLength);
		_genomeLength += chrSize;
		_chromList.push_back(chrName);
	}
	if (_maxId == -1) {
		cerr << "Error: The genome file " << _genomeFileName << " has no valid entries. Exiting." << endl;
		exit(1);
	}
	// Special: BAM files can have unmapped reads, which show as no chromosome, or an empty chrom string.
	// Add in an empty chrom so these don't error.
	_maxId++;
	_chromSizeIds[""] = pair<CHRPOS, int>(0, _maxId);
	_chromList.push_back("");


	_startOffsets.push_back(_genomeLength); //insert the final length as the last element
	//to help with the lower_bound call in the projectOnGenome method.
	genFile.close();
}
   void step(ulen rep)
    {
     genFilter();

     FileNameFilter filter(getFilter());

     for(; rep ;rep--)
       {
        genFilterFile();

        if( !filter(getFile()) )
          {
           Printf(Exception,"fail 1 #; #;",getFilter(),getFile());
          }

        genFile();

        if( filter(getFile())!=Match(getFilter(),getFile()) )
          {
           Printf(Exception,"fail 2 #; #;",getFilter(),getFile());
          }
       }
    }
示例#4
0
void NewGenomeFile::loadGenomeFileIntoMap() {


	ifstream genFile(_genomeFileName.c_str());
	if (!genFile.good()) {
		cerr << "Error: Can't open genome file" << _genomeFileName << "Exiting..." << endl;
		exit(1);
	}
	string sLine;
	Tokenizer fieldTokens;
	CHRPOS chrSize = 0;
	QuickString chrName;
	while (!genFile.eof()) {
		sLine.clear();
		chrSize = 0;
		chrName.clear();
		getline(genFile, sLine);
		int numFields = fieldTokens.tokenize(sLine.c_str());
		if (numFields != 2) {
			continue;
		}
		chrName = fieldTokens.getElem(0);
		chrSize = str2chrPos(fieldTokens.getElem(1));
		_maxId++;
		_chromSizeIds[chrName] = pair<CHRPOS, int>(chrSize, _maxId);
		_startOffsets.push_back(_genomeLength);
		_genomeLength += chrSize;
		_chromList.push_back(chrName);
	}
	if (_maxId == -1) {
		cerr << "Error: The genome file " << _genomeFileName << " has no valid entries. Exiting." << endl;
		exit(1);
	}
	_startOffsets.push_back(_genomeLength); //insert the final length as the last element
	//to help with the lower_bound call in the projectOnGenome method.
	genFile.close();
}
示例#5
0
文件: wxform.cpp 项目: azman/my1golcd
void my1Form::OnGenerate(wxCommandEvent& WXUNUSED(event))
{
	wxArrayString cList;
	wxString cBuffer, cConvert;
	bool cUseASM = false;
	wxFileDialog genFileDialog(this, wxT("Generated Filename"), wxT(""), wxT(""),
		wxT("ASM File (*.asm)|*.asm|C/C++ File (*.c;*.cpp)|*.c;*.cpp"), wxFD_SAVE|wxFD_OVERWRITE_PROMPT);

	if(genFileDialog.ShowModal()==wxID_OK)
	{
		if(genFileDialog.GetFilterIndex()==0)
		{
			cBuffer = wxT("\tdfb ");
			cUseASM = true;
		}
		else
		{
			cBuffer = wxT("\t0x");
			cList.Add(wxT("unsigned char cData[]={"));
		}
		unsigned char *pPixel = mCanvas->mCurrentImage->GetData();
		int cCount = 0;
		for(int cLoop=0;cLoop<mCanvas->mImageBankSize;cLoop++)
		{
			if(cUseASM)
			{
				cConvert.Printf(wxT("; Start Bank %d"),cLoop);
			}
			else
			{
				cConvert.Printf(wxT("/* Start Bank %d"),cLoop);
				cConvert << wxT(" */");
			}
			cList.Add(cConvert);
			for(int cLoop1=0;cLoop1<mCanvas->mImageWidth;cLoop1++)
			{
				int cY = cLoop*8;
				unsigned char cByte = 0x00, cMask = 0x01;
				for(int cLoop2=0;cLoop2<8;cLoop2++)
				{
					if(pPixel[((cY+cLoop2) * mCanvas->mImageWidth + cLoop1) * 3]==PIXEL_GRAY_BLACK)
					{
						cByte |= cMask;
					}
					cMask <<=1;
				}
				if(cByte>0x9f&&cUseASM)
					cConvert.Printf(wxT("%03X"),cByte);
				else
					cConvert.Printf(wxT("%02X"),cByte);
				cBuffer << cConvert;
				cCount++;
				if(cUseASM)
				{
					if(cCount==mCanvas->mImageBankSize)
					{
						cBuffer << wxT("h");
						cList.Add(cBuffer);
						cBuffer = wxT("\tdfb ");
						cCount = 0;
					}
					else
					{
						cBuffer << wxT("h, ");
					}
				}
				else
				{
					if(cCount==mCanvas->mImageBankSize)
					{
						cBuffer << wxT(",");
						cList.Add(cBuffer);
						cBuffer = wxT("\t0x");
						cCount = 0;
					}
					else
					{
						cBuffer << wxT(", 0x");
					}
				}
			}
		}
		if(!cUseASM)
		{
			cBuffer = cList[cList.GetCount()-1];
			cList.RemoveAt(cList.GetCount()-1);
			cBuffer.RemoveLast(); // remove trailing comma
			cList.Add(cBuffer);
			cList.Add(wxT("};"));
		}
		wxTextFile genFile(genFileDialog.GetPath());
		if(genFile.Exists())
		{
			genFile.Open(genFileDialog.GetPath());
			genFile.Clear();
		}
		else
		{
			genFile.Create(genFileDialog.GetPath());
		}
		for(int cIndex=0;cIndex<(int)(cList.GetCount());cIndex++)
		{
			genFile.AddLine(cList[cIndex]);
		}
		genFile.Write();
		genFile.Close();
		cBuffer.Printf(wxT("LCD Data Table Created in %s."),genFileDialog.GetPath().c_str());
		wxMessageBox(cBuffer,wxT("Just FYI"),wxOK|wxICON_INFORMATION,this);
	}
}