Exemplo n.º 1
0
void TestFileGenerator::WriteExpressionCDFFile(const std::string& filename, u_int32_t probeSetCnt)
{
	wchar_t name[100];

	u_int8_t unitType = 3;
	u_int8_t direction = 1;
	u_int32_t atoms = 11;
	u_int8_t cellsPerAtom = 2;
	u_int32_t cells = atoms*cellsPerAtom;

	CDFData data(filename);
	data.SetProbeSetCnt(probeSetCnt, Expression);
	data.SetArrayCols(atoms);
	data.SetArrayRows(probeSetCnt*cellsPerAtom);
	CDFFileWriter writer(data);

	for (u_int32_t i = 0; i < probeSetCnt; ++i)
	{
		// make the unit name
		FormatString1(name, 100, L"biob_%d", i);

		writer.OpenDataGroup(name, 1);
		CDFProbeSetWriter* probeWriter = writer.CreateProbeSetWriter(name,unitType,direction,atoms,cells,i,cellsPerAtom);
		probeWriter->WriteHeader();

		for (u_int32_t atom = 0; atom < atoms; ++atom)
		{
			for (u_int32_t cellInAtom = 0; cellInAtom < cellsPerAtom; ++cellInAtom)
			{
				probeWriter->Write(atom,i*cellsPerAtom+cellInAtom,atom,atom,'C','G');
			}
		}
		probeWriter->Close();
		delete probeWriter;
		writer.CloseDataGroup();	
	}
}
void CDFFileWriterTest::WriteTest()
{
	writer->OpenDataGroup(L"affy probe set 1", 1);
	CDFProbeSetWriter* probeWriter = writer->CreateProbeSetWriter(L"xda block name",100,100,33,17,3009,100);
	probeWriter->WriteHeader();
	probeWriter->Write(10,10,100,45,11,11);
	probeWriter->Close();
	delete probeWriter;
	writer->CloseDataGroup();

	writer->OpenDataGroup(L"affy probe set 2", 1);
	probeWriter = writer->CreateProbeSetWriter(L"xda block name",100,100,33,17,3009,100);
	probeWriter->WriteHeader();
	probeWriter->Write(10,10,100,45,11,11);
	probeWriter->Close();
	delete probeWriter;
	writer->CloseDataGroup();

	writer->OpenDataGroup(L"affy probe set 3", 1);
	probeWriter = writer->CreateProbeSetWriter(L"xda block name",100,100,33,17,3009,100);
	probeWriter->WriteHeader();
	probeWriter->Write(10,10,100,45,11,11);
	probeWriter->Close();
	delete probeWriter;
	writer->CloseDataGroup();

	writer->OpenDataGroup(L"affy probe set 4", 1);
	probeWriter = writer->CreateProbeSetWriter(L"xda block name",100,100,33,17,3009,100);
	probeWriter->WriteHeader();
	probeWriter->Write(10,10,100,45,11,11);
	probeWriter->Close();
	delete probeWriter;
	writer->CloseDataGroup();

	CPPUNIT_ASSERT(1);
}