src/jkOwnLib/genoFind.c 1.27
1.27 2010/03/05 00:30:25 kent
Putting in check for uniqueness of target sequence names.
Index: src/jkOwnLib/genoFind.c
===================================================================
RCS file: /projects/compbio/cvsroot/kent/src/jkOwnLib/genoFind.c,v
retrieving revision 1.26
retrieving revision 1.27
diff -b -B -U 4 -r1.26 -r1.27
--- src/jkOwnLib/genoFind.c 8 Oct 2009 18:09:38 -0000 1.26
+++ src/jkOwnLib/genoFind.c 5 Mar 2010 00:30:25 -0000 1.27
@@ -902,16 +902,31 @@
gfZeroOverused(gf);
return gf;
}
+static void checkUniqueNames(bioSeq *seqList)
+/* Check that each sequence has a unique name. */
+{
+struct hash *hash = hashNew(18);
+bioSeq *seq;
+for (seq = seqList; seq != NULL; seq = seq->next)
+ {
+ if (hashLookup(hash, seq->name))
+ errAbort("Error: sequence name %s is repeated in the database, all names must be unique.",
+ seq->name);
+ hashAdd(hash, seq->name, NULL);
+ }
+hashFree(&hash);
+}
struct genoFind *gfIndexSeq(bioSeq *seqList,
int minMatch, int maxGap, int tileSize, int maxPat, char *oocFile,
boolean isPep, boolean allowOneMismatch, boolean maskUpper,
int stepSize)
/* Make index for all seqs in list. For DNA sequences upper case bits will
* be unindexed. */
{
+checkUniqueNames(seqList);
struct genoFind *gf = gfNewEmpty(minMatch, maxGap, tileSize, stepSize, maxPat,
oocFile, isPep, allowOneMismatch);
if (stepSize == 0)
stepSize = tileSize;