| einverted

## Wiki

The master copies of EMBOSS documentation are available at http://emboss.open-bio.org/wiki/Appdocs on the EMBOSS Wiki.

Please help by correcting and extending the Wiki pages.

## Function

Find inverted repeats in nucleotide sequences

## Description

einverted finds inverted repeats (stem loops) in nucleotide sequences. It identifies regions of local alignment of the input sequence and its reverse complement that exceed a threshold score. The alignments may include a proportion of mismatches and gaps, which correspond to bulges in the stem loop. One or more sequences are read and a file with the sequence(s) (without gap characters) of the inverted repeat regions is written. It can find multiple inverted repeats in a sequence. Only non-overlapping matches are reported.

## Algorithm

einverted uses dynamic programming and thus is guaranteed to find optimal, local alignments between the sequence and its reverse complement. Matched bases contribute positively to the score whereas gaps and mismatches are penalised. The score for a local alignment is the sum of the values of each match, minus penalties for mismatches and gap insertion. Any region whose score exceeds the threshold is reported. The gap penalty, match score and mismatch score, and the threshold score for reporting regions, are all user-specified.

## Usage

Here is a sample session with einverted

    % einverted tembl:d00596
    Find inverted repeats in nucleotide sequences
    Gap penalty [12]:
    Minimum score threshold [50]:
    Match score [3]:
    Mismatch score [-4]:
    Sanger Centre program inverted output file [d00596.inv]:
    File for sequence of regions of inverted repeats. [d00596.fasta]:

Go to the input files for this example
Go to the output files for this example

## Command line arguments

    Find inverted repeats in nucleotide sequences
    Version: EMBOSS:6.6.0.0

       Standard (Mandatory) qualifiers:
      [-sequence]          seqall     Nucleotide sequence(s) filename and optional
                                      format, or reference (input USA)
       -gap                integer    [12] Gap penalty (Integer 0 or more)
       -threshold          integer    [50] Minimum score threshold (Integer 0 or
                                      more)
       -match              integer    [3] Match score (Integer 0 or more)
       -mismatch           integer    [-4] Mismatch score (Integer up to 0)
      [-outfile]           outfile    [*.einverted] Sanger Centre program inverted
                                      output file
      [-outseq]            seqout     [<sequence>.<format>] The sequence of the
                                      inverted repeat regions without gap
                                      characters.

       Additional (Optional) qualifiers:
       -maxrepeat          integer    [2000] Maximum separation between the start
                                      of repeat and the end of the inverted
                                      repeat. (Integer 0 or more)

       Advanced (Unprompted) qualifiers: (none)
       Associated qualifiers:

       "-sequence" associated qualifiers
       -sbegin1            integer    Start of each sequence to be used
       -send1              integer    End of each sequence to be used
       -sreverse1          boolean    Reverse (if DNA)
       -sask1              boolean    Ask for begin/end/reverse
       -snucleotide1       boolean    Sequence is nucleotide
       -sprotein1          boolean    Sequence is protein
       -slower1            boolean    Make lower case
       -supper1            boolean    Make upper case
       -scircular1         boolean    Sequence is circular
       -squick1            boolean    Read id and sequence only
       -sformat1           string     Input sequence format
       -iquery1            string     Input query fields or ID list
       -ioffset1           integer    Input start position offset
       -sdbname1           string     Database name
       -sid1               string     Entryname
       -ufo1               string     UFO features
       -fformat1           string     Features format
       -fopenfile1         string     Features file name

       "-outfile" associated qualifiers
       -odirectory2        string     Output directory

       "-outseq" associated qualifiers
       -osformat3          string     Output seq format
       -osextension3       string     File name extension
       -osname3            string     Base file name
       -osdirectory3       string     Output directory
       -osdbname3          string     Database name to add
       -ossingle3          boolean    Separate file for each entry
       -oufo3              string     UFO features
       -offormat3          string     Features format
       -ofname3            string     Features file name
       -ofdirectory3       string     Output directory

       General qualifiers:
       -auto               boolean    Turn off prompts
       -stdout             boolean    Write first file to standard output
       -filter             boolean    Read first file from standard input, write
                                      first file to standard output
       -options            boolean    Prompt for standard and additional values
       -debug              boolean    Write debug output to program.dbg
       -verbose            boolean    Report some/full command line options
       -help               boolean    Report command line options and exit. More
                                      information on associated and general
                                      qualifiers can be found with -help -verbose
       -warning            boolean    Report warnings
       -error              boolean    Report errors
       -fatal              boolean    Report fatal errors
       -die                boolean    Report dying program messages
       -version            boolean    Report version number and exit

