Commit afca1d86 authored by Mathieu Giraud's avatar Mathieu Giraud

core/fasta.{h,cpp}: getPos(), number of characters read

Note that input->tellg() was not working (not compatible with igzstream ?)
parent 44b3d712
......@@ -133,11 +133,16 @@ OnlineFasta::~OnlineFasta() {
}
void OnlineFasta::init() {
char_nb = 0;
line_nb = 0;
line = getInterestingLine();
current.seq = NULL;
}
unsigned long long OnlineFasta::getPos() {
return char_nb;
}
size_t OnlineFasta::getLineNb() {
return line_nb;
}
......@@ -226,6 +231,7 @@ string OnlineFasta::getInterestingLine(int state) {
string line;
while (line.length() == 0 && hasNext() && getline(*input, line)) {
line_nb++;
char_nb += line.length() + 1;
remove_trailing_whitespaces(line);
if (line.length() && line[0] == '#' && state != FASTX_FASTQ_SEP)
......
......@@ -91,6 +91,7 @@ class OnlineFasta {
string line;
bool input_allocated;
size_t line_nb;
unsigned long long char_nb;
public:
......@@ -113,7 +114,12 @@ class OnlineFasta {
int extract_field=0, string extract_separator="|");
~OnlineFasta();
/**
* @return the position in the file
*/
unsigned long long getPos();
/**
* @return the current line number
*/
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment