Skip to content

Commit

Permalink
Fix issue #53 -- "local variable 'prop'"
Browse files Browse the repository at this point in the history
 - appears when to low coverage inside a window
 - leading to no output of dpm_sampler
 - Fix: missing null check that crashed dpm_sampler
 - Fix: no samples that crashed shotgun.py
  • Loading branch information
DrYak committed Aug 27, 2019
1 parent 1a3807a commit cf3f190
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 5 deletions.
10 changes: 6 additions & 4 deletions src/cpp/dpm_sampler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1321,11 +1321,13 @@ ssret* sample_class(unsigned int i, unsigned int step)
// if it's in the head
if (c_ptr[i] == NULL && mxt->size == 1) {

rn = mxt->next->rlist;
if (mxt->next != NULL) {
rn = mxt->next->rlist;

while (rn != NULL) {
c_ptr[rn->ri] = NULL;
rn = rn->next;
while (rn != NULL) {
c_ptr[rn->ri] = NULL;
rn = rn->next;
}
}

remove_comp(&mxt);
Expand Down
5 changes: 4 additions & 1 deletion src/shorah/shotgun.py
Original file line number Diff line number Diff line change
Expand Up @@ -281,7 +281,7 @@ def get_prop(filename):
else:
return 'not found'

prop = 0
prop = 'not found'
for l in h:
if l.startswith('#made'):
prop = int(l.split()[1])
Expand Down Expand Up @@ -334,6 +334,9 @@ def win_to_run(alpha_w, seed):


def merge_corrected_reads(aligned_read):
if aligned_read is None:
print("empty window found", file=sys.stderr)
return (none, [])

ID = aligned_read[0]
seq = aligned_read[1][4]
Expand Down

0 comments on commit cf3f190

Please sign in to comment.