This is an automated email from the git hooks/post-receive script.

plessy pushed a commit to branch debian/unstable
in repository libgtextutils.

commit c3f5931dcee9865620d42563ebbfa16ceeb36ea5
Author: A. Gordon <[email protected]>
Date:   Wed Oct 28 20:18:39 2009 -0400

    Improved Boost-Program-Options classes.
---
 src/gtextutils/bpo_base.cpp          |  2 +-
 src/gtextutils/bpo_base.h            |  2 ++
 src/gtextutils/bpo_interval_file.cpp | 26 +++++++++++++++++++++++---
 src/gtextutils/bpo_interval_file.h   | 10 ++++++++++
 src/gtextutils/bpo_io.cpp            |  6 ++++--
 src/gtextutils/bpo_io.h              |  3 ++-
 6 files changed, 42 insertions(+), 7 deletions(-)

diff --git a/src/gtextutils/bpo_base.cpp b/src/gtextutils/bpo_base.cpp
index b4bca17..c64be39 100644
--- a/src/gtextutils/bpo_base.cpp
+++ b/src/gtextutils/bpo_base.cpp
@@ -11,6 +11,7 @@ using namespace std;
 using namespace std::tr1;
 using std::tr1::placeholders::_1;
 
+
 namespace po = boost::program_options;
 
 BPO_EasyParser::BPO_EasyParser()
@@ -43,4 +44,3 @@ void BPO_EasyParser::parse ( int argc, char* argv[] )
                exit(1);
        }
 }
-
diff --git a/src/gtextutils/bpo_base.h b/src/gtextutils/bpo_base.h
index 0ea8cfe..83d4bdb 100644
--- a/src/gtextutils/bpo_base.h
+++ b/src/gtextutils/bpo_base.h
@@ -1,8 +1,10 @@
 #ifndef __BPO_BASE_H__
 #define __BPO_BASE_H__
 
+#include <boost/program_options.hpp>
 #include <vector>
 