Qualifier | Type | Description | Allowed values | Default
--- | --- | --- | --- | ---
Standard (Mandatory) qualifiers
[-sequence] (Parameter 1) | seqall | Nucleotide sequence(s) filename and optional format, or reference (input USA) | Readable sequence(s) | Required
-gap | integer | Gap penalty | Integer 0 or more | 12
-threshold | integer | Minimum score threshold | Integer 0 or more | 50
-match | integer | Match score | Integer 0 or more | 3
-mismatch | integer | Mismatch score | Integer up to 0 | -4
[-outfile] (Parameter 2) | outfile | Sanger Centre program inverted output file | Output file | <*>.einverted
[-outseq] (Parameter 3) | seqout | The sequence of the inverted repeat regions without gap characters. | Writeable sequence | <*>.format
Additional (Optional) qualifiers
-maxrepeat | integer | Maximum separation between the start of repeat and the end of the inverted repeat. | Integer 0 or more | 2000
Advanced (Unprompted) qualifiers
(none)
Associated qualifiers
"-sequence" associated seqall qualifiers
-sbegin1 -sbegin_sequence | integer | Start of each sequence to be used | Any integer value | 0
-send1 -send_sequence | integer | End of each sequence to be used | Any integer value | 0
-sreverse1 -sreverse_sequence | boolean | Reverse (if DNA) | Boolean value Yes/No | N
-sask1 -sask_sequence | boolean | Ask for begin/end/reverse | Boolean value Yes/No | N
-snucleotide1 -snucleotide_sequence | boolean | Sequence is nucleotide | Boolean value Yes/No | N
-sprotein1 -sprotein_sequence | boolean | Sequence is protein | Boolean value Yes/No | N
-slower1 -slower_sequence | boolean | Make lower case | Boolean value Yes/No | N
-supper1 -supper_sequence | boolean | Make upper case | Boolean value Yes/No | N
-scircular1 -scircular_sequence | boolean | Sequence is circular | Boolean value Yes/No | N
-squick1 -squick_sequence | boolean | Read id and sequence only | Boolean value Yes/No | N
-sformat1 -sformat_sequence | string | Input sequence format | Any string |
-iquery1 -iquery_sequence | string | Input query fields or ID list | Any string |
-ioffset1 -ioffset_sequence | integer | Input start position offset | Any integer value | 0
-sdbname1 -sdbname_sequence | string | Database name | Any string |
-sid1 -sid_sequence | string | Entryname | Any string |
-ufo1 -ufo_sequence | string | UFO features | Any string |
-fformat1 -fformat_sequence | string | Features format | Any string |
-fopenfile1 -fopenfile_sequence | string | Features file name | Any string |
"-outfile" associated outfile qualifiers
-odirectory2 -odirectory_outfile | string | Output directory | Any string |
"-outseq" associated seqout qualifiers
-osformat3 -osformat_outseq | string | Output seq format | Any string |
-osextension3 -osextension_outseq | string | File name extension | Any string |
-osname3 -osname_outseq | string | Base file name | Any string |
-osdirectory3 -osdirectory_outseq | string | Output directory | Any string |
-osdbname3 -osdbname_outseq | string | Database name to add | Any string |
-ossingle3 -ossingle_outseq | boolean | Separate file for each entry | Boolean value Yes/No | N
-oufo3 -oufo_outseq | string | UFO features | Any string |
-offormat3 -offormat_outseq | string | Features format | Any string |
-ofname3 -ofname_outseq | string | Features file name | Any string |
-ofdirectory3 -ofdirectory_outseq | string | Output directory | Any string |
General qualifiers
-auto | boolean | Turn off prompts | Boolean value Yes/No | N
-stdout | boolean | Write first file to standard output | Boolean value Yes/No | N
-filter | boolean | Read first file from standard input, write first file to standard output | Boolean value Yes/No | N
-options | boolean | Prompt for standard and additional values | Boolean value Yes/No | N
-debug | boolean | Write debug output to program.dbg | Boolean value Yes/No | N
-verbose | boolean | Report some/full command line options | Boolean value Yes/No | Y
-help | boolean | Report command line options and exit. More information on associated and general qualifiers can be found with -help -verbose | Boolean value Yes/No | N
-warning | boolean | Report warnings | Boolean value Yes/No | Y
-error | boolean | Report errors | Boolean value Yes/No | Y
-fatal | boolean | Report fatal errors | Boolean value Yes/No | Y
-die | boolean | Report dying program messages | Boolean value Yes/No | Y
-version | boolean | Report version number and exit | Boolean value Yes/No | N

