| Bsoft 2.0.5 Bernard's software package

Classes | Functions | Variables
seq_analysis.cpp File Reference

Analysis of protein sequences. More...

`#include "seq_analysis.h"`
`#include "seq_util.h"`
`#include "ps_sequence.h"`
`#include "moving_average.h"`
`#include "linked_list.h"`
`#include "utilities.h"`

Go to the source code of this file.

## Classes
struct | ResInfo

## Functions
double * | seq_aligned_weight (Bmolgroup *molgroup)
double | log_2 (double a)
Bimage * | seq_aligned_identity (Bmolgroup *molgroup)
| Calculates the pairwise identities between aligned sequences. More...
Bimage * | seq_aligned_similarity (Bmolgroup *molgroup, double threshold, Bresidue_matrix *simat)
| Calculates the pairwise similarities between aligned sequences. More...
char * | seq_aligned_profile (Bmolgroup *molgroup)
| Generates a PROSITE format profile from an aligned set of sequences. More...
int | seq_aligned_information (Bmolgroup *molgroup, int window, Bstring &psfile)
| Calculates the sequence logo representation for an alignment. More...
int | seq_aligned_hydrophobicity (Bmolgroup *molgroup, int window, double threshold, Bstring &hphobfile, Bstring &psfile)
| Calculates the average hydrophobicity at every position in an alignment. More...
Complex< float > * | seq_frequency_analysis (int length, int win, int start, int end, double *data)
| Fourier transforms a vector for frequency analysis. More...
Bimage * | seq_correlated_mutation (Bmolgroup *molgroup, int refseqnum, double cutoff, Bstring &simfile)
| Correlated mutation analysis of an alignment. More...

## Variables
int | verbose

## Detailed Description

Analysis of protein sequences.

Author
  Bernard Heymann

Date
  Created: 19990123
  Modified: 20111030

Definition in file seq_analysis.cpp.

## Function Documentation

## ◆ log_2()

double log_2 | ( | double | a | ) |

Definition at line 25 of file seq_analysis.cpp.

## ◆ seq_aligned_hydrophobicity()

int seq_aligned_hydrophobicity | ( | Bmolgroup * | molgroup,
|  | int | window,
|  | double | threshold,
|  | Bstring & | hphobfile,
|  | Bstring & | psfile
| ) |  |

Calculates the average hydrophobicity at every position in an alignment.

    The default hydrophobicity scale is the GES scale.

Parameters

  *molgroup | the set of sequences.
  window | moving average window.
  threshold | fraction of sequences with a residue in a position.
  &hphobfile | parameter file.
  &psfile | postscript output file.

Returns
  int 0.

Definition at line 456 of file seq_analysis.cpp.

## ◆ seq_aligned_identity()

Bimage* seq_aligned_identity | ( | Bmolgroup * | molgroup | ) |

Calculates the pairwise identities between aligned sequences.

    The identity between two sequences is defined as:
                   number of identical residues
        identity = ----------------------------
                           overlap
    where the overlap is the number of positions with residues in both sequences.

Parameters

  *molgroup | the set of sequences.

Returns
  Bimage* an image containing the matrix of identities.

Definition at line 43 of file seq_analysis.cpp.

## ◆ seq_aligned_information()

int seq_aligned_information | ( | Bmolgroup * | molgroup,
|  | int | window,
|  | Bstring & | psfile
| ) |  |

Calculates the sequence logo representation for an alignment.

    The information content of each position in an alignment is calculated
    as:
        information = log_2(n) - sum(pi * log_2(pi) )
                         fi
        pi          =  -------
                       sum(fi)
        fi          =  frequency of residue type i at this position
        n           =  sum(fi) if sum(fi) < 20, otherwise n = 20
    A moving average of the information is calculated over a given window
    to smooth the resultant data.
    The sequence logo representation for the occurrence of every residue type
    at every position is generated and written into a postscript file.

Parameters

  *molgroup | the set of sequences.
  window | window for calculating the moving average.
  &psfile | the postscript file name.

Returns
  int 0.

Definition at line 302 of file seq_analysis.cpp.

