00001
00002
00003 #include "common.h"
00004 #include "spacedSeed.h"
00005
00006 static char const rcsid[] = "$Id: spacedSeed.c,v 1.1 2005/01/10 00:02:37 kent Exp $";
00007
00008
00009
00010
00011
00012 char *spacedSeeds[] = {
00013 "",
00014 "1",
00015 "11",
00016 "1101",
00017 "110101",
00018 "1101011",
00019 "111001011",
00020 "1110010111",
00021 "1110010100111",
00022 "111001010011011",
00023 "1101100011010111",
00024 "111010010100110111",
00025 "111010110100110111",
00026 "11101011001100101111",
00027 "111011100101100101111",
00028 "11110010101011001101111",
00029 #ifdef EVER_NEEDED_IN_64_BIT_MACHINE
00030 "111100110101011001101111",
00031 "111101010111001101101111",
00032 "1111011001110101011011111",
00033 #endif
00034 };
00035
00036 int spacedSeedMaxWeight()
00037
00038 {
00039 return ArraySize(spacedSeeds)-1;
00040 }
00041
00042 int *spacedSeedOffsets(int weight)
00043
00044 {
00045 char *seed;
00046 int *output, offset, outCount = 0, seedSize;
00047
00048 assert(weight >= 1 && weight < ArraySize(spacedSeeds));
00049 seed = spacedSeeds[weight];
00050 seedSize = strlen(seed);
00051 AllocArray(output, weight);
00052 for (offset=0; offset<seedSize; ++offset)
00053 {
00054 if (seed[offset] == '1')
00055 output[outCount++] = offset;
00056 }
00057 assert(outCount == weight);
00058 return output;
00059 }
00060
00061 int spacedSeedSpan(int weight)
00062
00063 {
00064 return strlen(spacedSeeds[weight]);
00065 }
00066