Skip to content

Commit

Permalink
Fixed #5: output last coverage interval
Browse files Browse the repository at this point in the history
  • Loading branch information
jkvis committed Jul 22, 2020
1 parent 91867e5 commit 924e331
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 5 deletions.
6 changes: 2 additions & 4 deletions gvcf2coverage/src/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,6 @@ main(int argc, char* argv[])
int32_t* gt = NULL;

bool first = true;
bool jump = false;

int window_start = 0;
int window_end = 0;
Expand Down Expand Up @@ -197,7 +196,6 @@ main(int argc, char* argv[])
window_ploidy != ploidy ||
window_end + distance < start)
{
jump = true;
// eprint(f"Chrom changed from {window_chrom} to {chrom}.")
(void) fprintf(stdout, "%s\t%d\t%d\t%d\n", window_chrom, window_start, window_end, window_ploidy);

Expand All @@ -208,7 +206,6 @@ main(int argc, char* argv[])
} // if
else
{
jump = false;
window_start = imin(window_start, start);
window_end = imax(window_end, end);
// eprint(f"No jump! s:{start}, w_s={window_start} e:{end} w_e={window_end}")
Expand All @@ -217,8 +214,9 @@ main(int argc, char* argv[])

//
// If the last iteration of the loop was not a jump, we still need to print
// JKV: I'm not sure about the jump
//
if (merge && !jump)
if (merge)
{
(void) fprintf(stdout, "%s\t%d\t%d\t%d\n", window_chrom, window_start, window_end, window_ploidy);
} // if
Expand Down
3 changes: 2 additions & 1 deletion pygvcf2coverage/pygvcf2coverage/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -103,8 +103,9 @@ def gvcf2coverage(threshold, merge, distance):

#
# If the last iteration of the loop was not a jump, we still need to print
# JKV: I'm not sure about the jump
#
if merge and not jump:
if merge:
print(window_chrom, window_start, window_end, window_ploidy, sep="\t")


Expand Down

0 comments on commit 924e331

Please sign in to comment.