Commit 3dfd70e6 authored by jkvis's avatar jkvis
Browse files

Better? LCS selection: try to match the lengths of the remaining prefixes and suffixes

parent dbdff0d7
......@@ -9,7 +9,7 @@
// File: extractor.cc (depends on extractor.h)
// Author: Jonathan K. Vis
// Revision: 2.01a
// Date: 2014/07/22
// Date: 2014/07/28
// *******************************************************************
// DESCRIPTION:
// This library can be used to generete HGVS variant descriptions as
......@@ -210,7 +210,19 @@ size_t extractor(std::vector<Variant> &variant,
} // if
std::vector<Substring>::iterator const lcs = substring.begin();
size_t diff = (reference_end - reference_start) + (sample_end - sample_start);
std::vector<Substring>::iterator lcs = substring.begin();
for (std::vector<Substring>::iterator it = substring.begin(); it != substring.end(); ++it)
{
size_t const prefix_diff = abs((it->reference_index - reference_start) - (it->sample_index - sample_start));
size_t const suffix_diff = abs((reference_end - (it->reference_index + it->length)) - (sample_end - (it->sample_index + it->length)));
if (prefix_diff + suffix_diff < diff)
{
diff = prefix_diff + suffix_diff;
lcs = it;
} // if
} // for
if (lcs->reverse_complement)
{
weight = 2 * weight_position + WEIGHT_SEPARATOR + WEIGHT_INVERSION;
......
......@@ -9,7 +9,7 @@
// File: extractor.i (SWIG interface file)
// Author: Jonathan K. Vis
// Revision: 2.01a
// Date: 2014/07/22
// Date: 2014/07/28
// *******************************************************************
// DESCRIPTION:
// Defines the SWIG interface for the Extractor library for use in
......@@ -31,6 +31,8 @@ namespace std
namespace mutalyzer
{
static char const* const VERSION = "Description Extractor Rev 2.01a (2014/07/28)";
typedef char char_t;
static int const TYPE_DNA = 0;
......
Supports Markdown
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