lib/spacedSeed.c

Go to the documentation of this file.
00001 /* spacedSeed - stuff to help with spaced seeds for alignments. */
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 /* Seeds - the weight 9 and 11 seeds are from PatternHunter paper.
00009  * The weights 10,12,13,14,15,16,17 and 18 are from the Choi, Zeng,
00010  * and Zhang paper.  The others are just guesses. */
00011 
00012 char *spacedSeeds[] = {
00013     /*  0 */ "",
00014     /*  1 */ "1",
00015     /*  2 */ "11",
00016     /*  3 */ "1101",
00017     /*  4 */ "110101",
00018     /*  5 */ "1101011",
00019     /*  6 */ "111001011",
00020     /*  7 */ "1110010111",
00021     /*  8 */ "1110010100111",
00022     /*  9 */ "111001010011011",
00023     /* 10 */ "1101100011010111",
00024     /* 11 */ "111010010100110111",
00025     /* 12 */ "111010110100110111",
00026     /* 13 */ "11101011001100101111",
00027     /* 14 */ "111011100101100101111",
00028     /* 15 */ "11110010101011001101111",
00029 #ifdef EVER_NEEDED_IN_64_BIT_MACHINE
00030     /* 16 */ "111100110101011001101111",
00031     /* 17 */ "111101010111001101101111",
00032     /* 18 */ "1111011001110101011011111",
00033 #endif /* EVER_NEEDED_IN_64_BIT_MACHINE */
00034 };
00035 
00036 int spacedSeedMaxWeight()
00037 /* Return max weight of spaced seed. */
00038 {
00039 return ArraySize(spacedSeeds)-1;
00040 }
00041 
00042 int *spacedSeedOffsets(int weight)
00043 /* Return array with offsets for seed of given weight. */
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 /* Return span of seed of given weight */
00063 {
00064 return strlen(spacedSeeds[weight]);
00065 }
00066 

Generated on Tue Dec 25 18:39:32 2007 for blat by  doxygen 1.5.2