X-Git-Url: http://source.jalview.org/gitweb/?p=jpred.git;a=blobdiff_plain;f=sources%2Fpairwise%2Fdocs%2Fhtml%2Fpairwise_8h.html;fp=sources%2Fpairwise%2Fdocs%2Fhtml%2Fpairwise_8h.html;h=7a5454e81a84e17e156181728b0c70790b85436d;hp=0000000000000000000000000000000000000000;hb=9aa768067094f24f46f273077f867348e6143711;hpb=eb3001dc41bf6cd46e20fd13fe3efbe9dedf6013 diff --git a/sources/pairwise/docs/html/pairwise_8h.html b/sources/pairwise/docs/html/pairwise_8h.html new file mode 100644 index 0000000..7a5454e --- /dev/null +++ b/sources/pairwise/docs/html/pairwise_8h.html @@ -0,0 +1,618 @@ + +
+#include <stdlib.h>
+Include dependency graph for pairwise.h:
+This graph shows which files directly or indirectly include this file:
+Go to the source code of this file.
Data Structures | |
struct | fasta |
Functions | |
void | fatal_error (char *message) |
FILE * | xfopen (const char *path, const char *mode) |
void * | xmalloc (size_t size) |
void * | xrealloc (void *ptr, size_t size) |
int | diff (char a, char b) |
float | pairwise (struct fasta *a, struct fasta *b) |
void | populate (struct fasta *a) |
void | check_length (struct fasta **array) |
fasta ** | read_fasta (FILE *fh) |
+
+
|
+
+ + | +
+
+ + + +Definition at line 160 of file pairwise.c. + +References fatal_error(). + +Referenced by main(). + + 00160 { +00161 int i, length; +00162 +00163 if (array[0] != NULL) +00164 length = strlen(array[0]->seq); +00165 else { +00166 fprintf(stderr, "check_length() not passed an array of fasta structs\n"); +00167 return; +00168 } +00169 +00170 for (i = 0; array[i] != NULL; i++) { +00171 if (length != strlen(array[i]->seq)) { +00172 fatal_error("Not all of the sequences are the same length\n"); +00173 } +00174 } +00175 } + |
+
+Here is the call graph for this function:
+
+
|
+
+ + | +
+
+ + + +Definition at line 92 of file pairwise.c. + +Referenced by pairwise(). + + 00092 { +00093 if (a == b && a == '-') +00094 return 0; +00095 if (a == b) +00096 return 1; +00097 return 0; +00098 } + |
+
+
+
|
+
+ + | +
+
+ + + +Definition at line 53 of file pairwise.c. + +Referenced by check_length(). + + 00053 { +00054 printf(message); +00055 exit(EXIT_FAILURE); +00056 } + |
+
+
+
|
+
+ + | +
+
+ + + +Definition at line 106 of file pairwise.c. + +References diff(), fasta::end, MAX, MIN, fasta::numres, fasta::seq, and fasta::start. + +Referenced by main(). + + 00106 { +00107 float result; +00108 int start, end, numres, i, id = 0; +00109 +00110 /* If the sequences don't overlap then the seq ID is 0 */ +00111 if (a->end < b->start || a->start > b->end) +00112 return 0; +00113 +00114 start = MIN( a->start, b->start ); +00115 end = MAX( a->end, b->end ); +00116 numres = MAX( a->numres, b->numres ); +00117 +00118 for (i = start; i < end; i++) +00119 id += diff(a->seq[i], b->seq[i]); +00120 +00121 result = 100 * (float) id / (float) numres; +00122 +00123 return result; +00124 } + |
+
+Here is the call graph for this function:
+
+
|
+
+ + | +
+
+ + + +Definition at line 133 of file pairwise.c. + +References fasta::end, fasta::numres, fasta::seq, and fasta::start. + +Referenced by read_fasta(). + + 00133 { +00134 int i; +00135 int len = strlen(a->seq); +00136 +00137 a->numres = 0; +00138 +00139 for (i = 0; i <= len; i++) { +00140 if (a->seq[i] != '-') { +00141 a->start = i; +00142 break; +00143 } +00144 } +00145 for (i = len; i > 0; i--) { +00146 if (a->seq[i] != '-') { +00147 a->end = i; +00148 break; +00149 } +00150 } +00151 for (i = a->start; i < a->end; i++) { +00152 if (a->seq[i] != '-') { +00153 a->numres++; +00154 } +00155 } +00156 } + |
+
+
+
|
+
+ + | +
+
+ + + +Definition at line 179 of file pairwise.c. + +References ARRAY, FILEBUF, fasta::id, fasta::numres, populate(), read_fasta(), fasta::seq, xmalloc(), and xrealloc(). + +Referenced by main(), and read_fasta(). + + 00179 { +00180 int i, j, k, c, filesize = 1; +00181 char *file; +00182 struct fasta **array; +00183 +00184 array = (struct fasta **) xmalloc(ARRAY * sizeof(struct fasta *)); +00185 file = (char *) xmalloc(sizeof(char)); +00186 +00187 /* Allocate initial space for the file */ +00188 file = xrealloc(file, sizeof(char) * filesize); +00189 file[filesize] = '\0'; +00190 +00191 /* Read in the file */ +00192 while ((c = getc(fh)) != EOF) { +00193 if (filesize % FILEBUF) +00194 file = xrealloc(file, sizeof(char) * (FILEBUF + filesize)); +00195 +00196 file[filesize] = c; +00197 filesize++; +00198 } +00199 +00200 /* Parse the FASTA file into an array of structures */ +00201 for (i = 0, j = 0, k = 0; i < filesize; i++) { +00202 if (file[i] == '>') { +00203 if (j % ARRAY == 0) +00204 array = (struct fasta **) xrealloc(array, sizeof(struct fasta *) * (j + ARRAY)); +00205 +00206 array[j] = (struct fasta *) xmalloc(sizeof(struct fasta)); +00207 array[j]->id = (char *) xmalloc(sizeof(char)); +00208 array[j]->seq = (char *) xmalloc(sizeof(char)); +00209 array[j]->numres = 0; +00210 +00211 i++; +00212 while (file[i] != '\0' && file[i] != '\n') { +00213 if (k % ARRAY == 0) +00214 array[j]->id = (char *) xrealloc(array[j]->id, sizeof(char) * (ARRAY + k)); +00215 array[j]->id[k] = file[i]; +00216 k++; i++; +00217 } +00218 array[j]->id = (char *) xrealloc(array[j]->id, sizeof(char) * (ARRAY + k)); +00219 array[j]->id[k] = '\0'; +00220 k = 0; +00221 +00222 while (file[i] != '\0' && file[i] != '>') { +00223 if (file[i] == '\n') { +00224 i++; +00225 continue; +00226 } +00227 if (k % ARRAY == 0) +00228 array[j]->seq = (char *) xrealloc(array[j]->seq, sizeof(char) * (ARRAY + k)); +00229 array[j]->seq[k] = file[i]; +00230 k++; i++; +00231 } +00232 array[j]->seq = (char *) xrealloc(array[j]->seq, sizeof(char) * (ARRAY + k)); +00233 array[j]->seq[k] = '\0'; +00234 k = 0; +00235 i--; +00236 j++; +00237 } +00238 } +00239 +00240 free(file); +00241 array = (struct fasta **) xrealloc(array, sizeof(struct fasta *) * j); +00242 array[j] = NULL; +00243 +00244 /* find the start and end points for the alignments */ +00245 for (i = 0; array[i] != NULL; i++) { +00246 populate(array[i]); +00247 } +00248 +00249 return array; +00250 } + |
+
+Here is the call graph for this function:
+
+
|
+
+ + | +
+
+ + + +Definition at line 65 of file pairwise.c. + +References fatal_sys_error(). + +Referenced by main(). + + 00065 { +00066 FILE *fh; +00067 fh = fopen(path, mode); +00068 if (fh == NULL) +00069 fatal_sys_error("fopen returned NULL"); +00070 return fh; +00071 } + |
+
+Here is the call graph for this function:
+
+
|
+
+ + | +
+
+ + + +Definition at line 74 of file pairwise.c. + +References fatal_sys_error(). + +Referenced by read_fasta(). + + 00074 { +00075 void *ptr; +00076 ptr = (void *) malloc(size); +00077 if (ptr == NULL) +00078 fatal_sys_error("malloc returned NULL"); +00079 return ptr; +00080 } + |
+
+Here is the call graph for this function:
+
+
|
+
+ + | +
+
+ + + +Definition at line 83 of file pairwise.c. + +References fatal_sys_error(). + +Referenced by read_fasta(). + + 00083 { +00084 ptr = (void *) realloc(ptr, size); +00085 if (ptr == NULL && size != 0) +00086 fatal_sys_error("realloc returned NULL"); +00087 return ptr; +00088 } + |
+
+Here is the call graph for this function: