Commit 21e55ff3 authored by zhanxw's avatar zhanxw
Browse files

fix parsing

parent 7b776015
......@@ -125,29 +125,30 @@ class VCFRecord {
int ret;
// now comes each individual genotype
unsigned int idx = 0; // peopleIdx
VCFIndividual* p;
static VCFValue indv;
// VCFIndividual* p;
const size_t NumAllIndvSize = allIndv.size();
std::vector<VCFValue> indv(NumAllIndvSize);
int beg = this->format.end + 1;
while ((ret = indv.parseTill(this->parsed, beg, '\t')) == 0) {
if (idx >= this->allIndv.size()) {
while ((ret = indv[idx].parseTill(this->parsed, beg, '\t')) == 0) {
if (idx >= NumAllIndvSize) {
fprintf(stderr,
"Expected %d individual but already have %d individual\n",
(int)this->allIndv.size(), idx);
(int)NumAllIndvSize, idx);
fprintf(stderr, "VCF header have LESS people than VCF content!\n");
return -1;
}
this->parsed[indv.end] = '\0';
this->parsed[indv[idx].end] = '\0';
// p = this->allIndv[idx];
// p->parse(indv);
beg = indv.end + 1;
beg = indv[idx].end + 1;
idx++;
}
#pragma openmp parallel for
for (int i = 0; i < idx; ++i) {
this->allIndv[i]->parse(indv);
this->allIndv[i]->parse(indv[i]);
}
// if ret == 1 menas reaches end of this->parsed
......@@ -157,19 +158,20 @@ class VCFRecord {
fputc('\n', stderr);
return -1;
} else {
this->parsed[indv.end] = '\0';
p = this->allIndv[idx];
p->parse(indv);
this->parsed[indv[idx].end] = '\0';
// p = this->allIndv[idx];
// p->parse(indv);
this->allIndv[idx]->parse(indv[idx]);
idx++;
}
if (idx > this->allIndv.size()) {
if (idx > NumAllIndvSize) {
fprintf(stderr, "Expected %d individual but already have %d individual\n",
(int)this->allIndv.size(), idx);
(int)NumAllIndvSize, idx);
REPORT("VCF header have MORE people than VCF content!");
} else if (idx < this->allIndv.size()) {
} else if (idx < NumAllIndvSize) {
fprintf(stderr, "Expected %d individual but only have %d individual\n",
(int)this->allIndv.size(), idx);
(int)NumAllIndvSize, idx);
REPORT("VCF header have LESS people than VCF content!");
return -1;
}
......
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