Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
domain-world
RADIANT
Commits
f77b6a30
Commit
f77b6a30
authored
Mar 12, 2018
by
Dr. Carsten Kemena
Browse files
allow mismatches in words
parent
d2fb1494
Changes
2
Hide whitespace changes
Inline
Side-by-side
src/RadiantDB.cpp
View file @
f77b6a30
#include
"RadiantDB.hpp"
#include
<bitset>
using
namespace
std
;
namespace
fs
=
boost
::
filesystem
;
...
...
@@ -52,6 +53,25 @@ RadiantDB::build(const fs::path &inPath, bool forward, const fs::path &outPath)
fout.close();*/
}
short
char_diff
(
SuffixType
val1
,
SuffixType
val2
)
{
SuffixType
val
=
val1
^
val2
;
short
counter
=
0
;
for
(
short
i
=
0
;
i
<
10
;
++
i
)
{
for
(
short
j
=
0
;
j
<
3
;
++
j
)
{
short
n
=
i
*
3
+
j
;
if
(
val
&
(
1
<<
n
))
{
++
counter
;
break
;
}
}
}
return
counter
;
}
short
RadiantDB
::
getDomID
(
const
PrefixType
&
prefix
,
const
CodedSuffix
&
suffix
,
bool
&
position
)
const
...
...
@@ -72,6 +92,7 @@ RadiantDB::getDomID(const PrefixType &prefix, const CodedSuffix &suffix, bool &p
else
{
auto
tmp
=
it2
->
accession
;
auto
x
=
it2
->
suffix
.
suffix
;
if
(
it2
!=
it
->
second
.
begin
())
{
--
it2
;
...
...
@@ -79,11 +100,22 @@ RadiantDB::getDomID(const PrefixType &prefix, const CodedSuffix &suffix, bool &p
{
position
=
it2
->
suffix
.
position
;
return
tmp
;
//assignment.emplace(l-(multiplyer*j), std::pair<unsigned short, bool>(tmp, +it2->suffix.position));
}
else
{
short
threshold
=
2
;
auto
diff1
=
char_diff
(
x
,
suffix
.
suffix
);
auto
diff2
=
char_diff
(
it2
->
suffix
.
suffix
,
suffix
.
suffix
);
if
((
diff1
<
diff2
)
&&
(
diff1
<=
threshold
))
return
tmp
;
else
if
(
diff2
<=
threshold
)
return
it2
->
accession
;
}
}
}
}
}
return
0
;
}
...
...
src/makeRadiantDb.hpp
View file @
f77b6a30
...
...
@@ -92,7 +92,7 @@ cleanSuffixe(D &db)
auto
currIt
=
nextIt
++
;
while
(
nextIt
!=
endIt
)
{
if
(((
currIt
->
second
==
0
)
&&
(
prevIt
->
second
==
0
))
||
((
currIt
->
second
==
prevIt
->
second
)
&&
(
currIt
->
second
==
nextIt
->
second
))
||
((
currIt
->
second
!=
prevIt
->
second
)
&&
(
currIt
->
second
!=
nextIt
->
second
)
&&
(
prevIt
->
second
!=
nextIt
->
second
)))
if
(((
currIt
->
second
==
0
)
&&
(
prevIt
->
second
==
0
))
||
((
currIt
->
second
==
prevIt
->
second
)
&&
(
currIt
->
second
==
nextIt
->
second
))
)
//
|| ((currIt->second != prevIt->second) && (currIt->second != nextIt->second) && (prevIt->second != nextIt->second)))
currIt
=
db
.
erase
(
currIt
);
else
{
...
...
@@ -103,7 +103,7 @@ cleanSuffixe(D &db)
}
}
/*
// remove first/last suffix if differnt from next/previous
if (db.size() > 1)
{
...
...
@@ -124,7 +124,7 @@ cleanSuffixe(D &db)
// if only one element left its most liklely not very useful and can be removed
if (db.size() == 1)
db.clear();
*/
// test cleaning
if
(
db
.
size
()
>
1
)
{
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment