Wrapper for Clustal Omega.
[jabaws.git] / binaries / src / clustalo / src / clustal / seq.h
1 /*********************************************************************
2  * Clustal Omega - Multiple sequence alignment
3  *
4  * Copyright (C) 2010 University College Dublin
5  *
6  * Clustal-Omega is free software; you can redistribute it and/or
7  * modify it under the terms of the GNU General Public License as
8  * published by the Free Software Foundation; either version 2 of the
9  * License, or (at your option) any later version.
10  *
11  * This file is part of Clustal-Omega.
12  *
13  ********************************************************************/
14
15 /*
16  *  RCS $Id: seq.h 234 2011-04-13 05:26:16Z andreas $
17  */
18
19 #ifndef CLUSTALO_SEQ_H
20 #define CLUSTALO_SEQ_H
21
22 #include "squid/squid.h"
23
24 #include "util.h"
25
26
27 /**
28  * int-encoded sequence types.
29  * these are in sync with squid's seqtypes and only used for
30  * convenience here
31  */
32 #define SEQTYPE_UNKNOWN kOtherSeq
33 #define SEQTYPE_DNA kDNA
34 #define SEQTYPE_RNA kRNA
35 #define SEQTYPE_PROTEIN kAmino
36
37 /* Alphabets are defined in squid.h: AMINO_ALPHABET, DNA_ALPHABET,
38  * RNA_ALPHABET (all uppercase)
39  */
40 #define AMINOACID_ANY 'X'
41 #define NUCLEOTIDE_ANY 'N'
42
43 /**
44  * @brief structure for storing multiple sequences
45  *
46  */
47 typedef struct {
48     int nseqs; /**< number of sequences */
49     int seqtype; /**< sequence type */
50     char *filename; /**< input file / source of sequences */
51     bool aligned; /**< true if all seqs are same length **/
52     
53     /** (working) sequence residues as char pointer.
54      * range for first index: 0--nseq-1.
55      * changes during alignment.
56      */
57     char **seq;
58     
59     /** original sequence residues as char pointer.
60      * range for first index: 0--nseq-1.
61      * only set during input
62      */
63     char **orig_seq;
64     
65     /**
66      * @brief Squid's sequence info structure.
67      * Index range: 0--nseq-1.
68      *
69      * extra data are available:
70      * int flags;
71      *
72      * name:
73      * char name[SQINFO_NAMELEN];
74      *
75      * database identifier:
76      * char id[SQINFO_NAMELEN];
77      *
78      * database accession no:
79      * char acc[SQINFO_NAMELEN];
80      *
81      * description:      
82      * char desc[SQINFO_DESCLEN];
83      *
84      * length of this seq, incl gaps in our case!:
85      * int len;
86      *
87      * start position on source seq (valid range: 1..len):
88      * int start;
89      *
90      * end position on source seq (valid range: 1..len):
91      * int stop;
92      *
93      * original length of source seq:
94      * int olen;
95      *
96      * kRNA, kDNA, kAmino, or kOther:
97      * int type;
98      *
99      * secondary structure string (index range: 0..len-1):
100      * char *ss;
101      *
102      * percent side chain surface access (index range: 0..len-1):
103      * char *sa;                  
104      * 
105      * @see squid.h
106      * @see LogSqInfo()
107      *
108      */
109     SQINFO *sqinfo; 
110 } mseq_t;
111
112 extern void
113 AliStat(mseq_t *prMSeq, bool bSampling, bool bReportAll);
114
115 extern void
116 AddSeq(mseq_t **prMSeqDest_p, char *pcSeqName, char *pcSeqRes);
117
118 extern void
119 SeqSwap(mseq_t *mseq, int i, int j);
120
121 extern void
122 DealignMSeq(mseq_t *mseq);
123
124 extern const char *
125 SeqTypeToStr(int seqtype);
126
127 extern int
128 ReadSequences(mseq_t *prMSeq_p, char *pcSeqFile, int iSeqType,
129   int iMaxNumSeq, int iMaxSeqLen);
130
131 extern void
132 NewMSeq(mseq_t **mseq);
133
134 extern void
135 FreeMSeq(mseq_t **mseq);
136
137 extern void
138 CopyMSeq(mseq_t **prMSeqDest_p, mseq_t *prMSeqSrc);
139
140 extern void
141 LogSqInfo(SQINFO *sqinfo);
142
143 extern int
144 FindSeqName(char *seqname, mseq_t *mseq);
145
146 extern int
147 WriteAlignment(mseq_t *mseq, const char *aln_outfile, int msafile_format);
148
149 extern void
150 DealignSeq(char *seq);
151
152 extern void
153 ShuffleMSeq(mseq_t *prMSeq);
154
155 extern void
156 SortMSeqByLength(mseq_t *prMSeq, const char cOrder);
157
158 void
159 JoinMSeqs(mseq_t **prMSeqDest_p, mseq_t *prMSeqToAdd);
160
161 bool
162 SeqsAreAligned(mseq_t *prMSeq);
163
164 #endif