From: Tim Reddy Tim Date: Mon, 23 Feb 2009 17:44:07 +0000 (+0000) Subject: Small bug fix X-Git-Url: http://woldlab.caltech.edu/gitweb/?p=htsworkflow.git;a=commitdiff_plain;h=b08e00779cddf36328f2661dd85beaa7b1d9e22c Small bug fix --- 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;; + } } }