本文整理汇总了C++中BamMultiReader::GetHeader方法的典型用法代码示例。如果您正苦于以下问题:C++ BamMultiReader::GetHeader方法的具体用法?C++ BamMultiReader::GetHeader怎么用?C++ BamMultiReader::GetHeader使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类BamMultiReader
的用法示例。
在下文中一共展示了BamMultiReader::GetHeader方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: runInternal
int FileReader::runInternal()
{
ogeNameThread("am_FileReader");
if(!format_specified)
format = deduceFileFormat();
if(format == FORMAT_BAM)
{
BamMultiReader reader;
if(!reader.Open(filenames)) {
cerr << "Error opening BAM files." << endl;
reader.Close();
return -1;
}
header = reader.GetHeader();
references = reader.GetReferenceData();
open = true;
BamAlignment * al;
while(true)
{
if(load_string_data)
al = reader.GetNextAlignment();
else
al = reader.GetNextAlignmentCore();
if(!al)
break;
putOutputAlignment(al);
}
reader.Close();
} else if(format == FORMAT_SAM) {
vector<SamReader> readers;
SamHeader first_header;
// before doing any reading, open the files to
// verify they are the right format, etc.
for(int i = 0; i < filenames.size(); i++) {
SamReader reader;
if(!reader.Open(filenames[i])) {
cerr << "Error opening SAM file: " << filenames[i] << endl;
return -1;
}
if(filenames.size() > 1 && i == 0)
first_header = header;
// TODO: We can probably find a better way to deal with multiple SAM file headers,
// but for now we should disallow different headers to avoid issues.
if(i > 0 && header.ToString() != first_header.ToString())
cerr << "Warning! SAM input files have different headers." << endl;
reader.Close();
}
for(int i = 0; i < filenames.size(); i++) {
SamReader reader;
if(!reader.Open(filenames[i])) {
cerr << "Error opening SAM file: " << filenames[i] << endl;
return -1;
}
header = reader.GetHeader();
references = reader.GetReferenceData();
open = true;
if(filenames.size() > 1 && i == 0)
first_header = header;
BamAlignment * al = NULL;
while(true)
{
al = reader.GetNextAlignment();
if(NULL == al)
break;
putOutputAlignment(al);
}
reader.Close();
}
} else {
cerr << "FileReader couldn't detect file format. Aborting." << endl;
exit(-1);
return -1;
}
return 0;
}