| profit

## 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

Scan one or more sequences with a simple frequency matrix

## Description

profit scans one or more sequences with a simple frequency matrix and writes an output file with any high-scoring matches. All possible ungapped alignments of each sequence to the matrix are scored and any matches with a score higher than the specified threshold are written to the output file. The output file includes the name of any matching sequence found, the start position in the sequence of the match and the percentage of the maximum possible score.

## Algorithm

All possible ungapped alignments of each sequence to the frequency matrix are scored. The first alignment has the first positions of the sequence and matrix in the same register. If the sequence is larger than the matrix, there will be more than one alignment. Otherwise, there will be just one.

The score for a match is simply the sum of scores at each position of the matrix for the corresponding residue from the sequence. The percentage of the maximum possible score reported in the output file is the sum of the highest value at each position in the frequency matrix. Where the match score is above the threshold percentage of the maximum possible score for that matrix, then a hit is reported.

## Usage

Before running the example, we need to make a simple frequency matrix using prophecy

This is the ungapped aligned set of sequences used to make the matrix:

    % more m.seq
    >one
    DEVGGEALGRLLVVYPWTQR
    >two
    DEVGREALGRLLVVYPWTQR
    >three
    DEVGGEALGRILVVYPWTQR
    >four
    DEVGGEAAGRVLVVYPWTQR

    % prophecy
    Creates matrices/profiles from multiple alignments
    Input sequence set: m.seq
    Profile type
             F : Frequency
             G : Gribskov
             H : Henikoff
    Select type [F]:
    Enter a name for the profile [mymatrix]:
    Enter threshold reporting percentage [75]:
    Output file [outfile.prophecy]:

Here is a sample session with profit

    % profit
    Scan one or more sequences with a simple frequency matrix
    Profile or weight matrix file: outfile.prophecy
    Input sequence(s): tsw:*
    Output file [outfile.profit]:

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

## Command line arguments

    Scan one or more sequences with a simple frequency matrix
    Version: EMBOSS:6.6.0.0

       Standard (Mandatory) qualifiers:
      [-infile]            infile     Profile or weight matrix file
      [-sequence]          seqall     Sequence(s) filename and optional format, or
                                      reference (input USA)
      [-outfile]           outfile    [*.profit] Output file name

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

       "-sequence" associated qualifiers
       -sbegin2            integer    Start of each sequence to be used
       -send2              integer    End of each sequence to be used
       -sreverse2          boolean    Reverse (if DNA)
       -sask2              boolean    Ask for begin/end/reverse
       -snucleotide2       boolean    Sequence is nucleotide
       -sprotein2          boolean    Sequence is protein
       -slower2            boolean    Make lower case
       -supper2            boolean    Make upper case
       -scircular2         boolean    Sequence is circular
       -squick2            boolean    Read id and sequence only
       -sformat2           string     Input sequence format
       -iquery2            string     Input query fields or ID list
       -ioffset2           integer    Input start position offset
       -sdbname2           string     Database name
       -sid2               string     Entryname
       -ufo2               string     UFO features
       -fformat2           string     Features format
       -fopenfile2         string     Features file name

       "-outfile" associated qualifiers
       -odirectory3        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
[-infile] (Parameter 1) | infile | Profile or weight matrix file | Input file | Required
[-sequence] (Parameter 2) | seqall | Sequence(s) filename and optional format, or reference (input USA) | Readable sequence(s) | Required
[-outfile] (Parameter 3) | outfile | Output file name | Output file | <*>.profit
Additional (Optional) qualifiers
(none)
Advanced (Unprompted) qualifiers
(none)
Associated qualifiers
"-sequence" associated seqall qualifiers
-sbegin2 -sbegin_sequence | integer | Start of each sequence to be used | Any integer value | 0
-send2 -send_sequence | integer | End of each sequence to be used | Any integer value | 0
-sreverse2 -sreverse_sequence | boolean | Reverse (if DNA) | Boolean value Yes/No | N
-sask2 -sask_sequence | boolean | Ask for begin/end/reverse | Boolean value Yes/No | N
-snucleotide2 -snucleotide_sequence | boolean | Sequence is nucleotide | Boolean value Yes/No | N
-sprotein2 -sprotein_sequence | boolean | Sequence is protein | Boolean value Yes/No | N
-slower2 -slower_sequence | boolean | Make lower case | Boolean value Yes/No | N
-supper2 -supper_sequence | boolean | Make upper case | Boolean value Yes/No | N
-scircular2 -scircular_sequence | boolean | Sequence is circular | Boolean value Yes/No | N
-squick2 -squick_sequence | boolean | Read id and sequence only | Boolean value Yes/No | N
-sformat2 -sformat_sequence | string | Input sequence format | Any string |
-iquery2 -iquery_sequence | string | Input query fields or ID list | Any string |
-ioffset2 -ioffset_sequence | integer | Input start position offset | Any integer value | 0
-sdbname2 -sdbname_sequence | string | Database name | Any string |
-sid2 -sid_sequence | string | Entryname | Any string |
-ufo2 -ufo_sequence | string | UFO features | Any string |
-fformat2 -fformat_sequence | string | Features format | Any string |
-fopenfile2 -fopenfile_sequence | string | Features file name | Any string |
"-outfile" associated outfile qualifiers
-odirectory3 -odirectory_outfile | 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

