void CHPMultiDataData::AddAppMetaInfo(const ParameterNameValueTypeList& params)
{
	ParameterNameValueType param;
	GenericDataHeader* hdr = genericData.Header().GetGenericDataHdr();
	for (ParameterNameValueTypeList::const_iterator it=params.begin(); it != params.end(); ++it)
	{
		param = *it;
		param.SetName(APPLICATION_META_INFO_PREFIX_S + param.GetName());
		hdr->AddNameValParam(param);
	}
}
예제 #2
0
void CHPQuantificationData::AddSummaryParams(const ParameterNameValueTypeList& params)
{
	ParameterNameValueType param;
	GenericDataHeader* hdr = genericData.Header().GetGenericDataHdr();
	for (ParameterNameValueTypeList::const_iterator it=params.begin(); it != params.end(); it++)
	{
		param = *it;
		param.SetName(CHIP_SUMMARY_PARAMETER_NAME_PREFIX_S + param.GetName());
		hdr->AddNameValParam(param);
	}
}
void CHPMultiDataData::AddAlgParams(const ParameterNameValueTypeList& params)
{
	ParameterNameValueType param;
	GenericDataHeader* hdr = genericData.Header().GetGenericDataHdr();
	for (ParameterNameValueTypeList::const_iterator it=params.begin(); it != params.end(); it++)
	{
		param = *it;
		param.SetName(ALGORITHM_PARAM_NAME_PREFIX_S + param.GetName());
		hdr->AddNameValParam(param);
	}
}
void CHPMultiDataFileReaderTest::testReadCNV()
{
    affymetrix_calvin_data::ProbeSetMultiDataCopyNumberVariationRegionData e;
	ParameterNameValueType param;

    CHPMultiDataData data2;
	CHPMultiDataFileReader reader;
	reader.SetFilename("../data/CHP_MultiData_file_cnv");
	reader.Read(data2);
  
	CPPUNIT_ASSERT(data2.GetAlgName() == L"canary");
	CPPUNIT_ASSERT(data2.GetAlgVersion() == L"1.0");
	CPPUNIT_ASSERT(data2.GetArrayType() == L"test3");
    CPPUNIT_ASSERT(data2.GetEntryCount(CopyNumberVariationMultiDataType) == 2);
	CPPUNIT_ASSERT(data2.GetEntryCount(CopyNumberMultiDataType) == 0);
	CPPUNIT_ASSERT(data2.GetEntryCount(GenotypeMultiDataType) == 0);
	CPPUNIT_ASSERT(data2.GetEntryCount(ExpressionMultiDataType) == 0);

	ParameterNameValueTypeList p = data2.GetAlgParams();
	ParameterNameValueTypeList::iterator it = p.begin();
	param = *it;
	CPPUNIT_ASSERT(param.GetName() == L"an1");
	CPPUNIT_ASSERT(param.GetValueText() == L"av1");

	p = data2.GetSummaryParams();
	it = p.begin();
	param = *it;
	CPPUNIT_ASSERT(param.GetName() == L"sn1");
	CPPUNIT_ASSERT(param.GetValueText() == L"sv1");

    data2.GetCopyNumberVariationEntry(CopyNumberVariationMultiDataType, 0, e);
	CPPUNIT_ASSERT(e.call == 1);
	CPPUNIT_ASSERT(e.name == "abc");
    CPPUNIT_ASSERT_DOUBLES_EQUAL(e.confidenceScore, 1.1f, 0.0001f);
    CPPUNIT_ASSERT(e.signal == 100);
	data2.GetCopyNumberVariationEntry(CopyNumberVariationMultiDataType, 1, e);
	CPPUNIT_ASSERT(e.call == 2);
	CPPUNIT_ASSERT(e.name == "xyz");
    CPPUNIT_ASSERT_DOUBLES_EQUAL(e.confidenceScore, 2.2, 0.0001f);
    CPPUNIT_ASSERT(e.signal == 200);
}
예제 #5
0
void CHPQuantificationDetectionFileReaderTest::testReadId()
{
    CHPQuantificationDetectionData data;
    CHPQuantificationDetectionFileReader reader;
    CPPUNIT_ASSERT_NO_THROW(reader.SetFilename("../data/CHP_quantification_detection_file_id"));
    CPPUNIT_ASSERT_NO_THROW(reader.Read(data));

    CPPUNIT_ASSERT(data.GetFilename() == "../data/CHP_quantification_detection_file_id");
    CPPUNIT_ASSERT(data.GetAlgName() == L"sig");
    CPPUNIT_ASSERT(data.GetAlgVersion() == L"1.0");
    CPPUNIT_ASSERT(data.GetArrayType() == L"test3");
    CPPUNIT_ASSERT(data.GetEntryCount() == 2);

    ParameterNameValueTypeList params = data.GetAlgParams();
    CPPUNIT_ASSERT(params.size() == 1);
    ParameterNameValueTypeList::iterator it=params.begin();
    ParameterNameValueType param = *it;
    CPPUNIT_ASSERT(param.GetName() == L"an1");
    CPPUNIT_ASSERT(param.GetValueText() == L"av1");

    params = data.GetSummaryParams();
    CPPUNIT_ASSERT(params.size() == 1);
    it=params.begin();
    param = *it;
    CPPUNIT_ASSERT(param.GetName() == L"sn1");
    CPPUNIT_ASSERT(param.GetValueText() == L"sv1");

    ProbeSetQuantificationDetectionData e;
    data.GetQuantificationDetectionEntry(0, e);
    CPPUNIT_ASSERT(e.id == 10);
    CPPUNIT_ASSERT(e.quantification == 10.0f);
    CPPUNIT_ASSERT(e.pvalue == 0.1f);
    CPPUNIT_ASSERT(e.name == "");
    data.GetQuantificationDetectionEntry(1, e);
    CPPUNIT_ASSERT(e.id == 20);
    CPPUNIT_ASSERT(e.quantification == 20.0f);
    CPPUNIT_ASSERT(e.pvalue == 0.2f);
    CPPUNIT_ASSERT(e.name == "");
}
예제 #6
0
void FusionCHPQuantificationDataTest::testRead()
{
	FusionCHPData *chp = FusionCHPDataReg::Read("../../parsers/data/CHP_quantification_file");
	CPPUNIT_ASSERT(chp != NULL);
	FusionCHPQuantificationData *sigChp = FusionCHPQuantificationData::FromBase(chp); 
	CPPUNIT_ASSERT(sigChp != NULL);

	CPPUNIT_ASSERT(sigChp->GetAlgName() == L"sig");
	CPPUNIT_ASSERT(sigChp->GetAlgVersion() == L"1.0");
	CPPUNIT_ASSERT(sigChp->GetArrayType() == L"test3");
	CPPUNIT_ASSERT(sigChp->GetEntryCount() == 2);
	
	ParameterNameValueTypeList params = sigChp->GetAlgParams();
	CPPUNIT_ASSERT(params.size() == 1);
	ParameterNameValueTypeList::iterator it=params.begin();
	ParameterNameValueType &param = *it;
	CPPUNIT_ASSERT(param.GetName() == L"an1");
	CPPUNIT_ASSERT(param.GetValueText() == L"av1");

	params = sigChp->GetSummaryParams();
	CPPUNIT_ASSERT(params.size() == 1);
	it=params.begin();
	param = *it;
	CPPUNIT_ASSERT(param.GetName() == L"sn1");
	CPPUNIT_ASSERT(param.GetValueText() == L"sv1");

	affymetrix_calvin_data::ProbeSetQuantificationData e;
	sigChp->GetQuantificationEntry(0, e);
	CPPUNIT_ASSERT(e.name == "abc");
    CPPUNIT_ASSERT(e.quantification == 10.0f);
	sigChp->GetQuantificationEntry(1, e);
	CPPUNIT_ASSERT(e.name == "xyz");
	CPPUNIT_ASSERT(e.quantification == 20.0f);

	
	delete sigChp;
}
void CHPMultiDataFileReaderTest::testReadCN()
{
   	affymetrix_calvin_data::ProbeSetMultiDataCopyNumberData e;
	ParameterNameValueType param;
	CHPMultiDataData data2;
	CHPMultiDataFileReader reader;
	reader.SetFilename("../data/CHP_MultiData_file_cn");
	reader.Read(data2);

	CPPUNIT_ASSERT(data2.GetAlgName() == L"sig");
	CPPUNIT_ASSERT(data2.GetAlgVersion() == L"1.0");
	CPPUNIT_ASSERT(data2.GetArrayType() == L"test3");
	CPPUNIT_ASSERT(data2.GetEntryCount(CopyNumberMultiDataType) == 2);
	CPPUNIT_ASSERT(data2.GetEntryCount(GenotypeMultiDataType) == 0);
	CPPUNIT_ASSERT(data2.GetEntryCount(ExpressionMultiDataType) == 0);

	ParameterNameValueTypeList p = data2.GetAlgParams();
	ParameterNameValueTypeList::iterator it = p.begin();
	param = *it;
	CPPUNIT_ASSERT(param.GetName() == L"an1");
	CPPUNIT_ASSERT(param.GetValueText() == L"av1");

	p = data2.GetSummaryParams();
	it = p.begin();
	param = *it;
	CPPUNIT_ASSERT(param.GetName() == L"sn1");
	CPPUNIT_ASSERT(param.GetValueText() == L"sv1");

    data2.GetCopyNumberEntry(CopyNumberMultiDataType, 0, e);
	CPPUNIT_ASSERT(e.chr == 10);
	CPPUNIT_ASSERT(e.position == 11);
	CPPUNIT_ASSERT(e.name == "abc");
	data2.GetCopyNumberEntry(CopyNumberMultiDataType, 1, e);
	CPPUNIT_ASSERT(e.chr == 20);
	CPPUNIT_ASSERT(e.position == 21);
	CPPUNIT_ASSERT(e.name == "xyz");
}
void CHPQuantificationFileWriterTest::WriteTest()
{
	ParameterNameValueTypeList params;
	ParameterNameValueType param;

	CHPQuantificationData data("CHP_quantification_file");

	data.SetAlgName(L"sig");
	data.SetAlgVersion(L"1.0");
	data.SetArrayType(L"test3");
	data.SetEntryCount(2, 10);

	param.SetName(L"an1");
	param.SetValueText(L"av1");
	params.push_back(param);
	data.AddAlgParams(params);

	params.clear();
	param.SetName(L"sn1");
	param.SetValueText(L"sv1");
	params.push_back(param);
	data.AddSummaryParams(params);


	CHPQuantificationFileWriter *writer = new CHPQuantificationFileWriter(data);
	affymetrix_calvin_data::ProbeSetQuantificationData e;

	writer->SeekToDataSet();
	e.name = "abc";
	e.quantification = 10.0f;
	writer->WriteEntry(e);
	e.name = "xyz";
	e.quantification = 20.0f;
	writer->WriteEntry(e);

	delete writer;

	CPPUNIT_ASSERT(1);




	CHPQuantificationData data2;
	CHPQuantificationFileReader reader;
	reader.SetFilename("CHP_quantification_file");
	reader.Read(data2);

	CPPUNIT_ASSERT(data2.GetAlgName() == L"sig");
	CPPUNIT_ASSERT(data2.GetAlgVersion() == L"1.0");
	CPPUNIT_ASSERT(data2.GetArrayType() == L"test3");
	CPPUNIT_ASSERT(data2.GetEntryCount() == 2);

	ParameterNameValueTypeList p = data2.GetAlgParams();
	ParameterNameValueTypeList::iterator it = p.begin();
	param = *it;
	CPPUNIT_ASSERT(param.GetName() == L"an1");
	CPPUNIT_ASSERT(param.GetValueText() == L"av1");

	p = data2.GetSummaryParams();
	it = p.begin();
	param = *it;
	CPPUNIT_ASSERT(param.GetName() == L"sn1");
	CPPUNIT_ASSERT(param.GetValueText() == L"sv1");


	data2.GetQuantificationEntry(0, e);
	CPPUNIT_ASSERT_DOUBLES_EQUAL(e.quantification, 10.0f, 0.0001f);
	CPPUNIT_ASSERT(e.name == "abc");
	data2.GetQuantificationEntry(1, e);
	CPPUNIT_ASSERT_DOUBLES_EQUAL(e.quantification, 20.0f, 0.0001f);
	CPPUNIT_ASSERT(e.name == "xyz");

}
예제 #9
0
void FusionCHPTilingDataTest::testRead()
{
	FusionCHPData *chp = FusionCHPDataReg::Read("../../parsers/data/CHP_tiling_file");
	CPPUNIT_ASSERT(chp != NULL);
	FusionCHPTilingData *tileChp = FusionCHPTilingData::FromBase(chp); 
	CPPUNIT_ASSERT(tileChp != NULL);

	CPPUNIT_ASSERT(tileChp->GetNumberSequences() == 2);
	CPPUNIT_ASSERT(tileChp->GetAlgName() == L"tile");
	CPPUNIT_ASSERT(tileChp->GetAlgVersion() == L"1.0");

	ParameterNameValueTypeList params = tileChp->GetAlgParams();
	CPPUNIT_ASSERT(params.size() == 1);
	ParameterNameValueTypeList::iterator it=params.begin();
	ParameterNameValueType &param = *it;
	CPPUNIT_ASSERT(param.GetName() == L"p1");
	CPPUNIT_ASSERT(param.GetValueText() == L"v1");

	const double eps=0.00001;
	CHPTilingEntry e;
	TilingSequenceData seq;

	tileChp->OpenTilingSequenceDataSet(0);
	seq = tileChp->GetTilingSequenceData();
	
	CPPUNIT_ASSERT(seq.name == L"n1");
	CPPUNIT_ASSERT(seq.groupName == L"g1");
	CPPUNIT_ASSERT(seq.version == L"v1");
	CPPUNIT_ASSERT(seq.parameters.size() == 1);
	it = seq.parameters.begin();
	param = *it;
	CPPUNIT_ASSERT(param.GetName() == L"seq1_p1");
	CPPUNIT_ASSERT(param.GetValueText() == L"seq1_v1");

	CPPUNIT_ASSERT(tileChp->GetTilingSequenceEntryCount(0) == 2);
	tileChp->GetTilingSequenceEntry(0, e);
	CPPUNIT_ASSERT(e.position == 10);
	CPPUNIT_ASSERT_DOUBLES_EQUAL(e.value, 10.0f, eps);

	tileChp->GetTilingSequenceEntry(1, e);
	CPPUNIT_ASSERT(e.position == 20);
	CPPUNIT_ASSERT_DOUBLES_EQUAL(e.value, 20.0f, eps);


	tileChp->OpenTilingSequenceDataSet(1);
	seq = tileChp->GetTilingSequenceData();
	
	CPPUNIT_ASSERT(seq.name == L"n2");
	CPPUNIT_ASSERT(seq.groupName == L"g2");
	CPPUNIT_ASSERT(seq.version == L"v2");
	CPPUNIT_ASSERT(seq.parameters.size() == 1);
	it = seq.parameters.begin();
	param = *it;
	CPPUNIT_ASSERT(param.GetName() == L"seq2_p1");
	CPPUNIT_ASSERT(param.GetValueText() == L"seq2_v1");

	CPPUNIT_ASSERT(tileChp->GetTilingSequenceEntryCount(1) == 3);
	tileChp->GetTilingSequenceEntry(0, e);
	CPPUNIT_ASSERT(e.position == 11);
	CPPUNIT_ASSERT_DOUBLES_EQUAL(e.value, 11.0f, eps);

	tileChp->GetTilingSequenceEntry(1, e);
	CPPUNIT_ASSERT(e.position == 21);
	CPPUNIT_ASSERT_DOUBLES_EQUAL(e.value, 21.0f, eps);

	tileChp->GetTilingSequenceEntry(2, e);
	CPPUNIT_ASSERT(e.position == 31);
	CPPUNIT_ASSERT_DOUBLES_EQUAL(e.value, 31.0f, eps);
	
	delete tileChp;
}