1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227
|
#ifndef MSA_SEEN
#define MSA_SEEN
/***********************************************************************
* *
* msa.c *
* *
* Copyright (C) 2003 Douglas L. Theobald *
* *
* msa.c is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published *
* by the Free Software Foundation; either version 2 of the License, *
* or (at your option) any later version. *
* *
* msa.c is distributed in the hope that it will be useful, but *
* WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
* General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License *
* along with msa.c in the file 'COPYING'; if not, write to the: *
* *
* Free Software Foundation, Inc., *
* 59 Temple Place, Suite 330, *
* Boston, MA 02111-1307 USA *
* *
* -/_|:|_|_\- *
* Douglas Theobald *
* Department of Chemistry and Biochemistry *
* UCB 215 *
* University of Colorado at Boulder *
* Boulder, CO 80309-0215 *
* *
* theobal@colorado.edu *
* dtheobald@hotmail.com *
* *
***********************************************************************/
#include "DLTutils.h"
#define MAXLINE 50
#define SEQ_NAME_LENGTH 8192
typedef struct
{
char filename[FILENAME_MAX]; /* MSA file name */
int distance;
int allocnum; /* number of sequences allocated in the MSA */
int alloclen; /* allocated length of the alignment */
int seqnum; /* number of actual sequences in the MSA */
int seqlen; /* actual length of the alignment */
int *checksum; /* GCG/MSF-style sequence checksums */
int msachecksum; /* MSA checksum */
int *flag; /* external boolean flag */
int *flag2; /* private boolean flag for MSA functions */
char **seq; /* pointer to an array of sequences */
char **name; /* pointer to an array of the sequence names */
double **dist; /* pointer to array of distances */
} MSA;
typedef struct
{
int arraynum; /* number of MSAs allocated in the MSAA */
int *flag; /* external boolean flag */
MSA **array; /* pointer to an array of the sequence names */
} MSAA;
/* ////////////////////////////////////////////////////////////////////// */
MSA
*getmsa(char *msafile_name);
int
isnexdist(char *msafile_name);
int
ismsf(char *msafile_name);
MSA
*MSAinit(void);
void
MSAalloc(MSA *msa, int seqnum, int alignment_len, int name_size);
MSA
*DISTalloc(MSA *msa);
void
DISTfree(MSA *msa);
MSAA
*MSAAalloc(int arraynum);
void
MSAfree(MSA **msa_ptr);
void
MSAAfree(MSAA **msas_ptr);
/* ////////////////////////////////////////////////////////////////////// */
void
MSAprint(MSA *);
void
MSAmultiprint(MSAA *msas);
MSA
*MSAcpy(MSA *msa1, MSA *msa2);
MSA
*MSAduplicate(MSA *msa);
MSA
*MSAduplicate_noflags(MSA *msa);
MSA
*MSAmult(MSA *msa, int multiply);
MSA
*MSAduplicate_empty(MSA *msa);
int
MSAseqeq(MSA *msa1, MSA *msa2, int *seq1, int *begin1, int *end1, int *seq2, int *begin2, int *end2);
MSA
*MSAdeldups(MSA *msa);
MSA
*MSAfixnamesphy(MSA *msa);
MSA
*MSAdelallgaps(MSA *msa, int begcol, int endcol, int logap, int upgap, double frac);
MSA
*MSAdelgap(MSA *msa);
MSA
*MSAmingap(MSA *msa);
MSA
*MSAmerge(MSAA *msas);
void
MSAcombine2(MSAA *msaa, int msa1_i, int msa2_i, int seq1_i, int seq2_i, int msao_i);
/* ////////////////////////////////////////////////////////////////////// */
int
GCGchecksum(MSA *msa, int seq);
int
GCGmultichecksum(MSA *msa);
void
reada2m(char *msafile_name, MSA *msa);
void
reada2m2(char *msafile_name, MSA *msa);
void
readaln(char *msafile_name, MSA *msa);
void
readnex(char *msafile_name, MSA *msa);
void
readnexd(char *msafile_name, MSA *msa);
void
nexus_dist(MSA *msa, char *filestr, int filesize, int format);
int
getvali(char *string, char *key, char delimiter, char **endptr);
char *
getvals(char *string, char *key, char delimiter, char **endptr);
double
getvald(char *string, char *key, char delimiter, char **endptr);
char
getvalc(char *string, char *key, char delimiter, char **endptr);
void
readphylip(char *msafile_name, MSA *msa);
void
readphylipd(char *msafile_name, MSA *msa);
int
phylip_dist_format(MSA *msa, char *filestr, int filesize);
void
phylip_dist(MSA *msa, char *filestr, int filesize, int format);
void
readmsf(char *msafile_name, MSA *msa);
/* ////////////////////////////////////////////////////////////////////// */
void
writea2m_seq(MSA *msa, int seqID, char *outfile_root);
void
writealn_seq(MSA *msa, int seqID, char *outfile_root);
void
writenex_seq(MSA *msa, int seqID, char *outfile_root);
void
writenexd(MSA *msa, char *outfile_root);
void
writea2m(MSA *msa, int begin, int window, char *outfile_root);
void
writealn(MSA *msa, int begin, int window, char *outfile_root);
void
writephylip(MSA *msa, int begin, int window, char *outfile_root);
void
writenex(MSA *msa, int begin, int window, char *outfile_root);
void
writepsib(MSA *msa, int begin, int window, char *outfile_root);
void
writefasta_explode(MSA *msa, int nfield);
#endif
|