nloyfer / wgbs_tools

tools for working with Bisulfite Sequencing data while preserving reads intrinsic dependencies
Other
125 stars 33 forks source link

Missing last CPG site in chromosome #41

Closed linhxxx closed 10 months ago

linhxxx commented 1 year ago

In patter.cpp, line 95-100, a bool array is constructed. If the last loci is 100 (bsize==100), the bool array should be constructed in a 100 + 1 size. If we make a bool array with 100 elements, we cant access the conv[100].

bsize = loci.at(loci.size() - 1);    

conv = new bool[bsize]();   -->  conv = new bool[(bsize + 1)]();
for (int locus: loci) {
    conv[locus] = true;
}

In line 254, we also need add 1 to make the code assess to the last locus of the chromosome:

    if ((start_locus + i) > (bsize - 1)) {           --->  if ((start_locus + i) > (bsize - 1 + 1)) {
        continue;  
    }
nloyfer commented 10 months ago

Fixed in 3220beb Thank you