## Input file format

The input for einverted is a nucleotide sequence

### Input files for usage example

'tembl:d00596' is a sequence entry in the example nucleic acid database 'tembl'

### Database entry: tembl:d00596

    ID   D00596; SV 1; linear; genomic DNA; STD; HUM; 18596 BP.
    XX
    AC   D00596;
    XX
    DT   17-JUL-1991 (Rel. 28, Created)
    DT   07-DEC-2007 (Rel. 94, Last updated, Version 6)
    XX
    DE   Homo sapiens gene for thymidylate synthase, complete cds.
    XX
    KW   .
    XX
    OS   Homo sapiens (human)
    OC   Eukaryota; Metazoa; Chordata; Craniata; Vertebrata; Euteleostomi; Mammalia;
    OC   Eutheria; Euarchontoglires; Primates; Haplorrhini; Catarrhini; Hominidae;
    OC   Homo.
    XX
    RN   [1]
    RP   1-18596
    RX   PUBMED; 2243092.
    RA   Kaneda S., Nalbantoglu J., Takeishi K., Shimizu K., Gotoh O., Seno T.,
    RA   Ayusawa D.;
    RT   "Structural and functional analysis of the human thymidylate synthase
    RT   gene";
    RL   J Biol Chem 265(33):20277-20284(1990).
    XX
    DR   Ensembl-Gn; ENSG00000176890; Homo_sapiens.
    DR   Ensembl-Tr; ENST00000323274; Homo_sapiens.
    DR   GDB; 163670.
    DR   GDB; 182340.
    XX
    CC   These data kindly submitted in computer readable form by:
    CC   Sumiko Kaneda
    CC   National Institute of Genetics
    CC   1111 Yata
    CC   Mishima 411
    CC   Japan
    XX
    FH   Key             Location/Qualifiers
    FH
    FT   source          1..18596
    FT                   /organism="Homo sapiens"
    FT                   /chromosome="18"
    FT                   /map="18p11.32"
    FT                   /mol_type="genomic DNA"
    FT                   /clone="lambdaHTS-1 and lambdaHTS-3"
    FT                   /db_xref="taxon:9606"
    FT   repeat_region   1..148
    FT                   /rpt_family="Alu"
    FT   repeat_region   202..477
    FT                   /rpt_family="Alu"

      [Part of this file has been deleted for brevity]

         ttttgttttt agcttcagcg agaacccaga cctttcccaa agctcaggat tcttcgaaaa     15660
         gttgagaaaa ttgatgactt caaagctgaa gactttcaga ttgaagggta caatccgcat     15720
         ccaactatta aaatggaaat ggctgtttag ggtgctttca aaggagctcg aaggatattg     15780
         tcagtcttta ggggttgggc tggatgccga ggtaaaagtt ctttttgctc taaaagaaaa     15840
         aggaactagg tcaaaaatct gtccgtgacc tatcagttat taatttttaa ggatgttgcc     15900
         actggcaaat gtaactgtgc cagttctttc cataataaaa ggctttgagt taactcactg     15960
         agggtatctg acaatgctga ggttatgaac aaagtgagga gaatgaaatg tatgtgctct     16020
         tagcaaaaac atgtatgtgc atttcaatcc cacgtactta taaagaaggt tggtgaattt     16080
         cacaagctat ttttggaata tttttagaat attttaagaa tttcacaagc tattccctca     16140
         aatctgaggg agctgagtaa caccatcgat catgatgtag agtgtggtta tgaactttaa     16200
         agttatagtt gttttatatg ttgctataat aaagaagtgt tctgcattcg tccacgcttt     16260
         gttcattctg tactgccact tatctgctca gttccttcct aaaatagatt aaagaactct     16320
         ccttaagtaa acatgtgctg tattctggtt tggatgctac ttaaaagagt atattttaga     16380
         aataatagtg aatatatttt gccctatttt tctcatttta actgcatctt atcctcaaaa     16440
         tataatgacc atttaggata gagttttttt tttttttttt taaactttta taaccttaaa     16500
         gggttatttt aaaataatct atggactacc attttgccct cattagcttc agcatggtgt     16560
         gacttctcta ataatatgct tagattaagc aaggaaaaga tgcaaaacca cttcggggtt     16620
         aatcagtgaa atatttttcc cttcgttgca taccagatac ccccggtgtt gcacgactat     16680
         ttttattctg ctaatttatg acaagtgtta aacagaacaa ggaattattc caacaagtta     16740
         tgcaacatgt tgcttatttt caaattacag tttaatgtct aggtgccagc ccttgatata     16800
         gctatttttg taagaacatc ctcctggact ttgggttagt taaatctaaa cttatttaag     16860
         gattaagtag gataacgtgc attgatttgc taaaagaatc aagtaataat tacttagctg     16920
         attcctgagg gtggtatgac ttctagctga actcatcttg atcggtagga ttttttaaat     16980
         ccatttttgt aaaactattt ccaagaaatt ttaagccctt tcacttcaga aagaaaaaag     17040
         ttgttggggc tgagcactta attttcttga gcaggaagga gtttcttcca aacttcacca     17100
         tctggagact ggtgtttctt tacagattcc tccttcattt ctgttgagta gccgggatcc     17160
         tatcaaagac caaaaaaatg agtcctgtta acaaccacct ggaacaaaaa cagattttat     17220
         gcatttatgc tgctccaaga aatgctttta cgtctaagcc agaggcaatt aattaatttt     17280
         tttttttttg acatggagtc actgtccgtt gcccaggctg cagtgcagtg gcgcaatctt     17340
         ggctcactgc aacctccacc tcccaggttc aagtgattct cctgcctcag cctcccatgt     17400
         agctgggatc acaggcacct gccaccatgc ccggctaatt ttttgtattt tttgtagaga     17460
         cagggtttca ccatgttggc caggctggtc tcaaacacct gacctcaaat gatccacctg     17520
         cctcagcctc ccaaagtgtt gggattacag gcgtaagcca ccatgcccag ccctgaatta     17580
         atatttttaa aataagtttg gagactgttg gaaataatag ggcagaggaa catattttac     17640
         tggctacttg ccagagttag ttaactcatc aaactctttg ataatagttt gacctctgtt     17700
         ggtgaaaatg agccatgatc tcttgaacat gatcagaata aatgccccag ccacacaatt     17760
         gtagtccaaa ctttttaggt cactaacttg ctagatggtg ccaggttttt ttgcacaagg     17820
         agtgcaaatg ttaagatctc cactagtgag gaaaggctag tattacagaa gccttgtcag     17880
         aggcaattga acctccaagc cctggccctc aggcctgagg attttgatac agacaaactg     17940
         aagaaccgtt tgttagtgga tattgcaaac aaacaggagt caaagcttgg tgctccacag     18000
         tctagttcac gagacaggcg tggcagtggc tggcagcatc tcttctcaca ggggccctca     18060
         ggcacagctt accttgggag gcatgtagga agcccgctgg atcatcacgg gatacttgaa     18120
         atgctcatgc aggtggtcaa catactcaca caccctagga ggagggaatc agatcggggc     18180
         aatgatgcct gaagtcagat tattcacgtg gtgctaactt aaagcagaag gagcgagtac     18240
         cactcaattg acagtgttgg ccaaggctta gctgtgttac catgcgtttc taggcaagtc     18300
         cctaaacctc tgtgcctcag gtccttttct tctaaaatat agcaatgtga ggtggggact     18360
         ttgatgacat gaacacacga agtccctctg agaggttttg tggtgccctt taaaagggat     18420
         caattcagac tctgtaaata tccagaatta tttgggttcc tctggtcaaa agtcagatga     18480
         atagattaaa atcaccacat tttgtgatct atttttcaag aagcgtttgt attttttcat     18540
         atggctgcag cagctgccag gggcttgggg tttttttggc aggtagggtt gggagg         18596
    //

