From b08e00779cddf36328f2661dd85beaa7b1d9e22c Mon Sep 17 00:00:00 2001 From: Tim Reddy Tim Date: Mon, 23 Feb 2009 17:44:07 +0000 Subject: [PATCH] Small bug fix --- htswanalysis/src/profile_reads_against_features.cpp | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/htswanalysis/src/profile_reads_against_features.cpp b/htswanalysis/src/profile_reads_against_features.cpp index ad48803..34d725d 100755 --- a/htswanalysis/src/profile_reads_against_features.cpp +++ b/htswanalysis/src/profile_reads_against_features.cpp @@ -81,7 +81,7 @@ int main(int argc, char** argv) { string line_str(line); vector fields; split(line_str, delim, fields); - if(fields.size() == 3) { continue; } + if(fields.size() <= 3) { continue; } vector location; split(fields[3], location_delim, location); string chr = location[0]; @@ -129,8 +129,14 @@ int main(int argc, char** argv) { ; } - for(unsigned int i = 0; i < profile.size(); i++) { - cout << (int)i - (int)1000 << "\t" << (double)profile[i] / (double)data.size() << endl;; + if(data.size() == 0) { + for(unsigned int i = 0; i < profile.size(); i++) { + cout << (int)i - (int)1000 << "\t0\n"; + } + } else { + for(unsigned int i = 0; i < profile.size(); i++) { + cout << (int)i - (int)1000 << "\t" << (double)profile[i] / (double)data.size() << endl;; + } } } -- 2.30.2