Skip to content

Commit

Permalink
added a flag to indicate if a filter requires
Browse files Browse the repository at this point in the history
variant classification
  • Loading branch information
atks committed May 4, 2014
1 parent 3730136 commit 2341939
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 6 deletions.
11 changes: 8 additions & 3 deletions filter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -604,6 +604,7 @@ Filter::Filter(std::string exp, VariantManip *vm)
*/
void Filter::parse(const char* exp, bool debug)
{
need_to_classify_variant = false;
if (strlen(exp)!=0)
{
if (tree!=NULL)
Expand Down Expand Up @@ -713,9 +714,6 @@ void Filter::parse(const char* exp, int32_t len, Node *node, bool debug)

node->type = type;

need_to_classif_variant = true;


node->left = new Node();
parse(exp, p-exp+1, node->left, debug);

Expand Down Expand Up @@ -796,6 +794,7 @@ void Filter::parse_literal(const char* exp, int32_t len, Node * node, bool debug
}
else if (strncmp(exp, "VTYPE", 5)==0)
{
need_to_classify_variant = true;
node->type = VT_VARIANT_TYPE;
if (debug) std::cerr << "\tis variant_op\n";
return;
Expand All @@ -808,40 +807,46 @@ void Filter::parse_literal(const char* exp, int32_t len, Node * node, bool debug
}
else if (strncmp(exp, "INDEL", len)==0)
{
need_to_classify_variant = true;
node->type = VT_INT;
node->i = VT_INDEL;
if (debug) std::cerr << "\tis INDEL\n";
return;
}
else if (strncmp(exp, "SNP", len)==0)
{
need_to_classify_variant = true;
node->type = VT_INT;
node->i = VT_SNP;
if (debug) std::cerr << "\tis SNP\n";
return;
}
else if (strncmp(exp, "MNP", len)==0)
{
need_to_classify_variant = true;
node->type = VT_INT;
node->i = VT_MNP;
if (debug) std::cerr << "\tis MNP\n";
return;
}
else if (strncmp(exp, "CLUMPED", len)==0)
{
need_to_classify_variant = true;
node->type = VT_INT;
node->i = VT_CLUMPED;
if (debug) std::cerr << "\tis CLUMPED\n";
return;
}
else if (strncmp(exp, "DLEN", len)==0)
{
need_to_classify_variant = true;
node->type = VT_VARIANT_DLEN;
if (debug) std::cerr << "\tis dlen\n";
return;
}
else if (strncmp(exp, "LEN", len)==0)
{
need_to_classify_variant = true;
node->type = VT_VARIANT_LEN;
if (debug) std::cerr << "\tis len\n";
return;
Expand Down
2 changes: 1 addition & 1 deletion filter.h
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ class Filter
bcf_hdr_t *h;
bcf1_t *v;
Variant *variant;
bool need_to_classif_variant;
bool need_to_classify_variant;

/**
* Constructor.
Expand Down
4 changes: 2 additions & 2 deletions variant_manip.h
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ class Allele
int32_t tv; //no. of tranversions (mlen-ts)
int32_t ins; //no. of insertions
int32_t del; //no. of deletions

Allele(int32_t type, int32_t diff, int32_t alen, int32_t dlen, int32_t tlen, int32_t mlen, int32_t ts)
{
this->type = type;
Expand Down Expand Up @@ -136,7 +136,7 @@ class Variant
int32_t mlen; //motif length
int32_t tlen; //reference tract length
std::vector<Allele> alleles;

Variant()
{
type = VT_REF;
Expand Down

0 comments on commit 2341939

Please sign in to comment.