## Output file format

### Output files for usage example

### File: d00596.fasta

    >D00596_13_142
    gctacgcgagaggctgaggcagcagaattacttgaacccaggaggcggaggttgcagtga
    gccgagatcgcgccactgcactccagcctgggtgagagagcgagactctgtctcaaaaaa
    aaaaaaaaaa
    >D00596_199_328
    ttttttttttttttttttgggacagtcttgctctgtcgcccaggctggagtacaatggtc
    ggatcttggctcactgcaacctctgcctcccaggttcaagcaattcttctgcctcagcct
    cccaagtagc
    >D00596_12128_12301
    agaggatttttttttttttttttttttttgagacagagttttgctctgttgcccaggctg
    gaatgcaacggcgtgatcttggctcactgtaacctctgcctcctgggttcgagtgattct
    cctgcctcagcctccaagtagctgggattacagcatgtgccaccatgcctggct
    >D00596_12573_12749
    agccaggtgtggtggctcacacctgtaattccaacaactccagaggccaaggcgagagga
    tcatttgaacccacggaatttgaggctgtagtgagtcatgatcacgccattgcactccat
    cctgggcaacagagtgagaccctgaatatttaaaaacaacaacaacaacaaaactct
    >D00596_12246_12296
    ctcctgcctcagcctccaagtagctgggattacagcatgtgccaccatgcc
    >D00596_13886_13938
    ggtatggtggctcatgcctgtaatcccagcactttggaagactgagacaggag
    >D00596_13884_13949
    tgggtatggtggctcatgcctgtaatcccagcactttggaagactgagacaggagcaatt
    gcttga
    >D00596_14628_14692
    tcaagcaattcttctgcctcagcctcccaggtagctgggattacaggcacatgccaccac
    accca

