[med-svn] [nanopolish] 01/04: More abs() replacements
Andreas Tille
tille at debian.org
Fri Sep 1 06:39:32 UTC 2017
This is an automated email from the git hooks/post-receive script.
tille pushed a commit to branch master
in repository nanopolish.
commit 1d012e170f5984b6de87499d8f704cdfd9489095
Author: Andreas Tille <tille at debian.org>
Date: Fri Sep 1 07:25:55 2017 +0200
More abs() replacements
---
debian/patches/gcc-7.patch | 58 ++++++++++++++++++++++++++++++++++++++++++++--
1 file changed, 56 insertions(+), 2 deletions(-)
diff --git a/debian/patches/gcc-7.patch b/debian/patches/gcc-7.patch
index b7fa956..a8bda2b 100644
--- a/debian/patches/gcc-7.patch
+++ b/debian/patches/gcc-7.patch
@@ -1,4 +1,5 @@
-Autor: Andreas Tille <tille at debian.org>
+Autor: Andreas Tille <tille at debian.org>,
+ Walter Landry <wlandry at caltech.edu>
last-Update: Thu, 31 Aug 2017 23:33:00 +0200
Bug-Debian: https://bugs.debian.org/853568
Description: Make sure abs() gets int arguments
@@ -10,7 +11,60 @@ Description: Make sure abs() gets int arguments
// is that we can get segments that have very few alignable events. We
// just stop processing them for now
- if(abs(input.event_start_idx - input.event_stop_idx) < 2)
-+ if(abs(int(input.event_start_idx) - int(input.event_stop_idx)) < 2)
++ if(abs(static_cast<int>((input.event_start_idx - input.event_stop_idx)) < 2)
break;
input.strand = params.strand_idx;
+--- a/src/common/nanopolish_variant.cpp
++++ b/src/common/nanopolish_variant.cpp
+@@ -29,7 +29,7 @@ std::vector<Variant> extract_variants(co
+ const std::string& haplotype)
+ {
+ AlnParam par = aln_param_nt2nt;
+- size_t difference = std::abs(reference.size() - haplotype.size());
++ size_t difference = std::abs(static_cast<ptrdiff_t>(reference.size() - haplotype.size()));
+ par.band_width = std::max((size_t) 20, difference * 2);
+ AlnAln* aln = aln_stdaln(reference.c_str(), haplotype.c_str(), &par, 1, 1);
+
+--- a/src/hmm/nanopolish_profile_hmm.cpp
++++ b/src/hmm/nanopolish_profile_hmm.cpp
+@@ -290,7 +290,7 @@ void print_alignment(const std::string&
+ double time_start = data.read->events[data.strand][data.event_start_idx].start_time;
+ double time_end = data.read->events[data.strand][data.event_stop_idx].start_time;
+ double total_duration = fabs(time_start - time_end);
+- double num_events = abs(data.event_start_idx - data.event_stop_idx) + 1;
++ double num_events = abs(static_cast<int>(data.event_start_idx - data.event_stop_idx)) + 1;
+ double final_lp = alignment[alignment.size() - 1].l_fm;
+ double mean_lp = final_lp / num_events;
+
+--- a/src/nanopolish_call_variants.cpp
++++ b/src/nanopolish_call_variants.cpp
+@@ -392,7 +392,7 @@ void print_debug_stats(const std::string
+ const HMMInputData& data = event_sequences[i];
+
+ // summarize score
+- double num_events = abs(data.event_start_idx - data.event_stop_idx) + 1;
++ double num_events = abs(static_cast<int>(data.event_start_idx - data.event_stop_idx)) + 1;
+ double base_score = profile_hmm_score(base_haplotype.get_sequence(), data, alignment_flags);
+ double called_score = profile_hmm_score(called_haplotype.get_sequence(), data, alignment_flags);
+ double base_avg = base_score / num_events;
+@@ -548,7 +548,7 @@ Haplotype fix_homopolymers(const Haploty
+ assert(kmer_size == 6);
+
+ // skip small event regions
+- if( abs(event_sequences[j].event_start_idx - event_sequences[j].event_stop_idx) < 10) {
++ if( abs(static_cast<int>(event_sequences[j].event_start_idx - event_sequences[j].event_stop_idx)) < 10) {
+ continue;
+ }
+
+--- a/src/nanopolish_consensus.cpp
++++ b/src/nanopolish_consensus.cpp
+@@ -531,7 +531,7 @@ void filter_outlier_data(std::vector<HMM
+ const HMMInputData& rs = input[ri];
+
+ double curr = score_sequence(sequence, rs);
+- double n_events = abs(rs.event_start_idx - rs.event_stop_idx) + 1.0f;
++ double n_events = abs(static_cast<int>(rs.event_start_idx - rs.event_stop_idx)) + 1.0f;
+ double lp_per_event = curr / n_events;
+
+ if(opt::verbose >= 1) {
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/debian-med/nanopolish.git
More information about the debian-med-commit
mailing list