application: twofeat [
  documentation: "Find neighbouring pairs of features in sequence(s)"
  groups: "Feature tables"
    relations: "EDAM_topic:0160 Sequence sites and features"
    relations: "EDAM_operation:0255 Feature table query"
]

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

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

  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"
    relations: "EDAM_data:0856 Sequence feature source"
    ]

    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://www.ebi.ac.uk/embl/WebFeat/ for a list of the
             EMBL feature types and see Appendix A of the Swissprot user
             manual in http://www.expasy.org/sprot/userman.html
             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"
    relations: "EDAM_data:1020 Sequence feature key"
    ]

    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."
    relations: "EDAM_data:0853 DNA sense specification"
    ]

    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."
    relations: "EDAM_data:1772 Score or penalty"
    ]

    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."
    relations: "EDAM_data:1772 Score or penalty"
    ]

    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"
    relations: "EDAM_data:1021 Sequence feature qualifier"
    ]

    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"
    relations: "EDAM_data:1021 Sequence feature qualifier"
    ]

  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"
    relations: "EDAM_data:0856 Sequence feature source"
    ]

    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://www.ebi.ac.uk/embl/WebFeat/ for a list of the
             EMBL feature types and see Appendix A of the Swissprot user
             manual in http://www.expasy.org/sprot/userman.html
             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"
    relations: "EDAM_data:1020 Sequence feature key"
    ]

    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."
    relations: "EDAM_data:0853 DNA sense specification"
    ]

    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."
    relations: "EDAM_data:1772 Score or penalty"
    ]

    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."
    relations: "EDAM_data:1772 Score or penalty"
    ]

    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"
    relations: "EDAM_data:1021 Sequence feature qualifier"
    ]

    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"
    relations: "EDAM_data:1021 Sequence feature qualifier"
    ]

  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."
    relations: "EDAM_data:2527 Parameter"
    ]

    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"
    relations: "EDAM_data:1249 Sequence length"
    ]

    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"
    relations: "EDAM_data:1249 Sequence length"
    ]

    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"
    relations: "EDAM_data:2527 Parameter"
    ]

    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."
    relations: "EDAM_data:0853 DNA sense specification"
    ]

    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."
    relations: "EDAM_data:2527 Parameter"
    ]

  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."
    relations: "EDAM_data:2527 Parameter"
  ]

  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://www.ebi.ac.uk/embl/WebFeat/ for a list of the EMBL
           feature types and see Appendix A of the Swissprot user manual in
           http://www.expasy.org/sprot/userman.html 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"
    relations: "EDAM_data:1020 Sequence feature key"
  ]

  report: outfile [
    parameter: "Y"
    taglist: "int:starta int:enda int:startb int:endb"
    rformat: "table"
    relations: "EDAM_data:1255 Feature record"
  ]

endsection: output
