<?xml version='1.0' encoding='UTF-8' standalone='no'?>
<section xmlns="http://docbook.org/ns/docbook" version="5.0" xmlns:xlink="http://www.w3.org/1999/xlink" xml:id="_seq__analysis_8h">
<title>/Users/bernard/b20/bsoft/include/seq_analysis.h File Reference</title>
<indexterm><primary>/Users/bernard/b20/bsoft/include/seq_analysis.h</primary></indexterm>
<para>

<para>Header file for sequence analysis functions. </para>
 
</para>
<programlisting>#include &quot;rwmolecule.h&quot;
#include &quot;rwresprop.h&quot;
#include &quot;rwimg.h&quot;
#include &quot;Complex.h&quot;
#include &quot;utilities.h&quot;
</programlisting><simplesect>
    <title>Functions    </title>
        <itemizedlist>
            <listitem><para><link linkend="_class_bimage">Bimage</link> * <link linkend="_seq__analysis_8h_1a08afbb35214bbf766f1f149603e2d377">seq_aligned_identity</link> (<link linkend="_struct_bmolgroup">Bmolgroup</link> *molgroup)</para>

<para>Calculates the pairwise identities between aligned sequences. </para>
</listitem>
            <listitem><para><link linkend="_class_bimage">Bimage</link> * <link linkend="_seq__analysis_8h_1a020dc5229c979149a1c7ca41e29405d1">seq_aligned_similarity</link> (<link linkend="_struct_bmolgroup">Bmolgroup</link> *molgroup, double threshold, <link linkend="_struct_bresidue__matrix">Bresidue_matrix</link> *simat)</para>

<para>Calculates the pairwise similarities between aligned sequences. </para>
</listitem>
            <listitem><para>char * <link linkend="_seq__analysis_8h_1a0375c8f0f4e5f612640133d0c65c8028">seq_aligned_profile</link> (<link linkend="_struct_bmolgroup">Bmolgroup</link> *molgroup)</para>

<para>Generates a PROSITE format profile from an aligned set of sequences. </para>
</listitem>
            <listitem><para>int <link linkend="_seq__analysis_8h_1ac0bf64706aa52e370e6b0b9478a8484e">seq_aligned_information</link> (<link linkend="_struct_bmolgroup">Bmolgroup</link> *molgroup, int window, <link linkend="_class_bstring">Bstring</link> &amp;psfile)</para>

<para>Calculates the sequence logo representation for an alignment. </para>
</listitem>
            <listitem><para>int <link linkend="_seq__analysis_8h_1ab1046c781c78bce22535ae13ea69dd5c">seq_aligned_hydrophobicity</link> (<link linkend="_struct_bmolgroup">Bmolgroup</link> *molgroup, int window, double threshold, <link linkend="_class_bstring">Bstring</link> &amp;hphobfile, <link linkend="_class_bstring">Bstring</link> &amp;psfile)</para>

<para>Calculates the average hydrophobicity at every position in an alignment. </para>
</listitem>
            <listitem><para><link linkend="_class_complex">Complex</link>&lt; float &gt; * <link linkend="_seq__analysis_8h_1aea5ddfc7d8d815c0cd2908d5fb9b0275">seq_frequency_analysis</link> (int <link linkend="__vector3_8h_1a7baf5ed670fcf9bcca9a3a400820e292">length</link>, int win, int start, int end, double *data)</para>

<para>Fourier transforms a vector for frequency analysis. </para>
</listitem>
            <listitem><para><link linkend="_class_bimage">Bimage</link> * <link linkend="_seq__analysis_8h_1a36126174ca8afee83d8c766a49fd5cc4">seq_correlated_mutation</link> (<link linkend="_struct_bmolgroup">Bmolgroup</link> *molgroup, int refseqnum, double cutoff, <link linkend="_class_bstring">Bstring</link> &amp;simfile)</para>

<para>Correlated mutation analysis of an alignment. </para>
</listitem>
        </itemizedlist>
</simplesect>
<section>
<title>Detailed Description</title>

<para>Header file for sequence analysis functions. </para>

<para><formalpara><title>Author: </title>

<para>Bernard Heymann </para>
</formalpara>
<formalpara><title>Date: </title>

<para>Created: 19990123 </para>

<para>Modified: 20060710 </para>
</formalpara>
</para>
</section>
<section>
<title>Function Documentation</title>
<anchor xml:id="_seq__analysis_8h_1ab1046c781c78bce22535ae13ea69dd5c"/>    <section>
    <title>seq_aligned_hydrophobicity()</title>