+
 class GenericBoostProgramOptions
 {
 public:
diff --git a/src/gtextutils/bpo_interval_file.cpp 
b/src/gtextutils/bpo_interval_file.cpp
index ce771a4..71b4350 100644
--- a/src/gtextutils/bpo_interval_file.cpp
+++ b/src/gtextutils/bpo_interval_file.cpp
@@ -9,18 +9,38 @@
 namespace po = boost::program_options;
 
 IntervalFileColumnOptions::IntervalFileColumnOptions() : 
-       column_options("Input file format")
+       column_options("Input file format"),
+       _bed_base(true),
+       _zero_base(false),
+       _one_base(false),
+       _zero_based_start_coord(true),
+       _zero_based_end_coord(false)
 {
        column_options.add_options()
                ("chrom-col,c", po::value<unsigned 
int>(&_chrom_column)->default_value(1), "chromosome column") 
                ("start-col,s", po::value<unsigned 
int>(&_start_column)->default_value(2), "start-coordinate column") 
                ("end-col,e", po::value<unsigned 
int>(&_end_column)->default_value(3), "end-coordinate column") 
                ("orien-col,a", po::value<unsigned 
int>(&_orientation_column)->default_value(0), "orientation(+/-) column 
(default: no orientation information)") 
-               ("multi-col,m", po::value<unsigned 
int>(&_multiplicity_column)->default_value(0), "multiplicity (=read count) 
column (default: no multiplicity information)") ;
+               ("multi-col,m", po::value<unsigned 
int>(&_multiplicity_column)->default_value(0), "multiplicity (=read count) 
column (default: no multiplicity information)") 
+               ("BED-BASE", po::value<bool>(&_bed_base)->zero_tokens(), 
"Zero-based start coordinate, one-based end coordinate - like in BED files from 
UCSC.\nThis is the default." )
+               ("ZERO-BASE", po::value<bool>(&_zero_base)->zero_tokens(),"BOTH 
start & end coordinates are zero based" )
+               ("ONE-BASE", po::value<bool>(&_one_base)->zero_tokens(),"BOTH 
start & end coordinates are one based")
+               ;
 }
 
 void IntervalFileColumnOptions::validate() 
 {
+       if ( _bed_base ) {
+               _zero_based_start_coord = true ;
+               _zero_based_end_coord = false ;
+       } else if ( _zero_base ) {
+               _zero_based_start_coord = true ;
+               _zero_based_end_coord = true ;
+       } else if ( _one_base ) {
+               _zero_based_start_coord = false ;
+               _zero_based_end_coord = false ;
+       }
+
        std::stringstream os ;
        if (_chrom_column <= 0) {
                os << "Invalid chromosome-column value: '" << _chrom_column << 
"' - must be larger than zero" ;
@@ -35,7 +55,7 @@ void IntervalFileColumnOptions::validate()
                throw po::error(os.str()) ;
        }
 
-       std::vector<int> columns;
+       std::vector<unsigned int> columns;
        columns.push_back ( _chrom_column );
 
        if ( std::find(columns.begin(), columns.end(), _start_column ) != 
columns.end()) {
diff --git a/src/gtextutils/bpo_interval_file.h 
b/src/gtextutils/bpo_interval_file.h
index 7d8ca86..bbb9331 100644
--- a/src/gtextutils/bpo_interval_file.h
+++ b/src/gtextutils/bpo_interval_file.h
@@ -20,6 +20,13 @@ class IntervalFileColumnOptions : public 
GenericBoostProgramOptions
        unsigned int _multiplicity_column ;
 
        unsigned int _max_used_column ;
+       
+       bool _bed_base ;
+       bool _zero_base ;
+       bool _one_base ;
+
+       bool _zero_based_start_coord ;
+       bool _zero_based_end_coord ;
 
 public:
        IntervalFileColumnOptions() ;
@@ -35,6 +42,9 @@ public:
 
        unsigned int max_used_column() const { return _max_used_column; }
 
+       bool zero_based_start_coord() const { return _zero_based_start_coord; }
+       bool zero_based_end_coord() const { return _zero_based_end_coord; }
+
        virtual void validate() ;
 };
 
diff --git a/src/gtextutils/bpo_io.cpp b/src/gtextutils/bpo_io.cpp
index 2166225..8f02c74 100644
--- a/src/gtextutils/bpo_io.cpp
+++ b/src/gtextutils/bpo_io.cpp
@@ -11,13 +11,15 @@ namespace po = boost::program_options;
 InputOutputOptions::InputOutputOptions() :
        io_options("Input/Output options"),
        _verbose(false),
-       _help(false)
+       _help(false),
+       _skip_first_line(false)
 {
        io_options.add_options()
                ("input-file,i", po::value<std::string>(&_input_filename), 
"Input file (default: stdin)") 
                ("output-file,o", po::value<std::string>(&_output_filename), 
"Output file (default: stdout)" ) 
                ("verbose,v", po::value<bool>(&_verbose)->zero_tokens(), 
"verbose (if output goes to STDOUT, verbose summary will be printed to STDERR. 
If output goes to afile, verbose summary will be printed to STDOUT).")
-               ("help,h", po::value<bool>(&_help)->zero_tokens(), "help and 
command line options") ;
+               ("help,h", po::value<bool>(&_help)->zero_tokens(), "help and 
command line options") 
+               ("skip-first-line,L", 
po::value<bool>(&_skip_first_line)->zero_tokens(),"skip first input line (use 
if input file contains header line)" );
 }
 
 
diff --git a/src/gtextutils/bpo_io.h b/src/gtextutils/bpo_io.h
index 163d1be..5e463e7 100644
--- a/src/gtextutils/bpo_io.h
+++ b/src/gtextutils/bpo_io.h
@@ -7,7 +7,6 @@
 
 /*
    Future improvements:
-     option "SKIP_FIRST_LINE",
      option "DEBUG"
      make "VERBOSE" optional
 */
@@ -19,6 +18,7 @@ class InputOutputOptions : public GenericBoostProgramOptions
        std::string _output_filename ;
        bool _verbose ;
        bool _help ;
+       bool _skip_first_line ;
 
 public:
        InputOutputOptions();
@@ -30,6 +30,7 @@ public:
        std::string output_file() const { return _output_filename ; } 
        bool verbose() const { return _verbose; }
        bool help() const { return _help ; }
+       bool skip_first_line() const { return _skip_first_line; }
 };
 
 #endif

-- 
Alioth's /git/debian-med/git-commit-notice on 
/srv/git.debian.org/git/debian-med/libgtextutils.git

_______________________________________________
debian-med-commit mailing list
[email protected]
http://lists.alioth.debian.org/cgi-bin/mailman/listinfo/debian-med-commit

Reply via email to