Skip to content

Commit

Permalink
Merge pull request #7 from mklarqvist/dev2
Browse files Browse the repository at this point in the history
Bug fix if not expanding before linear index
Marcus D. R. Klarqvist authored Sep 25, 2017
2 parents 6696eca + 8ffd535 commit 7f08de7
Showing 2 changed files with 7 additions and 4 deletions.
6 changes: 4 additions & 2 deletions src/algorithm/sort/TomahawkOutputSort.cpp
Original file line number Diff line number Diff line change
@@ -291,6 +291,7 @@ bool TomahawkOutputSorter::sortMerge(const std::string& inputFile, const std::st
return false;
}

toi_header.controller.partial_sort = false;
toi_header.controller.sorted = true;
writer_type writer(this->reader.contigs, &this->reader.header, toi_header);

@@ -358,15 +359,16 @@ bool TomahawkOutputSorter::sortMerge(const std::string& inputFile, const std::st
}

writer.flush();
if(!writer.finalize()){
if(!writer.finalize(toi_header.controller.expanded)){
std::cerr << Helpers::timestamp("ERROR","SORT") << "Failed to finalize index..." << std::endl;
return false;
}

writer.close();

// Temp
index_type& index = writer.getIndex();
//index_type& index = writer.getIndex();
//std::cerr << index << std::endl;

// Cleanup
for(U32 i = 0; i < n_toi_entries; ++i)
5 changes: 3 additions & 2 deletions src/tomahawk/TomahawkOutput/TomahawkOutputWriter.h
Original file line number Diff line number Diff line change
@@ -318,7 +318,7 @@ class TomahawkOutputWriterIndex : public TomahawkOutputWriter{

index_type& getIndex(void){ return(this->index); }

bool finalize(void){
bool finalize(bool output_index){
// Totempole Output Index
// Update blocks written
std::fstream re(this->basePath + this->baseName + '.' + Tomahawk::Constants::OUTPUT_LD_SUFFIX + '.' + Tomahawk::Constants::OUTPUT_LD_SORT_INDEX_SUFFIX, std::ios::in | std::ios::out | std::ios::binary);
@@ -340,7 +340,8 @@ class TomahawkOutputWriterIndex : public TomahawkOutputWriter{
re.close();

// Write sorted index
this->stream_index.getNativeStream() << this->index;
if(output_index)
this->stream_index.getNativeStream() << this->index;

return true;
}

0 comments on commit 7f08de7

Please sign in to comment.