<indexterm><primary>seq_aligned_hydrophobicity</primary><secondary>seq_analysis.h</secondary></indexterm>
<indexterm><primary>seq_analysis.h</primary><secondary>seq_aligned_hydrophobicity</secondary></indexterm>
<para><computeroutput>int seq_aligned_hydrophobicity (<link linkend="_struct_bmolgroup">Bmolgroup</link> * molgroup, int window, double threshold, <link linkend="_class_bstring">Bstring</link> &amp; hphobfile, <link linkend="_class_bstring">Bstring</link> &amp; psfile)</computeroutput></para><para>

<para>Calculates the average hydrophobicity at every position in an alignment. </para>
</para>

<para><literallayout><computeroutput>The default hydrophobicity scale is the GES scale.
</computeroutput></literallayout></para>

<para>
                <formalpara>
                    <title>
Parameters                    </title>
                    <para>
                    <table frame="all">
                        <tgroup cols="2" align="left" colsep="1" rowsep="1">
                        <colspec colwidth="1*"/>
                        <colspec colwidth="4*"/>
                        <tbody>
                            <row>
                                <entry>*molgroup</entry>
                                <entry>
<para>the set of sequences. </para>
</entry>
                            </row>
                            <row>
                                <entry>window</entry>
                                <entry>
<para>moving average window. </para>
</entry>
                            </row>
                            <row>
                                <entry>threshold</entry>
                                <entry>
<para>fraction of sequences with a residue in a position. </para>
</entry>
                            </row>
                            <row>
                                <entry>&amp;hphobfile</entry>
                                <entry>
<para>parameter file. </para>
</entry>
                            </row>
                            <row>
                                <entry>&amp;psfile</entry>
                                <entry>
<para>postscript output file. </para>
</entry>
                            </row>
                        </tbody>
                        </tgroup>
                    </table>
                    </para>
                </formalpara>
                <formalpara><title>Returns: </title>

<para>int 0. </para>
</formalpara>
</para>
<para>
Definition at line 456 of file seq_analysis.cpp.</para>
    </section><anchor xml:id="_seq__analysis_8h_1a08afbb35214bbf766f1f149603e2d377"/>    <section>
    <title>seq_aligned_identity()</title>
<indexterm><primary>seq_aligned_identity</primary><secondary>seq_analysis.h</secondary></indexterm>
<indexterm><primary>seq_analysis.h</primary><secondary>seq_aligned_identity</secondary></indexterm>
<para><computeroutput><link linkend="_class_bimage">Bimage</link>* seq_aligned_identity (<link linkend="_struct_bmolgroup">Bmolgroup</link> * molgroup)</computeroutput></para><para>

<para>Calculates the pairwise identities between aligned sequences. </para>
</para>

<para><literallayout><computeroutput>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.
</computeroutput></literallayout></para>

<para>
                <formalpara>
                    <title>
Parameters                    </title>
                    <para>
                    <table frame="all">
                        <tgroup cols="2" align="left" colsep="1" rowsep="1">
                        <colspec colwidth="1*"/>
                        <colspec colwidth="4*"/>
                        <tbody>
                            <row>
                                <entry>*molgroup</entry>
                                <entry>
<para>the set of sequences. </para>
</entry>
                            </row>
                        </tbody>
                        </tgroup>
                    </table>
                    </para>
                </formalpara>
                <formalpara><title>Returns: </title>

<para>Bimage* an image containing the matrix of identities. </para>
</formalpara>
</para>
<para>
Definition at line 43 of file seq_analysis.cpp.</para>
    </section><anchor xml:id="_seq__analysis_8h_1ac0bf64706aa52e370e6b0b9478a8484e"/>    <section>
    <title>seq_aligned_information()</title>
<indexterm><primary>seq_aligned_information</primary><secondary>seq_analysis.h</secondary></indexterm>
<indexterm><primary>seq_analysis.h</primary><secondary>seq_aligned_information</secondary></indexterm>
<para><computeroutput>int seq_aligned_information (<link linkend="_struct_bmolgroup">Bmolgroup</link> * molgroup, int window, <link linkend="_class_bstring">Bstring</link> &amp; psfile)</computeroutput></para><para>

<para>Calculates the sequence logo representation for an alignment. </para>
</para>

<para><literallayout><computeroutput>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) &lt; 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.
</computeroutput></literallayout></para>

<para>
                <formalpara>
                    <title>
Parameters                    </title>
                    <para>
                    <table frame="all">
                        <tgroup cols="2" align="left" colsep="1" rowsep="1">
                        <colspec colwidth="1*"/>
                        <colspec colwidth="4*"/>
                        <tbody>
                            <row>
                                <entry>*molgroup</entry>
                                <entry>
<para>the set of sequences. </para>
</entry>
                            </row>
                            <row>
                                <entry>window</entry>
                                <entry>
<para>window for calculating the moving average. </para>
</entry>
                            </row>
                            <row>
                                <entry>&amp;psfile</entry>
                                <entry>
<para>the postscript file name. </para>
</entry>
                            </row>
                        </tbody>
                        </tgroup>
                    </table>
                    </para>
                </formalpara>
                <formalpara><title>Returns: </title>

<para>int 0. </para>
</formalpara>
</para>
<para>
Definition at line 302 of file seq_analysis.cpp.</para>
    </section><anchor xml:id="_seq__analysis_8h_1a0375c8f0f4e5f612640133d0c65c8028"/>    <section>
    <title>seq_aligned_profile()</title>
<indexterm><primary>seq_aligned_profile</primary><secondary>seq_analysis.h</secondary></indexterm>
<indexterm><primary>seq_analysis.h</primary><secondary>seq_aligned_profile</secondary></indexterm>
<para><computeroutput>char* seq_aligned_profile (<link linkend="_struct_bmolgroup">Bmolgroup</link> * molgroup)</computeroutput></para><para>

<para>Generates a PROSITE format profile from an aligned set of sequences. </para>
</para>

<para><literallayout><computeroutput>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 &quot;x&quot;.
The profile finally contains 1-3 residue type possibilities for highly
conserved positions interspersed by variable length gaps.
</computeroutput></literallayout></para>

<para>
                <formalpara>
                    <title>
Parameters                    </title>
                    <para>
                    <table frame="all">
                        <tgroup cols="2" align="left" colsep="1" rowsep="1">
                        <colspec colwidth="1*"/>
                        <colspec colwidth="4*"/>
                        <tbody>
                            <row>
                                <entry>*molgroup</entry>
                                <entry>
<para>the set of sequences. </para>
</entry>
                            </row>
                        </tbody>
                        </tgroup>
                    </table>
                    </para>
                </formalpara>
                <formalpara><title>Returns: </title>

<para>char* profile in PROSITE format. </para>
</formalpara>
</para>
<para>
Definition at line 197 of file seq_analysis.cpp.</para>
    </section><anchor xml:id="_seq__analysis_8h_1a020dc5229c979149a1c7ca41e29405d1"/>    <section>
    <title>seq_aligned_similarity()</title>
<indexterm><primary>seq_aligned_similarity</primary><secondary>seq_analysis.h</secondary></indexterm>
<indexterm><primary>seq_analysis.h</primary><secondary>seq_aligned_similarity</secondary></indexterm>
<para><computeroutput><link linkend="_class_bimage">Bimage</link>* seq_aligned_similarity (<link linkend="_struct_bmolgroup">Bmolgroup</link> * molgroup, double threshold, <link linkend="_struct_bresidue__matrix">Bresidue_matrix</link> * simat)</computeroutput></para><para>

<para>Calculates the pairwise similarities between aligned sequences. </para>
</para>

<para><literallayout><computeroutput>The similarity between two sequences is defined as:
                   sum(residue similarity)
    similarity   = -----------------------
                          overlap
                          number of residues with similarity &gt; 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.
</computeroutput></literallayout></para>

<para>
                <formalpara>
                    <title>
Parameters                    </title>
                    <para>
                    <table frame="all">
                        <tgroup cols="2" align="left" colsep="1" rowsep="1">
                        <colspec colwidth="1*"/>
                        <colspec colwidth="4*"/>
                        <tbody>
                            <row>
                                <entry>*molgroup</entry>
                                <entry>
<para>the set of sequences. </para>
</entry>
                            </row>
                            <row>
                                <entry>threshold</entry>
                                <entry>
<para>threshold to accept residues as similar. </para>
</entry>
                            </row>
                            <row>
                                <entry>*simat</entry>
                                <entry>
<para>residue similarity matrix. </para>
</entry>
                            </row>
                        </tbody>
                        </tgroup>
                    </table>
                    </para>
                </formalpara>
                <formalpara><title>Returns: </title>

