How To Specify Positional Argument Order In A Gkno Tool
2
0
Entering edit mode
10.8 years ago
Carlos Borroto ★ 2.1k

Hi,

I'm integrating a custom tool into gkno. My tool uses positional arguments that need to be in a correct order. I wrote the JSON configuration file following the documentation and looking at configuration from tools coming with gkno. Using the JSON configuration below, gkno generates a makefile with the positional arguments in the wrong order("qual_file fna_file" instead of "fna_file qual_file"). Is there a way to specify the correct order?

My tool usage:

$ 454-tools merge --help
usage: 454-tools merge [options] [--] <fna_file> <qual_file>

options:
    -h --help                       Show this screen.

    -o FILENAME --output=FILENAME   Write FASTQ output to FILENAME.

What I have in the JSON configuration so far.

{
  "tools" : {
    "454-tools-merge" : {
      "description" : "Merge 454's Fasta and Quality files into a Fastq file",
      "path" : "454-tools/scripts",
      "executable" : "454-tools",
      "modifier" : "merge",
      "help" : "--help|-h",
      "arguments" : {
        "--fna-file" : {
          "description" : "454's fasta input file",
          "input" : true,
          "output" : false,
          "required" : true,
          "dependent" : true,
          "type" : "string",
          "extension" : "fna",
          "modify argument name on command line" : "hide"
        },
        "--qual-file" : {
          "description" : "454's quality input file",
          "input" : true,
          "output" : false,
          "required" : true,
          "dependent" : true,
          "type" : "string",
          "extension" : "qual",
          "modify argument name on command line" : "hide"
        },
        "--output" : {
          "description" : "the output fastq file",
          "input" : false,
          "output" : true,
          "required" : true,
          "dependent" : false,
          "type" : "string",
          "extension" : "fastq",
          "short form argument" : "-o",
          "if output to stream" : "do not include"
        }
      },
      "instances" : {
        "default" : {
          "description" : "Default instance requires the users input for all files."
        }
      }
    }
  }
}

Edit: Removed 'additional files' section as it is not needed. I previously had a wrong interpretation of what is for. This edit does not affect the question or the answers, it is just for future references.

• 2.3k views
ADD COMMENT
1
Entering edit mode
10.8 years ago
Carlos Borroto ★ 2.1k

Answering myself...

After some extensive grepping through the code(you have to love open source) and configuration files of included tools. I found there is an undocumented setting (you have to love just a little less open source) named "argument order", nice!

I only had to modify the JSON configuration above as follow:

{
  "tools" : {
    "454-tools-merge" : {
      ...snip...
      "argument order" : [
        "--output",
        "--fna-file",
        "--qual-file"
      ],
      ...snip...
    }
  }
}
ADD COMMENT
0
Entering edit mode
10.8 years ago
alistairnward ▴ 210

I apologise that I am a little behind in completing all of the documentation. It is not by design that this option isn't clearly spelled out in the documentation, but I will get it in there quickly. But, yes this is the solution that you need. Setting the argument order section of the configuration file will ensure that the arguments always appear in the correct order on the command line.

ADD COMMENT
0
Entering edit mode

No problem at all. I don't expect a project under heavy development to have a fully up-to-date documentation. Thanks for the confirmation.

ADD REPLY

Login before adding your answer.

Traffic: 2683 users visited in the last hour
Help About
FAQ
Access RSS
API
Stats

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6