Skip to content

Commit

Permalink
improve histo trailing zeros fix, bump version
Browse files Browse the repository at this point in the history
  • Loading branch information
ryanlayer committed May 20, 2014
1 parent be38dbf commit 3c3939d
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 8 deletions.
7 changes: 1 addition & 6 deletions scripts/pairend_distro.pl
Original file line number Diff line number Diff line change
Expand Up @@ -99,12 +99,7 @@ sub print_usage {

open(FILE, "> $o_file");
for (my $i = 0; $i < ($end - $start); $i++) {
#print FILE "$i\t" . ($H[$i]/$sum) . "\n";
if ($H[$i]/$sum == 0) {
last;
} else {
print FILE "$i\t" . ($H[$i]/$sum) . "\n";
}
print FILE "$i\t" . ($H[$i]/$sum) . "\n";
}

close(FILE);
Expand Down
25 changes: 24 additions & 1 deletion src/lumpy/SV_Pair.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -343,7 +343,7 @@ print_bedpe(int score)
}
//}}}

//{{{void set_sv_pair_distro()
//{{{ set_distro_from_histo (int back_distance,
// We will assume that the distrobution to upsstream will follow the histogram
// and downstream will be follow an exponetial decay distribution based on the
// back_distance
Expand All @@ -357,12 +357,14 @@ set_distro_from_histo (int back_distance,
{
// It is possible for the histo to contain 0 values at the ends,
// to prevent further issues, we will trim them here
/*
for (int i = 0; i < histo_end - histo_start + 1; ++i) {
if (histo[i] == 0) {
histo_end = i-1;
break;
}
}
*/

double lambda = log(0.0001)/(-1 * back_distance);
// the bp distribution begins SV_Pair::back_distance base pairs back
Expand All @@ -385,6 +387,27 @@ set_distro_from_histo (int back_distance,
last = (*distro)[i + back_distance];
}


int zero_i = -1;
for (int i = 0; i < distro_size; ++i) {
if ((*distro)[i] == 0) {
cerr << i << "\t" << (*distro)[i] << endl;
zero_i = i;
break;
}
}

if (zero_i != -1) {
distro_size = zero_i;
double *new_distro = (double *) malloc(distro_size * sizeof(double));
for (int i = 0; i < distro_size; ++i) {
new_distro[i] = (*distro)[i];
}
free(*distro);
*distro = new_distro;
}


return distro_size;
}
//}}}
Expand Down
2 changes: 1 addition & 1 deletion src/lumpy/lumpy.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ void ShowHelp(void);
//{{{ void ShowHelp(void)
void ShowHelp(void)
{
cerr << endl << "Program: " << PROGRAM_NAME << " (v 0.2.2.2)" <<
cerr << endl << "Program: " << PROGRAM_NAME << " (v 0.2.2.3)" <<
endl <<
"Author: Ryan Layer ([email protected])" << endl <<
"Summary: Find structural variations in various signals." << endl <<
Expand Down

0 comments on commit 3c3939d

Please sign in to comment.