FU Logo
  • Startseite
  • Kontakt
  • Impressum
  • Home
  • Listenauswahl
  • Anleitungen

[Seqan-dev] bug in ArgumentParser

<-- thread -->
<-- date -->
  • From: Konstantin Okonechnikov <k.okonechnikov@gmail.com>
  • To: seqan-dev@lists.fu-berlin.de
  • Date: Mon, 4 Jun 2012 17:01:25 +0200
  • Reply-to: k.okonechnikov@gmail.com, SeqAn Development <seqan-dev@lists.fu-berlin.de>
  • Subject: [Seqan-dev] bug in ArgumentParser

Hi,

I've encountered a problem while using the ArgumentParser.
Plz, find simple example and its output attached.

The attached sample crashes if launched without any parameters.
./simple

Actually, it doesn't crash only if all parameters are provided:
./simple -i in -o out -t 42

Tested in svn revision 12035.
Env: Ubuntu Linux 10.04 64-bit, gcc 4.4.5

Best regards,
   Konstantin
/home/kokonech/playgrnd/seqan-trunk/core/include/seqan/arg_parse/arg_parse_argument.h:697 Assertion failed : position < me.value.size() || position < me.defaultValue.size() should be true but was 0 (ArgParseArgument: No value set for index 0)

stack trace:
  0          [0x41c724]  seqan::ClassTest::fail() + 0xe
  1          [0x41e47a]  seqan::getArgumentValue(seqan::ArgParseArgument const&, unsigned int) + 0x87
  2          [0x42d18a]  bool seqan::getOptionValue<seqan::String<char, seqan::Alloc<void> > >(seqan::String<char, seqan::Alloc<void> >&, seqan::ArgumentParser const&, std::string const&, unsigned int) + 0x92
  3          [0x429898]  bool seqan::getOptionValue<seqan::String<char, seqan::Alloc<void> > >(seqan::String<char, seqan::Alloc<void> >&, seqan::ArgumentParser const&, std::string const&) + 0x31
  4          [0x41c104]  main + 0x169
  5    [0x7f51e72e2d8e]  __libc_start_main + 0xfe
  6          [0x419de9]  ./simple()

#include <iostream>

#include <seqan/basic.h>
#include <seqan/sequence.h>
#include <seqan/file.h>      // For printing SeqAn Strings.

#include <seqan/stream.h>
#include <seqan/bam_io.h>
#include <seqan/arg_parse.h>


using namespace seqan;
using namespace std;

 
    
void setupArgumentParser(ArgumentParser & parser)
{
    setVersion(parser, "1.0");
    setShortDescription(parser, "42");

    addUsageLine(parser, "simple [OPTIONS]");
    
	addSection(parser, "Options");
    addOption(parser, ArgParseOption("v", "verbose", "Enable verbose mode (show steps).") );
    addOption(parser, ArgParseOption("i", "input-file", "Path to input file.", ArgParseArgument::STRING ));
    //setRequired(parser, "i", true);
    addOption(parser, ArgParseOption("o", "output-file", "Path to output file.", ArgParseArgument::STRING ));
    addOption(parser, ArgParseOption("t", "threshold", "Max eshold.", ArgParseArgument::INTEGER ));
    setMinValue(parser, "t", "1");
    
    addTextSection(parser, "References");
    addText(parser, "k00k <okonechnikov@mpiib-berlin.mpg.de>");
}



int main(int argc, char const ** argv)
{
    
    ArgumentParser parser("simple");
    setupArgumentParser(parser);
    
    ArgumentParser::ParseResult res = parse(parser, argc, argv);
    if (res != ArgumentParser::PARSE_OK) {
        return 1;
    }

    CharString inFile, outFile;
    int threshold = 0;
    bool verbose = false;

    getOptionValue(inFile, parser, "i");
    getOptionValue(outFile, parser, "o");
    getOptionValue(threshold, parser, "t");
    getOptionValue(verbose, parser, "v");

    cerr << "Options" << endl;
    cerr << "Input file:  " << inFile << endl;
    cerr << "Output file: " << outFile << endl;
    cerr << "Max coverage threshold: " << threshold << endl;
    cerr << "Verbose: " << verbose << endl;

    return 0;
}


<-- thread -->
<-- date -->
  • seqan-dev - June 2012 - Archives indexes sorted by:
    [ thread ] [ subject ] [ author ] [ date ]
  • Complete archive of the seqan-dev mailing list
  • More info on this list...

Hilfe

  • FAQ
  • Dienstbeschreibung
  • ZEDAT Beratung
  • postmaster@lists.fu-berlin.de

Service-Navigation

  • Startseite
  • Listenauswahl

Einrichtung Mailingliste

  • ZEDAT-Portal
  • Mailinglisten Portal