profit reads a simple frequency matrix produced by prophecy and uses it to search searches one or more protein or nucleic acid sequences.

The input is a standard EMBOSS sequence query (also known as a 'USA').

Major sequence database sources defined as standard in EMBOSS installations include srs:embl, srs:uniprot and ensembl

Data can also be read from sequence output in any supported format written by an EMBOSS or third-party application.

The input format can be specified by using the command-line qualifier `-sformat xxx`, where 'xxx' is replaced by the name of the required format. The available format names are: gff (gff3), gff2, embl (em), genbank (gb, refseq), ddbj, refseqp, pir (nbrf), swissprot (swiss, sw), dasgff and debug.

See: http://emboss.sf.net/docs/themes/SequenceFormats.html for further information on sequence formats.

### Input files for usage example

'tsw:*' is a sequence entry in the example protein database 'tsw'

### File: outfile.prophecy

    # Pure Frequency Matrix
    # Columns are amino acid counts A->Z
    # Rows are alignment positions 1->n
    Simple
    Name		mymatrix
    Length		20
    Maximum score	76
    Thresh		75
    Consensus	DEVGGEALGRLLVVYPWTQR
    0  0  0  4  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0
    0  0  0  0  4  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0
    0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  4  0  0  0  0  0
    0  0  0  0  0  0  4  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0
    0  0  0  0  0  0  3  0  0  0  0  0  0  0  0  0  0  1  0  0  0  0  0  0  0  0  0
    0  0  0  0  4  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0
    4  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0
    1  0  0  0  0  0  0  0  0  0  0  3  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0
    0  0  0  0  0  0  4  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0
    0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  4  0  0  0  0  0  0  0  0  0
    0  0  0  0  0  0  0  0  1  0  0  2  0  0  0  0  0  0  0  0  0  1  0  0  0  0  0
    0  0  0  0  0  0  0  0  0  0  0  4  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0
    0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  4  0  0  0  0  0
    0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  4  0  0  0  0  0
    0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  4  0  0
    0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  4  0  0  0  0  0  0  0  0  0  0  0
    0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  4  0  0  0  0
    0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  4  0  0  0  0  0  0  0
    0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  4  0  0  0  0  0  0  0  0  0  0
    0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  4  0  0  0  0  0  0  0  0  0

## Output file format

### Output files for usage example

### File: outfile.profit

    # PROF scan using simple frequency matrix mymatrix
    # Scores >= threshold 75 (max score 76)
    #
    HBB_HUMAN 22 Percentage: 100
    HBB_PANPA 22 Percentage: 100
    HBB_PANTR 22 Percentage: 100

The output is a list of three columns.

The first column is the name of the matching sequence found.
The second is the start position in the sequence of the match.
The third column (after the word 'Percentage:') is the percentage of the maximum possible score (sum of the highest value at each position in the frequency matrix).

## Data files

None.

## Notes

A 'simple frequency matrix' is simply a table containing a count of the number of times any particular amino acid occurs at each position in the sequence alignment from which it was derived. Simple frequency matrices are created using the program prophecy with the option `-type F` to create the correct type of matrix. The input alignment should not have gaps in it.

## References

None.

## Warnings

The aligned set of sequences used to make the simple frquency matrix should not have gaps in it. profit will let you use a matrix made from a gapped alignment, but the results will probably not be sensible.

## Diagnostic Error Messages

None.

## Exit status

It always exits with a status of 0.

## Known bugs

None.

## See also

Program name | Description
--- | ---
prophecy | Create frequency matrix or profile from a multiple alignment
prophet | Scan one or more sequences with a Gribskov or Henikoff profile

## Author(s)

Alan Bleasby
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) - Alan Bleasby

## Target users

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

## Comments

None