本文整理汇总了C++中DataSetHeader::AddColumn方法的典型用法代码示例。如果您正苦于以下问题:C++ DataSetHeader::AddColumn方法的具体用法?C++ DataSetHeader::AddColumn怎么用?C++ DataSetHeader::AddColumn使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DataSetHeader
的用法示例。
在下文中一共展示了DataSetHeader::AddColumn方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: WriteOutGenericDATDataFileNoGrid
void TestFileGenerator::WriteOutGenericDATDataFileNoGrid()
{
GenericDataHeader gdh;
AddStandardGenericDataHeader(gdh);
// Fill the DataGroupHeader
DataGroupHeader dch;
dch.SetName(L"First Data Cube");
// Fill the DataSetHeader
DataSetHeader dph;
dph.SetName(L"acquired data");
ParameterNameValueType nvt;
nvt.SetName(L"Scanner");
nvt.SetValueText(L"M10");
dph.AddNameValParam(nvt);
nvt.SetName(L"Pixel Size");
nvt.SetValueFloat(0.051f);
dph.AddNameValParam(nvt);
dph.AddColumn(UShortColumn(L"Pixel"));
int32_t rows = 100;
dph.SetRowCnt(rows);
dch.AddDataSetHdr(dph);
// Set the FileHeader
FileHeader fh;
fh.SetFilename("test.file.data_dat");
fh.SetGenericDataHdr(gdh);
fh.AddDataGroupHdr(dch);
// Create the generic file writer
GenericFileWriter gfWriter(&fh);
gfWriter.WriteHeader();
DataGroupWriterIt dcwBegin, dcwEnd;
gfWriter.GetDataGroupWriters(dcwBegin, dcwEnd);
DataGroupWriter d = *dcwBegin;
dcwBegin->WriteHeader();
DataSetWriterIt dpwBegin, dpwEnd;
dcwBegin->GetDataSetWriters(dpwBegin, dpwEnd);
dpwBegin->WriteHeader();
// Write out the data
for( int32_t i=0; i < rows; ++i )
{
u_int16_t value = (u_int16_t)(i*10+i);
dpwBegin->Write(value);
}
dpwBegin->UpdateNextDataSetOffset();
dcwBegin->Close();
}
示例2: AddColumns
void CHPMultiDataData::AddColumns(DataSetInfo &info, DataSetHeader& hdr)
{
switch (info.dataType)
{
case ExpressionMultiDataType:
hdr.AddAsciiColumn(PROBE_SET_NAME, info.maxName);
hdr.AddFloatColumn(QUANTIFICATION);
break;
case GenotypeMultiDataType:
hdr.AddAsciiColumn(PROBE_SET_NAME, info.maxName);
hdr.AddUByteColumn(CALL);
hdr.AddFloatColumn(CONFIDENCE);
break;
case CopyNumberMultiDataType:
hdr.AddAsciiColumn(PROBE_SET_NAME, info.maxName);
hdr.AddUByteColumn(CHR);
hdr.AddUIntColumn(POSITION);
break;
case CytoMultiDataType:
hdr.AddAsciiColumn(REGION, info.maxName);
hdr.AddUByteColumn(CHR);
hdr.AddUIntColumn(START_POSITION);
hdr.AddUIntColumn(STOP_POSITION);
hdr.AddUByteColumn(CALL);
hdr.AddFloatColumn(CONFIDENCE);
break;
case CopyNumberVariationMultiDataType:
hdr.AddAsciiColumn(REGION, info.maxName);
hdr.AddFloatColumn(SIGNAL);
hdr.AddUByteColumn(CALL);
hdr.AddFloatColumn(CONFIDENCE);
break;
case DmetCopyNumberMultiDataType:
hdr.AddAsciiColumn(PROBE_SET_NAME, info.maxName);
hdr.AddShortColumn(CN_CALL);
hdr.AddFloatColumn(CN_CONFIDENCE);
hdr.AddShortColumn(CN_FORCE);
hdr.AddFloatColumn(CN_ESTIMATE);
hdr.AddFloatColumn(CN_LOWER);
hdr.AddFloatColumn(CN_UPPER);
break;
case DmetMultiAllelicMultiDataType:
hdr.AddAsciiColumn(PROBE_SET_NAME, info.maxName);
hdr.AddUByteColumn(CALL);
hdr.AddFloatColumn(CONFIDENCE);
hdr.AddUByteColumn(FORCE);
hdr.AddUByteColumn(ALLELE_COUNT);
hdr.AddFloatColumn(SIGNAL_A);
hdr.AddFloatColumn(SIGNAL_B);
hdr.AddFloatColumn(SIGNAL_C);
hdr.AddFloatColumn(SIGNAL_D);
hdr.AddFloatColumn(SIGNAL_E);
hdr.AddFloatColumn(SIGNAL_F);
hdr.AddUByteColumn(CONTEXT_A);
hdr.AddUByteColumn(CONTEXT_B);
hdr.AddUByteColumn(CONTEXT_C);
hdr.AddUByteColumn(CONTEXT_D);
hdr.AddUByteColumn(CONTEXT_E);
hdr.AddUByteColumn(CONTEXT_F);
break;
case DmetBiAllelicMultiDataType:
hdr.AddAsciiColumn(PROBE_SET_NAME, info.maxName);
hdr.AddUByteColumn(CALL);
hdr.AddFloatColumn(CONFIDENCE);
hdr.AddUByteColumn(FORCE);
hdr.AddFloatColumn(SIGNAL_A);
hdr.AddFloatColumn(SIGNAL_B);
hdr.AddUByteColumn(CONTEXT_A);
hdr.AddUByteColumn(CONTEXT_B);
break;
case ChromosomeSummaryMultiDataType:
hdr.AddUByteColumn(CHR);
hdr.AddAsciiColumn(CHR_DISPLAY, info.maxName);
hdr.AddUIntColumn(START_INDEX);
hdr.AddUIntColumn(MARKER_COUNT);
hdr.AddFloatColumn(MIN_SIGNAL);
hdr.AddFloatColumn(MAX_SIGNAL);
hdr.AddFloatColumn(MEDIAN_CN_STATE);
hdr.AddFloatColumn(HOM_FREQ);
hdr.AddFloatColumn(HET_FREQ);
break;
case SegmentCNMultiDataType:
hdr.AddUIntColumn(SEGMENT_ID);
hdr.AddUByteColumn(CHR);
hdr.AddUIntColumn(START_POSITION);
hdr.AddUIntColumn(STOP_POSITION);
hdr.AddIntColumn(MARKER_COUNT);
hdr.AddUIntColumn(MEAN_MARKER_DISTANCE);
break;
case SegmentLOHMultiDataType:
//.........这里部分代码省略.........
示例3: WriteOutGenericDataFileWithAllColumnTypes
void TestFileGenerator::WriteOutGenericDataFileWithAllColumnTypes()
{
GenericDataHeader gdh;
AddStandardGenericDataHeader(gdh);
// Fill the DataGroupHeader
DataGroupHeader dch;
dch.SetName(L"default"); // default DataGroup
// Fill the all types DataSetHeader
DataSetHeader dphAT;
dphAT.SetName(L"all types");
ParameterNameValueType nvt;
nvt.SetName(L"How many types");
nvt.SetValueText(L"All types");
dphAT.AddNameValParam(nvt);
nvt.SetName(L"Powered by");
nvt.SetValueText(L"Affymetrix");
dphAT.AddNameValParam(nvt);
dphAT.AddColumn(ByteColumn(L"Byte type"));
dphAT.AddColumn(UByteColumn(L"UByte type"));
dphAT.AddColumn(ASCIIColumn(L"ASCII type", 10));
dphAT.AddColumn(ShortColumn(L"Short type"));
dphAT.AddColumn(UShortColumn(L"UShort type"));
dphAT.AddColumn(IntColumn(L"Int type"));
dphAT.AddColumn(UIntColumn(L"UInt type"));
dphAT.AddColumn(UnicodeColumn(L"Unicode type", 15));
dphAT.AddColumn(FloatColumn(L"Float type"));
int32_t rows = 2;
dphAT.SetRowCnt(rows);
dch.AddDataSetHdr(dphAT);
// Set the FileHeader
FileHeader fh;
fh.SetFilename("test.file.data_all_column_types");
fh.SetGenericDataHdr(gdh);
fh.AddDataGroupHdr(dch);
// Create the generic file writer
GenericFileWriter gfWriter(&fh);
gfWriter.WriteHeader();
DataGroupWriterIt dcwBegin, dcwEnd;
gfWriter.GetDataGroupWriters(dcwBegin, dcwEnd);
DataGroupWriter d = *dcwBegin;
dcwBegin->WriteHeader();
DataSetWriterIt dpwBegin, dpwEnd;
dcwBegin->GetDataSetWriters(dpwBegin, dpwEnd);
// Write out the all types DataSet
dpwBegin->WriteHeader();
for( int32_t row = 0; row < rows; ++row )
{
char str[10];
wchar_t wstr[15];
int8_t b = 1+10*row;
u_int8_t ub = 2+10*row;
sprintf(str, "%d", 3+10*row);
int16_t s = 4+10*row;
u_int16_t us = 5+10*row;
int32_t i = 6+10*row;
u_int32_t ui = 7+10*row;
FormatString1(wstr, 15, L"%d", 8+10*row);
float f = 9+10*row;
dpwBegin->Write(b); // btye
dpwBegin->Write(ub); // unsigned byte
dpwBegin->Write(str, 10); // ACSII string
dpwBegin->Write(s); // short
dpwBegin->Write(us); // unsigned short
dpwBegin->Write(i); // int
dpwBegin->Write(ui); // unsigned int
dpwBegin->Write(wstr, 15); // Unicode string
dpwBegin->Write(f); // float
}
dpwBegin->UpdateNextDataSetOffset();
dcwBegin->Close();
}
示例4: WriteOutGenericDATDataFileWithGrid
void TestFileGenerator::WriteOutGenericDATDataFileWithGrid()
{
GenericDataHeader gdh;
AddStandardGenericDataHeader(gdh);
// Fill the DataGroupHeader
DataGroupHeader dch;
dch.SetName(L""); // unnamed DataGroup
// Fill the pixel intensity DataSetHeader
DataSetHeader dphPixel;
dphPixel.SetName(L"acquired data");
ParameterNameValueType nvt;
nvt.SetName(L"Scanner");
nvt.SetValueText(L"M10");
dphPixel.AddNameValParam(nvt);
nvt.SetName(L"Pixel Size");
nvt.SetValueFloat(0.051f);
dphPixel.AddNameValParam(nvt);
dphPixel.AddColumn(UShortColumn(L"Pixel"));
int32_t rows = 1000;
dphPixel.SetRowCnt(rows);
dch.AddDataSetHdr(dphPixel);
// Fill the grid DataSetHeader
DataSetHeader dphGrid;
dphGrid.SetName(L"grid position");
nvt.SetName(L"GhostGrids");
nvt.SetValueText(L"True");
dphGrid.AddNameValParam(nvt);
nvt.SetName(L"Pixel Size");
nvt.SetValueFloat(0.051f);
dphGrid.AddNameValParam(nvt);
dphGrid.AddColumn(FloatColumn(L"Upper left x"));
dphGrid.AddColumn(FloatColumn(L"Upper left y"));
dphGrid.AddColumn(FloatColumn(L"Upper right x"));
dphGrid.AddColumn(FloatColumn(L"Upper right y"));
dphGrid.AddColumn(FloatColumn(L"Lower right x"));
dphGrid.AddColumn(FloatColumn(L"Lower right y"));
dphGrid.AddColumn(FloatColumn(L"Lower left x"));
dphGrid.AddColumn(FloatColumn(L"Lower left y"));
int32_t grids = 5; // first is the global grid with 4 subgrids
dphGrid.SetRowCnt(grids);
dch.AddDataSetHdr(dphGrid);
// Set the FileHeader
FileHeader fh;
fh.SetFilename("test.file.data_dat_with_grid");
fh.SetGenericDataHdr(gdh);
fh.AddDataGroupHdr(dch);
// Create the generic file writer
GenericFileWriter gfWriter(&fh);
gfWriter.WriteHeader();
DataGroupWriterIt dcwBegin, dcwEnd;
gfWriter.GetDataGroupWriters(dcwBegin, dcwEnd);
DataGroupWriter d = *dcwBegin;
dcwBegin->WriteHeader();
DataSetWriterIt dpwBegin, dpwEnd;
dcwBegin->GetDataSetWriters(dpwBegin, dpwEnd);
// Write out the pixel DataSet
dpwBegin->WriteHeader();
for( int32_t i=0; i < rows; ++i )
{
u_int16_t value = (u_int16_t)(i*10+i);
dpwBegin->Write(value);
}
dpwBegin->UpdateNextDataSetOffset();
++dpwBegin;
// Write out the grid DataSet
dpwBegin->WriteHeader();
for( int32_t i=0; i < grids; ++i )
{
for (int32_t corner = 0; corner < 4; ++corner)
{
float value = (float)(i*100 + corner);
dpwBegin->Write(value);
dpwBegin->Write(value);
}
}
dpwBegin->UpdateNextDataSetOffset();
//.........这里部分代码省略.........
示例5: dphWriter
// Uses a mix of the GenericFileWriter and raw commands
void TestFileGenerator::WriteOutGenericDATDataFile1UsingGenericWriter()
{
GenericDataHeader gdh;
AddStandardGenericDataHeader(gdh);
// Fill the DataSetHeader
DataSetHeader dph;
dph.SetName(L"acquired data");
ParameterNameValueType nvt;
nvt.SetName(L"Scanner");
nvt.SetValueText(L"M10");
dph.AddNameValParam(nvt);
nvt.SetName(L"Pixel Size");
nvt.SetValueFloat(0.051f);
dph.AddNameValParam(nvt);
dph.AddColumn(UShortColumn(L"Pixel"));
int32_t rows = 100;
dph.SetRowCnt(rows);
// Open the file.
ofstream fileStream;
fileStream.open( "test.file.data_dat", ios_base::out | ios_base::binary | ios_base::trunc);
// Write the file header using raw methods until the writer is available.
// magic number
FileOutput::WriteUInt8(fileStream, 59);
// version
FileOutput::WriteInt8(fileStream, 1);
// Number of data cubes - confirm this
FileOutput::WriteUInt32(fileStream, 1);
// offset to the data cube byte offset array
int offsetLocation = fileStream.tellp();
FileOutput::WriteUInt32(fileStream, 1); //????
// Write the GenericDataHeader to the file
GenericDataHeaderWriter gdhWriter;
gdhWriter.Write(fileStream, gdh);
//
// Data Cube
//
int offset = fileStream.tellp();
// Write the DataSetHeader
DataSetWriter dphWriter(&fileStream, &dph);
dphWriter.WriteHeader();
// Write out the data
for( int32_t i=0; i < rows; ++i )
{
u_int16_t value = (u_int16_t)(i*10+i);
FileOutput::WriteUInt16(fileStream, value);
}
// write the offset
fileStream.seekp(offsetLocation);
FileOutput::WriteUInt32(fileStream, offset);
fileStream.close();
}