-
Notifications
You must be signed in to change notification settings - Fork 45
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Make indexer use streaming parser; fix bug in streaming parser
- Loading branch information
Showing
22 changed files
with
628 additions
and
239 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,25 @@ | ||
/** | ||
>HEADER | ||
Copyright (c) 2013 Rob Patro [email protected] | ||
This file is part of Sailfish. | ||
Sailfish is free software: you can redistribute it and/or modify | ||
it under the terms of the GNU General Public License as published by | ||
the Free Software Foundation, either version 3 of the License, or | ||
(at your option) any later version. | ||
Sailfish is distributed in the hope that it will be useful, | ||
but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
GNU General Public License for more details. | ||
You should have received a copy of the GNU General Public License | ||
along with Sailfish. If not, see <http://www.gnu.org/licenses/>. | ||
<HEADER | ||
**/ | ||
|
||
|
||
#ifndef __BINARY_LITERAL_HPP__ | ||
#define __BINARY_LITERAL_HPP__ | ||
|
||
|
@@ -52,4 +74,4 @@ constexpr unsigned long long operator "" _binary() | |
|
||
//=============================================================== | ||
|
||
#endif // __BINARY_LITERAL_HPP__ | ||
#endif // __BINARY_LITERAL_HPP__ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,25 @@ | ||
/** | ||
>HEADER | ||
Copyright (c) 2013 Rob Patro [email protected] | ||
This file is part of Sailfish. | ||
Sailfish is free software: you can redistribute it and/or modify | ||
it under the terms of the GNU General Public License as published by | ||
the Free Software Foundation, either version 3 of the License, or | ||
(at your option) any later version. | ||
Sailfish is distributed in the hope that it will be useful, | ||
but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
GNU General Public License for more details. | ||
You should have received a copy of the GNU General Public License | ||
along with Sailfish. If not, see <http://www.gnu.org/licenses/>. | ||
<HEADER | ||
**/ | ||
|
||
|
||
#ifndef __HEPTAMER_INDEX_HPP__ | ||
#define __HEPTAMER_INDEX_HPP__ | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,25 @@ | ||
/** | ||
>HEADER | ||
Copyright (c) 2013 Rob Patro [email protected] | ||
This file is part of Sailfish. | ||
Sailfish is free software: you can redistribute it and/or modify | ||
it under the terms of the GNU General Public License as published by | ||
the Free Software Foundation, either version 3 of the License, or | ||
(at your option) any later version. | ||
Sailfish is distributed in the hope that it will be useful, | ||
but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
GNU General Public License for more details. | ||
You should have received a copy of the GNU General Public License | ||
along with Sailfish. If not, see <http://www.gnu.org/licenses/>. | ||
<HEADER | ||
**/ | ||
|
||
|
||
#ifndef __PARTITION_REFINER_HPP__ | ||
#define __PARTITION_REFINER_HPP__ | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,92 @@ | ||
/** | ||
>HEADER | ||
Copyright (c) 2013 Rob Patro [email protected] | ||
This file is part of Sailfish. | ||
Sailfish is free software: you can redistribute it and/or modify | ||
it under the terms of the GNU General Public License as published by | ||
the Free Software Foundation, either version 3 of the License, or | ||
(at your option) any later version. | ||
Sailfish is distributed in the hope that it will be useful, | ||
but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
GNU General Public License for more details. | ||
You should have received a copy of the GNU General Public License | ||
along with Sailfish. If not, see <http://www.gnu.org/licenses/>. | ||
<HEADER | ||
**/ | ||
|
||
|
||
#ifndef __READPRODUCER_HPP__ | ||
#define __READPRODUCER_HPP__ | ||
|
||
#include "jellyfish/parse_dna.hpp" | ||
#include "jellyfish/mapped_file.hpp" | ||
#include "jellyfish/parse_read.hpp" | ||
#include "jellyfish/sequence_parser.hpp" | ||
#include "jellyfish/dna_codes.hpp" | ||
#include "jellyfish/compacted_hash.hpp" | ||
#include "jellyfish/mer_counting.hpp" | ||
#include "jellyfish/misc.hpp" | ||
#include "StreamingSequenceParser.hpp" | ||
|
||
template <typename Parser> | ||
class ReadProducer { | ||
}; | ||
|
||
template <> | ||
class ReadProducer<jellyfish::parse_read> { | ||
public: | ||
ReadProducer(jellyfish::parse_read& parser) : s_(new ReadSeq), stream_(parser.new_thread()) {} | ||
~ReadProducer() { delete s_; } | ||
|
||
bool nextRead(ReadSeq*& s) { | ||
if ((read_ = stream_.next_read())) { | ||
// we iterate over the entire read | ||
const char* start = read_->seq_s; | ||
const char* const end = read_->seq_e; | ||
uint32_t readLen = std::distance(start, end); | ||
|
||
s_->seq = const_cast<char*>(read_->seq_s); | ||
s_->len = readLen; | ||
s_->name = const_cast<char*>(read_->header); | ||
s_->nlen = read_->hlen; | ||
s = s_; | ||
return true; | ||
} else { | ||
return false; | ||
} | ||
} | ||
|
||
void finishedWithRead(ReadSeq*& s) { s = nullptr; } | ||
|
||
private: | ||
ReadSeq* s_; | ||
jellyfish::parse_read::read_t* read_;//{parser.new_thread()}; | ||
jellyfish::parse_read::thread stream_;//{parser.new_thread()}; | ||
}; | ||
|
||
template <> | ||
class ReadProducer<StreamingReadParser> { | ||
public: | ||
ReadProducer(StreamingReadParser& parser) : parser_(parser) {} | ||
|
||
bool nextRead(ReadSeq*& s) { | ||
if (parser_.nextRead(s)) { | ||
return true; | ||
} else { | ||
s = nullptr; | ||
return false; | ||
} | ||
} | ||
|
||
void finishedWithRead(ReadSeq*& s) { parser_.finishedWithRead(s); } | ||
|
||
private: | ||
StreamingReadParser& parser_; | ||
}; | ||
|
||
#endif // __READPRODUCER_HPP__ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,25 @@ | ||
/** | ||
>HEADER | ||
Copyright (c) 2013 Rob Patro [email protected] | ||
This file is part of Sailfish. | ||
Sailfish is free software: you can redistribute it and/or modify | ||
it under the terms of the GNU General Public License as published by | ||
the Free Software Foundation, either version 3 of the License, or | ||
(at your option) any later version. | ||
Sailfish is distributed in the hope that it will be useful, | ||
but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
GNU General Public License for more details. | ||
You should have received a copy of the GNU General Public License | ||
along with Sailfish. If not, see <http://www.gnu.org/licenses/>. | ||
<HEADER | ||
**/ | ||
|
||
|
||
#ifndef __STREAMING_READ_PARSER__ | ||
#define __STREAMING_READ_PARSER__ | ||
|
||
|
@@ -21,8 +43,10 @@ extern "C" { | |
namespace bfs = boost::filesystem; | ||
|
||
struct ReadSeq { | ||
char* seq = nullptr; | ||
size_t len = 0; | ||
char* seq = nullptr; | ||
size_t len = 0; | ||
char* name = nullptr; | ||
size_t nlen = 0; | ||
}; | ||
|
||
class StreamingReadParser { | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,25 @@ | ||
/** | ||
>HEADER | ||
Copyright (c) 2013 Rob Patro [email protected] | ||
This file is part of Sailfish. | ||
Sailfish is free software: you can redistribute it and/or modify | ||
it under the terms of the GNU General Public License as published by | ||
the Free Software Foundation, either version 3 of the License, or | ||
(at your option) any later version. | ||
Sailfish is distributed in the hope that it will be useful, | ||
but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
GNU General Public License for more details. | ||
You should have received a copy of the GNU General Public License | ||
along with Sailfish. If not, see <http://www.gnu.org/licenses/>. | ||
<HEADER | ||
**/ | ||
|
||
|
||
#include <iostream> | ||
#include <cstdio> | ||
#include <cstdlib> | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.