File: NeighborSet.cpp

package info (click to toggle)
uc-echo 1.12-19
  • links: PTS, VCS
  • area: main
  • in suites: sid, trixie
  • size: 1,904 kB
  • sloc: cpp: 1,405; python: 659; makefile: 44; sh: 8
file content (28 lines) | stat: -rw-r--r-- 734 bytes parent folder | download | duplicates (6)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
#include "NeighborSet.hpp"
#include "DNASeq.hpp"

using namespace std;

const unsigned int NeighborSet::MaxNNeighbors = 1000;
const unsigned int NeighborSetLoader::MaxSeqLen = 500;
const unsigned int NeighborSetLoader::CacheSize = 50000;

bool NeighborInfo::isNeighbor(const DNASeq& read1, const DNASeq& read2, int k, int h, float e) {
    int st1 = get_st1();
    int st2 = get_st2();
    int overlap = get_overlap(read1.size(), read2.size());

    if(overlap<h)
        return false;

    nerr = 0;
    const char* seq1 = read1.getSeq();
    const char* seq2 = read2.getSeq();

    for(int i=0; i<overlap; i++)
        if(seq1[st1+i]!=seq2[st2+i])
            nerr++;
    if(nerr>overlap*e)
        return false;
    return true;
}