예제 #1
0
////////////////////////////////////////////////////////
// Obsolete Function: printData(char * filename)
//
// Prints a matrix to the Outfile.
// Useful for debugging.
//
void 	ProbData::printData(char * filename)
{
	ofstream Outfile(filename);
	if (!Outfile) {
		std::cout << "Warning: Unable to open " << filename << endl;
		return;
	}

	if (!ProbMat.size())
	{
		Outfile << "Empty Matrix" << endl;
		return;
	}
	
	Outfile << endl;
	for (unsigned r = 0; r < ProbMat[0].size(); r++)
	{
		Outfile << r;

		for (unsigned c = 0; c < ProbMat.size(); c++)
			Outfile << '\t' << this->getValue(r, c);

		Outfile << endl;
	}
}
예제 #2
0
void
begin (int argc, const char * argv[])
{
  size_t output;
  size_t pos;

  output = Outfile ("-");

  Add_field (output, Sym ("uint4"), Sym ("bp0"));
  Add_field (output, Sym ("uint4"), Sym ("bp1"));
  File_fix (output, 1, 0);


  pos = 0;
  while (1)
    {
      const int char_in = getchar ();

      if (char_in == EOF)
        {
          if (ferror (stdin))
            Fatal ("input error");
          else
            {
              if (pos % 2)
                {
                  Poke (output, 0, 1, uInt4 (bp_letter_to_int4 (0)));
                  Advance (output, 1);
                }
              break;
            }
        }

      Poke (output, 0, (pos % 2),
            uInt4 (bp_letter_to_int4 (char_in)));

      ++pos;

      if (!(pos % 2))
        Advance (output, 1);
    }

  Close (output);
}