### File: d00596.inv

    D00596: Score 236: 108/130 ( 83%) matches, 0 gaps
          13 gctacgcgagaggctgaggcagcagaattacttgaacccaggaggcggaggttgcagtgagccgagatcgcgccactgcactccagcctgggtgagagagcgagactctgtctcaaaaaaaaaaaaaaaa 142
             |||||  | ||||||||||||| |||||| ||||||||  |||||| |||||||||||||||| |||||   ||| || ||||||||||||| || ||||| ||||| |  |  ||||||||||||||||
         328 cgatgaaccctccgactccgtcttcttaacgaacttggaccctccgtctccaacgtcactcggttctaggctggtaacatgaggtcggacccgctgtctcgttctgacagggtttttttttttttttttt 199

    D00596: Score 164: 128/174 ( 73%) matches, 3 gaps
       12128 agaggatttttttttttttttttttttttgagacagagttttgctctgttgcccaggctggaatgcaacggcgtgatcttggctcactgtaacctctgcctcc-tgggttcgagtgattctcctgcctcagcctc-caagtagctgggattaca-gcatgtgccaccatgcctggct 12301
             ||||  || || || || || |||||    |  ||| || |  |||||||||||||| |||| ||||| ||||||||| || ||||||  | ||||    ||| ||||||| | |||| |||  ||||  |||||   ||| | ||| |||||| |  || |||||||  |||||||
       12749 tctcaaaacaacaacaacaacaaaaatttataagtcccagagtgagacaacgggtcctacctcacgttaccgcactagtactgagtgatgtcggagtttaaggcacccaagtttactaggagagcggaaccggagacctcaacaaccttaatgtccacactcggtggtgtggaccga 12573

    D00596: Score 80: 44/51 ( 86%) matches, 2 gaps
       12246 ctcctgcctcag-cctccaagtagctgggattaca-gcatgtgccaccatgcc 12296
             |||||| ||||| | |||||   |||||||||||| ||||| |||||||| ||
       13938 gaggacagagtcagaaggtttcacgaccctaatgtccgtactcggtggtatgg 13886

    D00596: Score 99: 53/65 ( 81%) matches, 1 gaps
       13884 tgggtatggtggctcatgcctgtaatcccagcactttggaagactgagacaggagcaattgcttga 13949
             ||||| |||||||   ||||||||||||||||    ||| || ||||| ||| || ||||||||||
       14692 acccacaccaccgtacacggacattagggtcgatggaccctccgactccgtcttc-ttaacgaact 14628

