Wrapper for Clustal Omega.
[jabaws.git] / binaries / src / clustalo / src / hhalign / hhhalfalignment.h
1 /* -*- mode: c; tab-width: 4; c-basic-offset: 4; indent-tabs-mode: nil -*- */
2
3 /*********************************************************************
4  * Clustal Omega - Multiple sequence alignment
5  *
6  * Copyright (C) 2010 University College Dublin
7  *
8  * Clustal-Omega is free software; you can redistribute it and/or
9  * modify it under the terms of the GNU General Public License as
10  * published by the Free Software Foundation; either version 2 of the
11  * License, or (at your option) any later version.
12  *
13  * This file is part of Clustal-Omega.
14  *
15  ********************************************************************/
16
17 /*
18  * RCS $Id: hhhalfalignment.h 143 2010-10-14 13:11:14Z andreas $
19  */
20
21 /////////////////////////////////////////////////////////////////////////////////////
22 // Class representing a2m/a3m-formatted alignment corresponding to one HMM
23 /////////////////////////////////////////////////////////////////////////////////////
24
25
26 class HalfAlignment
27 {
28 public:
29   HalfAlignment(int maxseqdis=MAXSEQDIS);
30   ~HalfAlignment();
31
32   // Initialize HalfAlignment; create index arrays s [],l[], m[]
33   void Set(char* name, char** seq_in, char** sname_in, int n_in, int L_in, int n1, int n2, int n3, int n4, int nc, int L_in2/*<--FS*/);
34
35   // Free memory in HalfAlignment arrays s[][], l[][], and m[][]
36   void Unset();
37
38   // Align query (HalfAlignment) to template (i.e. hit) match state structure
39   void AlignToTemplate(Hit& hit); 
40
41   // Write the a2m/a3m query alignment into alnfile 
42   void Print(char* outfile);
43
44   // Fill in insert states following match state i
45   void AddInserts(int i);
46
47   // Fill up alignment with gaps '.' to generate flush end (all h[k] equal)
48   void FillUpGaps();
49
50   // Fill in insert states following match state i and fill up gaps with '.' 
51   void AddInsertsAndFillUpGaps(int i);
52
53   // Add gap column '.' or character column
54   void AddChar(char c);
55
56   // Add match state column i as is
57   void AddColumn(int i);
58
59   // Add match state column i as insert state
60   void AddColumnAsInsert(int i);
61
62   // Build alignment in FASTA format
63   void BuildFASTA();
64
65   // Build alignment in A2M format
66   void BuildA2M();
67
68   // Build alignment in A3M format
69   void BuildA3M();
70
71   // Transform alignment sequences from A2M to FASTA ( lowercase to uppercase and '.' to '-')
72   void ToFASTA();
73
74   // Remove all characters c from template sequences
75   void RemoveChars(char c);
76
77 private:
78   friend class FullAlignment;
79
80   int n;           //number of sequences in half-alignment
81   char** seq;      //sequences (in ASCII) in alignment
82   char** sname;    //names of sequences in alignment
83   int nss_dssp;    //index of sequence with dssp sec structure states
84   int nsa_dssp;    //index of sequence with dssp solvent accessiblity states
85   int nss_pred;    //index of sequence with predicted sec structure states
86   int nss_conf;    //index of sequence with prediction confidence values
87   int ncons;       //index of consensus sequence
88     
89   int pos;         //After FillUpGaps() all h[k] have value pos 
90   int L;           //number of match states in corresponding profile
91   int* h;          //h[k] = next position of sequence k to be written
92   char** s;        //s[k][h] = column h, sequence k of output alignment
93   int** l;         //counts non-gap residues: l[k][i] = index of last residue AT OR BEFORE match state i in seq k 
94   int** m;         //counts positions:        m[k][i] = position of match state i in string seq[k]
95 /*   int h[MAXSEQ];   //h[k] = next position of sequence k to be written */
96 /*   char* s[MAXSEQ]; //s[k][h] = column h, sequence k of output alignment */
97 /*   int* l[MAXSEQ];  //counts non-gap residues: l[k][i] = index of last residue AT OR BEFORE match state i in seq k  */
98 /*   int* m[MAXSEQ];  //counts positions:        m[k][i] = position of match state i in string seq[k] */
99 };
100
101