Example #1
0
void GenericDataTest_FileIndependent::testmethod_DataSet_ByIndex()
{
	DataSet* dp = data->DataSet(0,0);
	CPPUNIT_ASSERT(0 != dp);
	dp->Delete();
	dp = data->DataSet(0,1);
	CPPUNIT_ASSERT(0 != dp);
	dp->Delete();
	CPPUNIT_ASSERT_THROW(data->DataSet(1,0), affymetrix_calvin_exceptions::DataGroupNotFoundException);
	CPPUNIT_ASSERT_THROW(data->DataSet(0,2), affymetrix_calvin_exceptions::DataSetNotFoundException);
	// TODO: Add more asserts to make sure that I am getting back the right data set.
}
Example #2
0
void GenericDataTest_FileIndependent::testmethod_DataSet_ByName()
{
	GenericData d;
	CPPUNIT_ASSERT_THROW(data->DataSet(L"none", dphPI->GetName()), affymetrix_calvin_exceptions::DataGroupNotFoundException);
	CPPUNIT_ASSERT_THROW(data->DataSet(L"Default", L"none"), affymetrix_calvin_exceptions::DataSetNotFoundException);
	DataSet* dp = data->DataSet(dch->GetName(), dphPI->GetName());
	CPPUNIT_ASSERT(0 != dp);
	dp->Delete();
	dp = data->DataSet(dch->GetName(), dphGrid->GetName());
	CPPUNIT_ASSERT(0 != dp);
	dp->Delete();
	// TODO: Add more asserts to make sure that I am getting back the right data set.
}
Example #3
0
void GenericDataTest_MinDPH::DataSetByIndexTest()
{
	// Check that a MinDP will be read-in completely before being accessed through GenericData.
	DataSet* dp = data->DataSet(0,0);
	CPPUNIT_ASSERT(dp);
	const DataSetHeader& dph = dp->Header();

	CPPUNIT_ASSERT(dph.GetName() == L"acquired data");
	CPPUNIT_ASSERT(dph.GetDataStartFilePos() != 0);
	CPPUNIT_ASSERT(dph.GetNameValParamCnt() == 2);
	CPPUNIT_ASSERT(dph.GetRowSize() == sizeof(u_int16_t));
	CPPUNIT_ASSERT(dph.GetDataSize() == sizeof(u_int16_t)*100);
	CPPUNIT_ASSERT(dph.GetRowCnt() == 100);
	CPPUNIT_ASSERT(dph.GetColumnCnt() == 1);
	CPPUNIT_ASSERT(dph.GetDataStartFilePos() == 0x3a0);

	// Check the data group name value pairs
	ParameterNameValueTypeConstIt nvpBegin, nvpEnd;
	dph.GetNameValIterators(nvpBegin, nvpEnd);
	CPPUNIT_ASSERT(nvpBegin != nvpEnd);
	CPPUNIT_ASSERT(nvpBegin->GetName() == L"Scanner");
	CPPUNIT_ASSERT(nvpBegin->GetValueText() == L"M10");
	++nvpBegin;
	CPPUNIT_ASSERT(nvpBegin != nvpEnd);
	CPPUNIT_ASSERT(nvpBegin->GetName() == L"Pixel Size");
	CPPUNIT_ASSERT(nvpBegin->GetValueFloat() == 0.051f);
	++nvpBegin;
	CPPUNIT_ASSERT(nvpBegin == nvpEnd);

	// Check the data set columns
	CPPUNIT_ASSERT(dph.GetColumnInfo(0).GetColumnType() == UShortColType);
	CPPUNIT_ASSERT(dph.GetColumnInfo(0).GetSize() == sizeof(u_int16_t));

	dp->Delete();
}
Example #4
0
void DataSetTest_GenericData::ColsFromDataSetWithZeroRows()
{
	GenericData gd;
	GenericFileReader reader;
	reader.SetFilename("../data/small_cel_file_with_dataset_of_zero_rows");
	reader.ReadHeader(gd);

	// Open a DataSet that has 0 rows.
	DataSet* ds = gd.DataSet(0,3);
	CPPUNIT_ASSERT(ds);
	CPPUNIT_ASSERT(ds->Cols() == 2);
	CPPUNIT_ASSERT(ds->Rows() == 0);

	ds->Delete();

	// Open another DataSet that has 0 rows.
	ds = gd.DataSet(0,4);
	CPPUNIT_ASSERT(ds);
	CPPUNIT_ASSERT(ds->Cols() == 2);
	CPPUNIT_ASSERT(ds->Rows() == 0);

	ds->Delete();
}
void GetRow(int row, RowDataType &d)
{
	GenericData data;
	GenericFileReader reader;
	reader.SetFilename(TEST_FILE);
	reader.Open(data);

	DataSet *set = data.DataSet(0, 0);
	set->Open();

	set->GetData(row, 0, d.str);
	set->GetData(row, 1, d.wstr);
	set->GetData(row, 2, d.b);
	set->GetData(row, 3, d.s);
	set->GetData(row, 4, d.i);
	set->GetData(row, 5, d.ub);
	set->GetData(row, 6, d.us);
	set->GetData(row, 7, d.ui);
	set->GetData(row, 8, d.f);

	set->Close();
	set->Delete();
}
/*
 * Read the file contents into the data object.
 */