## Data files

None.

## Notes

The original "inverted" program (from which einverted was derived) was used to annotate the nematode genome. Excluding overlapping repeats saved problems with simple repeat sequences in this genome.

einverted will find optimal alignments but is slower than heuristic methods such as BLAST.

Sometimes you can find repeats using the program palindrome that you can't find with einverted using the default parameters.

This is not due to a problem with either program. It is simply because some of the shortest repeats that you find with palindrome's default parameter values are below einverted's default cutoff score - you should decrease the 'Minimum score threshold' to see them.

For example, when palindrome is run with 'em:x65921', it finds the repeat:

    64    aaaactaaggc    74
          |||||||||||
    98    ttttgattccg    88

einverted will not report this as its score is 33 (11 bases scoring 3 each, no mismatches or gaps) which is below the default score cutoff of 50.

If einverted is run as:

% einverted em:x65921 -threshold 30

then it will find it:

    Score 33: 11/11 (100%) matches, 0 gaps
          64 aaaactaaggc 74
             |||||||||||
          98 ttttgattccg 88

Anything can be considered to be a repeat if you set the score threshold low enough!

einverted does not report overlapping matches.

## References

Some useful references on inverted repeats:

1. Pearson CE, Zorbas H, Price GB, Zannis-Hadjopoulos M Inverted repeats, stem-loops, and cruciforms: significance for initiation of DNA replication. J Cell Biochem 1996 Oct;63(1):1-22
2. Waldman AS, Tran H, Goldsmith EC, Resnick MA. q Long inverted repeats are an at-risk motif for recombination in mammalian cells. Genetics. 1999 Dec;153(4):1873-83. PMID: 10581292; UI: 20050682
3. Jacobsen SE Gene silencing: Maintaining methylation patterns. Curr Biol 1999 Aug 26;9(16):R617-9
4. Lewis S, Akgun E, Jasin M. Palindromic DNA and genome stability. Further studies. Ann N Y Acad Sci. 1999 May 18;870:45-57. PMID: 10415472; UI: 99343961
5. Dai X, Greizerstein MB, Nadas-Chinni K, Rothman-Denes LB Supercoil-induced extrusion of a regulatory DNA hairpin. Proc Natl Acad Sci U S A 1997 Mar 18;94(6):2174-9

## Warnings

None.

## Diagnostic Error Messages

None.

## Exit status

It always exits with a status of 0.

## Known bugs

None.

## See also

Program name | Description
--- | ---
banana | Plot bending and curvature data for B-DNA
btwisted | Calculate the twisting in a B-DNA sequence
equicktandem | Find tandem repeats in nucleotide sequences
etandem | Find tandem repeats in a nucleotide sequence
palindrome | Find inverted repeats in nucleotide sequence(s)
sirna | Find siRNA duplexes in mRNA

palindrome also looks for inverted repeats but is much faster and less sensitive, as it looks for near-perfect repeats.

## Author(s)

This program was originally written by Richard Durbin
Sanger Institute, Wellcome Trust Genome Campus, Hinxton, Cambridge, CB10 1SA, UK.

Please report all bugs to the EMBOSS bug team (emboss-bug © emboss.open-bio.org) not to the original author.

This application was modified for inclusion in EMBOSS by Peter Rice
European Bioinformatics Institute, Wellcome Trust Genome Campus, Hinxton, Cambridge CB10 1SD, UK

Please report all bugs to the EMBOSS bug team (emboss-bug © emboss.open-bio.org) not to the original author.

## History

Written (1999) - Peter Rice

## Target users

This program is intended to be used by everyone and everything, from naive users to embedded scripts.

## Comments

None