application: compseq [
  documentation: "Calculate the composition of unique words in sequences"
  groups: "Nucleic:Composition, Protein:Composition"
    relations: "EDAM_topic:0157 Sequence composition analysis"
    relations: "EDAM_operation:0236 Sequence composition  calculation"
]

section: input [
  information: "Input section"
  type: "page"
]

  seqall: sequence [
    parameter: "Y"
    type: "any"
    relations: "EDAM_data:0849 Sequence record"
  ]

  infile: infile [
    additional: "Y"
    nullok: "Y"
    information: "Program compseq output file (optional)"
    help: "This is a file previously produced by 'compseq' that can be
           used to set the expected frequencies of words in this analysis. \
           The word size in the current run must be the same as the one in
           this results file. Obviously, you should use a file produced from
           protein sequences if you are counting protein sequence word
           frequencies, and you must use one made from nucleotide frequencies
           if you are analysing a nucleotide sequence."
    knowntype: "compseq output"
    relations: "EDAM_data:1261 Sequence composition"
  ]

endsection: input

section: required [
  information: "Required section"
  type: "page"
]

  integer: word [
    standard: "Y"
    minimum: "1"
    default: "2"
    maximum: "@($(acdprotein)? 4 : 6)"
    failrange: "N"
    trueminimum: "N"
    information: "Word size to consider (e.g. 2=dimer)"
    help: "This is the size of word (n-mer) to count. \
           Thus if you want to count codon frequencies for a nucleotide
           sequence, you should enter 3 here."
    relations: "EDAM_data:1250 Word size"
  ]

endsection: required

section: additional [
  information: "Additional section"
  type: "page"
]

  integer: frame [
    additional: "Y"
    default: "0"
    minimum: "0"
    maximum: "$(word)"
    failrange: "N"
    trueminimum: "Y"
    information: "Frame of word to look at (0=all frames)"
    help: "The normal behaviour of 'compseq' is to count the
           frequencies of all words that occur by moving a window of length
           'word' up by one each time. \
           This option allows you to move the window up by the length of the
           word each time, skipping over the intervening words. \
           You can count only those words that occur in a single frame of the
           word by setting this value to a number other than zero. \
           If you set it to 1 it will only count the words in frame 1, 2 will
           only count the words in frame 2 and so on."
    relations: "EDAM_data:2126 Translation frame specification"
  ]

  boolean: ignorebz [
    additional: "$(acdprotein)"
    default: "Y"
    information: "Ignore the amino acids B and Z and just count
                  them as 'Other'"
    help: "The amino acid code B represents Asparagine or Aspartic
           acid and the code Z represents Glutamine or Glutamic acid. \
           These are not commonly used codes and you may wish not to count
           words containing them, just noting them in the count of 'Other'
           words."
    relations: "EDAM_data:2527 Parameter"
  ]

  boolean: reverse [
    additional: "@(!$(acdprotein))"
    default: "N"
    information: "Count words in the forward and reverse sense"
    help: "Set this to be true if you also wish to also count words in
           the reverse complement of a nucleic sequence."
    relations: "EDAM_data:2527 Parameter"
  ]

  boolean: calcfreq [
    additional: "Y"
    default: "N"
    information: "Calculate expected frequency from sequence"
    help: "If this is set true then the expected frequencies of words
           are calculated from the observed frequency of single bases or
           residues in the sequences. \
           If you are reporting a word size of 1 (single bases or residues)
           then there is no point in using this option because the calculated
           expected frequency will be equal to the observed frequency. \
           Calculating the expected frequencies like this will give an
           approximation of the expected frequencies that you might get by
           using an input file of frequencies produced by a previous run of
           this program. If an input file of expected word frequencies has
           been specified then the values from that file will be used instead
           of this calculation of expected frequency from the sequence, even
           if 'calcfreq' is set to be true."
    relations: "EDAM_data:2527 Parameter"
  ]

endsection: additional

section: output [
  information: "Output section"
  type: "page"
]

  outfile: outfile [
    parameter: "Y"
    extension: "composition"
    help: "This is the results file."
    information: "Program compseq output file"
    knowntype: "compseq output"
    relations: "EDAM_data:1261 Sequence composition"
  ]

  boolean: zerocount [
    additional: "Y"
    default: "Y"
    information: "Display the words that have a frequency of
                  zero"
    help: "You can make the output results file much smaller if you do
           not display the words with a zero count."
    relations: "EDAM_data:2527 Parameter"
  ]

endsection: output