## ◆ seq_aligned_profile()

char* seq_aligned_profile | ( | Bmolgroup * | molgroup | ) |

Generates a PROSITE format profile from an aligned set of sequences.

    At each position in the alignment, the number of distinct residue types
    are counted. If there are more than 3 residue types represented at a
    position, or there is a gap, it is designated as variable by an "x".
    The profile finally contains 1-3 residue type possibilities for highly
    conserved positions interspersed by variable length gaps.

Parameters

  *molgroup | the set of sequences.

Returns
  char* profile in PROSITE format.

Definition at line 197 of file seq_analysis.cpp.

## ◆ seq_aligned_similarity()

Bimage* seq_aligned_similarity | ( | Bmolgroup * | molgroup,
|  | double | threshold,
|  | Bresidue_matrix * | simat
| ) |  |

Calculates the pairwise similarities between aligned sequences.

    The similarity between two sequences is defined as:
                       sum(residue similarity)
        similarity   = -----------------------
                              overlap
                              number of residues with similarity > threshold
        fraction similarity = ----------------------------------------------
                                                overlap
    where the overlap is the number of positions with residues in both sequences.
    The residue similarity is taken from a residue substitution matrix.
    The default substitution matrix is BLOSUM62.

Parameters

  *molgroup | the set of sequences.
  threshold | threshold to accept residues as similar.
  *simat | residue similarity matrix.

Returns
  Bimage* an image containing the matrix of similarities.

Definition at line 119 of file seq_analysis.cpp.

## ◆ seq_aligned_weight()

double * seq_aligned_weight | ( | Bmolgroup * | molgroup | ) |

Definition at line 825 of file seq_analysis.cpp.

## ◆ seq_correlated_mutation()

Bimage* seq_correlated_mutation | ( | Bmolgroup * | molgroup,
|  | int | refseqnum,
|  | double | cutoff,
|  | Bstring & | simfile
| ) |  |

Correlated mutation analysis of an alignment.

    Reference: Gobel, Sander & Schneider (1994) Proteins 18, 309-317.
    Mutation (residue variation) correlation is defined as:
                        1
        r(i,j) =  ------------- sum(w(k,l)*(s(i,k,l) - <s(i)>)*(s(j,k,l) - <s(j)>))
                  m^2*o(i)*o(j)
        where:
            m:         number of sequences
            o(i):      standard deviation of similarities at alignment position i
            w(k,l):    weight for sequences k and l
                       (1 - fractional identity: see function seq_aligned_identity)
            s(i,k,l):  similarity for alignment position i between sequences k and l
            <s(i)>:    average similarity at alignment position i
    Individual high-scoring correlations (using the given cutoff value) are reported
    as follows:
        Res1    Num1    Res2    Num2    Total   Corr
        T   9   I   17  210  0.631
        TAIIIVVVIVVVIVIIIIIII
        IILLLLLLLLLLLLLLLLLLL
    The first 4 values gives the type and alignment position of the correlating residues.
    The total is the number of comparisons made: maximally m*(m-1)/2
    The last number is the correlation coefficient.
    The following two lines gives the corresponding residues at the two alignment positions
    for all the sequences, allowing the user to see on what basis this is a high correlation.

Parameters

  *molgroup | the set of aligned sequences.
  refseqnum | reference sequence to report on.
  cutoff | cutoff for reporting correlated mutations.
  &simfile | similarity matrix file.

Returns
  Bimage* an image containing the analysis result.

Definition at line 676 of file seq_analysis.cpp.

## ◆ seq_frequency_analysis()

Complex<float>* seq_frequency_analysis | ( | int | length,
|  | int | win,
|  | int | start,
|  | int | end,
|  | double * | data
| ) |  |

Fourier transforms a vector for frequency analysis.

    A brute force Fourier transform is done.

Parameters

  length | length of sequence.
  win | window size.
  start | start within window.
  end | end within window.
  *data | sequence.

Returns
  int 0.

Definition at line 596 of file seq_analysis.cpp.

## Variable Documentation

## ◆ verbose

int verbose