application: twofeat [
  documentation: "Finds neighbouring pairs of features in sequence(s)"
  groups: "Feature tables"
]

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

  seqall: sequence [
    parameter: "Y"
    type: "any"
    features: "Y"
  ]

  section: afeaturesection [
    information: "First feature options"
    type: "frame"
  ]

    string: asource [
      additional: "Y"
      default: "*"
      information: "Source of first feature"
      help: "By default any feature source in the feature table is
             allowed. You can set this to match any feature source you wish
             to allow. \
             The source name is usually either the name of the program that
             detected the feature or it is the feature table (eg: EMBL) that
             the feature came from. \
             The source may be wildcarded by using '*'. \
             If you wish to allow more than one source, separate their names
             with the character '|', eg: \
             gene* | embl"
      knowntype: "feature source list"
    ]

    string: atype [
      standard: "Y"
      default: "*"
      information: "Type of first feature"
      help: "By default every feature in the feature table is allowed.
             You can set this to be any feature type you wish to allow. \
             See http://www3.ebi.ac.uk/Services/WebFeat/ for a list of the
             EMBL feature types and see Appendix A of the Swissprot user
             manual in http://www.expasy.ch/txt/userman.txt for a list of the
             Swissprot feature types. \
             The type may be wildcarded by using '*'. \
             If you wish to allow more than one type, separate their names
             with the character '|', eg: \
             *UTR | intron"
      knowntype: "feature key list"
    ]

    list: asense [
      additional: "Y"
      default: "0"
      minimum: "1"
      maximum: "1"
      header: "Sense of first feature"
      values: "0:Any sense, +:Forward sense, -:Reverse sense"
      delimiter: ","
      codedelimiter: ":"
      information: "Sense of first feature"
      help: "By default any feature sense is allowed. You can set this
             to match the required sense."
    ]

    float: aminscore [
      additional: "Y"
      default: "0.0"
      information: "Minimum score of first feature"
      help: "If this is greater than or equal to the maximum score,
             then any score is allowed."
    ]

    float: amaxscore [
      additional: "Y"
      default: "0.0"
      information: "Maximum score of first feature"
      help: "If this is less than or equal to the maximum score, then
             any score is permitted."
    ]

    string: atag [
      additional: "Y"
      default: "*"
      information: "Tag of first feature"
      help: "Tags are the types of extra values that a feature may
             have. For example in the EMBL feature table, a 'CDS' type of
             feature may have the tags '/codon', '/codon_start', '/db_xref',
             '/EC_number', '/evidence', '/exception', '/function', '/gene',
             '/label', '/map', '/note', '/number', '/partial', '/product',
             '/protein_id', '/pseudo', '/standard_name', '/translation',
             '/transl_except', '/transl_table', or '/usedin'. Some of these
             tags also have values, for example '/gene' can have the value of
             the gene name. \
             By default any feature tag in the feature table is allowed. You
             can set this to match any feature tag you wish to allow. \
             The tag may be wildcarded by using '*'. \
             If you wish to allow more than one tag, separate their names
             with the character '|', eg: \
             gene | label"
      knowntype: "feature tag list"
    ]

    string: avalue [
      additional: "Y"
      default: "*"
      information: "Value of first feature's tags"
      help: "Tag values are the values associated with a feature tag.
             Tags are the types of extra values that a feature may have. For
             example in the EMBL feature table, a 'CDS' type of feature may
             have the tags '/codon', '/codon_start', '/db_xref',
             '/EC_number', '/evidence', '/exception', '/function', '/gene',
             '/label', '/map', '/note', '/number', '/partial', '/product',
             '/protein_id', '/pseudo', '/standard_name', '/translation',
             '/transl_except', '/transl_table', or '/usedin'. Only some of
             these tags can have values, for example '/gene' can have the
             value of the gene name. By default any feature tag value in the
             feature table is allowed. You can set this to match any feature
             tag value you wish to allow. \
             The tag value may be wildcarded by using '*'. \
             If you wish to allow more than one tag value, separate their
             names with the character '|', eg: \
             pax* | 10"
      knowntype: "feature tagvalue list"
    ]

  endsection: afeaturesection

  section: bfeaturesection [
    information: "Second feature options"
    type: "frame"
  ]

    string: bsource [
      additional: "Y"
      default: "*"
      information: "Source of second feature"
      help: "By default any feature source in the feature table is
             allowed. You can set this to match any feature source you wish
             to allow. \
             The source name is usually either the name of the program that
             detected the feature or it is the feature table (eg: EMBL) that
             the feature came from. \
             The source may be wildcarded by using '*'. \
             If you wish to allow more than one source, separate their names
             with the character '|', eg: \
             gene* | embl"
      knowntype: "feature source list"
    ]

    string: btype [
      standard: "Y"
      default: "*"
      information: "Type of second feature"
      help: "By default every feature in the feature table is allowed.
             You can set this to be any feature type you wish to allow. \
             See http://www3.ebi.ac.uk/Services/WebFeat/ for a list of the
             EMBL feature types and see Appendix A of the Swissprot user
             manual in http://www.expasy.ch/txt/userman.txt for a list of the
             Swissprot feature types. \
             The type may be wildcarded by using '*'. \
             If you wish to allow more than one type, separate their names
             with the character '|', eg: \
             *UTR | intron"
      knowntype: "feature key list"
    ]

    list: bsense [
      additional: "Y"
      default: "0"
      minimum: "1"
      maximum: "1"
      header: "Sense of second feature"
      values: "0:Any sense, +:Forward sense, -:Reverse sense"
      delimiter: ","
      codedelimiter: ":"
      information: "Sense of second feature"
      help: "By default any feature sense is allowed. You can set this
             to match the required sense."
    ]

    float: bminscore [
      additional: "Y"
      default: "0.0"
      information: "Minimum score of second feature"
      help: "If this is greater than or equal to the maximum score,
             then any score is allowed."
    ]

    float: bmaxscore [
      additional: "Y"
      default: "0.0"
      information: "Maximum score of second feature"
      help: "If this is less than or equal to the maximum score, then
             any score is permitted."
    ]

    string: btag [
      additional: "Y"
      default: "*"
      information: "Tag of second feature"
      help: "Tags are the types of extra values that a feature may
             have. For example in the EMBL feature table, a 'CDS' type of
             feature may have the tags '/codon', '/codon_start', '/db_xref',
             '/EC_number', '/evidence', '/exception', '/function', '/gene',
             '/label', '/map', '/note', '/number', '/partial', '/product',
             '/protein_id', '/pseudo', '/standard_name', '/translation',
             '/transl_except', '/transl_table', or '/usedin'. Some of these
             tags also have values, for example '/gene' can have the value of
             the gene name. \
             By default any feature tag in the feature table is allowed. You
             can set this to match any feature tag you wish to allow. \
             The tag may be wildcarded by using '*'. \
             If you wish to allow more than one tag, separate their names
             with the character '|', eg: \
             gene | label"
      knowntype: "feature tag list"
    ]

    string: bvalue [
      additional: "Y"
      default: "*"
      information: "Value of second feature's tags"
      help: "Tag values are the values associated with a feature tag.
             Tags are the types of extra values that a feature may have. For
             example in the EMBL feature table, a 'CDS' type of feature may
             have the tags '/codon', '/codon_start', '/db_xref',
             '/EC_number', '/evidence', '/exception', '/function', '/gene',
             '/label', '/map', '/note', '/number', '/partial', '/product',
             '/protein_id', '/pseudo', '/standard_name', '/translation',
             '/transl_except', '/transl_table', or '/usedin'. Only some of
             these tags can have values, for example '/gene' can have the
             value of the gene name. By default any feature tag value in the
             feature table is allowed. You can set this to match any feature
             tag value you wish to allow. \
             The tag value may be wildcarded by using '*'. \
             If you wish to allow more than one tag value, separate their
             names with the character '|', eg: \
             pax* | 10"
      knowntype: "feature tagvalue list"
    ]

  endsection: bfeaturesection

  section: featurerelationsection [
    information: "Feature relation options"
    type: "frame"
  ]

    list: overlap [
      additional: "Y"
      default: "A"
      minimum: "1"
      maximum: "1"
      header: "Type of overlap required"
      values: "A:Any, O:Overlap required, NO:No overlaps are
               allowed, NW:Overlap required but not within, AW:A must be all
               within B, BW:B must be all within A"
      delimiter: ","
      codedelimiter: ":"
      information: "Specify overlap"
      help: "This allows you to specify the allowed overlaps of the
             features A and B. \
             You can allow any or no overlaps, specify that they must or must
             not overlap, that one must or must not be wholly enclosed
             within another feature."
    ]

    integer: minrange [
      standard: "Y"
      default: "0"
      information: "The minimum distance between the features"
      help: "If this is greater or equal to 'maxrange', then no min or
             max range is specified"
    ]

    integer: maxrange [
      standard: "Y"
      default: "0"
      information: "The maximum distance between the features"
      help: "If this is less than or equal to 'minrange', then no min
             or max range is specified"
    ]

    list: rangetype [
      additional: "Y"
      default: "N"
      minimum: "1"
      maximum: "1"
      header: "Positions from which to measure the distance"
      values: "N:From nearest ends, L:From left ends, R:From right
               ends, F:From furthest ends"
      delimiter: ","
      codedelimiter: ":"
      information: "Specify position"
      help: "This allows you to specify the positions from which the
             allowed minimum or maximum distance between the features is
             measured"
    ]

    list: sense [
      additional: "Y"
      default: "A"
      minimum: "1"
      maximum: "1"
      header: "Sense of the features"
      values: "A:Any sense, S:Same sense, O:Opposite sense"
      delimiter: ","
      codedelimiter: ":"
      information: "Specify sense"
      help: "This allows you to specify the required sense that the
             two features must be on. This is ignored (always 'Any') when
             looking at protein sequence features."
    ]

    list: order [
      additional: "Y"
      default: "A"
      minimum: "1"
      maximum: "1"
      header: "Order of the features"
      values: "A:Any, AB:Feature A then feature B, BA:Feature B then
               feature A"
      delimiter: ","
      codedelimiter: ":"
      information: "Specify order"
      help: "This allows you to specify the required order of the two
             features. The order is measured from the start positions of the
             features. This criterion is always applied despite the specified
             overlap type required."
    ]

  endsection: featurerelationsection

endsection: input

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

  toggle: twoout [
    additional: "Y"
    default: "N"
    information: "Do you want the two features written out
                  individually"
    help: "If you set this to be true, then the two features
           themselves will be written out. If it is left as false, then a
           single feature will be written out covering the two features you
           found."
  ]

  string: typeout [
    additional: "@(!$(twoout))"
    default: "misc_feature"
    information: "Name of the output new feature"
    help: "If you have specified that the pairs of features that are
           found should be reported as one feature in the ouput, then you can
           specify the 'type' name of the new feature here. By default every
           feature in the feature table is allowed. See
           http://www3.ebi.ac.uk/Services/WebFeat/ for a list of the EMBL
           feature types and see Appendix A of the Swissprot user manual in
           http://www.expasy.ch/txt/userman.txt for a list of the Swissprot
           feature types. If you specify an invalid feature type name, then
           the default name 'misc_feature' is used."
    knowntype: "feature key"
  ]

  report: outfile [
    parameter: "Y"
    taglist: "int:starta int:enda int:startb int:endb"
    rformat: "table"
  ]

endsection: output
