1 
2 /******************************************************************************
3  *
4  *  This file is part of canu, a software program that assembles whole-genome
5  *  sequencing reads into contigs.
6  *
7  *  This software is based on:
8  *    'Celera Assembler' r4587 (http://wgs-assembler.sourceforge.net)
9  *    the 'kmer package' r1994 (http://kmer.sourceforge.net)
10  *
11  *  Except as indicated otherwise, this is a 'United States Government Work',
12  *  and is released in the public domain.
13  *
14  *  File 'README.licenses' in the root directory of this distribution
15  *  contains full conditions and disclaimers.
16  */
17 
18 #pragma once
19 
20 #include <utility>
21 #include "types.H"
22 
23 static const uint32 DEFAULT_FLANK_IGNORE = 5;
24 
25 inline
26 int32
TrimStartingIndels(char * & s,int32 & s_end,int32 * delta,int32 & deltaLen,int32 val)27 TrimStartingIndels(char *&s, int32 &s_end, int32 *delta, int32 &deltaLen, int32 val) {
28     int32  i = 0;
29 
30     //while (i < stop && ped->delta[i] == 1)
31     while (i < deltaLen && delta[i] == val)
32       i++;
33 
34     //fprintf(stderr, "RESET 1 i=%d delta=%d\n", i, ped->delta[i]);
35     //assert(i == stop || ped->delta[i] != -1);
36 
37     if (i == 0)
38       return 0;
39 
40     deltaLen -= i;
41     memmove(delta, delta + i, deltaLen * sizeof(int32));
42 
43     s += i;
44     s_end -= i;
45     return i;
46 }
47 
48 std::pair<std::size_t, std::size_t>
49 ComputeErrors(const char* const a_part, const char* const b_part,
50     int32 delta_len, int32 *deltas,
51     int32 a_len, int32 b_len,
52     bool check_trivial_dna,
53     uint32 ignore_flank = DEFAULT_FLANK_IGNORE);
54