<para>Bimage* an image containing the matrix of similarities. </para>
</formalpara>
</para>
<para>
Definition at line 119 of file seq_analysis.cpp.</para>
    </section><anchor xml:id="_seq__analysis_8h_1a36126174ca8afee83d8c766a49fd5cc4"/>    <section>
    <title>seq_correlated_mutation()</title>
<indexterm><primary>seq_correlated_mutation</primary><secondary>seq_analysis.h</secondary></indexterm>
<indexterm><primary>seq_analysis.h</primary><secondary>seq_correlated_mutation</secondary></indexterm>
<para><computeroutput><link linkend="_class_bimage">Bimage</link>* seq_correlated_mutation (<link linkend="_struct_bmolgroup">Bmolgroup</link> * molgroup, int refseqnum, double cutoff, <link linkend="_class_bstring">Bstring</link> &amp; simfile)</computeroutput></para><para>

<para>Correlated mutation analysis of an alignment. </para>
</para>

<para><literallayout><computeroutput>Reference: Gobel, Sander &amp; 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) - &lt;s(i)&gt;)*(s(j,k,l) - &lt;s(j)&gt;))
              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
        &lt;s(i)&gt;:    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.
</computeroutput></literallayout></para>

<para>
                <formalpara>
                    <title>
Parameters                    </title>
                    <para>
                    <table frame="all">
                        <tgroup cols="2" align="left" colsep="1" rowsep="1">
                        <colspec colwidth="1*"/>
                        <colspec colwidth="4*"/>
                        <tbody>
                            <row>
                                <entry>*molgroup</entry>
                                <entry>
<para>the set of aligned sequences. </para>
</entry>
                            </row>
                            <row>
                                <entry>refseqnum</entry>
                                <entry>
<para>reference sequence to report on. </para>
</entry>
                            </row>
                            <row>
                                <entry>cutoff</entry>
                                <entry>
<para>cutoff for reporting correlated mutations. </para>
</entry>
                            </row>
                            <row>
                                <entry>&amp;simfile</entry>
                                <entry>
<para>similarity matrix file. </para>
</entry>
                            </row>
                        </tbody>
                        </tgroup>
                    </table>
                    </para>
                </formalpara>
                <formalpara><title>Returns: </title>

<para>Bimage* an image containing the analysis result. </para>
</formalpara>
</para>
<para>
Definition at line 676 of file seq_analysis.cpp.</para>
    </section><anchor xml:id="_seq__analysis_8h_1aea5ddfc7d8d815c0cd2908d5fb9b0275"/>    <section>
    <title>seq_frequency_analysis()</title>
<indexterm><primary>seq_frequency_analysis</primary><secondary>seq_analysis.h</secondary></indexterm>
<indexterm><primary>seq_analysis.h</primary><secondary>seq_frequency_analysis</secondary></indexterm>
<para><computeroutput><link linkend="_class_complex">Complex</link>&lt;float&gt;* seq_frequency_analysis (int length, int win, int start, int end, double * data)</computeroutput></para><para>

<para>Fourier transforms a vector for frequency analysis. </para>
</para>

<para><literallayout><computeroutput>A brute force Fourier transform is done.
</computeroutput></literallayout></para>

<para>
                <formalpara>
                    <title>
Parameters                    </title>
                    <para>
                    <table frame="all">
                        <tgroup cols="2" align="left" colsep="1" rowsep="1">
                        <colspec colwidth="1*"/>
                        <colspec colwidth="4*"/>
                        <tbody>
                            <row>
                                <entry>length</entry>
                                <entry>
<para>length of sequence. </para>
</entry>
                            </row>
                            <row>
                                <entry>win</entry>
                                <entry>
<para>window size. </para>
</entry>
                            </row>
                            <row>
                                <entry>start</entry>
                                <entry>
<para>start within window. </para>
</entry>
                            </row>
                            <row>
                                <entry>end</entry>
                                <entry>
<para>end within window. </para>
</entry>
                            </row>
                            <row>
                                <entry>*data</entry>
                                <entry>
<para>sequence. </para>
</entry>
                            </row>
                        </tbody>
                        </tgroup>
                    </table>
                    </para>
                </formalpara>
                <formalpara><title>Returns: </title>

<para>int 0. </para>
</formalpara>
</para>
<para>
Definition at line 596 of file seq_analysis.cpp.</para>
</section>
</section>
</section>
