Skip to content
This repository has been archived by the owner on Oct 17, 2022. It is now read-only.

Commit

Permalink
Fixed a bug when find_start_line() does not locate exactly at the sta…
Browse files Browse the repository at this point in the history
…rting CpG site, resulting in a false -nan.
  • Loading branch information
mengzhou committed Oct 31, 2015
1 parent 38d2b0b commit f63954e
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/analysis/roimethstat.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -266,6 +266,13 @@ get_cpg_stats(const bool METHPIPE_FORMAT,
find_start_line(chrom, start_pos, cpg_in);

GenomicRegion cpg;
// find_start_line not necessarily locate at the start site.
// in this case the file pointer needs to be move forward,
// a little bit hopefully.
while (load_cpg(METHPIPE_FORMAT, cpg_in, cpg) &&
(cpg.get_chrom() < chrom ||
(cpg.same_chrom(region) &&
cpg.get_end() < start_pos)));
while (load_cpg(METHPIPE_FORMAT, cpg_in, cpg) &&
(cpg.same_chrom(region) &&
cpg.get_end() <= end_pos)) {
Expand Down

1 comment on commit f63954e

@mengzhou
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks to @sarahsma; she made a good testing example which catches this error.

Please sign in to comment.