void GridControlFileReader::Read(const std::string &fileName, GridControlData& data)
{
	// Clear the old data and read the file.
	data.Clear();
	GenericFileReader reader;
	GenericData gdata;
	reader.SetFilename(fileName);
	reader.ReadHeader(gdata);

	// Check the file identifier
	if (gdata.FileIdentifier() != GRD_FILE_TYPE_IDENTIFIER)
	{
		affymetrix_calvin_exceptions::InvalidFileTypeException e(L"Calvin",L"Default Description, Please Update!",affymetrix_calvin_utilities::DateTime::GetCurrentDateTime().ToString(),std::string(__FILE__),(u_int16_t)__LINE__,0);
		throw e;
	}

	// Get the header parameters.
	ParameterNameValueType param;
	gdata.Header().GetGenericDataHdr()->FindNameValParam(GRD_ROWS_PARAMETER_NAME, param);
	data.SetRows(param.GetValueInt32());
	gdata.Header().GetGenericDataHdr()->FindNameValParam(GRD_COLUMNS_PARAMETER_NAME, param);
	data.SetColumns(param.GetValueInt32());

	// Get the XY coordinates from the dataSets.
	FeatureCoordinate coord;
	u_int16_t x;
	u_int16_t y;
	int nRows;
	DataSet *dataSet;

	// First the B1 probes.
	dataSet = gdata.DataSet(GRD_FILE_COORDINATE_GROUP_NAME, GRD_FILE_B1_SET_NAME);
	if (dataSet->Open() == false)
	{
		affymetrix_calvin_exceptions::DataSetNotOpenException e(L"Calvin",L"Default Description, Please Update!",affymetrix_calvin_utilities::DateTime::GetCurrentDateTime().ToString(),std::string(__FILE__),(u_int16_t)__LINE__,0);
		throw e;
	}
	nRows = dataSet->Rows();
	data.ResizeB1(nRows);
	for (int iRow=0; iRow<nRows; iRow++)
	{
		dataSet->GetData(iRow, 0, x);
		dataSet->GetData(iRow, 1, y);
		coord.x = x;
		coord.y = y;
		data.SetB1(iRow, coord);
	}
	dataSet->Close();
	dataSet->Delete();

	// Next the B2 probes.
	dataSet = gdata.DataSet(GRD_FILE_COORDINATE_GROUP_NAME, GRD_FILE_B2_SET_NAME);
	if (dataSet->Open() == false)
	{
		affymetrix_calvin_exceptions::DataSetNotOpenException e(L"Calvin",L"Default Description, Please Update!",affymetrix_calvin_utilities::DateTime::GetCurrentDateTime().ToString(),std::string(__FILE__),(u_int16_t)__LINE__,0);
		throw e;
	}
	nRows = dataSet->Rows();
	data.ResizeB2(nRows);
	for (int iRow=0; iRow<nRows; iRow++)
	{
		dataSet->GetData(iRow, 0, x);
		dataSet->GetData(iRow, 1, y);
		coord.x = x;
		coord.y = y;
		data.SetB2(iRow, coord);
	}
	dataSet->Close();
	dataSet->Delete();

	// Last the NS probes.
	dataSet = gdata.DataSet(GRD_FILE_COORDINATE_GROUP_NAME, GRD_FILE_NS_SET_NAME);
	if (dataSet->Open() == false)
	{
		affymetrix_calvin_exceptions::DataSetNotOpenException e(L"Calvin",L"Default Description, Please Update!",affymetrix_calvin_utilities::DateTime::GetCurrentDateTime().ToString(),std::string(__FILE__),(u_int16_t)__LINE__,0);
		throw e;
	}
	nRows = dataSet->Rows();
	data.ResizeNS(nRows);
	for (int iRow=0; iRow<nRows; iRow++)
	{
		dataSet->GetData(iRow, 0, x);
		dataSet->GetData(iRow, 1, y);
		coord.x = x;
		coord.y = y;
		data.SetNS(iRow, coord);
	}
	dataSet->Close();
	dataSet->Delete();
}